mirror of
https://github.com/shagr4th/droid48
synced 2024-12-28 22:23:54 +01:00
New settings (bitmap skin)
This commit is contained in:
parent
e424470073
commit
e6f8baddfc
2 changed files with 57 additions and 16 deletions
|
@ -13,7 +13,8 @@
|
||||||
<string name="prog_ko">This program cannot be loaded.\nMake sure it\'s a valid one and you have enough memory to load it</string>
|
<string name="prog_ko">This program cannot be loaded.\nMake sure it\'s a valid one and you have enough memory to load it</string>
|
||||||
<string name="rom_ko">Rom files not found! This shouldn\'t happen :\\. Quitting now...</string>
|
<string name="rom_ko">Rom files not found! This shouldn\'t happen :\\. Quitting now...</string>
|
||||||
<string name="general_preferences">General settings</string>
|
<string name="general_preferences">General settings</string>
|
||||||
<string name="display_preferences">Display/Sound settings</string>
|
<string name="display_preferences">Display settings</string>
|
||||||
|
<string name="misc_preferences">Misc settings</string>
|
||||||
|
|
||||||
<string name="choose_contrast">Contrast</string>
|
<string name="choose_contrast">Contrast</string>
|
||||||
<string name="choose_contrast_value">Select the contrast</string>
|
<string name="choose_contrast_value">Select the contrast</string>
|
||||||
|
@ -56,4 +57,6 @@
|
||||||
<string name="sound_summary">EXPERIMENTAL: system beeps ok, so far</string>
|
<string name="sound_summary">EXPERIMENTAL: system beeps ok, so far</string>
|
||||||
<string name="hp48s">HP48 S</string>
|
<string name="hp48s">HP48 S</string>
|
||||||
<string name="hp48s_summary">Emulate an HP48S (Need App Restart !)</string>
|
<string name="hp48s_summary">Emulate an HP48S (Need App Restart !)</string>
|
||||||
|
<string name="bitmapSkin">HP48 Bitmap Skin</string>
|
||||||
|
<string name="bitmapSkin_summary">Restore the previous bitmap skin (48G mode only !)</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.ab.x48;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
|
@ -24,12 +26,26 @@ public class Settings extends PreferenceActivity {
|
||||||
inlinePrefCat.setTitle(R.string.general_preferences);
|
inlinePrefCat.setTitle(R.string.general_preferences);
|
||||||
root.addPreference(inlinePrefCat);
|
root.addPreference(inlinePrefCat);
|
||||||
|
|
||||||
CheckBoxPreference h48Pref = new CheckBoxPreference(this);
|
final CheckBoxPreference bitmapSkinPref = new CheckBoxPreference(this);
|
||||||
|
final CheckBoxPreference scaleControlsPref = new CheckBoxPreference(this);
|
||||||
|
|
||||||
|
final CheckBoxPreference h48Pref = new CheckBoxPreference(this);
|
||||||
h48Pref.setKey("hp48s");
|
h48Pref.setKey("hp48s");
|
||||||
h48Pref.setDefaultValue(false);
|
h48Pref.setDefaultValue(false);
|
||||||
h48Pref.setTitle(R.string.hp48s);
|
h48Pref.setTitle(R.string.hp48s);
|
||||||
h48Pref.setSummary(R.string.hp48s_summary);
|
h48Pref.setSummary(R.string.hp48s_summary);
|
||||||
|
h48Pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
bitmapSkinPref.setEnabled(!newValue.toString().equals("true"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
inlinePrefCat.addPreference(h48Pref);
|
inlinePrefCat.addPreference(h48Pref);
|
||||||
|
boolean bitmapskin = getPreferenceManager().getSharedPreferences().getBoolean("bitmapskin", false);
|
||||||
|
if (bitmapskin)
|
||||||
|
h48Pref.setEnabled(false);
|
||||||
|
|
||||||
CheckBoxPreference savePref = new CheckBoxPreference(this);
|
CheckBoxPreference savePref = new CheckBoxPreference(this);
|
||||||
savePref.setKey("saveOnExit");
|
savePref.setKey("saveOnExit");
|
||||||
|
@ -71,18 +87,23 @@ public class Settings extends PreferenceActivity {
|
||||||
inlineDispPrefCat.setTitle(R.string.display_preferences);
|
inlineDispPrefCat.setTitle(R.string.display_preferences);
|
||||||
root.addPreference(inlineDispPrefCat);
|
root.addPreference(inlineDispPrefCat);
|
||||||
|
|
||||||
CheckBoxPreference hapticPref = new CheckBoxPreference(this);
|
bitmapSkinPref.setKey("bitmapskin");
|
||||||
hapticPref.setKey("haptic");
|
bitmapSkinPref.setTitle(R.string.bitmapSkin);
|
||||||
hapticPref.setTitle(R.string.haptic_feedback);
|
bitmapSkinPref.setSummary(R.string.bitmapSkin_summary);
|
||||||
hapticPref.setDefaultValue(true);
|
bitmapSkinPref.setDefaultValue(false);
|
||||||
inlineDispPrefCat.addPreference(hapticPref);
|
inlineDispPrefCat.addPreference(bitmapSkinPref);
|
||||||
|
bitmapSkinPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
|
||||||
CheckBoxPreference soundPref = new CheckBoxPreference(this);
|
@Override
|
||||||
soundPref.setKey("sound");
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
soundPref.setTitle(R.string.sound);
|
h48Pref.setEnabled(!newValue.toString().equals("true"));
|
||||||
soundPref.setSummary(R.string.sound_summary);
|
scaleControlsPref.setEnabled(newValue.toString().equals("true"));
|
||||||
soundPref.setDefaultValue(false);
|
return true;
|
||||||
inlineDispPrefCat.addPreference(soundPref);
|
}
|
||||||
|
});
|
||||||
|
boolean hp48s = getPreferenceManager().getSharedPreferences().getBoolean("hp48s", false);
|
||||||
|
if (hp48s)
|
||||||
|
bitmapSkinPref.setEnabled(false);
|
||||||
|
|
||||||
CheckBoxPreference largeLCDPref = new CheckBoxPreference(this);
|
CheckBoxPreference largeLCDPref = new CheckBoxPreference(this);
|
||||||
largeLCDPref.setKey("large_width");
|
largeLCDPref.setKey("large_width");
|
||||||
|
@ -91,12 +112,12 @@ public class Settings extends PreferenceActivity {
|
||||||
largeLCDPref.setDefaultValue(false);
|
largeLCDPref.setDefaultValue(false);
|
||||||
inlineDispPrefCat.addPreference(largeLCDPref);
|
inlineDispPrefCat.addPreference(largeLCDPref);
|
||||||
|
|
||||||
CheckBoxPreference scaleControlsPref = new CheckBoxPreference(this);
|
|
||||||
scaleControlsPref.setKey("scale_buttons");
|
scaleControlsPref.setKey("scale_buttons");
|
||||||
scaleControlsPref.setTitle(R.string.scale_buttons);
|
scaleControlsPref.setTitle(R.string.scale_buttons);
|
||||||
scaleControlsPref.setSummary(R.string.scale_buttons_summary);
|
scaleControlsPref.setSummary(R.string.scale_buttons_summary);
|
||||||
scaleControlsPref.setDefaultValue(false);
|
scaleControlsPref.setDefaultValue(false);
|
||||||
inlineDispPrefCat.addPreference(scaleControlsPref);
|
inlineDispPrefCat.addPreference(scaleControlsPref);
|
||||||
|
scaleControlsPref.setEnabled(bitmapskin);
|
||||||
|
|
||||||
CheckBoxPreference fullScreenPref = new CheckBoxPreference(this);
|
CheckBoxPreference fullScreenPref = new CheckBoxPreference(this);
|
||||||
fullScreenPref.setKey("fullScreen");
|
fullScreenPref.setKey("fullScreen");
|
||||||
|
@ -115,6 +136,23 @@ public class Settings extends PreferenceActivity {
|
||||||
listPref.setSummary(R.string.choose_contrast_value);
|
listPref.setSummary(R.string.choose_contrast_value);
|
||||||
inlineDispPrefCat.addPreference(listPref);
|
inlineDispPrefCat.addPreference(listPref);
|
||||||
|
|
||||||
|
PreferenceCategory inlineMiscPrefCat = new PreferenceCategory(this);
|
||||||
|
inlineMiscPrefCat.setTitle(R.string.misc_preferences);
|
||||||
|
root.addPreference(inlineMiscPrefCat);
|
||||||
|
|
||||||
|
CheckBoxPreference hapticPref = new CheckBoxPreference(this);
|
||||||
|
hapticPref.setKey("haptic");
|
||||||
|
hapticPref.setTitle(R.string.haptic_feedback);
|
||||||
|
hapticPref.setDefaultValue(true);
|
||||||
|
inlineMiscPrefCat.addPreference(hapticPref);
|
||||||
|
|
||||||
|
CheckBoxPreference soundPref = new CheckBoxPreference(this);
|
||||||
|
soundPref.setKey("sound");
|
||||||
|
soundPref.setTitle(R.string.sound);
|
||||||
|
soundPref.setSummary(R.string.sound_summary);
|
||||||
|
soundPref.setDefaultValue(false);
|
||||||
|
inlineMiscPrefCat.addPreference(soundPref);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PreferenceCategory portPrefCat = new PreferenceCategory(this);
|
PreferenceCategory portPrefCat = new PreferenceCategory(this);
|
||||||
|
|
Loading…
Reference in a new issue