diff options
Diffstat (limited to 'templates/activities/BlankActivity')
25 files changed, 0 insertions, 712 deletions
diff --git a/templates/activities/BlankActivity/globals.xml.ftl b/templates/activities/BlankActivity/globals.xml.ftl deleted file mode 100644 index 11aabd7..0000000 --- a/templates/activities/BlankActivity/globals.xml.ftl +++ /dev/null @@ -1,8 +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="menuName" value="${classToResource(activityClass)}" /> -</globals> diff --git a/templates/activities/BlankActivity/recipe.xml.ftl b/templates/activities/BlankActivity/recipe.xml.ftl deleted file mode 100644 index 1889cdc..0000000 --- a/templates/activities/BlankActivity/recipe.xml.ftl +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0"?> -<recipe> - <merge from="AndroidManifest.xml.ftl" - to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" /> - - <instantiate from="res/menu/main.xml.ftl" - to="${escapeXmlAttribute(resOut)}/menu/${menuName}.xml" /> - - <merge from="res/values/strings.xml.ftl" - to="${escapeXmlAttribute(resOut)}/values/strings.xml" /> - - <merge from="res/values/dimens.xml" - to="${escapeXmlAttribute(resOut)}/values/dimens.xml" /> - <merge from="res/values-sw600dp/dimens.xml" - to="${escapeXmlAttribute(resOut)}/values-sw600dp/dimens.xml" /> - <merge from="res/values-sw720dp-land/dimens.xml" - to="${escapeXmlAttribute(resOut)}/values-sw720dp-land/dimens.xml" /> - - <!-- Decide what kind of layout to add (viewpager or not) --> - <#if navType?contains("pager")> - <instantiate from="res/layout/activity_pager.xml.ftl" - to="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" /> - <instantiate from="res/layout/fragment_dummy.xml.ftl" - to="${escapeXmlAttribute(resOut)}/layout/fragment_${classToResource(activityClass)}_dummy.xml" /> - - <#elseif navType == "tabs" || navType == "dropdown"> - <instantiate from="res/layout/activity_fragment_container.xml" - to="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" /> - <instantiate from="res/layout/fragment_dummy.xml.ftl" - to="${escapeXmlAttribute(resOut)}/layout/fragment_${classToResource(activityClass)}_dummy.xml" /> - - <#else> - <instantiate from="res/layout/activity_simple.xml.ftl" - to="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" /> - </#if> - - <!-- Decide which activity code to add --> - <#if navType == "none"> - <instantiate from="src/app_package/SimpleActivity.java.ftl" - to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> - - <#elseif navType == "tabs_pager" || navType == "pager_strip"> - <instantiate from="src/app_package/TabsAndPagerActivity.java.ftl" - to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> - - <#elseif navType == "tabs"> - <instantiate from="src/app_package/TabsActivity.java.ftl" - to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> - - <#elseif navType == "dropdown"> - <instantiate from="src/app_package/DropdownActivity.java.ftl" - to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> - - </#if> - - <open file="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" /> -</recipe> diff --git a/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl b/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl deleted file mode 100644 index b8ae72e..0000000 --- a/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl +++ /dev/null @@ -1,24 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" > - - <application> - <activity android:name=".${activityClass}" - <#if isNewProject> - android:label="@string/app_name" - <#else> - android:label="@string/title_${activityToLayout(activityClass)}" - </#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> - </application> - -</manifest> diff --git a/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml b/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml deleted file mode 100644 index 935d379..0000000 --- a/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml +++ /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/container" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".${activityClass}" - tools:ignore="MergeRootFrame" /> diff --git a/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl b/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl deleted file mode 100644 index ab57463..0000000 --- a/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl +++ /dev/null @@ -1,24 +0,0 @@ -<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".${activityClass}"<#if navType != "pager_strip"> /><#else>> - - <!-- - This title strip will display the currently visible page title, as well as the page - titles for adjacent pages. - --> - - <android.support.v4.view.PagerTitleStrip - android:id="@+id/pager_title_strip" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="top" - android:background="#33b5e5" - android:paddingBottom="4dp" - android:paddingTop="4dp" - android:textColor="#fff" /> - -</android.support.v4.view.ViewPager> -</#if> diff --git a/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl b/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl deleted file mode 100644 index 9ddd213..0000000 --- a/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if> - android:layout_height=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if> - 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=".${activityClass}"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/hello_world" /> - -</RelativeLayout> diff --git a/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl b/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl deleted file mode 100644 index 1f21998..0000000 --- a/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if> - android:layout_height=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if> - 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=".${activityClass}$DummySectionFragment"> - - <TextView - android:id="@+id/section_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - -</RelativeLayout> diff --git a/templates/activities/BlankActivity/root/res/menu/main.xml.ftl b/templates/activities/BlankActivity/root/res/menu/main.xml.ftl deleted file mode 100644 index e35aa1b..0000000 --- a/templates/activities/BlankActivity/root/res/menu/main.xml.ftl +++ /dev/null @@ -1,6 +0,0 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/action_settings" - android:title="@string/action_settings" - android:orderInCategory="100"<#if buildApi gte 11> - android:showAsAction="never"</#if> /> -</menu> diff --git a/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml b/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml deleted file mode 100644 index 886b05f..0000000 --- a/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml +++ /dev/null @@ -1,4 +0,0 @@ -<resources> - <!-- Customize dimensions originally defined in res/values/dimens.xml (such as - screen margins) for sw600dp devices (e.g. 7" tablets) here. --> -</resources> diff --git a/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml b/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml deleted file mode 100644 index 00059fc..0000000 --- a/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ -<resources> - <!-- Customize dimensions originally defined in res/values/dimens.xml (such as - screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. --> - <dimen name="activity_horizontal_margin">128dp</dimen> -</resources> diff --git a/templates/activities/BlankActivity/root/res/values/dimens.xml b/templates/activities/BlankActivity/root/res/values/dimens.xml deleted file mode 100644 index 47c8224..0000000 --- a/templates/activities/BlankActivity/root/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl b/templates/activities/BlankActivity/root/res/values/strings.xml.ftl deleted file mode 100644 index 1c9bc8b..0000000 --- a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<resources> - <#if !isNewProject> - <string name="title_${activityToLayout(activityClass)}">${escapeXmlString(activityTitle)}</string> - </#if> - - <string name="action_settings">Settings</string> - - <#if navType != "none"> - <string name="title_section1">Section 1</string> - <string name="title_section2">Section 2</string> - <string name="title_section3">Section 3</string> - <#else> - <string name="hello_world">Hello world!</string> - </#if> -</resources> diff --git a/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl deleted file mode 100644 index cb0665e..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl +++ /dev/null @@ -1,108 +0,0 @@ -package ${packageName}; - -<#if minApiLevel < 14>import android.annotation.TargetApi;</#if> -import android.app.ActionBar; -import android.os.Bundle; -<#if minApiLevel < 14>import android.content.Context; -import android.os.Build;</#if> -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.NavUtils; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.TextView; - -public class ${activityClass} extends FragmentActivity implements ActionBar.OnNavigationListener { - - /** - * The serialization (saved instance state) Bundle key representing the - * current dropdown position. - */ - private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.${layoutName}); - - // Set up the action bar to show a dropdown list. - final ActionBar actionBar = getActionBar(); - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); - <#if parentActivityClass != ""> - // Show the Up button in the action bar. - actionBar.setDisplayHomeAsUpEnabled(true); - </#if> - - // Set up the dropdown list navigation in the action bar. - actionBar.setListNavigationCallbacks( - // Specify a SpinnerAdapter to populate the dropdown list. - new ArrayAdapter<String>( - <#if minApiLevel gte 14>actionBar.getThemedContext()<#else>getActionBarThemedContextCompat()</#if>, - android.R.layout.simple_list_item_1, - android.R.id.text1, - new String[] { - getString(R.string.title_section1), - getString(R.string.title_section2), - getString(R.string.title_section3), - }), - this); - } - - <#if minApiLevel < 14> - /** - * Backward-compatible version of {@link ActionBar#getThemedContext()} that - * simply returns the {@link android.app.Activity} if - * <code>getThemedContext</code> is unavailable. - */ - @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) - private Context getActionBarThemedContextCompat() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - return getActionBar().getThemedContext(); - } else { - return this; - } - } - </#if> - - @Override - public void onRestoreInstanceState(Bundle savedInstanceState) { - // Restore the previously serialized current dropdown position. - if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { - getActionBar().setSelectedNavigationItem( - savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - // Serialize the current dropdown position. - outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, - getActionBar().getSelectedNavigationIndex()); - } - - <#include "include_onCreateOptionsMenu.java.ftl"> - <#include "include_onOptionsItemSelected.java.ftl"> - - @Override - public boolean onNavigationItemSelected(int position, long id) { - // When the given dropdown item is selected, show its contents in the - // container view. - Fragment fragment = new DummySectionFragment(); - Bundle args = new Bundle(); - args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1); - fragment.setArguments(args); - getSupportFragmentManager().beginTransaction() - .replace(R.id.container, fragment) - .commit(); - return true; - } - - <#include "include_DummySectionFragment.java.ftl"> - -} diff --git a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl deleted file mode 100644 index 7edd647..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl +++ /dev/null @@ -1,42 +0,0 @@ -package ${packageName}; - -import android.os.Bundle; -import android.app.Activity; -import android.view.Menu; -<#if parentActivityClass != ""> -import android.view.MenuItem; -import android.support.v4.app.NavUtils; -<#if minApiLevel < 11> -import android.annotation.TargetApi; -import android.os.Build; -</#if> -</#if> - -public class ${activityClass} extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.${layoutName}); - <#if parentActivityClass != ""> - // Show the Up button in the action bar. - setupActionBar(); - </#if> - } - - <#if parentActivityClass != ""> - /** - * Set up the {@link android.app.ActionBar}<#if minApiLevel < 11>, if the API is available</#if>. - */ - <#if minApiLevel < 11>@TargetApi(Build.VERSION_CODES.HONEYCOMB) - </#if>private void setupActionBar() { - <#if minApiLevel < 11>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {</#if> - getActionBar().setDisplayHomeAsUpEnabled(true); - <#if minApiLevel < 11>}</#if> - } - </#if> - - <#include "include_onCreateOptionsMenu.java.ftl"> - <#include "include_onOptionsItemSelected.java.ftl"> - -} diff --git a/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl deleted file mode 100644 index 0bf975e..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl +++ /dev/null @@ -1,86 +0,0 @@ -package ${packageName}; - -import android.app.ActionBar; -import android.app.FragmentTransaction; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.NavUtils; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -public class ${activityClass} extends FragmentActivity implements ActionBar.TabListener { - - /** - * The serialization (saved instance state) Bundle key representing the - * current tab position. - */ - private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.${layoutName}); - - // Set up the action bar to show tabs. - final ActionBar actionBar = getActionBar(); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - <#if parentActivityClass != ""> - // Show the Up button in the action bar. - actionBar.setDisplayHomeAsUpEnabled(true); - </#if> - - // For each of the sections in the app, add a tab to the action bar. - actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this)); - actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this)); - actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this)); - } - - @Override - public void onRestoreInstanceState(Bundle savedInstanceState) { - // Restore the previously serialized current tab position. - if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) { - getActionBar().setSelectedNavigationItem( - savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM)); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - // Serialize the current tab position. - outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, - getActionBar().getSelectedNavigationIndex()); - } - - <#include "include_onCreateOptionsMenu.java.ftl"> - <#include "include_onOptionsItemSelected.java.ftl"> - - @Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - // When the given tab is selected, show the tab contents in the - // container view. - Fragment fragment = new DummySectionFragment(); - Bundle args = new Bundle(); - args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, tab.getPosition() + 1); - fragment.setArguments(args); - getSupportFragmentManager().beginTransaction() - .replace(R.id.container, fragment) - .commit(); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - } - - <#include "include_DummySectionFragment.java.ftl"> - -} diff --git a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl deleted file mode 100644 index 30c4f4a..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl +++ /dev/null @@ -1,153 +0,0 @@ -package ${packageName}; - -import java.util.Locale; - -<#if navType?contains("tabs")>import android.app.ActionBar; -import android.app.FragmentTransaction;</#if> -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.app.NavUtils; -import android.support.v4.view.ViewPager; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -public class ${activityClass} extends FragmentActivity<#if navType?contains("tabs")> implements ActionBar.TabListener</#if> { - - /** - * The {@link android.support.v4.view.PagerAdapter} that will provide - * fragments for each of the sections. We use a - * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which - * will keep every loaded fragment in memory. If this becomes too memory - * intensive, it may be best to switch to a - * {@link android.support.v4.app.FragmentStatePagerAdapter}. - */ - SectionsPagerAdapter mSectionsPagerAdapter; - - /** - * The {@link ViewPager} that will host the section contents. - */ - ViewPager mViewPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.${layoutName}); - - <#if navType?contains("tabs")> - // Set up the action bar. - final ActionBar actionBar = getActionBar(); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - <#if parentActivityClass != ""> - // Show the Up button in the action bar. - actionBar.setDisplayHomeAsUpEnabled(true); - </#if> - <#elseif parentActivityClass != ""> - // Show the Up button in the action bar. - getActionBar().setDisplayHomeAsUpEnabled(true); - </#if> - - // Create the adapter that will return a fragment for each of the three - // primary sections of the app. - mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); - - // Set up the ViewPager with the sections adapter. - mViewPager = (ViewPager) findViewById(R.id.pager); - mViewPager.setAdapter(mSectionsPagerAdapter); - - <#if navType?contains("tabs")> - // When swiping between different sections, select the corresponding - // tab. We can also use ActionBar.Tab#select() to do this if we have - // a reference to the Tab. - mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override - public void onPageSelected(int position) { - actionBar.setSelectedNavigationItem(position); - } - }); - - // For each of the sections in the app, add a tab to the action bar. - for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { - // Create a tab with text corresponding to the page title defined by - // the adapter. Also specify this Activity object, which implements - // the TabListener interface, as the callback (listener) for when - // this tab is selected. - actionBar.addTab( - actionBar.newTab() - .setText(mSectionsPagerAdapter.getPageTitle(i)) - .setTabListener(this)); - } - </#if> - } - - <#include "include_onCreateOptionsMenu.java.ftl"> - <#include "include_onOptionsItemSelected.java.ftl"> - - <#if navType?contains("tabs")>@Override - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - // When the given tab is selected, switch to the corresponding page in - // the ViewPager. - mViewPager.setCurrentItem(tab.getPosition()); - } - - @Override - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - } - - @Override - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { - }</#if> - - /** - * A {@link FragmentPagerAdapter} that returns a fragment corresponding to - * one of the sections/tabs/pages. - */ - public class SectionsPagerAdapter extends FragmentPagerAdapter { - - public SectionsPagerAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public Fragment getItem(int position) { - // getItem is called to instantiate the fragment for the given page. - // Return a DummySectionFragment (defined as a static inner class - // below) with the page number as its lone argument. - Fragment fragment = new DummySectionFragment(); - Bundle args = new Bundle(); - args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1); - fragment.setArguments(args); - return fragment; - } - - @Override - public int getCount() { - // Show 3 total pages. - return 3; - } - - @Override - public CharSequence getPageTitle(int position) { - Locale l = Locale.getDefault(); - switch (position) { - case 0: - return getString(R.string.title_section1).toUpperCase(l); - case 1: - return getString(R.string.title_section2).toUpperCase(l); - case 2: - return getString(R.string.title_section3).toUpperCase(l); - } - return null; - } - } - - <#include "include_DummySectionFragment.java.ftl"> - -} diff --git a/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl deleted file mode 100644 index 8eb1399..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl +++ /dev/null @@ -1,23 +0,0 @@ - /** - * A dummy fragment representing a section of the app, but that simply - * displays dummy text. - */ - public static class DummySectionFragment extends Fragment { - /** - * The fragment argument representing the section number for this - * fragment. - */ - public static final String ARG_SECTION_NUMBER = "section_number"; - - public DummySectionFragment() { - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View rootView = inflater.inflate(R.layout.fragment_${classToResource(activityClass)}_dummy, container, false); - TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label); - dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); - return rootView; - } - } diff --git a/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl deleted file mode 100644 index 005d629..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl +++ /dev/null @@ -1,6 +0,0 @@ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.${menuName}, menu); - return true; - } diff --git a/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl deleted file mode 100644 index e1dc462..0000000 --- a/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl +++ /dev/null @@ -1,19 +0,0 @@ - <#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> diff --git a/templates/activities/BlankActivity/template.xml b/templates/activities/BlankActivity/template.xml deleted file mode 100644 index 8b02ba9..0000000 --- a/templates/activities/BlankActivity/template.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0"?> -<template - format="3" - revision="3" - name="Blank Activity" - description="Creates a new blank activity, with an action bar and optional navigational elements such as tabs or horizontal swipe."> - <dependency name="android-support-v4" revision="8" /> - - <category value="Activities" /> - - <parameter - id="activityClass" - name="Activity Name" - type="string" - constraints="class|unique|nonempty" - suggest="${layoutToActivity(layoutName)}" - default="MainActivity" - help="The name of the activity class to create" /> - - <parameter - id="layoutName" - name="Layout Name" - type="string" - constraints="layout|unique|nonempty" - suggest="${activityToLayout(activityClass)}" - default="activity_main" - help="The name of the layout to create for the activity" /> - - <parameter - id="activityTitle" - name="Title" - type="string" - constraints="nonempty" - default="MainActivity" - suggest="${activityClass}" - help="The name of the activity. For launcher activities, the application title." /> - - <parameter - id="isLauncher" - name="Launcher Activity" - type="boolean" - default="false" - help="If true, this activity 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="navType" - name="Navigation Type" - type="enum" - default="none" - help="The type of navigation to use for the activity" > - <option id="none" default="true">None</option> - <!--<option id="tabs" minApi="11">Fixed Tabs</option>--> - <option id="tabs_pager" minApi="11">Fixed Tabs + Swipe</option> - <option id="pager_strip" minApi="11">Scrollable Tabs + Swipe</option> - <option id="dropdown" minApi="11">Dropdown</option> - </parameter> - - <parameter - id="packageName" - name="Package name" - type="string" - constraints="package" - default="com.mycompany.myapp" /> - - <!-- 128x128 thumbnails relative to template.xml --> - <thumbs> - <!-- default thumbnail is required --> - <thumb>template_blank_activity.png</thumb> - <!-- attributes act as selectors based on chosen parameters --> - <thumb navType="none">template_blank_activity.png</thumb> - <thumb navType="tabs">template_blank_activity_tabs.png</thumb> - <thumb navType="tabs_pager">template_blank_activity_tabs_pager.png</thumb> - <thumb navType="pager_strip">template_blank_activity_pager.png</thumb> - <thumb navType="dropdown">template_blank_activity_dropdown.png</thumb> - </thumbs> - - <globals file="globals.xml.ftl" /> - <execute file="recipe.xml.ftl" /> - -</template> diff --git a/templates/activities/BlankActivity/template_blank_activity.png b/templates/activities/BlankActivity/template_blank_activity.png Binary files differdeleted file mode 100644 index 729dd1c..0000000 --- a/templates/activities/BlankActivity/template_blank_activity.png +++ /dev/null diff --git a/templates/activities/BlankActivity/template_blank_activity_dropdown.png b/templates/activities/BlankActivity/template_blank_activity_dropdown.png Binary files differdeleted file mode 100644 index 09fa2cf..0000000 --- a/templates/activities/BlankActivity/template_blank_activity_dropdown.png +++ /dev/null diff --git a/templates/activities/BlankActivity/template_blank_activity_pager.png b/templates/activities/BlankActivity/template_blank_activity_pager.png Binary files differdeleted file mode 100644 index 7cd8e0e..0000000 --- a/templates/activities/BlankActivity/template_blank_activity_pager.png +++ /dev/null diff --git a/templates/activities/BlankActivity/template_blank_activity_tabs.png b/templates/activities/BlankActivity/template_blank_activity_tabs.png Binary files differdeleted file mode 100644 index 86a09d6..0000000 --- a/templates/activities/BlankActivity/template_blank_activity_tabs.png +++ /dev/null diff --git a/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png b/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png Binary files differdeleted file mode 100644 index 0697a56..0000000 --- a/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png +++ /dev/null |