main
qijingxi 7 months ago
parent 351c102dcf
commit f24dabb694

@ -14,6 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
/**
*
* @ProjectName: minode
* @Package: net.micode.notes.data
* @ClassName: ResourceParser
* @Description:
便 ID
使
* @Author:
*/
package net.micode.notes.tool; package net.micode.notes.tool;
import android.content.Context; import android.content.Context;
@ -42,6 +53,18 @@ public class ResourceParser {
public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM; public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM;
// 备忘录背景资源类 // 备忘录背景资源类
/**
* @method NoteBgResources
* @description ID
* @author:
*/
/*
ID
BG_EDIT_RESOURCES ID
BG_EDIT_TITLE_RESOURCES ID */
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,
@ -60,17 +83,56 @@ public class ResourceParser {
}; };
// 获取备忘录背景资源 // 获取备忘录背景资源
/**
* @method getNoteBgResource
* @description ID ID访 BG_EDIT_RESOURCES ID
* @author:
*/
/*
ID ID访 BG_EDIT_RESOURCES ID
id ID
ID
*/
public static int getNoteBgResource(int id) { public static int getNoteBgResource(int id) {
return BG_EDIT_RESOURCES[id]; return BG_EDIT_RESOURCES[id];
} }
// 获取备忘录标题背景资源 // 获取备忘录标题背景资源
/**
* @method getNoteTitleBgResource
* @description ID ID访 BG_EDIT_TITLE_RESOURCES ID
* @author:
*/
/*
ID ID访 BG_EDIT_TITLE_RESOURCES ID
id ID
ID
*/
public static int getNoteTitleBgResource(int id) { public static int getNoteTitleBgResource(int id) {
return BG_EDIT_TITLE_RESOURCES[id]; return BG_EDIT_TITLE_RESOURCES[id];
} }
} }
// 获取默认背景ID // 获取默认背景ID
/**
* @method getDefaultBgId
* @description ID
ID ID
* @author:
*/
/*
ID ID ID
context访
ID
*/
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)) {
@ -81,6 +143,21 @@ public class ResourceParser {
} }
// 备忘录项目背景资源类 // 备忘录项目背景资源类
/**
* @method NoteItemBgResources
* @description ID
* @author:
*/
/*
ID
BG_FIRST_RESOURCES ID
BG_NORMAL_RESOURCES ID
BG_LAST_RESOURCES ID
BG_SINGLE_RESOURCES ID
*/
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,
@ -115,32 +192,117 @@ public class ResourceParser {
}; };
// 获取备忘录第一个背景资源 // 获取备忘录第一个背景资源
/**
* @method getNoteBgFirstRes
* @description ID
* @author:
*/
/*
ID
BG_FIRST_RESOURCES ID
BG_NORMAL_RESOURCES ID
BG_LAST_RESOURCES ID
BG_SINGLE_RESOURCES ID
*/
public static int getNoteBgFirstRes(int id) { public static int getNoteBgFirstRes(int id) {
return BG_FIRST_RESOURCES[id]; return BG_FIRST_RESOURCES[id];
} }
// 获取备忘录最后一个背景资源 // 获取备忘录最后一个背景资源
/**
* @method getNoteBgLastRes
* @description ID ID访 BG_FIRST_RESOURCES
ID
* @author:
*/
/*
ID ID访 BG_FIRST_RESOURCES ID
id ID
ID
*/
public static int getNoteBgLastRes(int id) { public static int getNoteBgLastRes(int id) {
return BG_LAST_RESOURCES[id]; return BG_LAST_RESOURCES[id];
} }
// 获取备忘录单独背景资源 // 获取备忘录单独背景资源
/**
* @method getNoteBgSingleRes
* @description ID ID访 BG_FIRST_RESOURCES
ID
* @author:
*/
/*
ID ID访 BG_LAST_RESOURCES ID
id ID
ID
*/
public static int getNoteBgSingleRes(int id) { public static int getNoteBgSingleRes(int id) {
return BG_SINGLE_RESOURCES[id]; return BG_SINGLE_RESOURCES[id];
} }
// 获取备忘录正常背景资源 // 获取备忘录正常背景资源
/**
* @method getNoteBgNormalRes
* @description ID ID访 BG_FIRST_RESOURCES
ID
* @author:
*/
/*
ID ID访 BG_SINGLE_RESOURCES ID
id ID
ID
*/
public static int getNoteBgNormalRes(int id) { public static int getNoteBgNormalRes(int id) {
return BG_NORMAL_RESOURCES[id]; return BG_NORMAL_RESOURCES[id];
} }
// 获取文件夹背景资源 // 获取文件夹背景资源
/**
* @method getFolderBgRes
* @description ID ID访 BG_FIRST_RESOURCES
ID
* @author:
*/
/*
ID ID访 BG_NORMAL_RESOURCES ID
id ID
ID
*/
public static int getFolderBgRes() { public static int getFolderBgRes() {
return R.drawable.list_folder; return R.drawable.list_folder;
} }
} }
// 小部件背景资源类 // 小部件背景资源类
/**
*
* @ProjectName: minode
* @Package: net.micode.notes.data
* @ClassName: WidgetBgResources
* @Description: ID
* @Author:
*/
/*
ID
BG_2X_RESOURCES 2x ID
BG_4X_RESOURCES 4x ID
*/
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,
@ -151,6 +313,18 @@ public class ResourceParser {
}; };
// 获取2x小部件背景资源 // 获取2x小部件背景资源
/**
* @method getWidget2xBgResource
* @description ID 2x ID访 BG_2X_RESOURCES ID
* @author:
*/
/*
ID 2x ID访 BG_2X_RESOURCES ID
id ID
2x ID
*/
public static int getWidget2xBgResource(int id) { public static int getWidget2xBgResource(int id) {
return BG_2X_RESOURCES[id]; return BG_2X_RESOURCES[id];
} }
@ -164,12 +338,39 @@ public class ResourceParser {
}; };
// 获取4x小部件背景资源 // 获取4x小部件背景资源
/**
* @method getWidget4xBgResource
* @description ID 4x ID访 BG_4X_RESOURCES ID
* @author:
*/
/*
ID 4x ID访 BG_4X_RESOURCES ID
id ID
4x ID
*/
public static int getWidget4xBgResource(int id) { public static int getWidget4xBgResource(int id) {
return BG_4X_RESOURCES[id]; return BG_4X_RESOURCES[id];
} }
} }
// 文本外观资源类 // 文本外观资源类
/**
*
* @ProjectName: minode
* @Package: net.micode.notes.data
* @ClassName: TextAppearanceResources
* @Description: ID
* @Author:
*/
/*
ID
TEXTAPPEARANCE_RESOURCES ID
*/
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,
@ -179,6 +380,20 @@ public class ResourceParser {
}; };
// 获取文本外观资源 // 获取文本外观资源
/**
* @method getTexAppearanceResource
* @description ID ID ID ID
访 TEXTAPPEARANCE_RESOURCES ID
* @author:
*/
/*
ID ID ID ID
访 TEXTAPPEARANCE_RESOURCES ID
id ID
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.
@ -192,6 +407,16 @@ public class ResourceParser {
} }
// 获取资源大小 // 获取资源大小
/**
* @method getResourcesSize
* @description TEXTAPPEARANCE_RESOURCES
* @author:
*/
/*
TEXTAPPEARANCE_RESOURCES
*/
public static int getResourcesSize() { public static int getResourcesSize() {
return TEXTAPPEARANCE_RESOURCES.length; return TEXTAPPEARANCE_RESOURCES.length;
} }

Loading…
Cancel
Save