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
private/mmeeks/thread-png
Jan Holesovsky 2019-04-16 12:53:38 +02:00
parent 1797ca4b45
commit 2c174e3c30
6 changed files with 84 additions and 30 deletions

View File

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

View File

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

View File

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

View File

@ -9,37 +9,42 @@
android:orientation="vertical"
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>

View File

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

View File

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