Roll NDK to pick std::deque patch.
[android_tools.git] / sdk / tools / templates / activities / MasterDetailFlow / root / src / app_package / ContentDetailFragment.java.ftl
blob27331cded31108fb69a8dc188f1df24eeee3c738
1 package ${packageName};
3 import android.os.Bundle;
4 import android.<#if appCompat>support.v4.</#if>app.Fragment;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.ViewGroup;
8 import android.widget.TextView;
9 <#if applicationPackage??>import ${applicationPackage}.R;</#if>
11 import ${packageName}.dummy.DummyContent;
13 /**
14  * A fragment representing a single ${objectKind} detail screen.
15  * This fragment is either contained in a {@link ${CollectionName}Activity}
16  * in two-pane mode (on tablets) or a {@link ${DetailName}Activity}
17  * on handsets.
18  */
19 public class ${DetailName}Fragment extends Fragment {
20     /**
21      * The fragment argument representing the item ID that this fragment
22      * represents.
23      */
24     public static final String ARG_ITEM_ID = "item_id";
26     /**
27      * The dummy content this fragment is presenting.
28      */
29     private DummyContent.DummyItem mItem;
31     /**
32      * Mandatory empty constructor for the fragment manager to instantiate the
33      * fragment (e.g. upon screen orientation changes).
34      */
35     public ${DetailName}Fragment() {
36     }
38     @Override
39     public void onCreate(Bundle savedInstanceState) {
40         super.onCreate(savedInstanceState);
42         if (getArguments().containsKey(ARG_ITEM_ID)) {
43             // Load the dummy content specified by the fragment
44             // arguments. In a real-world scenario, use a Loader
45             // to load content from a content provider.
46             mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
47         }
48     }
50     @Override
51     public View onCreateView(LayoutInflater inflater, ViewGroup container,
52             Bundle savedInstanceState) {
53         View rootView = inflater.inflate(R.layout.fragment_${detail_name}, container, false);
55         // Show the dummy content as text in a TextView.
56         if (mItem != null) {
57             ((TextView) rootView.findViewById(R.id.${detail_name})).setText(mItem.content);
58         }
60         return rootView;
61     }