package yuku.alkitab.base.ac;

import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;

import yuku.alkitab.R;
import yuku.alkitab.base.ac.base.BaseActivity;

public class PengaturanActivity extends PreferenceActivity {
	@SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		addPreferencesFromResource(R.xml.pengaturan);
		setTitle(R.string.pengaturan_alkitab);
	}
	
	@Override public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == android.R.id.home) {
			BaseActivity.backToRootActivity(this);
			return true;
		}
		
		return super.onOptionsItemSelected(item);
	}
}

@@ -53,16 +53,121 @@
 undle;%0D%0A
+import android.preference.Preference;%0D%0Aimport android.preference.Preference.OnPreferenceChangeListener;%0D%0A
 import a
@@ -205,16 +205,16 @@
 ivity;%0D%0A
-
 import a
@@ -309,16 +309,63 @@
 tivity;%0D
+%0Aimport yuku.alkitab.base.storage.Preferences;%0D
 %0A%0D%0Apubli
@@ -421,16 +421,89 @@
 vity %7B%0D%0A
+%09interface PreferenceUpdate %7B%0D%0A%09%09String withValue(Object value);%0D%0A%09%7D%0D%0A%09%0D%0A
 %09@Suppre
@@ -684,16 +684,16 @@
 uran);%0D%0A
-
 %09%09setTit
@@ -722,24 +722,1042 @@
 _alkitab);%0D%0A
+%09%09%0D%0A%09%09autoUpdateSummary(R.string.pref_ukuranHuruf2_key, new PreferenceUpdate() %7B%0D%0A%09%09%09@Override public String withValue(Object value) %7B%0D%0A%09%09%09%09if (value == null) return %22Default%22;%0D%0A%09%09%09%09float dp = (Float) value;%0D%0A%09%09%09%09return String.format(%22%25.1f dp (%25.1f pt)%22, dp, dp * 0.45f);%0D%0A%09%09%09%7D%0D%0A%09%09%7D);%0D%0A%09%09%0D%0A%09%09autoUpdateSummary(R.string.pref_jenisHuruf_key, new PreferenceUpdate() %7B%0D%0A%09%09%09@Override public String withValue(Object value) %7B%0D%0A%09%09%09%09return value != null? (String) value: %22Default%22;%0D%0A%09%09%09%7D%0D%0A%09%09%7D);%0D%0A%09%7D%0D%0A%0D%0A%09private void autoUpdateSummary(int keyResId, final PreferenceUpdate pu) %7B%0D%0A%09%09String key = getString(keyResId);%0D%0A%09%09@SuppressWarnings(%22deprecation%22) final Preference pref = findPreference(key);%0D%0A%09%09if (pref != null) %7B%0D%0A%09%09%09pref.setSummary(pu.withValue(Preferences.get(key)));%0D%0A%09%09%09pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() %7B%0D%0A%09%09%09%09@Override public boolean onPreferenceChange(Preference preference, Object newValue) %7B%0D%0A%09%09%09%09%09pref.setSummary(pu.withValue(newValue));%0D%0A%09%09%09%09%09return true;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D);%0D%0A%09%09%7D%0D%0A
 %09%7D%0D%0A%09%0D%0A%09@Ove

Use the summary field on preference to show the current value instead of the mostly useless description.