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

Widget debugging #1077

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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 @@ -191,7 +191,9 @@ public static RemoteViews buildRemoteViews(Context context, AppWidgetManager app
rv.setTextViewText(R.id.empty_view, context.getString(emptyResId));
if (!isCompactLayout) {
// only regular layout has text title
rv.setTextViewText(R.id.widgetTitle, context.getString(titleResId));
rv.setTextViewText(R.id.widgetTitle,
DateUtils.formatDateTime(context, System.currentTimeMillis(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME) + " "
+ context.getString(titleResId));
}

// app launch button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ListRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private Cursor dataCursor;
private int widgetType;
private boolean isLightTheme;
private long updateTime;

public ListRemoteViewsFactory(Context context, Intent intent) {
this.context = context;
Expand Down Expand Up @@ -136,6 +137,7 @@ private void onQueryForData() {
this.dataCursor = newCursor;
this.widgetType = widgetType;
this.isLightTheme = WidgetSettings.isLightTheme(context, appWidgetId);
updateTime = System.currentTimeMillis();

if (oldCursor != null) {
oldCursor.close();
Expand Down Expand Up @@ -191,6 +193,7 @@ public RemoteViews getViewAt(int position) {
String title = dataCursor.getString(isShowQuery ?
ShowsQuery.EPISODE_TITLE : CalendarAdapter.Query.TITLE);
rv.setTextViewText(R.id.textViewWidgetEpisode,
DateUtils.formatDateTime(context, updateTime, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME) + " " +
TextTools.getNextEpisodeString(context, seasonNumber, episodeNumber, title));

// relative release time
Expand Down