diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f9b325f..86cd4d7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,26 +1,48 @@ + + package="dev.jhale.binaryclock"> - - - - - - + android:roundIcon="@mipmap/ic_launcher_round" + android:theme="@style/BootTheme"> + + + + + + + + + + + + + + + + + + + + - + + \ No newline at end of file diff --git a/android/app/src/main/java/dev/jhale/binaryclock/BinaryClockWidget.kt b/android/app/src/main/java/dev/jhale/binaryclock/BinaryClockWidget.kt new file mode 100644 index 0000000..28aaac3 --- /dev/null +++ b/android/app/src/main/java/dev/jhale/binaryclock/BinaryClockWidget.kt @@ -0,0 +1,37 @@ +package com.binaryclock + +import android.appwidget.AppWidgetManager +import android.appwidget.AppWidgetProvider +import android.content.Context +import android.widget.RemoteViews +import dev.jhale.binaryclock.R + +/** + * Implementation of App Widget functionality. + */ +class BinaryClockWidget : AppWidgetProvider() { + override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { + // There may be multiple widgets active, so update all of them + for (appWidgetId in appWidgetIds) { + updateAppWidget(context, appWidgetManager, appWidgetId) + } + } + + override fun onEnabled(context: Context) { + // Enter relevant functionality for when the first widget is created + } + + override fun onDisabled(context: Context) { + // Enter relevant functionality for when the last widget is disabled + } +} + +internal fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int) { + val widgetText = context.getString(R.string.appwidget_text) + // Construct the RemoteViews object + val views = RemoteViews(context.packageName, R.layout.binary_clock_widget) + views.setTextViewText(R.id.appwidget_text, widgetText) + + // Instruct the widget manager to update the widget + appWidgetManager.updateAppWidget(appWidgetId, views) +} \ No newline at end of file diff --git a/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png b/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png new file mode 100644 index 0000000..894b069 Binary files /dev/null and b/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png differ diff --git a/android/app/src/main/res/drawable-v21/app_widget_background.xml b/android/app/src/main/res/drawable-v21/app_widget_background.xml new file mode 100644 index 0000000..785445c --- /dev/null +++ b/android/app/src/main/res/drawable-v21/app_widget_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml new file mode 100644 index 0000000..007e287 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/binary_clock_widget.xml b/android/app/src/main/res/layout/binary_clock_widget.xml new file mode 100644 index 0000000..e432893 --- /dev/null +++ b/android/app/src/main/res/layout/binary_clock_widget.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-night-v31/themes.xml b/android/app/src/main/res/values-night-v31/themes.xml new file mode 100644 index 0000000..e67e6c0 --- /dev/null +++ b/android/app/src/main/res/values-night-v31/themes.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-v21/styles.xml b/android/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..705e1d8 --- /dev/null +++ b/android/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/styles.xml b/android/app/src/main/res/values-v31/styles.xml new file mode 100644 index 0000000..81bedc8 --- /dev/null +++ b/android/app/src/main/res/values-v31/styles.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values-v31/themes.xml b/android/app/src/main/res/values-v31/themes.xml new file mode 100644 index 0000000..1bc5dfb --- /dev/null +++ b/android/app/src/main/res/values-v31/themes.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/attrs.xml b/android/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..7781ac8 --- /dev/null +++ b/android/app/src/main/res/values/attrs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index 961897a..4e4c50c 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -1,3 +1,7 @@ #000000 + #FFE1F5FE + #FF81D4FA + #FF039BE5 + #FF01579B diff --git a/android/app/src/main/res/values/dimens.xml b/android/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..4db8c59 --- /dev/null +++ b/android/app/src/main/res/values/dimens.xml @@ -0,0 +1,10 @@ + + + + + 0dp + + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 1d548e4..3d2d737 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,3 +1,7 @@ BinaryClock + EXAMPLE + Configure + Add widget + This is an app widget description diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index dd5dad4..91a5181 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -13,4 +13,14 @@ @style/AppTheme + + + + diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..b7d03a9 --- /dev/null +++ b/android/app/src/main/res/values/themes.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/xml/binary_clock_widget_info.xml b/android/app/src/main/res/xml/binary_clock_widget_info.xml new file mode 100644 index 0000000..a7116c6 --- /dev/null +++ b/android/app/src/main/res/xml/binary_clock_widget_info.xml @@ -0,0 +1,14 @@ + + \ No newline at end of file