Skip to content

Commit 6048bd8

Browse files
committed
Show the correct last export date in the book manager.
All books appeared with the date from the active book instead. Fixes #580
1 parent ff894a5 commit 6048bd8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

app/src/main/java/org/gnucash/android/ui/settings/BookManagerFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void bindView(View view, final Context context, Cursor cursor) {
160160
final String bookUID = cursor.getString(cursor.getColumnIndexOrThrow(BookEntry.COLUMN_UID));
161161

162162
TextView lastSyncText = (TextView) view.findViewById(R.id.last_sync_time);
163-
lastSyncText.setText(PreferencesHelper.getLastExportTime().toString());
163+
lastSyncText.setText(PreferencesHelper.getLastExportTime(bookUID).toString());
164164

165165
TextView labelLastSync = (TextView) view.findViewById(R.id.label_last_sync);
166166
labelLastSync.setText(R.string.label_last_export_time);

app/src/main/java/org/gnucash/android/util/PreferencesHelper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,20 @@ public static Timestamp getLastExportTime() {
8484
Log.d(LOG_TAG, "Retrieving '" + utcString + "' as lastExportTime from Android Preferences.");
8585
return TimestampHelper.getTimestampFromUtcString(utcString);
8686
}
87+
88+
/**
89+
* Get the time for the last export operation of a specific book.
90+
*
91+
* @return A {@link Timestamp} with the time.
92+
*/
93+
public static Timestamp getLastExportTime(String bookUID) {
94+
final String utcString =
95+
GnuCashApplication.getAppContext()
96+
.getSharedPreferences(bookUID, Context.MODE_PRIVATE)
97+
.getString(PREFERENCE_LAST_EXPORT_TIME_KEY,
98+
TimestampHelper.getUtcStringFromTimestamp(
99+
TimestampHelper.getTimestampFromEpochZero()));
100+
Log.d(LOG_TAG, "Retrieving '" + utcString + "' as lastExportTime from Android Preferences.");
101+
return TimestampHelper.getTimestampFromUtcString(utcString);
102+
}
87103
}

0 commit comments

Comments
 (0)