@@ 6,7 6,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
@@ 125,7 124,8 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
try {
final ImportBackupService.BackupFile backupFile = ImportBackupService.BackupFile.read(this, uri);
showEnterPasswordDialog(backupFile, finishOnCancel);
- } catch (IOException | IllegalArgumentException e) {
+ } catch (final IOException | IllegalArgumentException e) {
+ Log.d(Config.LOGTAG, "unable to open backup file " + uri, e);
Snackbar.make(binding.coordinator, R.string.not_a_backup_file, Snackbar.LENGTH_LONG).show();
}
}
@@ 181,6 181,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK) {
if (requestCode == 0xbac) {
openBackupFileFromUri(intent.getData(), false);
@@ 225,15 226,17 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_open_backup_file) {
- Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
- intent.setType("*/*");
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
- intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
- }
- intent.addCategory(Intent.CATEGORY_OPENABLE);
- startActivityForResult(Intent.createChooser(intent, getString(R.string.open_backup)), 0xbac);
+ openBackupFile();
return true;
}
return super.onOptionsItemSelected(item);
}
+
+ private void openBackupFile() {
+ final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.setType("*/*");
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+ startActivityForResult(Intent.createChooser(intent, getString(R.string.open_backup)), 0xbac);
+ }
}