diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 643dcd9..de70ae2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/layout/FrameWidget.java b/app/src/main/java/layout/FrameWidget.java new file mode 100644 index 0000000..c751670 --- /dev/null +++ b/app/src/main/java/layout/FrameWidget.java @@ -0,0 +1,45 @@ +package layout; + +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.Context; +import android.widget.RemoteViews; + +import horse.jaeil.microframe.R; + +/** + * Implementation of App Widget functionality. + */ +public class FrameWidget extends AppWidgetProvider { + + static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, + int appWidgetId) { + + CharSequence widgetText = context.getString(R.string.appwidget_text); + // Construct the RemoteViews object + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.frame_widget); +// views.setTextViewText(R.id.appwidget_text, widgetText); + + // Instruct the widget manager to update the widget + appWidgetManager.updateAppWidget(appWidgetId, views); + } + + @Override + public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + // There may be multiple widgets active, so update all of them + for (int appWidgetId : appWidgetIds) { + updateAppWidget(context, appWidgetManager, appWidgetId); + } + } + + @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 + } +} + diff --git a/app/src/main/res/drawable-nodpi/example_appwidget_preview.png b/app/src/main/res/drawable-nodpi/example_appwidget_preview.png new file mode 100644 index 0000000..894b069 Binary files /dev/null and b/app/src/main/res/drawable-nodpi/example_appwidget_preview.png differ diff --git a/app/src/main/res/layout/frame_widget.xml b/app/src/main/res/layout/frame_widget.xml new file mode 100644 index 0000000..ddf7ad0 --- /dev/null +++ b/app/src/main/res/layout/frame_widget.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-v14/dimens.xml b/app/src/main/res/values-v14/dimens.xml new file mode 100644 index 0000000..4db8c59 --- /dev/null +++ b/app/src/main/res/values-v14/dimens.xml @@ -0,0 +1,10 @@ + + + + + 0dp + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 47c8224..fb6e235 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,4 +2,10 @@ 16dp 16dp + + + 8dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7432432..a8c004f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,6 @@ MicroFrame - Version: 0.1\nAuthor: Tim Van Baak + Version: 0.1.1\nAuthor: Tim Van Baak + WAITAMINUTE + Add widget???? diff --git a/app/src/main/res/xml/frame_widget_info.xml b/app/src/main/res/xml/frame_widget_info.xml new file mode 100644 index 0000000..c4cc073 --- /dev/null +++ b/app/src/main/res/xml/frame_widget_info.xml @@ -0,0 +1,10 @@ + + \ No newline at end of file