android/source/res/layout/about.xml | 1 - android/source/res/values-de/strings.xml | 2 +- android/source/res/values-tr/strings.xml | 2 +- android/source/res/values/strings.xml | 2 +- android/source/src/java/org/libreoffice/AboutDialogFragment.java | 6 ++---- 5 files changed, 5 insertions(+), 8 deletions(-)
New commits: commit 71e005a62c3baa842bc270825c117af328f7e1cf Author: Michael Weghorn <[email protected]> AuthorDate: Thu Nov 30 12:00:52 2023 +0100 Commit: Christian Lohmaier <[email protected]> CommitDate: Mon Dec 11 20:02:26 2023 +0100 android: Simplify version info handling for about dialog * Don't set and retrieve the placeholder text in/from the TexView in the about dialog, but use the string resource directly. * Add the HTML code directly in the string resource, rather than having to fiddle with that in the Java code. With this in place, only the version name and the commit hash need to be replaced. Since there is no placeholder text in the text view, it's also no longer necessary to explicitly set an empty string in case of an exception. Change-Id: Iaa78f5a6020bea4ed80a1b41d3b23cc8d313813c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160146 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit 4958e21332c19a8bc1704ff71489c2c991efb05c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160046 Reviewed-by: Christian Lohmaier <[email protected]> diff --git a/android/source/res/layout/about.xml b/android/source/res/layout/about.xml index 8968c00d2695..8cce41cf076d 100644 --- a/android/source/res/layout/about.xml +++ b/android/source/res/layout/about.xml @@ -14,7 +14,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:textIsSelectable="true" - android:text="@string/app_version" android:textSize="18sp"/> <TextView diff --git a/android/source/res/values-de/strings.xml b/android/source/res/values-de/strings.xml index 30dd48ceb16e..372db550b875 100644 --- a/android/source/res/values-de/strings.xml +++ b/android/source/res/values-de/strings.xml @@ -5,7 +5,7 @@ <string name="app_name_settings">LibreOffice-Viewer-Einstellungen</string> <string name="app_about_name"><b>LibreOffice Viewer \'Beta\'</b></string> - <string name="app_version">Version: %1$s\nBuild ID: %2$s</string> + <string name="app_version">Version: %1$s<br>Build ID: <a href="https://hub.libreoffice.org/git-core/%2$s">%2$s</a></string> <string name="app_description">LibreOffice Viewer ist ein Dokumentenbetrachter, der auf LibreOffice basiert.</string> <string name="app_credits">https://www.libreoffice.org</string> <string name="app_vendor">Dieses Release wurde bereitgestellt durch $VENDOR.</string> diff --git a/android/source/res/values-tr/strings.xml b/android/source/res/values-tr/strings.xml index ec7274c8cca6..dc320d0eb976 100644 --- a/android/source/res/values-tr/strings.xml +++ b/android/source/res/values-tr/strings.xml @@ -5,7 +5,7 @@ <string name="app_name_settings">LibreOffice Görüntüleyici Ayarları</string> <string name="app_about_name"><b>LibreOffice Görüntüleyici \'Beta\'</b></string> - <string name="app_version">Versiyon: %1$s\nBuild ID: %2$s</string> + <string name="app_version">Versiyon: %1$s<br>Build ID: <a href="https://hub.libreoffice.org/git-core/%2$s">%2$s</a></string> <string name="app_description">LibreOffice Görüntüleyici LibreOffice tabanlı bir belge görüntüleyicisidir.</string> <string name="app_credits">https://www.libreoffice.org</string> <string name="app_vendor">Bu sürüm $VENDOR tarafından derlenmiştir.</string> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index 2cce872808e9..012a044dcd33 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -5,7 +5,7 @@ <string name="app_name_settings">LibreOffice Viewer Settings</string> <string name="app_about_name"><b>LibreOffice Viewer \'Beta\'</b></string> - <string name="app_version">Version: %1$s\nBuild ID: %2$s</string> + <string name="app_version">Version: %1$s<br>Build ID: <a href="https://hub.libreoffice.org/git-core/%2$s">%2$s</a></string> <string name="app_description">LibreOffice Viewer is a document viewer based on LibreOffice.</string> <string name="app_credits">https://www.libreoffice.org</string> <string name="app_vendor">This release was supplied by $VENDOR.</string> diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java b/android/source/src/java/org/libreoffice/AboutDialogFragment.java index 6bac113cc59e..3fe5ca097525 100644 --- a/android/source/src/java/org/libreoffice/AboutDialogFragment.java +++ b/android/source/src/java/org/libreoffice/AboutDialogFragment.java @@ -41,7 +41,6 @@ public class AboutDialogFragment extends DialogFragment { textView.setTextColor(defaultColor); // Take care of placeholders in the version and vendor text views. - TextView versionView = messageView.findViewById(R.id.about_version); TextView vendorView = messageView.findViewById(R.id.about_vendor); try { @@ -50,10 +49,10 @@ public class AboutDialogFragment extends DialogFragment { String[] tokens = versionName.split("/"); if (tokens.length == 3) { - String version = String.format(versionView.getText().toString().replace("\n", "<br/>"), - tokens[0], "<a href=\"https://hub.libreoffice.org/git-core/" + tokens[1] + "\">" + tokens[1] + "</a>"); + String version = String.format(getString(R.string.app_version), tokens[0], tokens[1]); @SuppressWarnings("deprecation") // since 24 with additional option parameter Spanned versionString = Html.fromHtml(version); + TextView versionView = messageView.findViewById(R.id.about_version); versionView.setText(versionString); versionView.setMovementMethod(LinkMovementMethod.getInstance()); String vendor = vendorView.getText().toString(); @@ -65,7 +64,6 @@ public class AboutDialogFragment extends DialogFragment { } catch (PackageManager.NameNotFoundException e) { - versionView.setText(""); vendorView.setText(""); }
