diff options
author | Tor Norbye <tnorbye@google.com> | 2012-05-25 17:05:55 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-06-04 16:57:34 -0700 |
commit | 56afaff9c34a60c0e850324938d101a0509f8a38 (patch) | |
tree | 8a945bf07d4cb162d2c1b0c1d13989ccaa55da41 /templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl | |
parent | 6de0364094c5780cf39f4805ac507374c382da2f (diff) | |
download | sdk-56afaff9c34a60c0e850324938d101a0509f8a38.zip sdk-56afaff9c34a60c0e850324938d101a0509f8a38.tar.gz sdk-56afaff9c34a60c0e850324938d101a0509f8a38.tar.bz2 |
Allow project templates to be bundled separately
This changeset moves the various FreeMarker templates out of the ADT
plugin and over into the tools install area. The code to instantiate
templates is simplified a bit now that it no longer needs to both
handle files on disk and files read out of the .jar.
There's a new first page to the various template wizards which is
shown if the tools are not up to date (specifically, if the
$SDK/tools/templates/ directory does not exist). This page explains
that the tools have to be updated, and the Next button is disabled
until they are up to date.
This CL also contains some other tweaks suggested by Roman to the
activity-to-layout name mapping and misc code changes.
Change-Id: I3bc65f54a6b79bbeedfb917a9d34ec0d312f3526
Diffstat (limited to 'templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl')
-rw-r--r-- | templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl new file mode 100644 index 0000000..a7deaf6 --- /dev/null +++ b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl @@ -0,0 +1,39 @@ +package ${packageName}; + +import android.os.Bundle; +import android.content.Intent; +import android.support.v4.app.FragmentActivity; +import android.support.v4.app.NavUtils; +import android.view.MenuItem; + +public class ${DetailName}Activity extends FragmentActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_${detail_name}); + + getActionBar().setDisplayHomeAsUpEnabled(true); + + if (savedInstanceState == null) { + 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) { + if (item.getItemId() == android.R.id.home) { + NavUtils.navigateUpTo(this, new Intent(this, ${CollectionName}Activity.class)); + return true; + } + + return super.onOptionsItemSelected(item); + } +} |