restart when cats get enabled/disabled

This commit is contained in:
Andrew Dolgov 2015-06-11 08:32:27 +03:00
parent cbc88f57e1
commit bc2cef9630

View File

@ -40,6 +40,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
private boolean m_feedIsSelected = false; private boolean m_feedIsSelected = false;
private boolean m_userFeedSelected = false; private boolean m_userFeedSelected = false;
private boolean m_catsEnabled = false;
private ActionBarDrawerToggle m_drawerToggle; private ActionBarDrawerToggle m_drawerToggle;
private DrawerLayout m_drawerLayout; private DrawerLayout m_drawerLayout;
@ -61,6 +62,8 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
m_catsEnabled = m_prefs.getBoolean("enable_cats", false);
Application.getInstance().load(savedInstanceState); Application.getInstance().load(savedInstanceState);
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer); m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
@ -409,6 +412,14 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
invalidateOptionsMenu(); invalidateOptionsMenu();
if (!m_catsEnabled == m_prefs.getBoolean("enable_cats", false)) {
Log.d(TAG, "root view settings changed, restarting");
finish();
startActivity(getIntent());
}
} }
@Override @Override