Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch change-app-name updated. #5

Open
wants to merge 1 commit into
base: change-app-name
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ android {
applicationIdSuffix ".debug"
}
}

flavorDimensions "default"

productFlavors {
// Free version
free {
applicationId = "oi.caster.wickedcool"
}
// Pro version
pro {
applicationId = "oi.caster.wickedcool.pro"
}
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.caster.wickedcool.util;

public class ProHelperImpl implements ProHelper {
@Override
public boolean isPro() {
// This is the free version man, not the pro version!!!!
return false;
}
}
12 changes: 6 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
android:label="@string/app_name">

<category android:name="android.intent.category.LAUNCHER" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import io.caster.wickedcool.util.ProHelper;
import io.caster.wickedcool.util.ProHelperImpl;

/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
Expand Down Expand Up @@ -84,30 +88,35 @@ public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Indicate that this fragment would like to influence the set of actions in the action bar.
setHasOptionsMenu(true);

ProHelper proHelper = new ProHelperImpl();
TextView metadata = getView().findViewById(R.id.metadata);
metadata.setText("Is Pro: " + Boolean.toString(proHelper.isPro()));
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
/*
mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
});
mDrawerListView.setAdapter(new ArrayAdapter<String>(
getActionBar().getThemedContext(),
android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
new String[]{
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3),
}));
mDrawerListView.setAdapter(new ArrayAdapter<>(getActionBar().getThemedContext(),
android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
new String[] {
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3),
}));
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
return mDrawerListView;
*/
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}

public boolean isDrawerOpen() {
Expand Down Expand Up @@ -246,12 +255,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}

if (item.getItemId() == R.id.action_example) {
Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
return true;
}

return super.onOptionsItemSelected(item);
}

Expand Down Expand Up @@ -279,4 +286,4 @@ public static interface NavigationDrawerCallbacks {
*/
void onNavigationDrawerItemSelected(int position);
}
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/io/caster/wickedcool/util/ProHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.caster.wickedcool.util;

public interface ProHelper {
boolean isPro();
}
21 changes: 10 additions & 11 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
Expand All @@ -12,7 +11,7 @@
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />

<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
Expand All @@ -21,11 +20,11 @@
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="io.caster.wickedcool.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer"/>

</android.support.v4.widget.DrawerLayout>
<fragment
android:id="@+id/navigation_drawer"
android:name="io.caster.wickedcool.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
23 changes: 11 additions & 12 deletions app/src/main/res/layout/fragment_main.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">

<TextView
android:id="@+id/section_label"
android:id="@+id/metadata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</RelativeLayout>
android:layout_height="wrap_content" />
</RelativeLayout>
16 changes: 8 additions & 8 deletions app/src/main/res/layout/fragment_navigation_drawer.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#cccc"
tools:context=".NavigationDrawerFragment"/>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccc"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
tools:context=".NavigationDrawerFragment" />
9 changes: 9 additions & 0 deletions app/src/pro/java/io/caster/wickedcool/util/ProHelperImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.caster.wickedcool.util;

public class ProHelperImpl implements ProHelper {
@Override
public boolean isPro() {
// Heck yes, this is the pro version.
return true;
}
}