Browse Source

fix theme on BrowserActivity

there should be only one ThemableActivity but there are two dark themes
- one for settings and on for BrowserActivity
master
DF1E 10 years ago
parent
commit
addaa3b2b3
  1. 2
      src/acr/browser/lightning/AboutSettingsActivity.java
  2. 2
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  3. 2
      src/acr/browser/lightning/BookmarkActivity.java
  4. 8
      src/acr/browser/lightning/BrowserActivity.java
  5. 6
      src/acr/browser/lightning/DisplaySettingsActivity.java
  6. 2
      src/acr/browser/lightning/GeneralSettingsActivity.java
  7. 2
      src/acr/browser/lightning/LicenseActivity.java
  8. 2
      src/acr/browser/lightning/PrivacySettingsActivity.java
  9. 2
      src/acr/browser/lightning/SettingsActivity.java
  10. 11
      src/acr/browser/lightning/ThemableActivity.java
  11. 43
      src/acr/browser/lightning/ThemableSettingsActivity.java

2
src/acr/browser/lightning/AboutSettingsActivity.java

@ -16,7 +16,7 @@ import android.view.View.OnClickListener; @@ -16,7 +16,7 @@ import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class AboutSettingsActivity extends ThemableActivity {
public class AboutSettingsActivity extends ThemableSettingsActivity {
private int mEasterEggCounter;
private Context mContext;

2
src/acr/browser/lightning/AdvancedSettingsActivity.java

@ -20,7 +20,7 @@ import android.widget.LinearLayout; @@ -20,7 +20,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class AdvancedSettingsActivity extends ThemableActivity {
public class AdvancedSettingsActivity extends ThemableSettingsActivity {
private SharedPreferences mPreferences;
private CheckBox cbAllowPopups, cbAllowCookies, cbAllowIncognitoCookies, cbRestoreTabs;

2
src/acr/browser/lightning/BookmarkActivity.java

@ -18,7 +18,7 @@ import android.view.View.OnClickListener; @@ -18,7 +18,7 @@ import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
public class BookmarkActivity extends ThemableActivity implements OnClickListener {
public class BookmarkActivity extends ThemableSettingsActivity implements OnClickListener {
private BookmarkManager mBookmarkManager;
private boolean mSystemBrowser;

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

@ -641,6 +641,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -641,6 +641,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
mBrowserFrame.removeView(mToolbarLayout);
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)) {
case 0:
@ -1374,6 +1380,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1374,6 +1380,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
}
}
}
supportInvalidateOptionsMenu();
}
/**

6
src/acr/browser/lightning/DisplaySettingsActivity.java

@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
*/
package acr.browser.lightning;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
@ -17,21 +16,18 @@ import android.widget.CompoundButton; @@ -17,21 +16,18 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RelativeLayout;
public class DisplaySettingsActivity extends ThemableActivity {
public class DisplaySettingsActivity extends ThemableSettingsActivity {
// mPreferences variables
private SharedPreferences mPreferences;
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow,
cbDarkTheme;
private Activity mActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display_settings);
mActivity = this;
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
// set up ActionBar

2
src/acr/browser/lightning/GeneralSettingsActivity.java

@ -24,7 +24,7 @@ import android.widget.LinearLayout; @@ -24,7 +24,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class GeneralSettingsActivity extends ThemableActivity {
public class GeneralSettingsActivity extends ThemableSettingsActivity {
// mPreferences variables
private static final int API = android.os.Build.VERSION.SDK_INT;

2
src/acr/browser/lightning/LicenseActivity.java

@ -15,7 +15,7 @@ import android.view.View; @@ -15,7 +15,7 @@ import android.view.View;
*under which this code is licensed. Unless you plan on providing other attribution in the app to
*the original source in another visible way, it is advised against the removal of this Activity.
*/
public class LicenseActivity extends ThemableActivity implements View.OnClickListener {
public class LicenseActivity extends ThemableSettingsActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {

2
src/acr/browser/lightning/PrivacySettingsActivity.java

@ -23,7 +23,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener; @@ -23,7 +23,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class PrivacySettingsActivity extends ThemableActivity {
public class PrivacySettingsActivity extends ThemableSettingsActivity {
// mPreferences variables
private static final int API = android.os.Build.VERSION.SDK_INT;

2
src/acr/browser/lightning/SettingsActivity.java

@ -26,7 +26,7 @@ import android.widget.EditText; @@ -26,7 +26,7 @@ import android.widget.EditText;
import android.widget.RelativeLayout;
import info.guardianproject.onionkit.ui.OrbotHelper;
public class SettingsActivity extends ThemableActivity {
public class SettingsActivity extends ThemableSettingsActivity {
private static int API = android.os.Build.VERSION.SDK_INT;
private SharedPreferences.Editor mEditPrefs;

11
src/acr/browser/lightning/ThemableActivity.java

@ -4,7 +4,6 @@ import android.content.Intent; @@ -4,7 +4,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.WindowManager;
public abstract class ThemableActivity extends ActionBarActivity {
@ -18,15 +17,7 @@ public abstract class ThemableActivity extends ActionBarActivity { @@ -18,15 +17,7 @@ public abstract class ThemableActivity extends ActionBarActivity {
// set the theme
if (mDark) {
setTheme(R.style.Theme_SettingsTheme_Dark);
}
// set window params
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);
setTheme(R.style.Theme_DarkTheme);
}
super.onCreate(savedInstanceState);
}

43
src/acr/browser/lightning/ThemableSettingsActivity.java

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
package acr.browser.lightning;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
public abstract class ThemableSettingsActivity extends ActionBarActivity {
private SharedPreferences mPreferences;
private boolean mDark;
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mDark = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
// set the theme
if (mDark) {
setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
if (mPreferences != null
&& mPreferences.getBoolean(PreferenceConstants.DARK_THEME,
false) != mDark) {
restart();
}
}
protected void restart() {
final Bundle outState = new Bundle();
onSaveInstanceState(outState);
final Intent intent = new Intent(this, getClass());
finish();
overridePendingTransition(0, 0);
startActivity(intent);
}
}
Loading…
Cancel
Save