Restore activity restart when tab mode changes
This commit is contained in:
parent
3cb576d358
commit
61b57cd992
@ -191,8 +191,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
|||||||
@Inject
|
@Inject
|
||||||
TabsManager tabsManager;
|
TabsManager tabsManager;
|
||||||
|
|
||||||
@Inject
|
// Preference manager was moved on ThemeableBrowserActivity
|
||||||
PreferenceManager mPreferences;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
HistoryDatabase mHistoryDatabase;
|
HistoryDatabase mHistoryDatabase;
|
||||||
|
@ -5,18 +5,25 @@ import android.content.res.Configuration;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import acr.browser.lightning.R;
|
import acr.browser.lightning.R;
|
||||||
|
import acr.browser.lightning.app.BrowserApp;
|
||||||
import acr.browser.lightning.preference.PreferenceManager;
|
import acr.browser.lightning.preference.PreferenceManager;
|
||||||
|
|
||||||
public abstract class ThemableBrowserActivity extends AppCompatActivity {
|
public abstract class ThemableBrowserActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
PreferenceManager mPreferences;
|
||||||
|
|
||||||
private int mTheme;
|
private int mTheme;
|
||||||
private boolean mShowTabsInDrawer;
|
private boolean mShowTabsInDrawer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
mTheme = 0; //PreferenceManager.getInstance().getUseTheme();
|
BrowserApp.getAppComponent().inject(this);
|
||||||
mShowTabsInDrawer = false; // PreferenceManager.getInstance().getShowTabsInDrawer(!isTablet());
|
mTheme = mPreferences.getUseTheme();
|
||||||
|
mShowTabsInDrawer = mPreferences.getShowTabsInDrawer(!isTablet());
|
||||||
|
|
||||||
// set the theme
|
// set the theme
|
||||||
if (mTheme == 1) {
|
if (mTheme == 1) {
|
||||||
@ -30,8 +37,8 @@ public abstract class ThemableBrowserActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
int theme = 0; // PreferenceManager.getInstance().getUseTheme();
|
int theme = mPreferences.getUseTheme();
|
||||||
boolean drawerTabs = false; // PreferenceManager.getInstance().getShowTabsInDrawer(!isTablet());
|
boolean drawerTabs = mPreferences.getShowTabsInDrawer(!isTablet());
|
||||||
if (theme != mTheme || mShowTabsInDrawer != drawerTabs) {
|
if (theme != mTheme || mShowTabsInDrawer != drawerTabs) {
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.squareup.otto.Bus;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import acr.browser.lightning.activity.BrowserActivity;
|
import acr.browser.lightning.activity.BrowserActivity;
|
||||||
|
import acr.browser.lightning.activity.ThemableBrowserActivity;
|
||||||
import acr.browser.lightning.constant.BookmarkPage;
|
import acr.browser.lightning.constant.BookmarkPage;
|
||||||
import acr.browser.lightning.database.HistoryDatabase;
|
import acr.browser.lightning.database.HistoryDatabase;
|
||||||
import acr.browser.lightning.dialog.LightningDialogBuilder;
|
import acr.browser.lightning.dialog.LightningDialogBuilder;
|
||||||
@ -53,4 +54,6 @@ public interface AppComponent {
|
|||||||
Context getApplicationContext();
|
Context getApplicationContext();
|
||||||
|
|
||||||
void inject(LightningView lightningView);
|
void inject(LightningView lightningView);
|
||||||
|
|
||||||
|
void inject(ThemableBrowserActivity activity);
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,9 @@ public final class BrowserEvents {
|
|||||||
* result is a new bookmark added.
|
* result is a new bookmark added.
|
||||||
*/
|
*/
|
||||||
public static class AddBookmark {
|
public static class AddBookmark {
|
||||||
public final java.lang.String title, url;
|
public final String title, url;
|
||||||
|
|
||||||
public AddBookmark(final java.lang.String title, final java.lang.String url) {
|
public AddBookmark(final String title, final String url) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
@ -30,9 +30,9 @@ public final class BrowserEvents {
|
|||||||
* {@link acr.browser.lightning.fragment.BookmarksFragment} interface.
|
* {@link acr.browser.lightning.fragment.BookmarksFragment} interface.
|
||||||
*/
|
*/
|
||||||
public static class CurrentPageUrl {
|
public static class CurrentPageUrl {
|
||||||
public final java.lang.String url;
|
public final String url;
|
||||||
|
|
||||||
public CurrentPageUrl(final java.lang.String url) {
|
public CurrentPageUrl(final String url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,11 +57,11 @@ public final class BrowserEvents {
|
|||||||
* Notify the Browser to display a SnackBar in the main activity
|
* Notify the Browser to display a SnackBar in the main activity
|
||||||
*/
|
*/
|
||||||
public static class ShowSnackBarMessage {
|
public static class ShowSnackBarMessage {
|
||||||
public final java.lang.String message;
|
public final String message;
|
||||||
@StringRes
|
@StringRes
|
||||||
public final int stringRes;
|
public final int stringRes;
|
||||||
|
|
||||||
public ShowSnackBarMessage(final java.lang.String message) {
|
public ShowSnackBarMessage(final String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.stringRes = -1;
|
this.stringRes = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user