diff options
Diffstat (limited to 'templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl')
-rw-r--r-- | templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl | 63 |
1 files changed, 0 insertions, 63 deletions
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); - } -} - - |