[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - android/Bootstrap android/experimental

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 12 00:38:42 PST 2015


 android/Bootstrap/Makefile.shared                                     |    3 -
 android/experimental/LOAndroid3/AndroidManifest.xml.in                |    2 
 android/experimental/LOAndroid3/res/layout/about.xml                  |    9 +++
 android/experimental/LOAndroid3/res/values/strings.xml                |    1 
 android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java |   23 ++++++++++
 5 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 4a3a63bd2b44e4d4a398950c7bb9f4b8fff72029
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 12 09:35:26 2015 +0100

    android: show version / buildid in about dialog
    
    Note that getPackageName() also throws NameNotFoundException, so in the
    unlikely situations in case:
    
    - package info (class containing the package version) is not found or
    - the package version is not in an "a/b" form
    
    We still just don't show anything.
    
    Also, mark the new TextView as android:textIsSelectable, so it's
    possible to copy&paste the version for bugreport purposes.
    
    Change-Id: I63b53cca4126da17bfbda0293d7c98e8524ef41a

diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index 82513df..ee50d1f 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -180,8 +180,9 @@ copy-stuff:
 	echo '[Version]' > assets/program/versionrc
 	echo 'AllLanguages=en-US' >> assets/program/versionrc
 	echo 'BuildVersion=' >> assets/program/versionrc
-	echo 'buildid=dead-beef' >> assets/program/versionrc
+	echo 'buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)' >> assets/program/versionrc
 	echo 'ReferenceOOoMajorMinor=4.1' >> assets/program/versionrc
+	sed -i 's|android:versionName=".*"|android:versionName="$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%H)"|' AndroidManifest.xml
 #
 # .res files
 	mkdir -p assets/program/resource
diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in
index 6b339e7..360687e 100644
--- a/android/experimental/LOAndroid3/AndroidManifest.xml.in
+++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in
@@ -3,7 +3,7 @@
     package="org.libreoffice"
     @ANDROID_INSTALL_LOCATION@
     android:versionCode="1"
-    android:versionName="1.0">
+    android:versionName="@ANDROID_VERSION@">
 
     <!-- App requires OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" android:required="true" />
diff --git a/android/experimental/LOAndroid3/res/layout/about.xml b/android/experimental/LOAndroid3/res/layout/about.xml
index 06c5bfe..c15f0cc 100644
--- a/android/experimental/LOAndroid3/res/layout/about.xml
+++ b/android/experimental/LOAndroid3/res/layout/about.xml
@@ -7,6 +7,15 @@
               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:textColor="@android:color/secondary_text_light"
+        android:textSize="18sp"/>
+
+    <TextView
         android:id="@+id/about_description"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
diff --git a/android/experimental/LOAndroid3/res/values/strings.xml b/android/experimental/LOAndroid3/res/values/strings.xml
index ea505d7..21172b6 100644
--- a/android/experimental/LOAndroid3/res/values/strings.xml
+++ b/android/experimental/LOAndroid3/res/values/strings.xml
@@ -4,6 +4,7 @@
     <string name="app_name">LibreOffice Viewer</string>
 
     <string name="app_about_name"><b>LibreOffice Viewer \'Beta\'</b></string>
+    <string name="app_version">Version: $VERSION\nBuild ID: $BUILDID</string>
     <string name="app_description">LibreOffice Viewer is a document viewer based on LibreOffice.</string>
     <string name="app_credits">http://www.libreoffice.org</string>
 
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
index 2b3bf31..1aca1c6 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
@@ -19,6 +19,7 @@ import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.content.Intent;
 import android.net.Uri;
+import android.content.pm.PackageManager.NameNotFoundException;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -58,6 +59,28 @@ public abstract class LOAbout extends Activity {
         int defaultColor = textView.getTextColors().getDefaultColor();
         textView.setTextColor(defaultColor);
 
+        // Take care of placeholders in the version text view.
+        textView = (TextView)messageView.findViewById(R.id.about_version);
+        try
+        {
+            String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
+            String[] tokens = versionName.split("/");
+            if (tokens.length == 2)
+            {
+                String version = textView.getText().toString();
+                version = version.replace("$VERSION", tokens[0]);
+                version = version.replace("$BUILDID", tokens[1]);
+                textView.setText(version);
+            }
+            else
+                throw new NameNotFoundException();
+        }
+        catch (NameNotFoundException e)
+        {
+            textView.setText("");
+        }
+
+
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.setIcon(R.drawable.lo_icon);
         builder.setTitle(R.string.app_name);


More information about the Libreoffice-commits mailing list