Refactored/Cleaned up some settings activities
This commit is contained in:
parent
532860245d
commit
38d44b8c2f
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="acr.browser.lightning"
|
package="acr.browser.lightning"
|
||||||
android:versionCode="74"
|
android:versionCode="75"
|
||||||
android:versionName="4.0.6a" >
|
android:versionName="4.0.7a" >
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
|
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package acr.browser.lightning;
|
package acr.browser.lightning;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
@ -16,99 +15,73 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class AboutSettingsActivity extends ThemableSettingsActivity {
|
public class AboutSettingsActivity extends ThemableSettingsActivity implements OnClickListener {
|
||||||
|
|
||||||
private int mEasterEggCounter;
|
private int mEasterEggCounter;
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.about_settings);
|
setContentView(R.layout.about_settings);
|
||||||
|
|
||||||
// set up ActionBar
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
setSupportActionBar(toolbar);
|
||||||
setSupportActionBar(toolbar);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
mContext = this;
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
String code = "1.0";
|
||||||
|
try {
|
||||||
|
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
code = p.versionName;
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView versionCode = (TextView) findViewById(R.id.versionCode);
|
||||||
|
versionCode.setText(code);
|
||||||
|
|
||||||
|
RelativeLayout licenses = (RelativeLayout) findViewById(R.id.layoutLicense);
|
||||||
|
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource);
|
||||||
|
RelativeLayout version = (RelativeLayout) findViewById(R.id.layoutVersion);
|
||||||
|
licenses.setOnClickListener(this);
|
||||||
|
source.setOnClickListener(this);
|
||||||
|
version.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
switch (view.getId()) {
|
||||||
|
case R.id.layoutLicense:
|
||||||
|
// NOTE: In order to comply legally with open source licenses,
|
||||||
|
// it is advised that you leave this code so that the License
|
||||||
|
// Activity may be viewed by the user.
|
||||||
|
startActivity(new Intent(this, LicenseActivity.class));
|
||||||
|
break;
|
||||||
|
case R.id.layoutSource:
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("http://twitter.com/RestainoAnthony"), this, MainActivity.class));
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
case R.id.layoutVersion:
|
||||||
|
mEasterEggCounter++;
|
||||||
|
if (mEasterEggCounter == 10) {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("http://imgs.xkcd.com/comics/compiling.png"), this,
|
||||||
|
MainActivity.class));
|
||||||
|
finish();
|
||||||
|
mEasterEggCounter = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize() {
|
|
||||||
|
|
||||||
String code = "1.0";
|
|
||||||
|
|
||||||
try {
|
|
||||||
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
|
|
||||||
code = p.versionName;
|
|
||||||
} catch (NameNotFoundException e) {
|
|
||||||
// TODO add logging
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView version = (TextView) findViewById(R.id.versionCode);
|
|
||||||
version.setText(code + "");
|
|
||||||
|
|
||||||
RelativeLayout licenses;
|
|
||||||
licenses = (RelativeLayout) findViewById(R.id.layoutLicense);
|
|
||||||
|
|
||||||
licenses.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View arg0) {
|
|
||||||
// NOTE: In order to comply with the open source license,
|
|
||||||
// it is advised that you leave this code so that the License
|
|
||||||
// Activity may be viewed by the user.
|
|
||||||
startActivity(new Intent(mContext, LicenseActivity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource);
|
|
||||||
|
|
||||||
source(source);
|
|
||||||
easterEgg();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void easterEgg() {
|
|
||||||
RelativeLayout easter = (RelativeLayout) findViewById(R.id.layoutVersion);
|
|
||||||
easter.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mEasterEggCounter++;
|
|
||||||
if (mEasterEggCounter == 10) {
|
|
||||||
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri
|
|
||||||
.parse("http://imgs.xkcd.com/comics/compiling.png"), mContext,
|
|
||||||
MainActivity.class));
|
|
||||||
finish();
|
|
||||||
mEasterEggCounter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void source(RelativeLayout view) {
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri
|
|
||||||
.parse("http://twitter.com/RestainoAnthony"), mContext, MainActivity.class));
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package acr.browser.lightning;
|
package acr.browser.lightning;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -25,7 +24,6 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private TextView mRenderText;
|
private TextView mRenderText;
|
||||||
private TextView mUrlText;
|
private TextView mUrlText;
|
||||||
private Activity mActivity;
|
|
||||||
private CharSequence[] mUrlOptions;
|
private CharSequence[] mUrlOptions;
|
||||||
private PreferenceManager mPreferences;
|
private PreferenceManager mPreferences;
|
||||||
|
|
||||||
@ -34,14 +32,12 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.advanced_settings);
|
setContentView(R.layout.advanced_settings);
|
||||||
|
|
||||||
// set up ActionBar
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
mContext = this;
|
mContext = this;
|
||||||
mActivity = this;
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +162,7 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
|||||||
|
|
||||||
public void renderPicker() {
|
public void renderPicker() {
|
||||||
|
|
||||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||||
picker.setTitle(getResources().getString(R.string.rendering_mode));
|
picker.setTitle(getResources().getString(R.string.rendering_mode));
|
||||||
CharSequence[] chars = { mContext.getString(R.string.name_normal),
|
CharSequence[] chars = { mContext.getString(R.string.name_normal),
|
||||||
mContext.getString(R.string.name_inverted),
|
mContext.getString(R.string.name_inverted),
|
||||||
@ -209,7 +205,7 @@ public class AdvancedSettingsActivity extends ThemableSettingsActivity {
|
|||||||
|
|
||||||
public void urlBoxPicker() {
|
public void urlBoxPicker() {
|
||||||
|
|
||||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||||
picker.setTitle(getResources().getString(R.string.url_contents));
|
picker.setTitle(getResources().getString(R.string.url_contents));
|
||||||
|
|
||||||
int n = mPreferences.getUrlBoxContentChoice();
|
int n = mPreferences.getUrlBoxContentChoice();
|
||||||
|
@ -24,7 +24,7 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
|||||||
private boolean mSystemBrowser;
|
private boolean mSystemBrowser;
|
||||||
private File[] mFileList;
|
private File[] mFileList;
|
||||||
private String[] mFileNameList;
|
private String[] mFileNameList;
|
||||||
private File mPath = new File(Environment.getExternalStorageDirectory().toString());
|
private static final File mPath = new File(Environment.getExternalStorageDirectory().toString());
|
||||||
private static final int DIALOG_LOAD_FILE = 1000;
|
private static final int DIALOG_LOAD_FILE = 1000;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -32,7 +32,6 @@ public class BookmarkActivity extends ThemableSettingsActivity implements OnClic
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.bookmark_settings);
|
setContentView(R.layout.bookmark_settings);
|
||||||
|
|
||||||
// set up ActionBar
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
@ -27,14 +27,11 @@ public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.display_settings);
|
setContentView(R.layout.display_settings);
|
||||||
|
|
||||||
mPreferences = PreferenceManager.getInstance();
|
|
||||||
|
|
||||||
// set up ActionBar
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
mPreferences = PreferenceManager.getInstance();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +44,8 @@ public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
|||||||
private void initialize() {
|
private void initialize() {
|
||||||
|
|
||||||
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize, rDarkTheme;
|
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize, rDarkTheme;
|
||||||
|
LayoutClickListener clickListener = new LayoutClickListener();
|
||||||
|
CheckBoxToggleListener toggleListener = new CheckBoxToggleListener();
|
||||||
|
|
||||||
rHideStatusBar = (RelativeLayout) findViewById(R.id.rHideStatusBar);
|
rHideStatusBar = (RelativeLayout) findViewById(R.id.rHideStatusBar);
|
||||||
rFullScreen = (RelativeLayout) findViewById(R.id.rFullScreen);
|
rFullScreen = (RelativeLayout) findViewById(R.id.rFullScreen);
|
||||||
@ -55,6 +54,14 @@ public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
|||||||
rTextReflow = (RelativeLayout) findViewById(R.id.rTextReflow);
|
rTextReflow = (RelativeLayout) findViewById(R.id.rTextReflow);
|
||||||
rTextSize = (RelativeLayout) findViewById(R.id.rTextSize);
|
rTextSize = (RelativeLayout) findViewById(R.id.rTextSize);
|
||||||
rDarkTheme = (RelativeLayout) findViewById(R.id.rDarkTheme);
|
rDarkTheme = (RelativeLayout) findViewById(R.id.rDarkTheme);
|
||||||
|
|
||||||
|
rHideStatusBar.setOnClickListener(clickListener);
|
||||||
|
rFullScreen.setOnClickListener(clickListener);
|
||||||
|
rWideViewPort.setOnClickListener(clickListener);
|
||||||
|
rOverView.setOnClickListener(clickListener);
|
||||||
|
rTextReflow.setOnClickListener(clickListener);
|
||||||
|
rTextSize.setOnClickListener(clickListener);
|
||||||
|
rDarkTheme.setOnClickListener(clickListener);
|
||||||
|
|
||||||
cbHideStatusBar = (CheckBox) findViewById(R.id.cbHideStatusBar);
|
cbHideStatusBar = (CheckBox) findViewById(R.id.cbHideStatusBar);
|
||||||
cbFullScreen = (CheckBox) findViewById(R.id.cbFullScreen);
|
cbFullScreen = (CheckBox) findViewById(R.id.cbFullScreen);
|
||||||
@ -70,186 +77,96 @@ public class DisplaySettingsActivity extends ThemableSettingsActivity {
|
|||||||
cbTextReflow.setChecked(mPreferences.getTextReflowEnabled());
|
cbTextReflow.setChecked(mPreferences.getTextReflowEnabled());
|
||||||
cbDarkTheme.setChecked(mPreferences.getUseDarkTheme());
|
cbDarkTheme.setChecked(mPreferences.getUseDarkTheme());
|
||||||
|
|
||||||
rHideStatusBar(rHideStatusBar);
|
cbHideStatusBar.setOnCheckedChangeListener(toggleListener);
|
||||||
rFullScreen(rFullScreen);
|
cbFullScreen.setOnCheckedChangeListener(toggleListener);
|
||||||
rWideViewPort(rWideViewPort);
|
cbWideViewPort.setOnCheckedChangeListener(toggleListener);
|
||||||
rOverView(rOverView);
|
cbOverView.setOnCheckedChangeListener(toggleListener);
|
||||||
rTextReflow(rTextReflow);
|
cbTextReflow.setOnCheckedChangeListener(toggleListener);
|
||||||
rTextSize(rTextSize);
|
cbDarkTheme.setOnCheckedChangeListener(toggleListener);
|
||||||
rDarkTheme(rDarkTheme);
|
|
||||||
cbHideStatusBar(cbHideStatusBar);
|
|
||||||
cbFullScreen(cbFullScreen);
|
|
||||||
cbWideViewPort(cbWideViewPort);
|
|
||||||
cbOverView(cbOverView);
|
|
||||||
cbTextReflow(cbTextReflow);
|
|
||||||
cbDarkTheme(cbDarkTheme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbHideStatusBar(CheckBox view) {
|
private class LayoutClickListener implements OnClickListener {
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onClick(View v) {
|
||||||
mPreferences.setHideStatusBarEnabled(isChecked);
|
switch (v.getId()) {
|
||||||
|
case R.id.rHideStatusBar:
|
||||||
|
cbHideStatusBar.setChecked(!cbHideStatusBar.isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.rFullScreen:
|
||||||
|
cbFullScreen.setChecked(!cbFullScreen.isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.rWideViewPort:
|
||||||
|
cbWideViewPort.setChecked(!cbWideViewPort.isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.rOverView:
|
||||||
|
cbOverView.setChecked(!cbOverView.isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.rTextReflow:
|
||||||
|
cbTextReflow.setChecked(!cbTextReflow.isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.rTextSize:
|
||||||
|
textSizePicker();
|
||||||
|
break;
|
||||||
|
case R.id.rDarkTheme:
|
||||||
|
cbDarkTheme.setChecked(!cbDarkTheme.isChecked());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cbFullScreen(CheckBox view) {
|
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mPreferences.setFullScreenEnabled(isChecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cbDarkTheme(CheckBox view) {
|
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mPreferences.setUseDarkTheme(isChecked);
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cbWideViewPort(CheckBox view) {
|
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mPreferences.setUseWideViewportEnabled(isChecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cbOverView(CheckBox view) {
|
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mPreferences.setOverviewModeEnabled(isChecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cbTextReflow(CheckBox view) {
|
|
||||||
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
mPreferences.setTextReflowEnabled(isChecked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rHideStatusBar(RelativeLayout view) {
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
cbHideStatusBar.setChecked(!cbHideStatusBar.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rFullScreen(RelativeLayout view) {
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
cbFullScreen.setChecked(!cbFullScreen.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rDarkTheme(RelativeLayout view) {
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
cbDarkTheme.setChecked(!cbDarkTheme.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rWideViewPort(RelativeLayout view) {
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
cbWideViewPort.setChecked(!cbWideViewPort.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rOverView(RelativeLayout view) {
|
private class CheckBoxToggleListener implements OnCheckedChangeListener {
|
||||||
view.setOnClickListener(new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
// TODO Auto-generated method stub
|
switch (buttonView.getId()) {
|
||||||
cbOverView.setChecked(!cbOverView.isChecked());
|
case R.id.cbHideStatusBar:
|
||||||
|
mPreferences.setHideStatusBarEnabled(isChecked);
|
||||||
|
break;
|
||||||
|
case R.id.cbFullScreen:
|
||||||
|
mPreferences.setFullScreenEnabled(isChecked);
|
||||||
|
break;
|
||||||
|
case R.id.cbWideViewPort:
|
||||||
|
mPreferences.setUseWideViewportEnabled(isChecked);
|
||||||
|
break;
|
||||||
|
case R.id.cbOverView:
|
||||||
|
mPreferences.setOverviewModeEnabled(isChecked);
|
||||||
|
break;
|
||||||
|
case R.id.cbTextReflow:
|
||||||
|
mPreferences.setTextReflowEnabled(isChecked);
|
||||||
|
break;
|
||||||
|
case R.id.cbDarkTheme:
|
||||||
|
mPreferences.setUseDarkTheme(isChecked);
|
||||||
|
restart();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rTextReflow(RelativeLayout view) {
|
private void textSizePicker() {
|
||||||
view.setOnClickListener(new OnClickListener() {
|
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this);
|
||||||
|
picker.setTitle(getResources().getString(R.string.title_text_size));
|
||||||
|
|
||||||
@Override
|
int n = mPreferences.getTextSize();
|
||||||
public void onClick(View v) {
|
|
||||||
cbTextReflow.setChecked(!cbTextReflow.isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
picker.setSingleChoiceItems(R.array.text_size, n - 1,
|
||||||
}
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
private void rTextSize(RelativeLayout view) {
|
@Override
|
||||||
view.setOnClickListener(new OnClickListener() {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mPreferences.setTextSize(which + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this);
|
|
||||||
picker.setTitle(getResources().getString(R.string.title_text_size));
|
|
||||||
|
|
||||||
int n = mPreferences.getTextSize();
|
}
|
||||||
|
});
|
||||||
picker.setSingleChoiceItems(R.array.text_size, n - 1,
|
picker.show();
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
mPreferences.setTextSize(which + 1);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
|
||||||
new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
picker.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user