|
|
@ -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); |
|
|
|
private class LayoutClickListener implements OnClickListener { |
|
|
|
cbWideViewPort(cbWideViewPort); |
|
|
|
|
|
|
|
cbOverView(cbOverView); |
|
|
|
@Override |
|
|
|
cbTextReflow(cbTextReflow); |
|
|
|
public void onClick(View v) { |
|
|
|
cbDarkTheme(cbDarkTheme); |
|
|
|
switch (v.getId()) { |
|
|
|
} |
|
|
|
case R.id.rHideStatusBar: |
|
|
|
|
|
|
|
cbHideStatusBar.setChecked(!cbHideStatusBar.isChecked()); |
|
|
|
private void cbHideStatusBar(CheckBox view) { |
|
|
|
break; |
|
|
|
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
case R.id.rFullScreen: |
|
|
|
|
|
|
|
cbFullScreen.setChecked(!cbFullScreen.isChecked()); |
|
|
|
@Override |
|
|
|
break; |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
case R.id.rWideViewPort: |
|
|
|
mPreferences.setHideStatusBarEnabled(isChecked); |
|
|
|
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) { |
|
|
|
private class CheckBoxToggleListener implements OnCheckedChangeListener { |
|
|
|
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
switch (buttonView.getId()) { |
|
|
|
mPreferences.setFullScreenEnabled(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 cbDarkTheme(CheckBox view) { |
|
|
|
private void textSizePicker() { |
|
|
|
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(DisplaySettingsActivity.this); |
|
|
|
|
|
|
|
picker.setTitle(getResources().getString(R.string.title_text_size)); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
|
|
|
|
mPreferences.setUseDarkTheme(isChecked); |
|
|
|
|
|
|
|
restart(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void cbWideViewPort(CheckBox view) { |
|
|
|
int n = mPreferences.getTextSize(); |
|
|
|
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
picker.setSingleChoiceItems(R.array.text_size, n - 1, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
mPreferences.setUseWideViewportEnabled(isChecked); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@Override |
|
|
|
} |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
mPreferences.setTextSize(which + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
private void cbOverView(CheckBox view) { |
|
|
|
@Override |
|
|
|
view.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
|
|
|
|
@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) { |
|
|
|
|
|
|
|
view.setOnClickListener(new OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
cbOverView.setChecked(!cbOverView.isChecked()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void rTextReflow(RelativeLayout view) { |
|
|
|
|
|
|
|
view.setOnClickListener(new OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
cbTextReflow.setChecked(!cbTextReflow.isChecked()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void rTextSize(RelativeLayout view) { |
|
|
|
|
|
|
|
view.setOnClickListener(new OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
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, |
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
picker.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|