android/app/build.gradle | 10 +- android/app/liboSettings.gradle.in | 4 - android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java | 23 ++++-- android/app/src/main/res/layout/about.xml | 35 +++++---- android/app/src/main/res/values/strings.xml | 6 - configure.ac | 36 ++++++++++ 6 files changed, 84 insertions(+), 30 deletions(-)
New commits: commit 2c174e3c306c9937fbc9aaaffeefcf3389ceead0 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue Apr 16 12:53:38 2019 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Apr 16 12:59:43 2019 +0200 android: Introduce --with-vendor and --with-info-url. For the Android's 'shell' About dialog box; includes also some fixes to that dialog. Change-Id: I0c9f660da981b653608bf11e1eaccb283feb513f diff --git a/android/app/build.gradle b/android/app/build.gradle index 77abf7675..ea3dd5288 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,15 +6,17 @@ apply from: 'liboSettings.gradle' android { compileSdkVersion 28 defaultConfig { - applicationId 'org.libreoffice.androidapp' + // applicationId defined in liboSettings.gradle minSdkVersion 21 targetSdkVersion 28 versionCode 1 - versionName "1.0" + // versionName defined in liboSettings.gradle } buildTypes { debug { - resValue "string", "app_name", "${liboAppName}" + resValue "string", "app_name", "${liboAppName} Debug" + resValue "string", "vendor", "${liboVendor}" + resValue "string", "info_url", "${liboInfoURL}" ndk { //abiFilters "x86", "armeabi-v7a", "armeabi" abiFilters "armeabi-v7a" @@ -23,6 +25,8 @@ android { } release { resValue "string", "app_name", "${liboAppName}" + resValue "string", "vendor", "${liboVendor}" + resValue "string", "info_url", "${liboInfoURL}" ndk { abiFilters "armeabi-v7a" } diff --git a/android/app/liboSettings.gradle.in b/android/app/liboSettings.gradle.in index 42cccfe81..b3a0abf61 100644 --- a/android/app/liboSettings.gradle.in +++ b/android/app/liboSettings.gradle.in @@ -12,9 +12,11 @@ ext { liboVersionMinor = '@LOOLWSD_VERSION_MAJOR@' liboGitFullCommit = '@LOOLWSD_VERSION_HASH@' liboAppName = '@APP_NAME@' + liboVendor = '@VENDOR@' + liboInfoURL = '@INFO_URL@' } android.defaultConfig { applicationId 'org.libreoffice.androidapp' //versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : 1 - versionName '@LOOLWSD_VERSION@' + versionName '1.0/@LOOLWSD_VERSION@' } diff --git a/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java b/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java index 01433a31b..7105daab1 100644 --- a/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java +++ b/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java @@ -42,26 +42,23 @@ public class AboutDialogFragment extends DialogFragment { TextView textView = messageView.findViewById(R.id.about_credits); int defaultColor = textView.getTextColors().getDefaultColor(); textView.setTextColor(defaultColor); + textView.setText(getResources().getString(R.string.info_url)); - // Take care of placeholders in the version and vendor text views. + // Take care of placeholders in the version text view. TextView versionView = messageView.findViewById(R.id.about_version); - TextView vendorView = messageView.findViewById(R.id.about_vendor); try { String versionName = getActivity().getPackageManager() .getPackageInfo(getActivity().getPackageName(), 0).versionName; String[] tokens = versionName.split("/"); - if (tokens.length == 3) + if (tokens.length >= 2) { 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>"); + tokens[0], "<a href=\"https://hub.libreoffice.org/git-online/" + tokens[1] + "\">" + tokens[1] + "</a>"); @SuppressWarnings("deprecation") // since 24 with additional option parameter Spanned versionString = Html.fromHtml(version); versionView.setText(versionString); versionView.setMovementMethod(LinkMovementMethod.getInstance()); - String vendor = vendorView.getText().toString(); - vendor = vendor.replace("$VENDOR", tokens[2]); - vendorView.setText(vendor); } else throw new PackageManager.NameNotFoundException(); @@ -69,9 +66,19 @@ public class AboutDialogFragment extends DialogFragment { catch (PackageManager.NameNotFoundException e) { versionView.setText(""); - vendorView.setText(""); } + // Take care of some placeholders + TextView descriptionView = messageView.findViewById(R.id.about_description); + String description = descriptionView.getText().toString(); + description = description.replace("$APP_NAME", getResources().getString(R.string.app_name)); + descriptionView.setText(description); + + TextView vendorView = messageView.findViewById(R.id.about_vendor); + String vendor = vendorView.getText().toString(); + vendor = vendor.replace("$VENDOR", getResources().getString(R.string.vendor)); + vendorView.setText(vendor); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder .setIcon(R.drawable.lo_icon) .setTitle(R.string.app_name) diff --git a/android/app/src/main/res/layout/about.xml b/android/app/src/main/res/layout/about.xml index 8968c00d2..3b1ec37ff 100644 --- a/android/app/src/main/res/layout/about.xml +++ b/android/app/src/main/res/layout/about.xml @@ -10,36 +10,41 @@ android:padding="20dip"> <TextView - android:id="@+id/about_version" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textIsSelectable="true" - android:text="@string/app_version" - android:textSize="18sp"/> - - <TextView android:id="@+id/about_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/app_description" - android:textSize="18sp"/> + android:textAlignment="center" + android:textSize="18sp" /> <TextView android:id="@+id/about_credits" android:layout_width="match_parent" android:layout_height="wrap_content" android:autoLink="web" - android:paddingBottom="20dip" - android:paddingTop="20dip" - android:text="@string/app_credits" - android:textSize="18sp"/> + android:paddingTop="10dip" + android:paddingBottom="10dip" + android:text="" + android:textAlignment="center" + android:textSize="18sp" /> <TextView android:id="@+id/about_vendor" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textIsSelectable="true" android:text="@string/app_vendor" - android:textSize="18sp"/> + android:textAlignment="center" + android:textIsSelectable="true" + android:textSize="14sp" /> + + <TextView + android:id="@+id/about_version" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/app_version" + android:textAlignment="center" + android:textIsSelectable="true" + android:textSize="14sp" /> + </LinearLayout> </ScrollView> diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index dc1ceb6a0..6a7648de9 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -2,10 +2,10 @@ <!--string name="app_name" definition is deliberately missing here, it is filled in in build.gradle.--> <string name="app_name_settings">Settings</string> - <string name="app_version">Version: %1$s\nBuild ID: %2$s</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_version">Version: %1$s, Build ID: %2$s</string> + <string name="app_description">$APP_NAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more.</string> <string name="app_vendor">This release was supplied by $VENDOR.</string> + <string name="no_recent_items">No recent items</string> <string name="no_items">No items</string> <string name="temp_file_saving_disabled">This file is read-only, saving is disabled.</string> diff --git a/configure.ac b/configure.ac index 944a7d624..988c36a62 100644 --- a/configure.ac +++ b/configure.ac @@ -98,6 +98,16 @@ AC_ARG_WITH([app-name], AS_HELP_STRING([--with-app-name=<name>], [Set the user-visible name of the app you build.])) +AC_ARG_WITH(vendor, + AS_HELP_STRING([--with-vendor="John the Builder"], + [Set vendor of the build.]), +,) + +AC_ARG_WITH(info-url, + AS_HELP_STRING([--with-info-url="https://john-the-builder.org"], + [Set the info url of the build.]), +,) + AC_ARG_ENABLE([seccomp], AS_HELP_STRING([--disable-seccomp], [Disable use of linux/seccomp.h header when kernel on target system does not support it. @@ -327,6 +337,32 @@ fi AC_DEFINE_UNQUOTED([APP_NAME],["$APP_NAME"],[The user-visible name of the app you build.]) AC_SUBST(APP_NAME) +VENDOR= +AC_MSG_CHECKING([for vendor]) +if test -z "$with_vendor" -o "$with_vendor" = "no"; then + VENDOR="$USERNAME" + + if test -z "$VENDOR"; then + VENDOR="$USER" + fi + + if test -z "$VENDOR"; then + VENDOR="`id -u -n`" + fi + + AC_MSG_RESULT([not set, using $VENDOR]) +else + VENDOR="$with_vendor" + AC_MSG_RESULT([$VENDOR]) +fi +AC_SUBST(VENDOR) + +INFO_URL='https://www.libreoffice.org' +if test -n "$with_info_url" -a "$with_info_url" != "no"; then + INFO_URL="$with_info_url" +fi +AC_SUBST(INFO_URL) + ENABLE_IOSAPP= IOSAPP_BUNDLE_VERSION= _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits