summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-05 12:07:01 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-09 10:16:16 +0100
commit636e6187b5237d04341b217c8aae649bf76e94b2 (patch)
tree60be906fcc5b871f6bda30bb8a70b706bc7394d4 /android
parent76d797b9ac41a6f22957c7831094adb167dcc735 (diff)
android: LOAbout doesn't need to extend Activity
Change-Id: I74a6eaab21685ff5a857255fb3ab23ed9c896574
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java20
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java8
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java10
3 files changed, 19 insertions, 19 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
index 47ecddf6a613..c4f628cdefa5 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java
@@ -12,33 +12,34 @@ import android.widget.TextView;
import java.io.File;
-public abstract class LOAbout extends Activity {
+public class LOAbout {
private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
+ private final Activity mActivity;
private boolean mNewActivity;
- public LOAbout(boolean newActivity) {
- super();
+ public LOAbout(Activity activity, boolean newActivity) {
+ mActivity = activity;
mNewActivity = newActivity;
}
private void loadFromAbout(String input) {
if (mNewActivity) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(new File(input)));
- String packageName = getApplicationContext().getPackageName();
+ String packageName = mActivity.getApplicationContext().getPackageName();
ComponentName componentName = new ComponentName(packageName, LibreOfficeMainActivity.class.getName());
i.setComponent(componentName);
- startActivity(i);
+ mActivity.startActivity(i);
} else {
LOKitShell.sendCloseEvent();
LOKitShell.sendLoadEvent(input);
}
}
- protected void showAbout() {
+ public void showAbout() {
// Inflate the about message contents
- View messageView = getLayoutInflater().inflate(R.layout.about, null, false);
+ View messageView = mActivity.getLayoutInflater().inflate(R.layout.about, null, false);
// When linking text, force to always use default color. This works
// around a pressed color state bug.
@@ -51,7 +52,7 @@ public abstract class LOAbout extends Activity {
TextView vendorView = (TextView)messageView.findViewById(R.id.about_vendor);
try
{
- String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
+ String versionName = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName;
String[] tokens = versionName.split("/");
if (tokens.length == 3)
{
@@ -72,8 +73,7 @@ public abstract class LOAbout extends Activity {
vendorView.setText("");
}
-
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setIcon(R.drawable.lo_icon);
builder.setTitle(R.string.app_name);
builder.setView(messageView);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 43f2e6a2de09..0634c1dd9327 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -30,7 +30,7 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-public class LibreOfficeMainActivity extends LOAbout {
+public class LibreOfficeMainActivity extends Activity {
private static final String LOGTAG = "LibreOfficeMainActivity";
private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
@@ -51,9 +51,9 @@ public class LibreOfficeMainActivity extends LOAbout {
private TextSelection mTextSelection;
private TextCursorLayer mTextCursorLayer;
private File mTempFile = null;
-
+ private LOAbout mAbout;
public LibreOfficeMainActivity() {
- super(/*newActivity=*/false);
+ mAbout = new LOAbout(this, false);
}
public static GeckoLayerClient getLayerClient() {
@@ -72,7 +72,7 @@ public class LibreOfficeMainActivity extends LOAbout {
int id = item.getItemId();
switch (id) {
case R.id.action_about:
- showAbout();
+ mAbout.showAbout();
return true;
case R.id.action_parts:
mDrawerLayout.openDrawer(mDrawerList);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index e12141b0c021..d0092060f59e 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -69,7 +69,7 @@ import android.widget.Toast;
import java.net.URI;
import java.net.URISyntaxException;
-public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNavigationListener {
+public class LibreOfficeUIActivity extends Activity implements ActionBar.OnNavigationListener {
private String tag = "file_manager";
private SharedPreferences prefs;
private int filterMode = FileUtilities.ALL;
@@ -98,15 +98,15 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
GridView gv;
ListView lv;
+ private final LOAbout mAbout;
+
public LibreOfficeUIActivity() {
- super(/*newActivity=*/true);
+ mAbout = new LOAbout(this, true);
}
@Override
public void onCreate(Bundle savedInstanceState) {
-
super.onCreate(savedInstanceState);
- Log.d(tag, "onCreate - tweaked - meeks !");
// initialize document provider factory
DocumentProviderFactory.initialize(this);
@@ -440,7 +440,7 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
sortFiles(item);
break;
case R.id.action_about:
- showAbout();
+ mAbout.showAbout();
return true;
default:
return super.onOptionsItemSelected(item);