summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-17 09:35:51 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-17 10:44:59 +0100
commit6d9b7738b9007e60ab2992065b7a9da7625adcae (patch)
tree7405508b183da300e2ca6a469a77406ce8f16238 /android
parentd4a953e57475234f1a07c40bb07899a1677fcabe (diff)
android: extract LOAbout from LibreOfficeMainActivity
Change-Id: Ied6a9a64041de94766b307c7ca64eba7edeab64c
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java74
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java48
2 files changed, 75 insertions, 47 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
new file mode 100644
index 000000000000..01d2cb234ed2
--- /dev/null
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
@@ -0,0 +1,74 @@
+package org.libreoffice;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v4.widget.DrawerLayout;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class LOAbout extends Activity {
+
+ private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
+
+ protected void showAbout() {
+ // Inflate the about message contents
+ View messageView = getLayoutInflater().inflate(R.layout.about, null, false);
+
+ // When linking text, force to always use default color. This works
+ // around a pressed color state bug.
+ TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
+ int defaultColor = textView.getTextColors().getDefaultColor();
+ textView.setTextColor(defaultColor);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setIcon(R.drawable.lo_icon);
+ builder.setTitle(R.string.app_name);
+ builder.setView(messageView);
+
+ builder.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ LOKitShell.sendEvent(LOEventFactory.close());
+ LOKitShell.sendEvent(LOEventFactory.load("/assets/license.txt"));
+ dialog.dismiss();
+ }
+ });
+
+ builder.setPositiveButton(R.string.about_notice, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ LOKitShell.sendEvent(LOEventFactory.close());
+ LOKitShell.sendEvent(LOEventFactory.load("/assets/notice.txt"));
+ dialog.dismiss();
+ }
+ });
+
+ builder.setNeutralButton(R.string.about_moreinfo, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ LOKitShell.sendEvent(LOEventFactory.close());
+ LOKitShell.sendEvent(LOEventFactory.load(DEFAULT_DOC_PATH));
+ dialog.dismiss();
+ }
+ });
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index ff7bb4313df3..cb30f4dd6b31 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -24,7 +24,7 @@ import org.mozilla.gecko.gfx.LayerView;
import java.util.ArrayList;
import java.util.List;
-public class LibreOfficeMainActivity extends Activity {
+public class LibreOfficeMainActivity extends LOAbout {
private static final String LOGTAG = "LibreOfficeMainActivity";
private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
@@ -185,52 +185,6 @@ public class LibreOfficeMainActivity extends Activity {
return mDocumentPartViewListAdapter;
}
- private void showAbout() {
- // Inflate the about message contents
- View messageView = getLayoutInflater().inflate(R.layout.about, null, false);
-
- // When linking text, force to always use default color. This works
- // around a pressed color state bug.
- TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
- int defaultColor = textView.getTextColors().getDefaultColor();
- textView.setTextColor(defaultColor);
-
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setIcon(R.drawable.lo_icon);
- builder.setTitle(R.string.app_name);
- builder.setView(messageView);
-
- builder.setNegativeButton(R.string.about_license, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- LOKitShell.sendEvent(LOEventFactory.close());
- LOKitShell.sendEvent(LOEventFactory.load("/assets/license.txt"));
- dialog.dismiss();
- }
- });
-
- builder.setPositiveButton(R.string.about_notice, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- LOKitShell.sendEvent(LOEventFactory.close());
- LOKitShell.sendEvent(LOEventFactory.load("/assets/notice.txt"));
- dialog.dismiss();
- }
- });
-
- builder.setNeutralButton(R.string.about_moreinfo, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- LOKitShell.sendEvent(LOEventFactory.close());
- LOKitShell.sendEvent(LOEventFactory.load(DEFAULT_DOC_PATH));
- dialog.dismiss();
- }
- });
-
- AlertDialog dialog = builder.create();
- dialog.show();
- }
-
public void showProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.VISIBLE);
}