|
|
@ -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;
|
|
|
|
|
|
|
|
|
|
|
@ -40,7 +40,7 @@ public class ResourceParser {
|
|
|
|
public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM;
|
|
|
|
public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM;
|
|
|
|
|
|
|
|
|
|
|
|
public static class NoteBgResources {
|
|
|
|
public static class NoteBgResources {
|
|
|
|
private final static int [] BG_EDIT_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_EDIT_RESOURCES = new int[] {
|
|
|
|
R.drawable.edit_yellow,
|
|
|
|
R.drawable.edit_yellow,
|
|
|
|
R.drawable.edit_blue,
|
|
|
|
R.drawable.edit_blue,
|
|
|
|
R.drawable.edit_white,
|
|
|
|
R.drawable.edit_white,
|
|
|
@ -48,7 +48,7 @@ public class ResourceParser {
|
|
|
|
R.drawable.edit_red
|
|
|
|
R.drawable.edit_red
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_EDIT_TITLE_RESOURCES = new int[] {
|
|
|
|
R.drawable.edit_title_yellow,
|
|
|
|
R.drawable.edit_title_yellow,
|
|
|
|
R.drawable.edit_title_blue,
|
|
|
|
R.drawable.edit_title_blue,
|
|
|
|
R.drawable.edit_title_white,
|
|
|
|
R.drawable.edit_title_white,
|
|
|
@ -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)) {
|
|
|
@ -75,7 +76,7 @@ public class ResourceParser {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class NoteItemBgResources {
|
|
|
|
public static class NoteItemBgResources {
|
|
|
|
private final static int [] BG_FIRST_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_FIRST_RESOURCES = new int[] {
|
|
|
|
R.drawable.list_yellow_up,
|
|
|
|
R.drawable.list_yellow_up,
|
|
|
|
R.drawable.list_blue_up,
|
|
|
|
R.drawable.list_blue_up,
|
|
|
|
R.drawable.list_white_up,
|
|
|
|
R.drawable.list_white_up,
|
|
|
@ -83,7 +84,7 @@ public class ResourceParser {
|
|
|
|
R.drawable.list_red_up
|
|
|
|
R.drawable.list_red_up
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private final static int [] BG_NORMAL_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_NORMAL_RESOURCES = new int[] {
|
|
|
|
R.drawable.list_yellow_middle,
|
|
|
|
R.drawable.list_yellow_middle,
|
|
|
|
R.drawable.list_blue_middle,
|
|
|
|
R.drawable.list_blue_middle,
|
|
|
|
R.drawable.list_white_middle,
|
|
|
|
R.drawable.list_white_middle,
|
|
|
@ -91,7 +92,7 @@ public class ResourceParser {
|
|
|
|
R.drawable.list_red_middle
|
|
|
|
R.drawable.list_red_middle
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private final static int [] BG_LAST_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_LAST_RESOURCES = new int[] {
|
|
|
|
R.drawable.list_yellow_down,
|
|
|
|
R.drawable.list_yellow_down,
|
|
|
|
R.drawable.list_blue_down,
|
|
|
|
R.drawable.list_blue_down,
|
|
|
|
R.drawable.list_white_down,
|
|
|
|
R.drawable.list_white_down,
|
|
|
@ -99,7 +100,7 @@ public class ResourceParser {
|
|
|
|
R.drawable.list_red_down,
|
|
|
|
R.drawable.list_red_down,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private final static int [] BG_SINGLE_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_SINGLE_RESOURCES = new int[] {
|
|
|
|
R.drawable.list_yellow_single,
|
|
|
|
R.drawable.list_yellow_single,
|
|
|
|
R.drawable.list_blue_single,
|
|
|
|
R.drawable.list_blue_single,
|
|
|
|
R.drawable.list_white_single,
|
|
|
|
R.drawable.list_white_single,
|
|
|
@ -129,7 +130,7 @@ public class ResourceParser {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class WidgetBgResources {
|
|
|
|
public static class WidgetBgResources {
|
|
|
|
private final static int [] BG_2X_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_2X_RESOURCES = new int[] {
|
|
|
|
R.drawable.widget_2x_yellow,
|
|
|
|
R.drawable.widget_2x_yellow,
|
|
|
|
R.drawable.widget_2x_blue,
|
|
|
|
R.drawable.widget_2x_blue,
|
|
|
|
R.drawable.widget_2x_white,
|
|
|
|
R.drawable.widget_2x_white,
|
|
|
@ -141,7 +142,7 @@ public class ResourceParser {
|
|
|
|
return BG_2X_RESOURCES[id];
|
|
|
|
return BG_2X_RESOURCES[id];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private final static int [] BG_4X_RESOURCES = new int [] {
|
|
|
|
private final static int[] BG_4X_RESOURCES = new int[] {
|
|
|
|
R.drawable.widget_4x_yellow,
|
|
|
|
R.drawable.widget_4x_yellow,
|
|
|
|
R.drawable.widget_4x_blue,
|
|
|
|
R.drawable.widget_4x_blue,
|
|
|
|
R.drawable.widget_4x_white,
|
|
|
|
R.drawable.widget_4x_white,
|
|
|
@ -155,13 +156,14 @@ public class ResourceParser {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class TextAppearanceResources {
|
|
|
|
public static class TextAppearanceResources {
|
|
|
|
private final static int [] TEXTAPPEARANCE_RESOURCES = new int [] {
|
|
|
|
private final static int[] TEXTAPPEARANCE_RESOURCES = new int[] {
|
|
|
|
R.style.TextAppearanceNormal,
|
|
|
|
R.style.TextAppearanceNormal,
|
|
|
|
R.style.TextAppearanceMedium,
|
|
|
|
R.style.TextAppearanceMedium,
|
|
|
|
R.style.TextAppearanceLarge,
|
|
|
|
R.style.TextAppearanceLarge,
|
|
|
|
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.
|
|
|
|