diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-09 20:49:36 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-09 20:49:36 +0200 |
commit | 452b3ddaabf9428a81105bb167dda79f03a59117 (patch) | |
tree | 9c498452f8d7721cff78f4437c19af0fdf015734 | |
parent | 7c4fc9677e8e2880c3639d9dd68ff6e60d37d6ef (diff) |
android: Simplify the About dialog creation.
Change-Id: I40fb007e8f672e1c5ff4e6e23c043b7305e726a9
3 files changed, 9 insertions, 28 deletions
diff --git a/android/experimental/LOAndroid3/res/layout/about.xml b/android/experimental/LOAndroid3/res/layout/about.xml index ec014a0e89f8..06c5bfe74ef7 100644 --- a/android/experimental/LOAndroid3/res/layout/about.xml +++ b/android/experimental/LOAndroid3/res/layout/about.xml @@ -25,24 +25,4 @@ android:textColor="@android:color/secondary_text_light" android:textSize="18dip"/> - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <Button - android:id="@+id/about_license_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginRight="12dp" - android:text="License"/> - - <Button - android:id="@+id/about_notice_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginRight="12dp" - android:text="Notice"/> - </LinearLayout> - -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/android/experimental/LOAndroid3/res/values/strings.xml b/android/experimental/LOAndroid3/res/values/strings.xml index f913e5e030d3..c98c0cde5f22 100644 --- a/android/experimental/LOAndroid3/res/values/strings.xml +++ b/android/experimental/LOAndroid3/res/values/strings.xml @@ -4,9 +4,12 @@ <string name="app_name">LibreOffice Viewer</string> <string name="app_about_name"><b>LibreOffice Viewer \'Beta\'</b></string> - <string name="app_description">LibreOffice Viewer is a document viewer based on LibreOffice</string> + <string name="app_description">LibreOffice Viewer is a document viewer based on LibreOffice.</string> <string name="app_credits">http://www.libreoffice.org</string> + <string name="about_license">License</string> + <string name="about_notice">Notice</string> + <string name="browser_app_name">LibreOffice Browser</string> <string name="menu_search">Search</string> <string name="list_view">List</string> diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index 1df149aba467..1778e3597f88 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -196,11 +196,8 @@ public class LibreOfficeMainActivity extends Activity { builder.setIcon(R.drawable.lo_icon); builder.setTitle(R.string.app_name); builder.setView(messageView); - builder.create(); - builder.show(); - Button licenseButton = (Button) messageView.findViewById(R.id.about_license_button); - licenseButton.setOnClickListener(new View.OnClickListener() { + builder.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(), LibreOfficeMainActivity.class); @@ -210,8 +207,7 @@ public class LibreOfficeMainActivity extends Activity { } }); - Button noticeButton = (Button) messageView.findViewById(R.id.about_notice_button); - noticeButton.setOnClickListener(new View.OnClickListener() { + builder.setPositiveButton(R.string.about_notice, new DialogInterface.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(), LibreOfficeMainActivity.class); @@ -221,6 +217,8 @@ public class LibreOfficeMainActivity extends Activity { } }); + AlertDialog dialog = builder.create(); + dialog.show(); } public void showProgressSpinner() { |