Skip to content
Snippets Groups Projects
Verified Commit 0deac1d1 authored by Torsten Grote's avatar Torsten Grote
Browse files

Only show RSS Feed Import Failed Dialog when Activity lives

parent 387e44d1
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package org.briarproject.android;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.UiThread;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
......@@ -16,12 +17,14 @@ import static android.view.inputmethod.InputMethodManager.SHOW_FORCED;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
public abstract class BaseActivity extends AppCompatActivity {
public abstract class BaseActivity extends AppCompatActivity
implements Destroyable {
protected ActivityComponent activityComponent;
private final List<ActivityLifecycleController> lifecycleControllers =
new ArrayList<>();
private boolean destroyed = false;
public abstract void injectActivity(ActivityComponent component);
......@@ -78,11 +81,17 @@ public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onDestroy() {
super.onDestroy();
destroyed = true;
for (ActivityLifecycleController alc : lifecycleControllers) {
alc.onActivityDestroy();
}
}
@UiThread
public boolean hasBeenDestroyed() {
return destroyed;
}
public void showSoftKeyboardForced(View view) {
Object o = getSystemService(INPUT_METHOD_SERVICE);
((InputMethodManager) o).showSoftInput(view, SHOW_FORCED);
......
package org.briarproject.android;
import android.support.annotation.UiThread;
interface Destroyable {
@UiThread
boolean hasBeenDestroyed();
}
......@@ -151,6 +151,8 @@ public class RssFeedImportActivity extends BriarActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (RssFeedImportActivity.this.hasBeenDestroyed()) return;
// hide progress bar, show publish button
progressBar.setVisibility(GONE);
importButton.setVisibility(VISIBLE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment