android: Simplify vendor info handling for about dialog

Similar to

    Change-Id: Iaa78f5a6020bea4ed80a1b41d3b23cc8d313813c
    Author: Michael Weghorn <m.weghorn@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.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2023-11-30 12:54:54 +01:00
parent 4958e21332
commit 3ee963afc7
2 changed files with 3 additions and 6 deletions

View file

@ -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>

View file

@ -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());