Browse Source

improve theming 2

master
DF1E 10 years ago
parent
commit
aedf76e3ae
  1. 9
      src/acr/browser/lightning/BrowserActivity.java
  2. 16
      src/acr/browser/lightning/MainActivity.java

9
src/acr/browser/lightning/BrowserActivity.java

@ -55,7 +55,6 @@ import android.webkit.*;
import android.webkit.WebChromeClient.CustomViewCallback; import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.WebView.HitTestResult; import android.webkit.WebView.HitTestResult;
import android.widget.*; import android.widget.*;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.graphics.Palette; import android.support.v7.graphics.Palette;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
@ -72,7 +71,7 @@ import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
public class BrowserActivity extends ActionBarActivity implements BrowserController, OnClickListener { public class BrowserActivity extends ThemableActivity implements BrowserController, OnClickListener {
private DrawerLayout mDrawerLayout; private DrawerLayout mDrawerLayout;
private ListView mDrawerListLeft, mDrawerListRight; private ListView mDrawerListLeft, mDrawerListRight;
@ -642,12 +641,6 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
mBrowserFrame.removeView(mToolbarLayout); mBrowserFrame.removeView(mToolbarLayout);
mUiLayout.addView(mToolbarLayout, 0); mUiLayout.addView(mToolbarLayout, 0);
} }
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
switch (mPreferences.getInt(PreferenceConstants.SEARCH, 1)) { switch (mPreferences.getInt(PreferenceConstants.SEARCH, 1)) {
case 0: case 0:

16
src/acr/browser/lightning/MainActivity.java

@ -13,16 +13,11 @@ public class MainActivity extends BrowserActivity {
SharedPreferences mPreferences; SharedPreferences mPreferences;
CookieManager mCookieManager; CookieManager mCookieManager;
private boolean mDark;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mDark = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
if (mDark) {
this.setTheme(R.style.Theme_DarkTheme);
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
} }
@Override @Override
@ -62,15 +57,6 @@ public class MainActivity extends BrowserActivity {
saveOpenTabs(); saveOpenTabs();
} }
@Override
protected void onResume() {
super.onResume();
if (mPreferences != null
&& mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false) != mDark) {
this.recreate();
}
}
@Override @Override
public void updateHistory(String title, String url) { public void updateHistory(String title, String url) {
super.updateHistory(title, url); super.updateHistory(title, url);

Loading…
Cancel
Save