<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fedorahosted.freeotp"
- android:versionCode="3"
- android:versionName="1.1" >
+ android:versionCode="4"
+ android:versionName="1.2" >
<uses-sdk
android:minSdkVersion="11"
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<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="16dp" >
+ <TextView
+ android:id="@+id/about_version"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="18sp"
+ android:textStyle="bold"
+ android:text="@string/about_version" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/about_copyright"/>
+
+ <TextView
+ android:id="@+id/about_license"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/about_license" />
+
+ <TextView
+ android:id="@+id/about_website"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/about_website" />
+
+ <TextView
+ android:id="@+id/about_feedback"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/about_feedback" />
+</LinearLayout>
android:showAsAction="always"
android:icon="@drawable/scan"
android:title="@string/add" />
+
+ <item
+ android:id="@+id/action_about"
+ android:orderInCategory="110"
+ android:showAsAction="never"
+ android:icon="@android:drawable/ic_menu_info_details"
+ android:title="@string/about" />
</menu>
<resources>
<string name="app_name">FreeOTP</string>
<string name="add">Add</string>
+ <string name="about">About</string>
<string name="invalid_token">The token specified was invalid!</string>
<string name="delete">Delete</string>
<string name="yes">Yes</string>
<string name="algorithm">Algorithm</string>
<string name="digits">Digits</string>
+ <string name="about_version">Version %1$s (%2$d)</string>
+ <string name="about_copyright">© 2013 - Red Hat, Inc., et al.</string>
+ <string name="about_license">FreeOTP is licensed under %1$s.</string>
+ <string name="about_website">For more information, see our %s.</string>
+ <string name="about_feedback">We welcome your feedback:<br/>• %1$s<br/>• %2$s</string>
+ <string name="link_website"><a href="http://freeotp.fedorahosted.org">website</a></string>
+ <string name="link_report_a_problem"><a href="http://fedorahosted.org/freeotp/newticket">Report a Problem</a></string>
+ <string name="link_ask_for_help"><a href="http://lists.fedorahosted.org/mailman/listinfo/freeotp-devel">Ask for Help</a></string>
+ <string name="link_apache2"><a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0</a></string>
+
<plurals name="tokens_selected">
<item quantity="one">%d token selected</item>
<item quantity="other">%d tokens selected</item>
--- /dev/null
+package org.fedorahosted.freeotp;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.text.Html;
+import android.text.method.LinkMovementMethod;
+import android.view.View;
+import android.widget.TextView;
+
+public class AboutDialog extends AlertDialog {
+ private void init(Context ctx) {
+ Resources res = ctx.getResources();
+ View v = getLayoutInflater().inflate(R.layout.about, null, false);
+ TextView tv;
+
+ try {
+ PackageManager pm = ctx.getPackageManager();
+ PackageInfo info = pm.getPackageInfo(ctx.getPackageName(), 0);
+ String version = res.getString(R.string.about_version,
+ info.versionName,
+ info.versionCode);
+ tv = (TextView) v.findViewById(R.id.about_version);
+ tv.setText(version);
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ String apache2 = res.getString(R.string.link_apache2);
+ String license = res.getString(R.string.about_license, apache2);
+ tv = (TextView) v.findViewById(R.id.about_license);
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
+ tv.setText(Html.fromHtml(license));
+
+ String lwebsite = res.getString(R.string.link_website);
+ String swebsite = res.getString(R.string.about_website, lwebsite);
+ tv = (TextView) v.findViewById(R.id.about_website);
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
+ tv.setText(Html.fromHtml(swebsite));
+
+ String problem = res.getString(R.string.link_report_a_problem);
+ String help = res.getString(R.string.link_ask_for_help);
+ String feedback = res.getString(R.string.about_feedback, problem, help);
+ tv = (TextView) v.findViewById(R.id.about_feedback);
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
+ tv.setText(Html.fromHtml(feedback));
+
+ String title = ctx.getResources().getString(R.string.about);
+ setTitle(title + " " + ctx.getResources().getString(R.string.app_name));
+ setView(v);
+
+ String ok = res.getString(android.R.string.ok);
+ setButton(BUTTON_POSITIVE, ok, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ });
+ }
+
+ public AboutDialog(Context context, boolean cancelable,
+ OnCancelListener cancelListener) {
+ super(context, cancelable, cancelListener);
+ init(context);
+ }
+
+ public AboutDialog(Context context, int theme) {
+ super(context, theme);
+ init(context);
+ }
+
+ public AboutDialog(Context context) {
+ super(context);
+ init(context);
+ }
+}
ad.show();
- return false;
+ return true;
+ }
+ });
+
+ menu.findItem(R.id.action_about).setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ new AboutDialog(MainActivity.this).show();
+ return true;
}
});