diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2015-01-21 10:59:40 +0000 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2015-02-10 09:40:34 +0000 |
commit | 4810f108c4d7c2e4ff79fd5cecbe60900f68068c (patch) | |
tree | 054ad9aac17a332d68d8ef07c23670fe1eaf2238 /android | |
parent | bc8cb4e3b2a1fc4b84bf366945dd72e9ebeb00ce (diff) |
Android: run openParentDirectory() in a different thread.
The Document Provider framework will implement access to network
services in the future, and network operations must be run in separate
threads.
Change-Id: Ifcba8f28cc4dbffaf2946c12749aa38d0eb11923
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 18 |
1 files changed, 17 insertions, 1 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 5606b1c1b395..8c93b418a776 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -289,6 +289,22 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga } } + private void openParentDirectory() { + new AsyncTask<Void, Void, IFile>() { + @Override + protected IFile doInBackground(Void... dir) { + // this operation may imply network access and must be run in + // a different thread + return currentDirectory.getParent(); + } + + @Override + protected void onPostExecute(IFile result) { + openDirectory(result); + } + }.execute(); + } + private void share(int position) { File file = filePaths.get(position).getDocument(); Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); @@ -323,7 +339,7 @@ public class LibreOfficeUIActivity extends LOAbout implements ActionBar.OnNaviga switch (item.getItemId()) { case android.R.id.home: if( !currentDirectory.equals( homeDirectory ) ){ - openDirectory(currentDirectory.getParent()); + openParentDirectory(); } break; case R.id.menu_view_toggle: |