summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2015-01-27 11:55:02 +0000
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2015-02-10 09:40:43 +0000
commitcc9d29ff7b781b5f1392e13bb9a21bc05229da8a (patch)
treed7d2d97dbdfcca1a027528ec7e402705b5531866 /android
parent4810f108c4d7c2e4ff79fd5cecbe60900f68068c (diff)
Android: run open(IFile) in a different thread.
Change-Id: I3a7023dba7621f9bd066edb9c0894df48313b117
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java24
1 files changed, 18 insertions, 6 deletions
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 8c93b418a776..25870c069ab4 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -272,12 +272,24 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga
}
public void open(IFile document) {
- File file = document.getDocument();
- Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
- String packageName = getApplicationContext().getPackageName();
- ComponentName componentName = new ComponentName(packageName, LibreOfficeMainActivity.class.getName());
- i.setComponent(componentName);
- startActivity(i);
+ new AsyncTask<IFile, Void, File>() {
+ @Override
+ protected File doInBackground(IFile... document) {
+ // this operation may imply network access and must be run in
+ // a different thread
+ return document[0].getDocument();
+ }
+
+ @Override
+ protected void onPostExecute(File file) {
+ Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
+ String packageName = getApplicationContext().getPackageName();
+ ComponentName componentName = new ComponentName(packageName,
+ LibreOfficeMainActivity.class.getName());
+ i.setComponent(componentName);
+ startActivity(i);
+ }
+ }.execute(document);
}
private void open(int position) {