1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-30 08:11:17 +00:00

Don't use isFinished(), as it's not available on older devices.

This commit is contained in:
Felix Ableitner 2015-03-23 00:29:45 +01:00
parent 1665c04e37
commit 3cea511c88

View file

@ -10,7 +10,6 @@ import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
@ -20,6 +19,7 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab; import android.support.v7.app.ActionBar.Tab;
import android.support.v7.app.ActionBar.TabListener; import android.support.v7.app.ActionBar.TabListener;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -43,13 +43,15 @@ public class MainActivity extends SyncthingActivity
private AlertDialog mDisabledDialog; private AlertDialog mDisabledDialog;
private boolean mIsDestroyed = false;
/** /**
* Causes population of folder and device lists, unlocks info drawer. * Causes population of folder and device lists, unlocks info drawer.
*/ */
@Override @Override
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public void onApiChange(SyncthingService.State currentState) { public void onApiChange(SyncthingService.State currentState) {
if (currentState != SyncthingService.State.ACTIVE && !isFinishing() && !isDestroyed()) { if (currentState != SyncthingService.State.ACTIVE && !isFinishing() && mIsDestroyed) {
if (currentState == SyncthingService.State.DISABLED) { if (currentState == SyncthingService.State.DISABLED) {
if (mLoadingDialog != null) { if (mLoadingDialog != null) {
mLoadingDialog.dismiss(); mLoadingDialog.dismiss();
@ -204,6 +206,7 @@ public class MainActivity extends SyncthingActivity
if (mLoadingDialog != null) { if (mLoadingDialog != null) {
mLoadingDialog.dismiss(); mLoadingDialog.dismiss();
} }
mIsDestroyed = true;
} }
@Override @Override