diff --git a/ChangeLog b/ChangeLog index 679e39c28..34172406c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ ===== 0.7.18 (??? ??, 2010) ===== * Local library activity has been moved to a separate process +* fb2.zip files opening from ASTRO file manager has been fixed ===== 0.7.17 (Nov 14, 2010) ===== * Network catalog order has been changed: language is used for ordering diff --git a/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidActivity.java b/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidActivity.java index c68c8a12d..e93df4bd0 100644 --- a/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidActivity.java +++ b/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidActivity.java @@ -96,6 +96,25 @@ public abstract class ZLAndroidActivity extends Activity { } } + private String extractFileNameFromIntent(Intent intent) { + String fileToOpen = null; + if (Intent.ACTION_VIEW.equals(intent.getAction())) { + final Uri uri = intent.getData(); + if (uri != null) { + fileToOpen = fileNameFromUri(uri); + final String scheme = uri.getScheme(); + if ("content".equals(scheme)) { + final File file = new File(fileToOpen); + if (!file.exists()) { + fileToOpen = file.getParent(); + } + } + } + intent.setData(null); + } + return fileToOpen; + } + @Override public void onCreate(Bundle state) { super.onCreate(state); @@ -113,22 +132,7 @@ public abstract class ZLAndroidActivity extends Activity { getLibrary().setActivity(this); - final Intent intent = getIntent(); - String fileToOpen = null; - if (Intent.ACTION_VIEW.equals(intent.getAction())) { - final Uri uri = intent.getData(); - if (uri != null) { - fileToOpen = fileNameFromUri(uri); - final String scheme = uri.getScheme(); - if ("content".equals(scheme)) { - final File file = new File(fileToOpen); - if (!file.exists()) { - fileToOpen = file.getParent(); - } - } - } - intent.setData(null); - } + final String fileToOpen = extractFileNameFromIntent(getIntent()); if (((ZLAndroidApplication)getApplication()).myMainWindow == null) { ZLApplication application = createApplication(fileToOpen); @@ -233,18 +237,11 @@ public abstract class ZLAndroidActivity extends Activity { public void onNewIntent(Intent intent) { super.onNewIntent(intent); - String fileToOpen = null; - if (Intent.ACTION_VIEW.equals(intent.getAction())) { - final Uri uri = intent.getData(); - if (uri != null) { - fileToOpen = fileNameFromUri(uri); - } - intent.setData(null); - } - + final String fileToOpen = extractFileNameFromIntent(intent); if (fileToOpen != null) { ZLApplication.Instance().openFile(ZLFile.createFileByPath(fileToOpen)); } + ZLApplication.Instance().repaintView(); }