Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sync icon to list widget #12

Merged
merged 4 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
17 changes: 16 additions & 1 deletion app/src/main/res/layout/list_widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/ListWidgetTheme"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<LinearLayout
android:id="@+id/list_widget_header_container"
android:layout_width="match_parent"
Expand Down Expand Up @@ -55,8 +58,18 @@
android:layout_height="24dp"
android:src="@drawable/ic_arrow_drop_down"
android:layout_gravity="center_vertical" />

</LinearLayout>

<ImageButton
android:id="@+id/list_widget_header_sync"
style="@style/BorderlessButton"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:padding="0dp"
android:src="@drawable/ic_sync" />

<ImageButton
android:id="@+id/list_widget_header_add"
style="@style/BorderlessButton"
Expand All @@ -65,6 +78,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_add" />

</LinearLayout>

<LinearLayout
Expand Down Expand Up @@ -96,4 +110,5 @@
android:textColor="?android:attr/textColorPrimary"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>

</LinearLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Loading