Skip to content

Commit

Permalink
Add widget update time
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Aug 9, 2023
1 parent 4c922c6 commit 457b455
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import android.view.View;
import android.widget.RemoteViews;

import java.text.DateFormat;
import java.util.Date;

import org.json.JSONArray;

// BusesWidgetProvider
Expand Down Expand Up @@ -88,6 +91,11 @@ public void onUpdate(Context context,
Log.d(TAG, "List " + listJSON);

StringBuilder buffer = new StringBuilder();
DateFormat format = DateFormat.getTimeInstance();
buffer.append(context.getString(R.string.updated))
.append(format.format(new Date()))
.append(System.getProperty("line.separator"));

// Check list
if (listJSON != null)
{
Expand Down
1 change: 1 addition & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<string name="help">Help</string>
<string name="about">About</string>
<string name="locate">Locate</string>
<string name="updated">"Updated: "</string>
<string name="version" formatted="false"><a
href="https://github.com/billthefarmer/print/releases/latest">%s</a>\n\nBuilt
%s\n\nCopyright \u00A9 2021 <a
Expand Down

0 comments on commit 457b455

Please sign in to comment.