aboutsummaryrefslogtreecommitdiffstats
path: root/templates/activities/MasterDetailFlow
diff options
context:
space:
mode:
Diffstat (limited to 'templates/activities/MasterDetailFlow')
-rw-r--r--templates/activities/MasterDetailFlow/globals.xml.ftl11
-rw-r--r--templates/activities/MasterDetailFlow/recipe.xml.ftl32
-rw-r--r--templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl31
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl7
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl10
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl38
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl9
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl10
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl11
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl6
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl67
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl61
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl105
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl151
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl55
-rw-r--r--templates/activities/MasterDetailFlow/template.xml65
-rw-r--r--templates/activities/MasterDetailFlow/template_master_detail.pngbin7173 -> 0 bytes
17 files changed, 0 insertions, 669 deletions
diff --git a/templates/activities/MasterDetailFlow/globals.xml.ftl b/templates/activities/MasterDetailFlow/globals.xml.ftl
deleted file mode 100644
index 415d60e..0000000
--- a/templates/activities/MasterDetailFlow/globals.xml.ftl
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="projectOut" value="." />
- <global id="manifestOut" value="." />
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="resOut" value="res" />
- <global id="CollectionName" value="${extractLetters(objectKind)}List" />
- <global id="collection_name" value="${extractLetters(objectKind?lower_case)}_list" />
- <global id="DetailName" value="${extractLetters(objectKind)}Detail" />
- <global id="detail_name" value="${extractLetters(objectKind?lower_case)}_detail" />
-</globals>
diff --git a/templates/activities/MasterDetailFlow/recipe.xml.ftl b/templates/activities/MasterDetailFlow/recipe.xml.ftl
deleted file mode 100644
index 4b39f74..0000000
--- a/templates/activities/MasterDetailFlow/recipe.xml.ftl
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl"
- to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" />
-
- <merge from="res/values-large/refs.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/values-large/refs.xml" />
- <merge from="res/values-sw600dp/refs.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/values-sw600dp/refs.xml" />
- <merge from="res/values/strings.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/values/strings.xml" />
-
- <instantiate from="res/layout/activity_content_detail.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/layout/activity_${detail_name}.xml" />
- <instantiate from="res/layout/activity_content_list.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/layout/activity_${collection_name}.xml" />
- <instantiate from="res/layout/activity_content_twopane.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/layout/activity_${extractLetters(objectKind?lower_case)}_twopane.xml" />
- <instantiate from="res/layout/fragment_content_detail.xml.ftl"
- to="${escapeXmlAttribute(resOut)}/layout/fragment_${detail_name}.xml" />
-
- <instantiate from="src/app_package/ContentDetailActivity.java.ftl"
- to="${escapeXmlAttribute(srcOut)}/${DetailName}Activity.java" />
- <instantiate from="src/app_package/ContentDetailFragment.java.ftl"
- to="${escapeXmlAttribute(srcOut)}/${DetailName}Fragment.java" />
- <instantiate from="src/app_package/ContentListActivity.java.ftl"
- to="${escapeXmlAttribute(srcOut)}/${CollectionName}Activity.java" />
- <instantiate from="src/app_package/ContentListFragment.java.ftl"
- to="${escapeXmlAttribute(srcOut)}/${CollectionName}Fragment.java" />
- <instantiate from="src/app_package/dummy/DummyContent.java.ftl"
- to="${escapeXmlAttribute(srcOut)}/dummy/DummyContent.java" />
-</recipe>
diff --git a/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl b/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 4707bd6..0000000
--- a/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,31 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
-
- <application>
- <activity android:name=".${CollectionName}Activity"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${collection_name}"
- </#if>
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- <#if isLauncher>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </#if>
- </activity>
-
- <activity android:name=".${DetailName}Activity"
- android:label="@string/title_${detail_name}"
- <#if buildApi gte 16>android:parentActivityName=".${CollectionName}Activity"</#if>>
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value=".${CollectionName}Activity" />
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl
deleted file mode 100644
index ddc1ecc..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${detail_name}_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${DetailName}Activity"
- tools:ignore="MergeRootFrame" />
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl
deleted file mode 100644
index 065cd42..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${collection_name}"
- android:name="${packageName}.${CollectionName}Fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- tools:context=".${CollectionName}Activity"
- tools:layout="@android:layout/list_content" />
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl
deleted file mode 100644
index 575e9e6..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl
+++ /dev/null
@@ -1,38 +0,0 @@
-<LinearLayout 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:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- android:baselineAligned="false"
- android:divider="?android:attr/dividerHorizontal"
- android:orientation="horizontal"
- android:showDividers="middle"
- tools:context=".${CollectionName}Activity">
-
- <!--
- This layout is a two-pane layout for the ${objectKindPlural}
- master/detail flow. See res/values-large/refs.xml and
- res/values-sw600dp/refs.xml for an example of layout aliases
- that replace the single-pane version of the layout with
- this two-pane version.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
-
- <fragment
- android:id="@+id/${collection_name}"
- android:name="${packageName}.${CollectionName}Fragment"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- tools:layout="@android:layout/list_content" />
-
- <FrameLayout
- android:id="@+id/${detail_name}_container"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="3" />
-
-</LinearLayout>
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl
deleted file mode 100644
index 808fc31..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl
+++ /dev/null
@@ -1,9 +0,0 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${detail_name}"
- style="?android:attr/textAppearanceLarge"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="16dp"
- android:textIsSelectable="true"
- tools:context=".${DetailName}Fragment" />
diff --git a/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl
deleted file mode 100644
index 97215c3..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<resources>
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item type="layout" name="activity_${collection_name}">@layout/activity_${extractLetters(objectKind?lower_case)}_twopane</item>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl
deleted file mode 100644
index d592404..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on screens with a smallest width (smallest dimension)
- of at least 600 density-independent pixels (dips).
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item type="layout" name="activity_${collection_name}">@layout/activity_${extractLetters(objectKind?lower_case)}_twopane</item>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl
deleted file mode 100644
index ea882bc..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,6 +0,0 @@
-<resources>
- <#if !isNewProject>
- <string name="title_${collection_name}">${escapeXmlString(objectKindPlural)}</string>
- </#if>
- <string name="title_${detail_name}">${escapeXmlString(objectKind)} Detail</string>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl
deleted file mode 100644
index 2cc6054..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl
+++ /dev/null
@@ -1,67 +0,0 @@
-package ${packageName};
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.NavUtils;
-import android.view.MenuItem;
-
-/**
- * An activity representing a single ${objectKind} detail screen. This
- * activity is only used on handset devices. On tablet-size devices,
- * item details are presented side-by-side with a list of items
- * in a {@link ${CollectionName}Activity}.
- * <p>
- * This activity is mostly just a 'shell' activity containing nothing
- * more than a {@link ${DetailName}Fragment}.
- */
-public class ${DetailName}Activity extends FragmentActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_${detail_name});
-
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
-
- // savedInstanceState is non-null when there is fragment state
- // saved from previous configurations of this activity
- // (e.g. when rotating the screen from portrait to landscape).
- // In this case, the fragment will automatically be re-added
- // to its container so we don't need to manually add it.
- // For more information, see the Fragments API guide at:
- //
- // http://developer.android.com/guide/components/fragments.html
- //
- if (savedInstanceState == null) {
- // Create the detail fragment and add it to the activity
- // using a fragment transaction.
- Bundle arguments = new Bundle();
- arguments.putString(${DetailName}Fragment.ARG_ITEM_ID,
- getIntent().getStringExtra(${DetailName}Fragment.ARG_ITEM_ID));
- ${DetailName}Fragment fragment = new ${DetailName}Fragment();
- fragment.setArguments(arguments);
- getSupportFragmentManager().beginTransaction()
- .add(R.id.${detail_name}_container, fragment)
- .commit();
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- NavUtils.navigateUpTo(this, new Intent(this, ${CollectionName}Activity.class));
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl
deleted file mode 100644
index 2cecaec..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl
+++ /dev/null
@@ -1,61 +0,0 @@
-package ${packageName};
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import ${packageName}.dummy.DummyContent;
-
-/**
- * A fragment representing a single ${objectKind} detail screen.
- * This fragment is either contained in a {@link ${CollectionName}Activity}
- * in two-pane mode (on tablets) or a {@link ${DetailName}Activity}
- * on handsets.
- */
-public class ${DetailName}Fragment extends Fragment {
- /**
- * The fragment argument representing the item ID that this fragment
- * represents.
- */
- public static final String ARG_ITEM_ID = "item_id";
-
- /**
- * The dummy content this fragment is presenting.
- */
- private DummyContent.DummyItem mItem;
-
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public ${DetailName}Fragment() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if (getArguments().containsKey(ARG_ITEM_ID)) {
- // Load the dummy content specified by the fragment
- // arguments. In a real-world scenario, use a Loader
- // to load content from a content provider.
- mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
- }
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_${detail_name}, container, false);
-
- // Show the dummy content as text in a TextView.
- if (mItem != null) {
- ((TextView) rootView.findViewById(R.id.${detail_name})).setText(mItem.content);
- }
-
- return rootView;
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl
deleted file mode 100644
index ae73f7d..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl
+++ /dev/null
@@ -1,105 +0,0 @@
-package ${packageName};
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-<#if parentActivityClass != "">import android.support.v4.app.NavUtils;
-import android.view.MenuItem;</#if>
-
-/**
- * An activity representing a list of ${objectKindPlural}. This activity
- * has different presentations for handset and tablet-size devices. On
- * handsets, the activity presents a list of items, which when touched,
- * lead to a {@link ${DetailName}Activity} representing
- * item details. On tablets, the activity presents the list of items and
- * item details side-by-side using two vertical panes.
- * <p>
- * The activity makes heavy use of fragments. The list of items is a
- * {@link ${CollectionName}Fragment} and the item details
- * (if present) is a {@link ${DetailName}Fragment}.
- * <p>
- * This activity also implements the required
- * {@link ${CollectionName}Fragment.Callbacks} interface
- * to listen for item selections.
- */
-public class ${CollectionName}Activity extends FragmentActivity
- implements ${CollectionName}Fragment.Callbacks {
-
- /**
- * Whether or not the activity is in two-pane mode, i.e. running on a tablet
- * device.
- */
- private boolean mTwoPane;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_${collection_name});
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- </#if>
-
- if (findViewById(R.id.${detail_name}_container) != null) {
- // The detail container view will be present only in the
- // large-screen layouts (res/values-large and
- // res/values-sw600dp). If this view is present, then the
- // activity should be in two-pane mode.
- mTwoPane = true;
-
- // In two-pane mode, list items should be given the
- // 'activated' state when touched.
- ((${CollectionName}Fragment) getSupportFragmentManager()
- .findFragmentById(R.id.${collection_name}))
- .setActivateOnItemClick(true);
- }
-
- // TODO: If exposing deep links into your app, handle intents here.
- }
- <#if parentActivityClass != "">
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
-
- /**
- * Callback method from {@link ${CollectionName}Fragment.Callbacks}
- * indicating that the item with the given ID was selected.
- */
- @Override
- public void onItemSelected(String id) {
- if (mTwoPane) {
- // In two-pane mode, show the detail view in this activity by
- // adding or replacing the detail fragment using a
- // fragment transaction.
- Bundle arguments = new Bundle();
- arguments.putString(${DetailName}Fragment.ARG_ITEM_ID, id);
- ${DetailName}Fragment fragment = new ${DetailName}Fragment();
- fragment.setArguments(arguments);
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.${detail_name}_container, fragment)
- .commit();
-
- } else {
- // In single-pane mode, simply start the detail activity
- // for the selected item ID.
- Intent detailIntent = new Intent(this, ${DetailName}Activity.class);
- detailIntent.putExtra(${DetailName}Fragment.ARG_ITEM_ID, id);
- startActivity(detailIntent);
- }
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl
deleted file mode 100644
index e9a2e74..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl
+++ /dev/null
@@ -1,151 +0,0 @@
-package ${packageName};
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import ${packageName}.dummy.DummyContent;
-
-/**
- * A list fragment representing a list of ${objectKindPlural}. This fragment
- * also supports tablet devices by allowing list items to be given an
- * 'activated' state upon selection. This helps indicate which item is
- * currently being viewed in a {@link ${DetailName}Fragment}.
- * <p>
- * Activities containing this fragment MUST implement the {@link Callbacks}
- * interface.
- */
-public class ${CollectionName}Fragment extends ListFragment {
-
- /**
- * The serialization (saved instance state) Bundle key representing the
- * activated item position. Only used on tablets.
- */
- private static final String STATE_ACTIVATED_POSITION = "activated_position";
-
- /**
- * The fragment's current callback object, which is notified of list item
- * clicks.
- */
- private Callbacks mCallbacks = sDummyCallbacks;
-
- /**
- * The current activated item position. Only used on tablets.
- */
- private int mActivatedPosition = ListView.INVALID_POSITION;
-
- /**
- * A callback interface that all activities containing this fragment must
- * implement. This mechanism allows activities to be notified of item
- * selections.
- */
- public interface Callbacks {
- /**
- * Callback for when an item has been selected.
- */
- public void onItemSelected(String id);
- }
-
- /**
- * A dummy implementation of the {@link Callbacks} interface that does
- * nothing. Used only when this fragment is not attached to an activity.
- */
- private static Callbacks sDummyCallbacks = new Callbacks() {
- @Override
- public void onItemSelected(String id) {
- }
- };
-
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public ${CollectionName}Fragment() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // TODO: replace with a real list adapter.
- setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(
- getActivity(),
- android.R.layout.simple_list_item_activated_1,
- android.R.id.text1,
- DummyContent.ITEMS));
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- // Restore the previously serialized activated item position.
- if (savedInstanceState != null
- && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
- setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
- }
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
-
- // Activities containing this fragment must implement its callbacks.
- if (!(activity instanceof Callbacks)) {
- throw new IllegalStateException("Activity must implement fragment's callbacks.");
- }
-
- mCallbacks = (Callbacks) activity;
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
-
- // Reset the active callbacks interface to the dummy implementation.
- mCallbacks = sDummyCallbacks;
- }
-
- @Override
- public void onListItemClick(ListView listView, View view, int position, long id) {
- super.onListItemClick(listView, view, position, id);
-
- // Notify the active callbacks interface (the activity, if the
- // fragment is attached to one) that an item has been selected.
- mCallbacks.onItemSelected(DummyContent.ITEMS.get(position).id);
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- if (mActivatedPosition != ListView.INVALID_POSITION) {
- // Serialize and persist the activated item position.
- outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
- }
- }
-
- /**
- * Turns on activate-on-click mode. When this mode is on, list items will be
- * given the 'activated' state when touched.
- */
- public void setActivateOnItemClick(boolean activateOnItemClick) {
- // When setting CHOICE_MODE_SINGLE, ListView will automatically
- // give items the 'activated' state when touched.
- getListView().setChoiceMode(activateOnItemClick
- ? ListView.CHOICE_MODE_SINGLE
- : ListView.CHOICE_MODE_NONE);
- }
-
- private void setActivatedPosition(int position) {
- if (position == ListView.INVALID_POSITION) {
- getListView().setItemChecked(mActivatedPosition, false);
- } else {
- getListView().setItemChecked(position, true);
- }
-
- mActivatedPosition = position;
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl
deleted file mode 100644
index 3545ba3..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl
+++ /dev/null
@@ -1,55 +0,0 @@
-package ${packageName}.dummy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper class for providing sample content for user interfaces created by
- * Android template wizards.
- * <p>
- * TODO: Replace all uses of this class before publishing your app.
- */
-public class DummyContent {
-
- /**
- * An array of sample (dummy) items.
- */
- public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
-
- /**
- * A map of sample (dummy) items, by ID.
- */
- public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
-
- static {
- // Add 3 sample items.
- addItem(new DummyItem("1", "Item 1"));
- addItem(new DummyItem("2", "Item 2"));
- addItem(new DummyItem("3", "Item 3"));
- }
-
- private static void addItem(DummyItem item) {
- ITEMS.add(item);
- ITEM_MAP.put(item.id, item);
- }
-
- /**
- * A dummy item representing a piece of content.
- */
- public static class DummyItem {
- public String id;
- public String content;
-
- public DummyItem(String id, String content) {
- this.id = id;
- this.content = content;
- }
-
- @Override
- public String toString() {
- return content;
- }
- }
-}
diff --git a/templates/activities/MasterDetailFlow/template.xml b/templates/activities/MasterDetailFlow/template.xml
deleted file mode 100644
index 47de074..0000000
--- a/templates/activities/MasterDetailFlow/template.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="3"
- name="Master/Detail Flow"
- minApi="11"
- description="Creates a new master/detail flow, allowing users to view a collection of objects as well as details for each object. This flow is presented using two columns on tablet-size screens and one column on handsets and smaller screens. This template creates two activities, a master fragment, and a detail fragment.">
- <dependency name="android-support-v4" revision="8" />
-
- <thumbs>
- <thumb>template_master_detail.png</thumb>
- </thumbs>
-
- <category value="Flows" />
-
- <parameter
- id="objectKind"
- name="Object Kind"
- type="string"
- constraints="nonempty"
- default="Item"
- help="Other examples are 'Person', 'Book', etc." />
-
- <parameter
- id="objectKindPlural"
- name="Object Kind Plural"
- type="string"
- constraints="nonempty"
- default="Items"
- help="Other examples are 'People', 'Books', etc." />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- suggest="${objectKindPlural}"
- default="Items" />
-
- <parameter
- id="isLauncher"
- name="Launcher Activity"
- type="boolean"
- default="false"
- help="If true, the primary activity in the flow will have a CATEGORY_LAUNCHER intent filter, making it visible in the launcher" />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/MasterDetailFlow/template_master_detail.png b/templates/activities/MasterDetailFlow/template_master_detail.png
deleted file mode 100644
index f9d3f23..0000000
--- a/templates/activities/MasterDetailFlow/template_master_detail.png
+++ /dev/null
Binary files differ