diff options
Diffstat (limited to 'templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl')
-rw-r--r-- | templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl new file mode 100644 index 0000000..a0acb1c --- /dev/null +++ b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl @@ -0,0 +1,38 @@ +package ${packageName}; + +import ${packageName}.dummy.DummyContent; + +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; + +public class ${DetailName}Fragment extends Fragment { + + public static final String ARG_ITEM_ID = "item_id"; + + DummyContent.DummyItem mItem; + + public ${DetailName}Fragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments().containsKey(ARG_ITEM_ID)) { + 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); + if (mItem != null) { + ((TextView) rootView.findViewById(R.id.${detail_name})).setText(mItem.content); + } + return rootView; + } +} |