Update ResourceParser.java

pull/5/head
pgf78rp5y 2 years ago
parent c470e73916
commit 47831521cb

@ -16,9 +16,9 @@
package net.micode.notes.tool; package net.micode.notes.tool;
import android.content.Context; import javax.naming.Context;
import android.preference.PreferenceManager;
import android.preference.PreferenceManager;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.ui.NotesPreferenceActivity; import net.micode.notes.ui.NotesPreferenceActivity;
@ -65,6 +65,7 @@ public class ResourceParser {
} }
} }
// 直接获取默认的背景颜色。
public static int getDefaultBgId(Context context) { public static int getDefaultBgId(Context context) {
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean( if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) { NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) {
@ -162,6 +163,7 @@ public class ResourceParser {
R.style.TextAppearanceSuper R.style.TextAppearanceSuper
}; };
// 这里有一个容错的函数防止输入的id大于资源总量若如此则自动返回默认的设置结果
public static int getTexAppearanceResource(int id) { public static int getTexAppearanceResource(int id) {
/** /**
* HACKME: Fix bug of store the resource id in shared preference. * HACKME: Fix bug of store the resource id in shared preference.

Loading…
Cancel
Save