Android: Implement "About" option menu action.
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 7f67b39..322413b 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -33,6 +33,13 @@
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
+ <activity android:label="@string/title_activity_about"
+ android:name="org.linaro.glmark2.AboutActivity"
+ android:theme="@android:style/Theme.Dialog">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/android/res/layout/activity_about.xml b/android/res/layout/activity_about.xml
new file mode 100644
index 0000000..6402727
--- /dev/null
+++ b/android/res/layout/activity_about.xml
@@ -0,0 +1,43 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="10dp">
+
+ <TextView android:id="@+id/name_version"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_name_version_format" />
+
+ <TextView android:id="@+id/description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_description" />
+
+ <TextView android:id="@+id/copyright"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_copyright" />
+
+ <TextView android:id="@+id/url"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_url" />
+
+ <TextView android:id="@+id/license1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_license_1" />
+
+ <TextView android:id="@+id/license2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/about_license_2" />
+</LinearLayout>
+
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index c1ceba0..04f0413 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -4,6 +4,7 @@
<string name="title_activity_main">GLMark2</string>
<string name="title_activity_editor">GLMark2 Benchmark Editor</string>
<string name="title_activity_preferences">GLMark2 Settings</string>
+ <string name="title_activity_about">About GLMark2</string>
<string name="title_activity_glmark2">GLMark2</string>
<string name="runButtonText">Run</string>
<string name="saveButtonText">Save</string>
@@ -18,4 +19,22 @@
<string name="runForeverPreferenceTitle">Run forever</string>
<string name="runForeverPreferenceSummary">Run indefinitely, looping from the last benchmark back to the first</string>
+
+ <string name="about_name_version_format">GLMark2 %1$s</string>
+ <string name="about_description">OpenGL (ES) 2.0 benchmark suite</string>
+ <string name="about_copyright">Copyright © 2010-2012 Linaro Limited</string>
+ <string name="about_url">http://launchpad.net/glmark2</string>
+ <string name="about_license_1">
+ glmark2 is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version
+ </string>
+ <string name="about_license_2">
+ glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+ </string>
+
</resources>
diff --git a/android/src/org/linaro/glmark2/AboutActivity.java b/android/src/org/linaro/glmark2/AboutActivity.java
new file mode 100644
index 0000000..0c88cdb
--- /dev/null
+++ b/android/src/org/linaro/glmark2/AboutActivity.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2012 Linaro Limited
+ *
+ * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
+ *
+ * glmark2 is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * glmark2. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alexandros Frantzis
+ */
+package org.linaro.glmark2;
+
+import android.app.Activity;
+import android.content.pm.PackageInfo;
+import android.os.Bundle;
+import android.view.Window;
+import android.widget.TextView;
+
+public class AboutActivity extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ setContentView(R.layout.activity_about);
+
+ /* Get the application version */
+ String versionName = "?";
+
+ try {
+ PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
+ versionName = info.versionName;
+ }
+ catch (Exception e) {
+ }
+
+ /* Display the application version */
+ TextView tv = (TextView) findViewById(R.id.name_version);
+ String formatString = getString(R.string.about_name_version_format);
+ tv.setText(String.format(formatString, versionName));
+ }
+}
diff --git a/android/src/org/linaro/glmark2/MainActivity.java b/android/src/org/linaro/glmark2/MainActivity.java
index f7adcba..a8a3ebf 100644
--- a/android/src/org/linaro/glmark2/MainActivity.java
+++ b/android/src/org/linaro/glmark2/MainActivity.java
@@ -246,6 +246,7 @@
ret = true;
break;
case R.id.about:
+ startActivity(new Intent(MainActivity.this, AboutActivity.class));
ret = true;
break;
default: