From a9c44b26f2e65925e178d86fd324f7217cb814b2 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Tue, 19 Sep 2023 23:46:57 -0400 Subject: [PATCH 1/3] Add sync icon to widget I merged in updates to the PR by @tomoyukim. --- .../ui/notifications/Notifications.java | 2 +- .../android/widgets/ListWidgetProvider.java | 11 +++ app/src/main/res/layout/list_widget.xml | 69 +++++++++++-------- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 55 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/com/orgzly/android/ui/notifications/Notifications.java b/app/src/main/java/com/orgzly/android/ui/notifications/Notifications.java index 321689b12..3b337fb8a 100644 --- a/app/src/main/java/com/orgzly/android/ui/notifications/Notifications.java +++ b/app/src/main/java/com/orgzly/android/ui/notifications/Notifications.java @@ -119,4 +119,4 @@ private static int getNotificationPriority(String priority) { public static void cancelNewNoteNotification(Context context) { SystemServices.getNotificationManager(context).cancel(ONGOING_NEW_NOTE_ID); } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/orgzly/android/widgets/ListWidgetProvider.java b/app/src/main/java/com/orgzly/android/widgets/ListWidgetProvider.java index fd42a9d60..ee1856e58 100644 --- a/app/src/main/java/com/orgzly/android/widgets/ListWidgetProvider.java +++ b/app/src/main/java/com/orgzly/android/widgets/ListWidgetProvider.java @@ -14,6 +14,7 @@ import com.orgzly.BuildConfig; import com.orgzly.R; +import com.orgzly.android.ActionReceiver; import com.orgzly.android.App; import com.orgzly.android.AppIntent; import com.orgzly.android.data.DataRepository; @@ -107,6 +108,16 @@ private void updateAppWidgetLayout(Context context, AppWidgetManager appWidgetMa R.id.list_widget_header_add, ShareActivity.createNewNotePendingIntent(context, "widget-" + appWidgetId, savedSearch)); + // Sync icon - sync start + final Intent onSyncIntent = new Intent(context, ActionReceiver.class); + onSyncIntent.setAction(AppIntent.ACTION_SYNC_START); + final PendingIntent onSyncPendingIntent = PendingIntent.getBroadcast( + context, + 0, + onSyncIntent, + ActivityUtils.mutable(PendingIntent.FLAG_UPDATE_CURRENT)); + remoteViews.setOnClickPendingIntent(R.id.list_widget_header_sync, onSyncPendingIntent); + // Logo - open query Intent openIntent = Intent.makeRestartActivityTask(new ComponentName(context, MainActivity.class)); openIntent.putExtra(AppIntent.EXTRA_QUERY_STRING, savedSearch.getQuery()); diff --git a/app/src/main/res/layout/list_widget.xml b/app/src/main/res/layout/list_widget.xml index bf33b930b..f6c6708f8 100644 --- a/app/src/main/res/layout/list_widget.xml +++ b/app/src/main/res/layout/list_widget.xml @@ -1,39 +1,40 @@ - + android:orientation="vertical" + android:theme="@style/ListWidgetTheme"> + android:elevation="1dp" + android:orientation="horizontal"> + android:layout_weight="1" + android:gravity="start" + android:orientation="horizontal" + android:paddingStart="0dp" + android:paddingEnd="0dp"> + android:maxLines="1" + android:text="@string/list_widget_select_search" + android:textColor="?android:attr/textColorPrimary" + android:textSize="@dimen/widget_header_text_size_14" /> + android:layout_gravity="center_vertical" + android:src="@drawable/ic_arrow_drop_down" /> + + + + + android:dividerHeight="0dp" + android:paddingStart="@dimen/widget_padding" + android:paddingTop="@dimen/widget_padding" + android:paddingBottom="@dimen/widget_padding" /> + android:textSize="20sp" + android:visibility="gone" /> - \ No newline at end of file + + diff --git a/build.gradle b/build.gradle index 3f32a4cdd..22aeff4ff 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { def versions = [:] - versions.android_gradle_plugin = '7.3.1' + versions.android_gradle_plugin = '7.4.2' versions.kotlin = '1.7.20' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4ab3c681f..fa5d7088e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sat Jan 29 20:23:20 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME From 7db35a738b2a5fcc9769cabb09d61cc7e3a1b053 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Wed, 20 Sep 2023 00:10:05 -0400 Subject: [PATCH 2/3] Clean up line ordering changes --- app/src/main/res/layout/list_widget.xml | 47 +++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/layout/list_widget.xml b/app/src/main/res/layout/list_widget.xml index f6c6708f8..c4799602e 100644 --- a/app/src/main/res/layout/list_widget.xml +++ b/app/src/main/res/layout/list_widget.xml @@ -1,6 +1,7 @@ - + android:elevation="1dp"> + android:orientation="horizontal"> + android:textSize="@dimen/widget_header_text_size_14" + android:drawablePadding="4dp" + android:ellipsize="end" + android:maxLines="1" /> + android:src="@drawable/ic_arrow_drop_down" + android:layout_gravity="center_vertical" /> @@ -71,19 +72,19 @@ + android:paddingBottom="@dimen/widget_padding" + android:paddingStart="@dimen/widget_padding" + android:divider="@null" + android:dividerHeight="0dp" /> + android:textSize="20sp" /> From 200656eee292b2469a3c4f51248e4b54f9e26055 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Wed, 20 Sep 2023 00:12:42 -0400 Subject: [PATCH 3/3] Two more order cleanups --- app/src/main/res/layout/list_widget.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/list_widget.xml b/app/src/main/res/layout/list_widget.xml index c4799602e..70beb6994 100644 --- a/app/src/main/res/layout/list_widget.xml +++ b/app/src/main/res/layout/list_widget.xml @@ -2,12 +2,13 @@ + android:orientation="vertical"> +