android/source/res/layout/about.xml                              |    2 -
 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 |   14 
+++-------
 5 files changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 3ee963afc7dfae473d5368e88a2caa847f7450f8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 30 12:54:54 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 14:40:08 2023 +0100

    android: Simplify vendor info handling for about dialog
    
    Similar to
    
        Change-Id: Iaa78f5a6020bea4ed80a1b41d3b23cc8d313813c
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu Nov 30 12:00:52 2023 +0100
    
        android: Simplify version info handling for about dialog
    
    , also simplify the handling of the vendor info text by
    retrieving the text from the string resource right away.
    
    Change-Id: I7d56b1814454be2bc8d13e01265f0a0db6d865be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160147
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/source/res/layout/about.xml 
b/android/source/res/layout/about.xml
index 8cce41cf076d..30f1ed3d95ae 100644
--- a/android/source/res/layout/about.xml
+++ b/android/source/res/layout/about.xml
@@ -38,7 +38,6 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:textIsSelectable="true"
-        android:text="@string/app_vendor"
         android:textSize="18sp"/>
 </LinearLayout>
 </ScrollView>
diff --git a/android/source/src/java/org/libreoffice/AboutDialogFragment.java 
b/android/source/src/java/org/libreoffice/AboutDialogFragment.java
index de2e48ffbdde..b215ab5e7601 100644
--- a/android/source/src/java/org/libreoffice/AboutDialogFragment.java
+++ b/android/source/src/java/org/libreoffice/AboutDialogFragment.java
@@ -40,8 +40,7 @@ public class AboutDialogFragment extends DialogFragment {
         int defaultColor = textView.getTextColors().getDefaultColor();
         textView.setTextColor(defaultColor);
 
-        // Take care of placeholders in the version and vendor text views.
-        TextView vendorView = messageView.findViewById(R.id.about_vendor);
+        // Take care of placeholders and set text in version and vendor text 
views.
         try
         {
             String versionName = getActivity().getPackageManager()
@@ -55,8 +54,8 @@ public class AboutDialogFragment extends DialogFragment {
                 TextView versionView = 
messageView.findViewById(R.id.about_version);
                 versionView.setText(versionString);
                 
versionView.setMovementMethod(LinkMovementMethod.getInstance());
-                String vendor = vendorView.getText().toString();
-                vendor = vendor.replace("$VENDOR", tokens[2]);
+                TextView vendorView = 
messageView.findViewById(R.id.about_vendor);
+                String vendor = 
getString(R.string.app_vendor).replace("$VENDOR", tokens[2]);
                 vendorView.setText(vendor);
             }
             else
@@ -64,7 +63,6 @@ public class AboutDialogFragment extends DialogFragment {
         }
         catch (PackageManager.NameNotFoundException e)
         {
-            vendorView.setText("");
         }
 
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
commit 4958e21332c19a8bc1704ff71489c2c991efb05c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 30 12:00:52 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 14:39:59 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 <m.wegh...@posteo.de>

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 bd979b78f8ae..bbab9383b794 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&lt;br&gt;Build ID: &lt;a 
href=&quot;https://hub.libreoffice.org/git-core/%2$s&quot;&gt;%2$s&lt;/a&gt;</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 ef0722f035cd..a9ce0782da97 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&lt;br&gt;Build ID: &lt;a 
href=&quot;https://hub.libreoffice.org/git-core/%2$s&quot;&gt;%2$s&lt;/a&gt;</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 d2262406136e..bb8e3cdcfcfc 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&lt;br&gt;Build ID: &lt;a 
href=&quot;https://hub.libreoffice.org/git-core/%2$s&quot;&gt;%2$s&lt;/a&gt;</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 4ed351026778..de2e48ffbdde 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("");
         }
 

Reply via email to