[app] Expose repo timestamp in the repo details UI

This timestamp is more relevant than the time the client downloaded the update.
This commit is contained in:
Torsten Grote
2023-05-26 14:56:14 -03:00
committed by Hans-Christoph Steiner
parent 44a2d95f18
commit 2011eb30f6
3 changed files with 23 additions and 5 deletions

View File

@@ -408,6 +408,7 @@ public class RepoDetailsActivity extends AppCompatActivity {
TextView name = repoView.findViewById(R.id.text_repo_name);
TextView numApps = repoView.findViewById(R.id.text_num_apps);
TextView lastUpdated = repoView.findViewById(R.id.text_last_update);
TextView lastDownloaded = repoView.findViewById(R.id.text_last_update_downloaded);
name.setText(repo.getName(App.getLocales()));
disposable = Single.fromCallable(() -> appDao.getNumberOfAppsInRepository(repoId))
@@ -419,15 +420,21 @@ public class RepoDetailsActivity extends AppCompatActivity {
setupRepoFingerprint(repoView, repo);
setupCredentials(repoView, repo);
// Repos that existed before this feature was supported will have an
// "Unknown" last update until next time they update...
if (repo.getLastUpdated() == null) {
if (repo.getTimestamp() == -1) {
lastUpdated.setText(R.string.unknown);
} else {
int format = DateUtils.isToday(repo.getTimestamp()) ?
DateUtils.FORMAT_SHOW_TIME :
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE;
lastUpdated.setText(DateUtils.formatDateTime(this, repo.getTimestamp(), format));
}
if (repo.getLastUpdated() == null) {
lastDownloaded.setText(R.string.unknown);
} else {
int format = DateUtils.isToday(repo.getLastUpdated()) ?
DateUtils.FORMAT_SHOW_TIME :
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE;
lastUpdated.setText(DateUtils.formatDateTime(this, repo.getLastUpdated(), format));
lastDownloaded.setText(DateUtils.formatDateTime(this, repo.getLastUpdated(), format));
}
}

View File

@@ -83,7 +83,17 @@
android:text="@string/repo_last_update" />
<TextView
android:id="@+id/text_last_update"
android:id="@+id/text_last_update"
style="@style/BodyText" />
<!-- The last time this repo was checked for updates -->
<TextView
android:id="@+id/label_last_update_downloaded"
style="@style/CaptionText"
android:text="@string/repo_last_update_downloaded" />
<TextView
android:id="@+id/text_last_update_downloaded"
style="@style/BodyText" />
<!-- mirrors included in the index -->

View File

@@ -427,6 +427,7 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="repo_fingerprint">Fingerprint of the signing key (SHA-256)</string>
<string name="repo_description">Description</string>
<string name="repo_last_update">Last update</string>
<string name="repo_last_update_downloaded">Last update downloaded</string>
<string name="repo_official_mirrors">Official mirrors</string>
<string name="repo_user_mirrors">User mirrors</string>
<string name="repo_name">Name</string>