diff options
author | Josiah Gaskin <josiahgaskin@google.com> | 2013-07-31 14:21:16 -0700 |
---|---|---|
committer | Josiah Gaskin <josiahgaskin@google.com> | 2013-07-31 14:21:16 -0700 |
commit | f7c5f6b3fb2f6bd820d0d70ec48be12df103cf12 (patch) | |
tree | 91e9e7227cc1a79a08edd6f742a918628b08d994 /templates/other/AppWidget/root | |
parent | be3b71eb1f30ebaf063d0df63e1f082844df24a3 (diff) | |
download | sdk-f7c5f6b3fb2f6bd820d0d70ec48be12df103cf12.zip sdk-f7c5f6b3fb2f6bd820d0d70ec48be12df103cf12.tar.gz sdk-f7c5f6b3fb2f6bd820d0d70ec48be12df103cf12.tar.bz2 |
Update template location for SDK build
This change removes templates from the SDK source tree (from sdk/templates)
and points the build/tools.atree build location file to their new location
in tools/base/templates
Change-Id: Id37b24eceaae6dcc0b3bf5078a759a337cb13467
Diffstat (limited to 'templates/other/AppWidget/root')
10 files changed, 0 insertions, 293 deletions
diff --git a/templates/other/AppWidget/root/AndroidManifest.xml.ftl b/templates/other/AppWidget/root/AndroidManifest.xml.ftl deleted file mode 100644 index 8b96d56..0000000 --- a/templates/other/AppWidget/root/AndroidManifest.xml.ftl +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android"> - - <application> - - <receiver android:name=".${className}" > - <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> - </intent-filter> - - <meta-data - android:name="android.appwidget.provider" - android:resource="@xml/${class_name}_info" /> - </receiver> - - <#if configurable> - <activity android:name=".${className}ConfigureActivity" > - <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> - </intent-filter> - </activity> - </#if> - </application> - -</manifest>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png b/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png Binary files differdeleted file mode 100644 index 894b069..0000000 --- a/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png +++ /dev/null diff --git a/templates/other/AppWidget/root/res/layout/appwidget.xml b/templates/other/AppWidget/root/res/layout/appwidget.xml deleted file mode 100644 index 3a00464..0000000 --- a/templates/other/AppWidget/root/res/layout/appwidget.xml +++ /dev/null @@ -1,21 +0,0 @@ -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="@dimen/widget_margin" - android:background="#09C" > - - <TextView - android:id="@+id/appwidget_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:text="@string/appwidget_text" - android:textColor="#ffffff" - android:textSize="24sp" - android:textStyle="bold|italic" - android:layout_margin="8dp" - android:contentDescription="@string/appwidget_text" - android:background="#09C"/> - -</RelativeLayout>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/layout/appwidget_configure.xml b/templates/other/AppWidget/root/res/layout/appwidget_configure.xml deleted file mode 100644 index 8ddc335..0000000 --- a/templates/other/AppWidget/root/res/layout/appwidget_configure.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/configure" - android:layout_marginBottom="8dp" /> - - <EditText - android:id="@+id/appwidget_text" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="text" /> - - <Button - android:id="@+id/add_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/add_widget" - android:layout_marginTop="8dp" /> - -</LinearLayout>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/values-v14/dimens.xml b/templates/other/AppWidget/root/res/values-v14/dimens.xml deleted file mode 100644 index 4db8c59..0000000 --- a/templates/other/AppWidget/root/res/values-v14/dimens.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <!-- -Refer to App Widget Documentation for margin information -http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout - --> - <dimen name="widget_margin">0dp</dimen> - -</resources>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/values/dimens.xml b/templates/other/AppWidget/root/res/values/dimens.xml deleted file mode 100644 index fdececf..0000000 --- a/templates/other/AppWidget/root/res/values/dimens.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <!-- -Refer to App Widget Documentation for margin information -http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout - --> - <dimen name="widget_margin">8dp</dimen> - -</resources>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/values/strings.xml.ftl b/templates/other/AppWidget/root/res/values/strings.xml.ftl deleted file mode 100644 index 66c06bc..0000000 --- a/templates/other/AppWidget/root/res/values/strings.xml.ftl +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="appwidget_text">EXAMPLE</string> - <#if configurable> - <string name="configure">Configure</string> - </#if> - <string name="add_widget">Add widget</string> -</resources>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl b/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl deleted file mode 100644 index 75791be..0000000 --- a/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" - android:minWidth="${-30 + 70 * minWidth?number}dp" - android:minHeight="${-30 + 70 * minHeight?number}dp" - android:updatePeriodMillis="86400000" - android:previewImage="@drawable/example_appwidget_preview" - android:initialLayout="@layout/${class_name}" -<#if configurable> - android:configure="${packageName}.${className}ConfigureActivity" -</#if> -<#if resizable='both'> - android:resizeMode="horizontal|vertical" -<#elseif resizable='horizontal'> - android:resizeMode="horizontal" -<#elseif resizable='vertical'> - android:resizeMode="vertical" -<#elseif resizable='none'> -</#if> -<#if placement='both'> - android:widgetCategory="home_screen|keyguard" -<#elseif placement='homescreen'> - android:widgetCategory="home_screen" -<#elseif placement='keyguard'> - android:widgetCategory="keyguard" -</#if> - android:initialKeyguardLayout="@layout/${class_name}"> -</appwidget-provider>
\ No newline at end of file diff --git a/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl b/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl deleted file mode 100644 index d86b0b5..0000000 --- a/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl +++ /dev/null @@ -1,63 +0,0 @@ -package ${packageName}; - -import android.appwidget.AppWidgetManager; -import android.appwidget.AppWidgetProvider; -import android.content.Context; -import android.widget.RemoteViews; - -/** - * Implementation of App Widget functionality. -<#if configurable> - * App Widget Configuration implemented in {@link ${className}ConfigureActivity ${className}ConfigureActivity} -</#if> - */ -public class ${className} extends AppWidgetProvider { - - @Override - public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { - // There may be multiple widgets active, so update all of them - final int N = appWidgetIds.length; - for (int i=0; i<N; i++) { - updateAppWidget(context, appWidgetManager, appWidgetIds[i]); - } - } - -<#if configurable> - @Override - public void onDeleted(Context context, int[] appWidgetIds) { - // When the user deletes the widget, delete the preference associated with it. - final int N = appWidgetIds.length; - for (int i=0; i<N; i++) { - ${className}ConfigureActivity.deleteTitlePref(context, appWidgetIds[i]); - } - } -</#if> - - @Override - public void onEnabled(Context context) { - // Enter relevant functionality for when the first widget is created - } - - @Override - public void onDisabled(Context context) { - // Enter relevant functionality for when the last widget is disabled - } - - static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, - int appWidgetId) { - -<#if configurable> - CharSequence widgetText = ${className}ConfigureActivity.loadTitlePref(context, appWidgetId); -<#else> - CharSequence widgetText = context.getString(R.string.appwidget_text); -</#if> - // Construct the RemoteViews object - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.${class_name}); - views.setTextViewText(R.id.appwidget_text, widgetText); - - // Instruct the widget manager to update the widget - appWidgetManager.updateAppWidget(appWidgetId, views); - } -} - - diff --git a/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl b/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl deleted file mode 100644 index 3c2be67..0000000 --- a/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl +++ /dev/null @@ -1,102 +0,0 @@ -package ${packageName}; - -import android.app.Activity; -import android.appwidget.AppWidgetManager; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.view.View; -import android.widget.EditText; - -/** - * The configuration screen for the {@link ${className} ${className}} AppWidget. - */ -public class ${className}ConfigureActivity extends Activity { - - int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; - EditText mAppWidgetText; - private static final String PREFS_NAME = "${packageName}.${className}"; - private static final String PREF_PREFIX_KEY = "appwidget_"; - - public ${className}ConfigureActivity() { - super(); - } - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - - // Set the result to CANCELED. This will cause the widget host to cancel - // out of the widget placement if the user presses the back button. - setResult(RESULT_CANCELED); - - setContentView(R.layout.${class_name}_configure); - mAppWidgetText = (EditText)findViewById(R.id.appwidget_text); - findViewById(R.id.add_button).setOnClickListener(mOnClickListener); - - // Find the widget id from the intent. - Intent intent = getIntent(); - Bundle extras = intent.getExtras(); - if (extras != null) { - mAppWidgetId = extras.getInt( - AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); - } - - // If this activity was started with an intent without an app widget ID, finish with an error. - if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { - finish(); - return; - } - - mAppWidgetText.setText(loadTitlePref(${className}ConfigureActivity.this, mAppWidgetId)); - } - - View.OnClickListener mOnClickListener = new View.OnClickListener() { - public void onClick(View v) { - final Context context = ${className}ConfigureActivity.this; - - // When the button is clicked, store the string locally - String widgetText = mAppWidgetText.getText().toString(); - saveTitlePref(context,mAppWidgetId,widgetText); - - // It is the responsibility of the configuration activity to update the app widget - AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); - ${className}.updateAppWidget(context, appWidgetManager, mAppWidgetId); - - // Make sure we pass back the original appWidgetId - Intent resultValue = new Intent(); - resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); - setResult(RESULT_OK, resultValue); - finish(); - } - }; - - // Write the prefix to the SharedPreferences object for this widget - static void saveTitlePref(Context context, int appWidgetId, String text) { - SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit(); - prefs.putString(PREF_PREFIX_KEY + appWidgetId, text); - prefs.commit(); - } - - // Read the prefix from the SharedPreferences object for this widget. - // If there is no preference saved, get the default from a resource - static String loadTitlePref(Context context, int appWidgetId) { - SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0); - String titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null); - if (titleValue != null) { - return titleValue; - } else { - return context.getString(R.string.appwidget_text); - } - } - - static void deleteTitlePref(Context context, int appWidgetId) { - SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit(); - prefs.remove(PREF_PREFIX_KEY + appWidgetId); - prefs.commit(); - } -} - - - |