mirror of https://github.com/M66B/NetGuard.git
Refactoring
This commit is contained in:
parent
ebad4d1d04
commit
e2b4b7d495
|
@ -622,6 +622,19 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
|
|
||||||
} else if (requestCode == REQUEST_EXPORT) {
|
} else if (requestCode == REQUEST_EXPORT) {
|
||||||
if (resultCode == RESULT_OK && data != null)
|
if (resultCode == RESULT_OK && data != null)
|
||||||
|
handleExport(data);
|
||||||
|
|
||||||
|
} else if (requestCode == REQUEST_IMPORT) {
|
||||||
|
if (resultCode == RESULT_OK && data != null)
|
||||||
|
handleImport(data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Unknown activity result request=" + requestCode);
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleExport(final Intent data) {
|
||||||
new AsyncTask<Object, Object, Throwable>() {
|
new AsyncTask<Object, Object, Throwable>() {
|
||||||
@Override
|
@Override
|
||||||
protected Throwable doInBackground(Object... objects) {
|
protected Throwable doInBackground(Object... objects) {
|
||||||
|
@ -652,9 +665,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
|
}
|
||||||
|
|
||||||
} else if (requestCode == REQUEST_IMPORT) {
|
private void handleImport(final Intent data) {
|
||||||
if (resultCode == RESULT_OK && data != null)
|
|
||||||
new AsyncTask<Object, Object, Throwable>() {
|
new AsyncTask<Object, Object, Throwable>() {
|
||||||
@Override
|
@Override
|
||||||
protected Throwable doInBackground(Object... objects) {
|
protected Throwable doInBackground(Object... objects) {
|
||||||
|
@ -687,11 +700,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Unknown activity result request=" + requestCode);
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Intent getIntentSupport() {
|
private static Intent getIntentSupport() {
|
||||||
|
|
Loading…
Reference in New Issue