Skip to content

Commit 457b455

Browse files
committed
Add widget update time
1 parent 4c922c6 commit 457b455

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/main/java/org/billthefarmer/buses/BusesWidgetProvider.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
import android.view.View;
3636
import android.widget.RemoteViews;
3737

38+
import java.text.DateFormat;
39+
import java.util.Date;
40+
3841
import org.json.JSONArray;
3942

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

9093
StringBuilder buffer = new StringBuilder();
94+
DateFormat format = DateFormat.getTimeInstance();
95+
buffer.append(context.getString(R.string.updated))
96+
.append(format.format(new Date()))
97+
.append(System.getProperty("line.separator"));
98+
9199
// Check list
92100
if (listJSON != null)
93101
{

src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<string name="help">Help</string>
88
<string name="about">About</string>
99
<string name="locate">Locate</string>
10+
<string name="updated">"Updated: "</string>
1011
<string name="version" formatted="false"><a
1112
href="https://github.com/billthefarmer/print/releases/latest">%s</a>\n\nBuilt
1213
%s\n\nCopyright \u00A9 2021 <a

0 commit comments

Comments
 (0)