diff options
author | Daniel Bailey <daniel.bailey@grappleIT.co.uk> | 2020-06-16 22:40:40 +0300 |
---|---|---|
committer | Daniel Bailey <daniel.bailey@grappleIT.co.uk> | 2020-07-07 22:12:14 +0300 |
commit | a951c672c0b699e5d14d687e61d4c21386cbd91b (patch) | |
tree | e0feb0f6dd0dbd7bf2264b54244208109a26b04e | |
parent | 13f05cbd124a5155839288ba17dc2416d5eb0a6d (diff) |
Moved stack widget package.
Signed-off-by: Daniel Bailey <daniel.bailey@grappleIT.co.uk>
-rw-r--r-- | app/src/main/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidget.java (renamed from app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidget.java) | 2 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetConfigurationActivity.java (renamed from app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetConfigurationActivity.java) | 2 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetFactory.java (renamed from app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetFactory.java) | 32 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetService.java (renamed from app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetService.java) | 2 | ||||
-rw-r--r-- | app/src/main/res/layout/widget_stack.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/xml/stack_widget_provider.xml | 2 |
7 files changed, 36 insertions, 12 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 08b66831c..4b62c8cc5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -127,14 +127,14 @@ android:process=":error_activity" /> <activity - android:name=".ui.appwidget.StackWidgetConfigurationActivity"> + android:name=".ui.widget.stack.StackWidgetConfigurationActivity"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/> </intent-filter> </activity> <receiver - android:name="it.niedermann.nextcloud.deck.ui.appwidget.StackWidget" + android:name="it.niedermann.nextcloud.deck.ui.widget.stack.StackWidget" android:label="@string/widget_stack_title"> <intent-filter> @@ -158,7 +158,7 @@ </service> <service - android:name=".ui.appwidget.StackWidgetService" + android:name=".ui.widget.stack.StackWidgetService" android:permission="android.permission.BIND_REMOTEVIEWS" /> <activity diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidget.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidget.java index 78619bbc5..5dbc4de2e 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidget.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidget.java @@ -1,4 +1,4 @@ -package it.niedermann.nextcloud.deck.ui.appwidget; +package it.niedermann.nextcloud.deck.ui.widget.stack; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetConfigurationActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetConfigurationActivity.java index 5ca36e352..bbfd92177 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetConfigurationActivity.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetConfigurationActivity.java @@ -1,4 +1,4 @@ -package it.niedermann.nextcloud.deck.ui.appwidget; +package it.niedermann.nextcloud.deck.ui.widget.stack; import android.appwidget.AppWidgetManager; import android.content.Intent; diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetFactory.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetFactory.java index b105859ef..82ac4befd 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetFactory.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetFactory.java @@ -1,9 +1,10 @@ -package it.niedermann.nextcloud.deck.ui.appwidget; +package it.niedermann.nextcloud.deck.ui.widget.stack; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.graphics.Color; import android.widget.RemoteViews; import android.widget.RemoteViewsService; @@ -12,18 +13,20 @@ import androidx.lifecycle.LiveData; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.R; import it.niedermann.nextcloud.deck.model.Card; +import it.niedermann.nextcloud.deck.model.full.FullBoard; import it.niedermann.nextcloud.deck.model.full.FullStack; import it.niedermann.nextcloud.deck.persistence.sync.SyncManager; +import it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DataBaseAdapter; public class StackWidgetFactory implements RemoteViewsService.RemoteViewsFactory { private final Context context; private final int appWidgetId; - - private FullStack stack; - private final long accountId; private final long stackId; + private FullStack stack; + private int boardColor = Color.GRAY; + StackWidgetFactory(Context context, Intent intent) { this.context = context; @@ -41,9 +44,16 @@ public class StackWidgetFactory implements RemoteViewsService.RemoteViewsFactory if (fullStack != null) { stack = fullStack; +// stack.getStack().getBoardId(); +// LiveData<Board> fb = syncManager.getBoard(accountId, stack.getStack().getBoardId()); + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_stack); + views.setImageViewResource(R.id.widget_stack_header_icon, R.drawable.circle_grey600_8dp); + views.setInt(R.id.widget_stack_header_icon, "setColorFilter", boardColor); views.setTextViewText(R.id.widget_stack_title_tv, stack.getStack().getTitle()); + stack.getStack().getBoardId(); + AppWidgetManager awm = AppWidgetManager.getInstance(context); int[] appWidgetIds = awm.getAppWidgetIds(new ComponentName(context, StackWidget.class)); awm.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.stack_widget_lv); @@ -51,10 +61,24 @@ public class StackWidgetFactory implements RemoteViewsService.RemoteViewsFactory } }); + + LiveData<FullBoard> fullBoardLiveData = syncManager.getFullBoard(accountId, stack.getStack().getBoardId()); + fullBoardLiveData.observeForever((FullBoard fullBoard) -> { + if (fullBoard != null) { + + } + }); } @Override public void onDataSetChanged() { + if (stack == null) { + return; + } + + DataBaseAdapter db = new DataBaseAdapter(context); + FullBoard Fullboard = db.getFullBoardByLocalIdDirectly(accountId, stack.getStack().getBoardId()); + boardColor = Color.parseColor("#" + Fullboard.getBoard().getColor()); } diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetService.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetService.java index c1181108b..9299a96e2 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/appwidget/StackWidgetService.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/stack/StackWidgetService.java @@ -1,4 +1,4 @@ -package it.niedermann.nextcloud.deck.ui.appwidget; +package it.niedermann.nextcloud.deck.ui.widget.stack; import android.content.Intent; import android.widget.RemoteViewsService; diff --git a/app/src/main/res/layout/widget_stack.xml b/app/src/main/res/layout/widget_stack.xml index f40870d30..1a16fe339 100644 --- a/app/src/main/res/layout/widget_stack.xml +++ b/app/src/main/res/layout/widget_stack.xml @@ -18,7 +18,7 @@ android:id="@+id/widget_stack_header_icon" android:layout_width="@dimen/widget_stack_icon_width" android:layout_height="match_parent" - android:src="@mipmap/ic_launcher" + android:src="@drawable/circle_grey600_8dp" android:layout_alignParentStart="true" android:layout_alignParentBottom="true" android:paddingStart="@dimen/widget_stack_card_padding" diff --git a/app/src/main/res/xml/stack_widget_provider.xml b/app/src/main/res/xml/stack_widget_provider.xml index 77ec72dfb..3712625da 100644 --- a/app/src/main/res/xml/stack_widget_provider.xml +++ b/app/src/main/res/xml/stack_widget_provider.xml @@ -9,4 +9,4 @@ android:updatePeriodMillis="86400000" android:widgetCategory="keyguard|home_screen" android:previewImage="@drawable/widget_stack_preview" - android:configure="it.niedermann.nextcloud.deck.ui.appwidget.StackWidgetConfigurationActivity" /> + android:configure="it.niedermann.nextcloud.deck.ui.widget.stack.StackWidgetConfigurationActivity" /> |