Skip to content

Commit de8c1a6

Browse files
Fixed: Show Open Termux:Widget app to refresh widget message instead of No files in ~/.shortcuts/ message when initial layout of widget is being shown so that it is not confused with shortcuts directory being empty
In this stuck state which may happen after app updates or if app process gets killed without being restarted by Android, the widgets must be refreshed by starting the Termux:Widget app or with the refresh button in the main activity. If the widget was successfully refreshed/updated and shortcuts directory was empty, only then the `No files in ~/.shortcuts/` message will be shown.
1 parent d4cfdb2 commit de8c1a6

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

app/src/main/java/com/termux/widget/TermuxWidgetProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static void updateAppWidgetRemoteViews(@NonNull Context context, @NonNull
8585
// The empty view is displayed when the collection has no items. It should be a sibling
8686
// of the collection view:
8787
remoteViews.setEmptyView(R.id.widget_list, R.id.empty_view);
88+
remoteViews.setTextViewText(R.id.empty_view, context.getString(R.string.msg_no_shortcut_scripts));
8889

8990
// Setup intent which points to the TermuxWidgetService which will provide the views for this collection.
9091
Intent intent = new Intent(context, TermuxWidgetService.class);

app/src/main/res/layout/widget_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
android:layout_below="@id/top_row"
4848
android:background="@android:color/white"
4949
android:padding="6dp"
50-
android:text="@string/msg_no_shortcut_scripts"
50+
android:text="@string/msg_refresh_widget_from_app"
5151
android:textColor="@android:color/black" />
5252
</RelativeLayout>
5353

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"Open &TERMUX_WIDGET_APP_NAME; app to refresh widget" message instead of showing the
5656
shortcuts. In this state, the refresh buttons of the widgets itself will not work. Just
5757
launching the &TERMUX_WIDGET_APP_NAME; app will also refresh the widget.</string>
58+
<string name="msg_refresh_widget_from_app">Open &TERMUX_WIDGET_APP_NAME; app to refresh widget</string>
5859
<string name="action_refresh_all_widgets">Refresh Widgets</string>
5960

6061
<!-- ShortcutFile -->

0 commit comments

Comments
 (0)