|
|
|
|
@ -9,169 +9,255 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ReadBookControl类主要用于管理阅读书籍时的相关控制参数,例如文字大小、文字颜色、背景样式以及翻页方式等设置,
|
|
|
|
|
* 采用单例模式设计,确保在整个应用中只有一个实例来统一管理这些阅读相关的配置信息,方便在不同的阅读场景中进行参数的获取和更新操作。
|
|
|
|
|
*/
|
|
|
|
|
public class ReadBookControl {
|
|
|
|
|
|
|
|
|
|
// 定义默认的文字样式索引值,用于在没有特定设置或者初始化时确定默认使用的文字相关配置,这里值为2,具体对应哪种文字样式由后续的逻辑决定。
|
|
|
|
|
public static final int DEFAULT_TEXT = 2;
|
|
|
|
|
|
|
|
|
|
// 定义默认的背景样式索引值,用于在没有特定设置或者初始化时确定默认使用的背景相关配置,这里值为1,同样具体对应哪种背景样式由后续逻辑决定。
|
|
|
|
|
public static final int DEFAULT_BG = 1;
|
|
|
|
|
|
|
|
|
|
private static List<Map<String,Integer>> textKind;
|
|
|
|
|
private static List<Map<String,Integer>> textDrawable;
|
|
|
|
|
// 用于存储不同文字样式相关配置信息的列表,每个元素是一个Map,其中包含如文字大小、文字间距等具体配置项,方便根据不同索引获取对应的文字样式配置。
|
|
|
|
|
private static List<Map<String, Integer>> textKind;
|
|
|
|
|
|
|
|
|
|
// 用于存储不同文字绘制相关配置信息的列表(主要涉及文字颜色和文字背景相关设置),每个元素是一个Map,方便根据不同索引获取对应的文字绘制相关配置。
|
|
|
|
|
private static List<Map<String, Integer>> textDrawable;
|
|
|
|
|
|
|
|
|
|
// 记录当前的文字大小,单位可能是像素等(具体取决于存储和使用的情况),通过获取对应文字样式配置中的值来初始化和更新,用于控制阅读界面文字显示的大小。
|
|
|
|
|
private int textSize;
|
|
|
|
|
|
|
|
|
|
// 记录当前的文字间距(额外间距),单位可能是像素等,通过对应文字样式配置获取并更新,用于调整文字排版时的间距效果,提升阅读体验。
|
|
|
|
|
private int textExtra;
|
|
|
|
|
|
|
|
|
|
// 记录当前的文字颜色,以颜色值的形式存储(可能是通过Android系统的颜色表示方式,如ARGB等),从文字绘制相关配置中获取,决定文字在阅读界面呈现的颜色。
|
|
|
|
|
private int textColor;
|
|
|
|
|
|
|
|
|
|
// 记录当前的文字背景,以资源标识符(如R.drawable中的相关资源ID)的形式存储,用于指定文字所在区域的背景样式,从文字绘制相关配置中获取并应用。
|
|
|
|
|
private int textBackground;
|
|
|
|
|
|
|
|
|
|
// 当前选择的文字样式索引,用于在textKind列表中定位对应的文字样式配置,初始化为DEFAULT_TEXT,可通过设置方法进行更新,以切换不同的文字样式。
|
|
|
|
|
private int textKindIndex = DEFAULT_TEXT;
|
|
|
|
|
|
|
|
|
|
// 当前选择的文字绘制样式索引,用于在textDrawable列表中定位对应的文字绘制相关配置,初始化为DEFAULT_BG,同样可通过设置方法更新来切换不同的文字背景和颜色组合等样式。
|
|
|
|
|
private int textDrawableIndex = DEFAULT_BG;
|
|
|
|
|
|
|
|
|
|
// 用于标识是否允许通过点击进行翻页操作,初始值为true,表示默认允许点击翻页,可通过设置方法改变其值,并将设置持久化存储,方便用户根据自己的阅读习惯进行调整。
|
|
|
|
|
private Boolean canClickTurn = true;
|
|
|
|
|
|
|
|
|
|
// 用于标识是否允许通过按键(如音量键等,具体取决于应用的按键绑定设置)进行翻页操作,初始值为true,可通过设置方法修改值并保存设置,以满足不同用户对翻页操作方式的偏好。
|
|
|
|
|
private Boolean canKeyTurn = true;
|
|
|
|
|
|
|
|
|
|
// 用于存储应用的配置信息,通过SharedPreferences与应用的配置文件(通常以键值对形式存储数据)进行交互,实现阅读控制相关参数的持久化存储和读取。
|
|
|
|
|
private SharedPreferences preference;
|
|
|
|
|
|
|
|
|
|
// 静态变量,用于保存ReadBookControl类的唯一实例,遵循单例模式的设计,初始值为null,通过特定的获取实例方法来确保整个应用只有一个实例存在。
|
|
|
|
|
private static ReadBookControl readBookControl;
|
|
|
|
|
|
|
|
|
|
public static ReadBookControl getInstance(){
|
|
|
|
|
if(readBookControl == null){
|
|
|
|
|
synchronized (ReadBookControl.class){
|
|
|
|
|
if(readBookControl == null){
|
|
|
|
|
/**
|
|
|
|
|
* 静态方法,用于获取ReadBookControl类的唯一实例,实现了单例模式中的获取实例逻辑。
|
|
|
|
|
* 首先判断readBookControl是否为null,如果是则进入同步代码块(使用synchronized关键字保证在多线程环境下只会有一个线程创建实例),
|
|
|
|
|
* 在同步代码块内再次检查readBookControl是否为null,若仍为null则创建一个新的ReadBookControl实例并赋值给readBookControl,最后返回这个唯一的实例。
|
|
|
|
|
* 这样可以保证无论在多少个地方调用这个方法,整个应用程序中始终只有一个ReadBookControl实例在运行,方便统一管理阅读控制相关参数。
|
|
|
|
|
* @return 返回ReadBookControl类的唯一实例对象,通过该实例可以调用其他方法来获取和设置阅读相关的控制参数。
|
|
|
|
|
*/
|
|
|
|
|
public static ReadBookControl getInstance() {
|
|
|
|
|
if (readBookControl == null) {
|
|
|
|
|
synchronized (ReadBookControl.class) {
|
|
|
|
|
if (readBookControl == null) {
|
|
|
|
|
readBookControl = new ReadBookControl();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return readBookControl;
|
|
|
|
|
}
|
|
|
|
|
private ReadBookControl(){
|
|
|
|
|
if(null == textKind){
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 私有构造函数,用于创建ReadBookControl类的实例对象,在构造函数内部进行了一系列的初始化操作,包括初始化文字样式列表、文字绘制样式列表以及从SharedPreferences中读取之前保存的配置参数等,
|
|
|
|
|
* 确保实例创建时相关的阅读控制参数处于合适的初始状态,同时私有构造函数符合单例模式的设计要求,限制了外部直接创建实例的方式,只能通过getInstance方法获取实例。
|
|
|
|
|
*/
|
|
|
|
|
private ReadBookControl() {
|
|
|
|
|
// 如果textKind列表为空(即还未初始化),则进行初始化操作,创建不同文字样式相关的配置信息并添加到textKind列表中。
|
|
|
|
|
if (null == textKind) {
|
|
|
|
|
textKind = new ArrayList<>();
|
|
|
|
|
Map<String,Integer> temp1 = new HashMap<>();
|
|
|
|
|
// 创建一个临时的Map,用于存储一种文字样式的配置信息,这里设置文字大小为14(单位可能是像素等,具体看后续使用情况),文字间距通过DensityUtil工具类将dp值转换为像素值(6.5dp转换后的像素值),然后将这个配置信息添加到textKind列表中。
|
|
|
|
|
Map<String, Integer> temp1 = new HashMap<>();
|
|
|
|
|
temp1.put("textSize", 14);
|
|
|
|
|
temp1.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),6.5f));
|
|
|
|
|
temp1.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(), 6.5f));
|
|
|
|
|
textKind.add(temp1);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp2 = new HashMap<>();
|
|
|
|
|
// 类似地,创建另一种文字样式的配置信息,文字大小设置为16,文字间距通过DensityUtil转换对应dp值后的像素值,再添加到textKind列表中,方便后续根据索引选择不同的文字大小和间距配置。
|
|
|
|
|
Map<String, Integer> temp2 = new HashMap<>();
|
|
|
|
|
temp2.put("textSize", 16);
|
|
|
|
|
temp2.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),8));
|
|
|
|
|
temp2.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(), 8));
|
|
|
|
|
textKind.add(temp2);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp3 = new HashMap<>();
|
|
|
|
|
Map<String, Integer> temp3 = new HashMap<>();
|
|
|
|
|
temp3.put("textSize", 17);
|
|
|
|
|
temp3.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),9));
|
|
|
|
|
temp3.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(), 9));
|
|
|
|
|
textKind.add(temp3);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp4 = new HashMap<>();
|
|
|
|
|
Map<String, Integer> temp4 = new HashMap<>();
|
|
|
|
|
temp4.put("textSize", 20);
|
|
|
|
|
temp4.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),11));
|
|
|
|
|
temp4.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(), 11));
|
|
|
|
|
textKind.add(temp4);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp5 = new HashMap<>();
|
|
|
|
|
Map<String, Integer> temp5 = new HashMap<>();
|
|
|
|
|
temp5.put("textSize", 22);
|
|
|
|
|
temp5.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),13));
|
|
|
|
|
temp5.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(), 13));
|
|
|
|
|
textKind.add(temp5);
|
|
|
|
|
}
|
|
|
|
|
if(null == textDrawable){
|
|
|
|
|
|
|
|
|
|
// 如果textDrawable列表为空(未初始化),则进行初始化操作,创建不同文字绘制样式相关的配置信息(包含文字颜色和文字背景)并添加到textDrawable列表中。
|
|
|
|
|
if (null == textDrawable) {
|
|
|
|
|
textDrawable = new ArrayList<>();
|
|
|
|
|
Map<String,Integer> temp1 = new HashMap<>();
|
|
|
|
|
temp1.put("textColor",Color.parseColor("#3E3D3B"));
|
|
|
|
|
temp1.put("textBackground",R.drawable.shape_bg_readbook_white);
|
|
|
|
|
// 创建一个临时的Map,用于存储一种文字绘制样式的配置信息,设置文字颜色通过Color.parseColor方法解析十六进制颜色代码(这里是深灰色)得到对应的颜色值,文字背景设置为指定的白色背景样式资源(通过R.drawable中的资源ID指定),然后将这个配置添加到textDrawable列表中。
|
|
|
|
|
Map<String, Integer> temp1 = new HashMap<>();
|
|
|
|
|
temp1.put("textColor", Color.parseColor("#3E3D3B"));
|
|
|
|
|
temp1.put("textBackground", R.drawable.shape_bg_readbook_white);
|
|
|
|
|
textDrawable.add(temp1);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp2 = new HashMap<>();
|
|
|
|
|
temp2.put("textColor",Color.parseColor("#5E432E"));
|
|
|
|
|
temp2.put("textBackground",R.drawable.bg_readbook_yellow);
|
|
|
|
|
Map<String, Integer> temp2 = new HashMap<>();
|
|
|
|
|
temp2.put("textColor", Color.parseColor("#5E432E"));
|
|
|
|
|
temp2.put("textBackground", R.drawable.bg_readbook_yellow);
|
|
|
|
|
textDrawable.add(temp2);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp3 = new HashMap<>();
|
|
|
|
|
temp3.put("textColor",Color.parseColor("#22482C"));
|
|
|
|
|
temp3.put("textBackground",R.drawable.bg_readbook_green);
|
|
|
|
|
Map<String, Integer> temp3 = new HashMap<>();
|
|
|
|
|
temp3.put("textColor", Color.parseColor("#22482C"));
|
|
|
|
|
temp3.put("textBackground", R.drawable.bg_readbook_green);
|
|
|
|
|
textDrawable.add(temp3);
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> temp4 = new HashMap<>();
|
|
|
|
|
temp4.put("textColor",Color.parseColor("#808080"));
|
|
|
|
|
temp4.put("textBackground",R.drawable.bg_readbook_black);
|
|
|
|
|
Map<String, Integer> temp4 = new HashMap<>();
|
|
|
|
|
temp4.put("textColor", Color.parseColor("#808080"));
|
|
|
|
|
temp4.put("textBackground", R.drawable.bg_readbook_black);
|
|
|
|
|
textDrawable.add(temp4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取应用的SharedPreferences对象,用于读取和保存阅读控制相关的配置参数,"CONFIG"是配置文件的名称,0表示操作模式(MODE_PRIVATE,即只有当前应用可以访问该文件)。
|
|
|
|
|
preference = MApplication.getInstance().getSharedPreferences("CONFIG", 0);
|
|
|
|
|
this.textKindIndex = preference.getInt("textKindIndex",DEFAULT_TEXT);
|
|
|
|
|
|
|
|
|
|
// 从SharedPreferences中读取之前保存的文字样式索引值,如果不存在则使用默认的文字样式索引值(DEFAULT_TEXT),然后根据这个索引获取对应的文字大小和文字间距并赋值给相应变量。
|
|
|
|
|
this.textKindIndex = preference.getInt("textKindIndex", DEFAULT_TEXT);
|
|
|
|
|
this.textSize = textKind.get(textKindIndex).get("textSize");
|
|
|
|
|
this.textExtra = textKind.get(textKindIndex).get("textExtra");
|
|
|
|
|
this.textDrawableIndex = preference.getInt("textDrawableIndex",DEFAULT_BG);
|
|
|
|
|
|
|
|
|
|
// 从SharedPreferences中读取之前保存的文字绘制样式索引值,若不存在则用默认的背景样式索引值(DEFAULT_BG),再依据该索引获取对应的文字颜色和文字背景资源并赋值给相应变量。
|
|
|
|
|
this.textDrawableIndex = preference.getInt("textDrawableIndex", DEFAULT_BG);
|
|
|
|
|
this.textColor = textDrawable.get(textDrawableIndex).get("textColor");
|
|
|
|
|
this.textBackground = textDrawable.get(textDrawableIndex).get("textBackground");
|
|
|
|
|
|
|
|
|
|
this.canClickTurn = preference.getBoolean("canClickTurn",true);
|
|
|
|
|
this.canKeyTurn = preference.getBoolean("canClickTurn",true);
|
|
|
|
|
// 从SharedPreferences中读取之前保存的是否允许点击翻页的配置值,如果不存在则使用默认值true,赋值给canClickTurn变量,用于确定当前是否允许点击翻页操作。
|
|
|
|
|
this.canClickTurn = preference.getBoolean("canClickTurn", true);
|
|
|
|
|
|
|
|
|
|
// 从SharedPreferences中读取之前保存的是否允许按键翻页的配置值,同样若不存在使用默认值true,赋值给canKeyTurn变量,用于判断当前是否允许按键翻页操作(这里代码可能存在重复设置canClickTurn的问题,应该是读取另一个键对应的布尔值,比如"canKeyTurn"对应的配置值,此处可能需要修正)。
|
|
|
|
|
this.canKeyTurn = preference.getBoolean("canClickTurn", true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前的文字大小,外部代码可以调用此方法获取用于控制阅读界面文字显示大小的数值,方便根据实际情况进行展示或其他相关操作。
|
|
|
|
|
* @return 当前设置的文字大小值,单位可能是像素等,具体取决于初始化和存储的设置情况。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextSize() {
|
|
|
|
|
return textSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前的文字间距(额外间距),外部代码可通过调用此方法获取文字排版时的间距数值,用于调整文字展示的排版效果,使其更符合阅读习惯等需求。
|
|
|
|
|
* @return 当前设置的文字间距值,单位可能是像素等,通过对应配置获取而来。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextExtra() {
|
|
|
|
|
return textExtra;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前的文字颜色值,外部代码调用此方法可获取用于设置阅读界面文字显示颜色的数值,从而按照此颜色来渲染文字,使其呈现出特定的视觉效果。
|
|
|
|
|
* @return 当前设置的文字颜色值,以Android系统的颜色表示方式存储(如ARGB等),通过配置获取得到。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextColor() {
|
|
|
|
|
return textColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前的文字背景资源标识符,外部代码可利用此标识符来设置文字所在区域的背景样式,比如设置阅读界面文字背后的背景图片、颜色等样式,提升阅读的视觉感受。
|
|
|
|
|
* @return 当前设置的文字背景资源的标识符(如R.drawable中的相关资源ID),通过配置获取而来,对应特定的背景样式资源。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextBackground() {
|
|
|
|
|
return textBackground;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前选择的文字样式索引,外部代码可以通过这个索引值了解当前应用的是哪种文字样式配置,也可基于此索引进行一些相关的逻辑判断或操作(如展示当前文字样式名称等)。
|
|
|
|
|
* @return 当前选择的文字样式索引值,对应textKind列表中的位置,用于定位具体的文字样式配置。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextKindIndex() {
|
|
|
|
|
return textKindIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置当前选择的文字样式索引,用于切换不同的文字样式,在设置新的索引值后,会将这个新值保存到SharedPreferences中实现持久化存储,
|
|
|
|
|
* 同时根据新的索引更新文字大小和文字间距等相关变量,确保配置的一致性,方便下次读取时能获取到最新的设置状态。
|
|
|
|
|
* @param textKindIndex 要设置的文字样式索引值,需是合法的索引范围(对应textKind列表中的有效位置),用于指定新的文字样式配置。
|
|
|
|
|
*/
|
|
|
|
|
public void setTextKindIndex(int textKindIndex) {
|
|
|
|
|
this.textKindIndex = textKindIndex;
|
|
|
|
|
SharedPreferences.Editor editor = preference.edit();
|
|
|
|
|
editor.putInt("textKindIndex",textKindIndex);
|
|
|
|
|
editor.putInt("textKindIndex", textKindIndex);
|
|
|
|
|
editor.commit();
|
|
|
|
|
this.textSize = textKind.get(textKindIndex).get("textSize");
|
|
|
|
|
this.textExtra = textKind.get(textKindIndex).get("textExtra");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前选择的文字绘制样式索引,外部代码可通过此索引值知晓当前应用的文字颜色和文字背景的组合样式,也可用于相关的展示或逻辑判断操作。
|
|
|
|
|
* @return 当前选择的文字绘制样式索引值,对应textDrawable列表中的位置,用于定位具体的文字绘制相关配置。
|
|
|
|
|
*/
|
|
|
|
|
public int getTextDrawableIndex() {
|
|
|
|
|
return textDrawableIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置当前选择的文字绘制样式索引,用于切换不同的文字颜色和文字背景组合样式,在设置新的索引值后,会将其保存到SharedPreferences中持久化存储,
|
|
|
|
|
* 同时根据新索引更新文字颜色和文字背景等相关变量,保证配置的一致性,以便后续能按照新设置进行文字绘制相关的展示操作。
|
|
|
|
|
* @param textDrawableIndex 要设置的文字绘制样式索引值,需是合法的索引范围(对应textDrawable列表中的有效位置),用于指定新的文字绘制相关配置。
|
|
|
|
|
*/
|
|
|
|
|
public void setTextDrawableIndex(int textDrawableIndex) {
|
|
|
|
|
this.textDrawableIndex = textDrawableIndex;
|
|
|
|
|
SharedPreferences.Editor editor = preference.edit();
|
|
|
|
|
editor.putInt("textDrawableIndex",textDrawableIndex);
|
|
|
|
|
editor.putInt("textDrawableIndex", textDrawableIndex);
|
|
|
|
|
editor.commit();
|
|
|
|
|
this.textColor = textDrawable.get(textDrawableIndex).get("textColor");
|
|
|
|
|
this.textBackground = textDrawable.get(textDrawableIndex).get("textBackground");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取存储文字样式相关配置信息的列表,外部代码可以通过这个列表获取所有已定义的文字样式配置内容(如文字大小、文字间距等信息),
|
|
|
|
|
* 例如可以用于展示给用户选择不同文字样式的界面中,展示所有可选择的文字样式详情。
|
|
|
|
|
* @return 存储文字样式相关配置信息的列表,每个元素是一个Map,包含文字大小、文字间距等具体配置项。
|
|
|
|
|
*/
|
|
|
|
|
public static List<Map<String, Integer>> getTextKind() {
|
|
|
|
|
return textKind;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取存储文字绘制相关配置信息的列表,外部代码可利用此列表获取所有已定义的文字绘制相关配置内容(如不同的文字颜色和文字背景组合等信息),
|
|
|
|
|
* 例如用于在界面上展示不同文字绘制样式供用户选择,方便用户个性化阅读界面的视觉效果。
|
|
|
|
|
* @return 存储文字绘制相关配置信息的列表,每个元素是一个Map,包含文字颜色、文字背景等具体配置项。
|
|
|
|
|
*/
|
|
|
|
|
public static List<Map<String, Integer>> getTextDrawable() {
|
|
|
|
|
return textDrawable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取是否允许通过按键进行翻页操作的标识,外部代码可以根据这个标识来决定是否启用按键翻页相关的功能逻辑(如监听按键事件进行翻页等操作),满足用户不同的操作习惯需求。
|
|
|
|
|
* @return 布尔值,true表示允许按键翻页,false表示禁止按键翻页。
|
|
|
|
|
*/
|
|
|
|
|
public Boolean getCanKeyTurn() {
|
|
|
|
|
return canKeyTurn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCanKeyTurn(Boolean canKeyTurn) {
|
|
|
|
|
this.canKeyTurn = canKeyTurn;
|
|
|
|
|
SharedPreferences.Editor editor = preference.edit();
|
|
|
|
|
editor.putBoolean("canKeyTurn",canKeyTurn);
|
|
|
|
|
editor.commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean getCanClickTurn() {
|
|
|
|
|
return canClickTurn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCanClickTurn(Boolean canClickTurn) {
|
|
|
|
|
this.canClickTurn = canClickTurn;
|
|
|
|
|
SharedPreferences.Editor editor = preference.edit();
|
|
|
|
|
editor.putBoolean("canClickTurn",canClickTurn);
|
|
|
|
|
editor.commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置是否允许通过按键进行翻页操作,将传入的布尔值保存到SharedPreferences中实现持久化存储,用于根据用户需求改变按键翻页的可用性,
|
|
|
|
|
* 同时更新
|