parent
a216411b09
commit
31c16a6004
Binary file not shown.
@ -0,0 +1,74 @@ |
||||
package xyz.fycz.myreader.creator; |
||||
|
||||
import android.content.Context; |
||||
import android.content.DialogInterface; |
||||
import android.widget.Button; |
||||
import android.widget.ListView; |
||||
import androidx.appcompat.app.AlertDialog; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2020/8/29 21:08 |
||||
*/ |
||||
public class MultiChoiceDialog { |
||||
ListView itemList = null; |
||||
Button selectAll = null; |
||||
int checkedCount; |
||||
|
||||
public AlertDialog create(Context context, String title, CharSequence[] items, |
||||
boolean[] checkedItems, int checkedCount, |
||||
DialogInterface.OnClickListener positiveListener, |
||||
DialogInterface.OnClickListener negativeListener, |
||||
DialogCreator.OnMultiDialogListener onMultiDialogListener) { |
||||
this.checkedCount = checkedCount; |
||||
int itemsCount = checkedItems.length; |
||||
AlertDialog multiChoiceDialog = new AlertDialog.Builder(context) |
||||
.setTitle(title) |
||||
.setMultiChoiceItems(items, checkedItems, (dialog, which, isChecked) -> { |
||||
onMultiDialogListener.onItemClick(dialog, which, isChecked); |
||||
if(isChecked){ |
||||
this.checkedCount++; |
||||
}else { |
||||
this.checkedCount--; |
||||
} |
||||
if (this.checkedCount == itemsCount) { |
||||
selectAll.setText("取消全选"); |
||||
} else { |
||||
selectAll.setText("全选"); |
||||
} |
||||
}) |
||||
.setPositiveButton("确定", positiveListener) |
||||
.setNegativeButton("取消", negativeListener) |
||||
.setNeutralButton("全选", null).create(); |
||||
|
||||
multiChoiceDialog.show(); |
||||
itemList = multiChoiceDialog.getListView(); |
||||
selectAll = multiChoiceDialog.getButton(DialogInterface.BUTTON_NEUTRAL); |
||||
if (this.checkedCount == itemsCount) { |
||||
selectAll.setText("取消全选"); |
||||
} else { |
||||
selectAll.setText("全选"); |
||||
} |
||||
selectAll.setOnClickListener(v1 -> { |
||||
if (this.checkedCount == itemsCount) { |
||||
selectAll.setText("全选"); |
||||
this.checkedCount = 0; |
||||
for (int i = 0; i < itemsCount; i++) { |
||||
checkedItems[i] = false; |
||||
itemList.setItemChecked(i, false); |
||||
} |
||||
onMultiDialogListener.onSelectAll(false); |
||||
} else { |
||||
this.checkedCount = itemsCount; |
||||
selectAll.setText("取消全选"); |
||||
for (int i = 0; i < itemsCount; i++) { |
||||
checkedItems[i] = true; |
||||
itemList.setItemChecked(i, true); |
||||
} |
||||
onMultiDialogListener.onSelectAll(true); |
||||
} |
||||
}); |
||||
|
||||
return multiChoiceDialog; |
||||
} |
||||
} |
@ -1,164 +0,0 @@ |
||||
package xyz.fycz.myreader.greendao.util; |
||||
|
||||
import android.database.Cursor; |
||||
import android.text.TextUtils; |
||||
import android.util.Log; |
||||
|
||||
import xyz.fycz.myreader.greendao.gen.DaoMaster; |
||||
|
||||
import org.greenrobot.greendao.AbstractDao; |
||||
import org.greenrobot.greendao.database.Database; |
||||
import org.greenrobot.greendao.internal.DaoConfig; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
|
||||
public class GreenDaoUpgrade { |
||||
private static final String CONVERSION_CLASS_NOT_FOUND_EXCEPTION = "MIGRATION HELPER - CLASS DOESN'T MATCH WITH THE CURRENT PARAMETERS"; |
||||
private static GreenDaoUpgrade instance; |
||||
|
||||
public static GreenDaoUpgrade getInstance() { |
||||
if (instance == null) { |
||||
instance = new GreenDaoUpgrade(); |
||||
} |
||||
return instance; |
||||
} |
||||
|
||||
private static List<String> getColumns(Database db, String tableName) { |
||||
List<String> columns = new ArrayList<>(); |
||||
Cursor cursor = null; |
||||
try { |
||||
cursor = db.rawQuery("SELECT * FROM " + tableName + " limit 1", null); |
||||
if (cursor != null) { |
||||
columns = new ArrayList<>(Arrays.asList(cursor.getColumnNames())); |
||||
} |
||||
} catch (Exception e) { |
||||
Log.v(tableName, e.getMessage(), e); |
||||
e.printStackTrace(); |
||||
} finally { |
||||
if (cursor != null) |
||||
cursor.close(); |
||||
} |
||||
return columns; |
||||
} |
||||
|
||||
public void migrate(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
generateTempTables(db, daoClasses); |
||||
DaoMaster.dropAllTables(db, true); |
||||
DaoMaster.createAllTables(db, false); |
||||
restoreData(db, daoClasses); |
||||
} |
||||
|
||||
private void generateTempTables(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
for (int i = 0; i < daoClasses.length; i++) { |
||||
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]); |
||||
|
||||
String divider = ""; |
||||
String tableName = daoConfig.tablename; |
||||
String tempTableName = daoConfig.tablename.concat("_TEMP"); |
||||
ArrayList<String> properties = new ArrayList<>(); |
||||
|
||||
StringBuilder createTableStringBuilder = new StringBuilder(); |
||||
|
||||
createTableStringBuilder.append("CREATE TABLE ").append(tempTableName).append(" ("); |
||||
|
||||
for (int j = 0; j < daoConfig.properties.length; j++) { |
||||
String columnName = daoConfig.properties[j].columnName; |
||||
|
||||
if (getColumns(db, tableName).contains(columnName)) { |
||||
properties.add(columnName); |
||||
|
||||
String type = null; |
||||
|
||||
try { |
||||
type = getTypeByClass(daoConfig.properties[j].type); |
||||
} catch (Exception exception) { |
||||
exception.printStackTrace(); |
||||
} |
||||
|
||||
createTableStringBuilder.append(divider).append(columnName).append(" ").append(type); |
||||
|
||||
if (daoConfig.properties[j].primaryKey) { |
||||
createTableStringBuilder.append(" PRIMARY KEY"); |
||||
} |
||||
|
||||
divider = ","; |
||||
} |
||||
} |
||||
createTableStringBuilder.append(");"); |
||||
|
||||
db.execSQL(createTableStringBuilder.toString()); |
||||
|
||||
StringBuilder insertTableStringBuilder = new StringBuilder(); |
||||
|
||||
insertTableStringBuilder.append("INSERT INTO ").append(tempTableName).append(" ("); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(") SELECT "); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(" FROM ").append(tableName).append(";"); |
||||
|
||||
db.execSQL(insertTableStringBuilder.toString()); |
||||
} |
||||
} |
||||
|
||||
private void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
for (int i = 0; i < daoClasses.length; i++) { |
||||
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]); |
||||
|
||||
String tableName = daoConfig.tablename; |
||||
String tempTableName = daoConfig.tablename.concat("_TEMP"); |
||||
ArrayList<String> properties = new ArrayList(); |
||||
ArrayList<String> propertiesQuery = new ArrayList(); |
||||
for (int j = 0; j < daoConfig.properties.length; j++) { |
||||
String columnName = daoConfig.properties[j].columnName; |
||||
|
||||
if (getColumns(db, tempTableName).contains(columnName)) { |
||||
properties.add(columnName); |
||||
propertiesQuery.add(columnName); |
||||
} else { |
||||
try { |
||||
if (getTypeByClass(daoConfig.properties[j].type).equals("INTEGER")) { |
||||
propertiesQuery.add("0 as " + columnName); |
||||
properties.add(columnName); |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
StringBuilder insertTableStringBuilder = new StringBuilder(); |
||||
|
||||
insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" ("); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(") SELECT "); |
||||
insertTableStringBuilder.append(TextUtils.join(",", propertiesQuery)); |
||||
insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";"); |
||||
|
||||
StringBuilder dropTableStringBuilder = new StringBuilder(); |
||||
|
||||
dropTableStringBuilder.append("DROP TABLE ").append(tempTableName); |
||||
|
||||
db.execSQL(insertTableStringBuilder.toString()); |
||||
db.execSQL(dropTableStringBuilder.toString()); |
||||
} |
||||
} |
||||
|
||||
private String getTypeByClass(Class<?> type) throws Exception { |
||||
if (type.equals(String.class)) { |
||||
return "TEXT"; |
||||
} |
||||
if (type.equals(Long.class) || type.equals(Integer.class) || type.equals(long.class) || type.equals(int.class)) { |
||||
return "INTEGER"; |
||||
} |
||||
if (type.equals(Boolean.class) || type.equals(boolean.class)) { |
||||
return "BOOLEAN"; |
||||
} |
||||
|
||||
Exception exception = new Exception(CONVERSION_CLASS_NOT_FOUND_EXCEPTION.concat(" - Class: ").concat(type.toString())); |
||||
exception.printStackTrace(); |
||||
throw exception; |
||||
} |
||||
} |
@ -0,0 +1,411 @@ |
||||
package xyz.fycz.myreader.ui.activity; |
||||
|
||||
import android.content.DialogInterface; |
||||
import android.content.Intent; |
||||
import android.os.Bundle; |
||||
import android.view.View; |
||||
import android.widget.*; |
||||
import androidx.appcompat.app.AlertDialog; |
||||
import androidx.appcompat.app.AppCompatActivity; |
||||
import androidx.appcompat.widget.SwitchCompat; |
||||
import androidx.appcompat.widget.Toolbar; |
||||
import butterknife.BindView; |
||||
import xyz.fycz.myreader.R; |
||||
import xyz.fycz.myreader.application.MyApplication; |
||||
import xyz.fycz.myreader.application.SysManager; |
||||
import xyz.fycz.myreader.base.BaseActivity2; |
||||
import xyz.fycz.myreader.common.APPCONST; |
||||
import xyz.fycz.myreader.creator.DialogCreator; |
||||
import xyz.fycz.myreader.creator.MultiChoiceDialog; |
||||
import xyz.fycz.myreader.entity.Setting; |
||||
import xyz.fycz.myreader.greendao.entity.Book; |
||||
import xyz.fycz.myreader.greendao.service.BookService; |
||||
import xyz.fycz.myreader.util.ToastUtils; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
|
||||
/** |
||||
* Created by newbiechen on 17-6-6. |
||||
* 阅读界面的更多设置 |
||||
*/ |
||||
|
||||
public class MoreSettingActivity extends BaseActivity2 { |
||||
@BindView(R.id.more_setting_rl_volume) |
||||
RelativeLayout mRlVolume; |
||||
@BindView(R.id.more_setting_sc_volume) |
||||
SwitchCompat mScVolume; |
||||
@BindView(R.id.more_setting_rl_reset_screen) |
||||
RelativeLayout mRlResetScreen; |
||||
@BindView(R.id.more_setting_sc_reset_screen) |
||||
Spinner mScResetScreen; |
||||
@BindView(R.id.more_setting_rl_auto_refresh) |
||||
RelativeLayout mRlAutoRefresh; |
||||
@BindView(R.id.more_setting_sc_auto_refresh) |
||||
SwitchCompat mScAutoRefresh; |
||||
@BindView(R.id.more_setting_ll_close_refresh) |
||||
LinearLayout mLlCloseRefresh; |
||||
@BindView(R.id.more_setting_iv_match_chapter_tip) |
||||
ImageView mIvMatchChapterTip; |
||||
@BindView(R.id.more_setting_rl_match_chapter) |
||||
RelativeLayout mRlMatchChapter; |
||||
@BindView(R.id.more_setting_sc_match_chapter) |
||||
SwitchCompat mScMatchChapter; |
||||
@BindView(R.id.more_setting_rl_match_chapter_suitability) |
||||
RelativeLayout mRlMatchChapterSuitability; |
||||
@BindView(R.id.more_setting_sc_match_chapter_suitability) |
||||
Spinner mScMatchChapterSuitability; |
||||
@BindView(R.id.more_setting_rl_cathe_gap) |
||||
RelativeLayout mRlCatheGap; |
||||
@BindView(R.id.more_setting_sc_cathe_gap) |
||||
Spinner mScCatheGap; |
||||
@BindView(R.id.more_setting_rl_delete_cathe) |
||||
RelativeLayout mRlDeleteCathe; |
||||
@BindView(R.id.more_setting_ll_download_all) |
||||
LinearLayout mLlDownloadAll; |
||||
private Setting mSetting; |
||||
private boolean isVolumeTurnPage; |
||||
private int resetScreenTime; |
||||
private boolean autoRefresh; |
||||
private boolean isMatchChapter; |
||||
private float matchChapterSuitability; |
||||
private int catheCap; |
||||
|
||||
private ArrayList<Book> mBooks; |
||||
int booksCount; |
||||
CharSequence[] mBooksName; |
||||
|
||||
//选择禁用更新书籍对话框
|
||||
private AlertDialog mCloseRefreshDia; |
||||
//选择一键缓存书籍对话框
|
||||
private AlertDialog mDownloadAllDia; |
||||
|
||||
@Override |
||||
protected int getContentId() { |
||||
return R.layout.activity_more_setting; |
||||
} |
||||
|
||||
@Override |
||||
protected void initData(Bundle savedInstanceState) { |
||||
super.initData(savedInstanceState); |
||||
mSetting = SysManager.getSetting(); |
||||
isVolumeTurnPage = mSetting.isVolumeTurnPage(); |
||||
resetScreenTime = mSetting.getResetScreen(); |
||||
isMatchChapter = mSetting.isMatchChapter(); |
||||
matchChapterSuitability = mSetting.getMatchChapterSuitability(); |
||||
catheCap = mSetting.getCatheGap(); |
||||
autoRefresh = mSetting.isRefreshWhenStart(); |
||||
} |
||||
|
||||
@Override |
||||
protected void setUpToolbar(Toolbar toolbar) { |
||||
super.setUpToolbar(toolbar); |
||||
setStatusBarColor(R.color.colorPrimary, true); |
||||
getSupportActionBar().setTitle("设置"); |
||||
} |
||||
|
||||
@Override |
||||
protected void initWidget() { |
||||
super.initWidget(); |
||||
initSwitchStatus(); |
||||
if (isMatchChapter) { |
||||
mRlMatchChapterSuitability.setVisibility(View.VISIBLE); |
||||
} else { |
||||
mRlMatchChapterSuitability.setVisibility(View.GONE); |
||||
} |
||||
} |
||||
|
||||
private void initSwitchStatus() { |
||||
mScVolume.setChecked(isVolumeTurnPage); |
||||
mScMatchChapter.setChecked(isMatchChapter); |
||||
mScAutoRefresh.setChecked(autoRefresh); |
||||
} |
||||
|
||||
@Override |
||||
protected void initClick() { |
||||
super.initClick(); |
||||
mRlVolume.setOnClickListener( |
||||
(v) -> { |
||||
if (isVolumeTurnPage) { |
||||
isVolumeTurnPage = false; |
||||
} else { |
||||
isVolumeTurnPage = true; |
||||
} |
||||
mScVolume.setChecked(isVolumeTurnPage); |
||||
mSetting.setVolumeTurnPage(isVolumeTurnPage); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
); |
||||
mRlAutoRefresh.setOnClickListener( |
||||
(v) -> { |
||||
if (autoRefresh) { |
||||
autoRefresh = false; |
||||
} else { |
||||
autoRefresh = true; |
||||
} |
||||
mScAutoRefresh.setChecked(autoRefresh); |
||||
mSetting.setRefreshWhenStart(autoRefresh); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
); |
||||
|
||||
mLlCloseRefresh.setOnClickListener(v -> { |
||||
MyApplication.runOnUiThread(() -> { |
||||
if (mCloseRefreshDia != null){ |
||||
mCloseRefreshDia.show(); |
||||
return; |
||||
} |
||||
|
||||
initmBooks(); |
||||
|
||||
if (mBooks.size() == 0){ |
||||
ToastUtils.showWarring("当前书架没有支持禁用更新的书籍!"); |
||||
return; |
||||
} |
||||
|
||||
boolean[] isCloseRefresh = new boolean[booksCount]; |
||||
int crBookCount = 0; |
||||
|
||||
for (int i = 0; i < booksCount; i++) { |
||||
Book book = mBooks.get(i); |
||||
isCloseRefresh[i] = book.getIsCloseUpdate(); |
||||
if (isCloseRefresh[i]){ |
||||
crBookCount++; |
||||
} |
||||
} |
||||
|
||||
mCloseRefreshDia = new MultiChoiceDialog().create(this, "禁用更新的书籍", |
||||
mBooksName, isCloseRefresh, crBookCount, (dialog, which) -> { |
||||
BookService.getInstance().updateBooks(mBooks); |
||||
}, null, new DialogCreator.OnMultiDialogListener() { |
||||
@Override |
||||
public void onItemClick(DialogInterface dialog, int which, boolean isChecked) { |
||||
mBooks.get(which).setIsCloseUpdate(isChecked); |
||||
} |
||||
|
||||
@Override |
||||
public void onSelectAll(boolean isSelectAll) { |
||||
for (Book book : mBooks){ |
||||
book.setIsCloseUpdate(isSelectAll); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
}); |
||||
}); |
||||
|
||||
mRlMatchChapter.setOnClickListener( |
||||
(v) -> { |
||||
if (isMatchChapter) { |
||||
isMatchChapter = false; |
||||
mRlMatchChapterSuitability.setVisibility(View.GONE); |
||||
} else { |
||||
isMatchChapter = true; |
||||
mRlMatchChapterSuitability.setVisibility(View.VISIBLE); |
||||
} |
||||
mScMatchChapter.setChecked(isMatchChapter); |
||||
mSetting.setMatchChapter(isMatchChapter); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
); |
||||
|
||||
|
||||
mLlDownloadAll.setOnClickListener(v -> { |
||||
MyApplication.runOnUiThread(() -> { |
||||
if (mDownloadAllDia != null){ |
||||
mDownloadAllDia.show(); |
||||
return; |
||||
} |
||||
|
||||
initmBooks(); |
||||
|
||||
if (mBooks.size() == 0){ |
||||
ToastUtils.showWarring("当前书架没有支持缓存的书籍!"); |
||||
return; |
||||
} |
||||
|
||||
int booksCount = mBooks.size(); |
||||
CharSequence[] mBooksName = new CharSequence[booksCount]; |
||||
boolean[] isDownloadAll = new boolean[booksCount]; |
||||
int daBookCount = 0; |
||||
for (int i = 0; i < booksCount; i++) { |
||||
Book book = mBooks.get(i); |
||||
mBooksName[i] = book.getName(); |
||||
isDownloadAll[i] = book.getIsDownLoadAll(); |
||||
if (isDownloadAll[i]){ |
||||
daBookCount++; |
||||
} |
||||
} |
||||
|
||||
mDownloadAllDia = new MultiChoiceDialog().create(this, "一键缓存的书籍", |
||||
mBooksName, isDownloadAll, daBookCount, (dialog, which) -> { |
||||
BookService.getInstance().updateBooks(mBooks); |
||||
}, null, new DialogCreator.OnMultiDialogListener() { |
||||
@Override |
||||
public void onItemClick(DialogInterface dialog, int which, boolean isChecked) { |
||||
mBooks.get(which).setIsDownLoadAll(isChecked); |
||||
} |
||||
|
||||
@Override |
||||
public void onSelectAll(boolean isSelectAll) { |
||||
for (Book book : mBooks){ |
||||
book.setIsDownLoadAll(isSelectAll); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
}); |
||||
}); |
||||
|
||||
mIvMatchChapterTip.setOnClickListener(v -> DialogCreator.createTipDialog(this, "智能匹配", getString(R.string.match_chapter_tip))); |
||||
|
||||
mRlMatchChapterSuitability.setOnClickListener(v -> mScMatchChapterSuitability.performClick()); |
||||
mRlResetScreen.setOnClickListener(v -> mScResetScreen.performClick()); |
||||
mRlCatheGap.setOnClickListener(v -> mScCatheGap.performClick()); |
||||
|
||||
mRlDeleteCathe.setOnClickListener(v -> { |
||||
DialogCreator.createCommonDialog(this, "清除缓存", "确定要清除全部书籍缓存吗?", |
||||
true, (dialog, which) -> { |
||||
BookService.getInstance().deleteAllBookCathe(); |
||||
ToastUtils.showSuccess("清除缓存成功!"); |
||||
}, null); |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
initSpinner(); |
||||
} |
||||
|
||||
private void initSpinner() { |
||||
// initSwitchStatus() be called earlier than onCreate(), so setSelection() won't work
|
||||
ArrayAdapter<CharSequence> resetScreenAdapter = ArrayAdapter.createFromResource(this, |
||||
R.array.reset_screen_time, android.R.layout.simple_spinner_item); |
||||
resetScreenAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
mScResetScreen.setAdapter(resetScreenAdapter); |
||||
|
||||
int resetScreenSelection = 0; |
||||
switch (resetScreenTime) { |
||||
case 0: |
||||
resetScreenSelection = 0; |
||||
break; |
||||
case 1: |
||||
resetScreenSelection = 1; |
||||
break; |
||||
case 3: |
||||
resetScreenSelection = 2; |
||||
break; |
||||
case 5: |
||||
resetScreenSelection = 3; |
||||
break; |
||||
} |
||||
mScResetScreen.setSelection(resetScreenSelection); |
||||
mScResetScreen.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { |
||||
@Override |
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
||||
switch (position) { |
||||
case 0: |
||||
resetScreenTime = 0; |
||||
break; |
||||
case 1: |
||||
resetScreenTime = 1; |
||||
break; |
||||
case 2: |
||||
resetScreenTime = 3; |
||||
break; |
||||
case 3: |
||||
resetScreenTime = 5; |
||||
break; |
||||
} |
||||
mSetting.setResetScreen(resetScreenTime); |
||||
SysManager.saveSetting(mSetting); |
||||
Intent result = new Intent(); |
||||
result.putExtra(APPCONST.RESULT_RESET_SCREEN, resetScreenTime); |
||||
setResult(AppCompatActivity.RESULT_OK, result); |
||||
} |
||||
|
||||
@Override |
||||
public void onNothingSelected(AdapterView<?> parent) { |
||||
} |
||||
}); |
||||
|
||||
|
||||
ArrayAdapter<CharSequence> matchSuiAdapter = ArrayAdapter.createFromResource(this, |
||||
R.array.match_chapter_suitability, android.R.layout.simple_spinner_item); |
||||
matchSuiAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
mScMatchChapterSuitability.setAdapter(matchSuiAdapter); |
||||
|
||||
if (matchChapterSuitability == 0.0) { |
||||
matchChapterSuitability = 0.7f; |
||||
mSetting.setMatchChapterSuitability(matchChapterSuitability); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
int matchSuiSelection = (int) (matchChapterSuitability * 10 - 5); |
||||
|
||||
mScMatchChapterSuitability.setSelection(matchSuiSelection); |
||||
|
||||
mScMatchChapterSuitability.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { |
||||
@Override |
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
||||
matchChapterSuitability = (position + 5) * 1f / 10f; |
||||
mSetting.setMatchChapterSuitability(matchChapterSuitability); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
|
||||
@Override |
||||
public void onNothingSelected(AdapterView<?> parent) { |
||||
} |
||||
}); |
||||
|
||||
|
||||
ArrayAdapter<CharSequence> catheGapAdapter = ArrayAdapter.createFromResource(this, |
||||
R.array.cathe_chapter_gap, android.R.layout.simple_spinner_item); |
||||
catheGapAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
||||
mScCatheGap.setAdapter(catheGapAdapter); |
||||
|
||||
if (catheCap == 0) { |
||||
catheCap = 150; |
||||
mSetting.setCatheGap(catheCap); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
int catheGapSelection = catheCap / 50 - 1; |
||||
|
||||
mScCatheGap.setSelection(catheGapSelection); |
||||
|
||||
mScCatheGap.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { |
||||
@Override |
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
||||
catheCap = (position + 1) * 50; |
||||
mSetting.setCatheGap(catheCap); |
||||
SysManager.saveSetting(mSetting); |
||||
} |
||||
|
||||
@Override |
||||
public void onNothingSelected(AdapterView<?> parent) { |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void initmBooks(){ |
||||
if (mBooks != null) { |
||||
return; |
||||
} |
||||
mBooks = (ArrayList<Book>) BookService.getInstance().getAllBooks(); |
||||
|
||||
Iterator<Book> mBooksIter = mBooks.iterator(); |
||||
while (mBooksIter.hasNext()){ |
||||
Book book = mBooksIter.next(); |
||||
if ("本地书籍".equals(book.getType())) { |
||||
mBooksIter.remove(); |
||||
} |
||||
} |
||||
booksCount = mBooks.size(); |
||||
mBooksName = new CharSequence[booksCount]; |
||||
|
||||
for (int i = 0; i < booksCount; i++) { |
||||
Book book = mBooks.get(i); |
||||
mBooksName[i] = book.getName(); |
||||
} |
||||
} |
||||
} |
@ -1,187 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import android.annotation.TargetApi; |
||||
import android.app.Notification; |
||||
import android.app.NotificationManager; |
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.content.pm.PackageManager; |
||||
import android.content.pm.ResolveInfo; |
||||
import android.os.Build; |
||||
|
||||
import java.lang.reflect.Field; |
||||
import java.lang.reflect.Method; |
||||
|
||||
|
||||
|
||||
public class BadgeUtil { |
||||
|
||||
/** |
||||
* Set badge count<br/> |
||||
* 针对 Samsung / xiaomi / sony 手机有效 |
||||
* @param context The context of the application package. |
||||
* @param count Badge count to be set |
||||
*/ |
||||
@TargetApi(16) |
||||
public static void setBadgeCount(Context context, int count) { |
||||
if (count <= 0) { |
||||
count = 0; |
||||
} else { |
||||
count = Math.max(0, Math.min(count, 99)); |
||||
} |
||||
|
||||
if (Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) { |
||||
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); |
||||
|
||||
Notification.Builder builder = new Notification.Builder(context).setContentTitle("title").setContentText("text"); |
||||
|
||||
Notification notification = builder.build(); |
||||
|
||||
try { |
||||
|
||||
Field field = notification.getClass().getDeclaredField("extraNotification"); |
||||
|
||||
Object extraNotification = field.get(notification); |
||||
|
||||
Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class); |
||||
|
||||
method.invoke(extraNotification, count); |
||||
|
||||
mNotificationManager.notify(0,notification); |
||||
sendToXiaoMi(notification, context, count); |
||||
|
||||
} catch (Exception e) { |
||||
|
||||
e.printStackTrace(); |
||||
|
||||
} |
||||
|
||||
|
||||
} else if (Build.MANUFACTURER.equalsIgnoreCase("sony")) { |
||||
sendToSony(context, count); |
||||
} else if (Build.MANUFACTURER.toLowerCase().contains("samsung")) { |
||||
sendToSamsumg(context, count); |
||||
} else { |
||||
// Toast.makeText(context, "Not Support", Toast.LENGTH_LONG).show();
|
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 向小米手机发送未读消息数广播 |
||||
* @param count |
||||
*/ |
||||
private static void sendToXiaoMi(Notification notification, Context context, int count) { |
||||
try { |
||||
// Class miuiNotificationClass = Class.forName("android.app.MiuiNotification");
|
||||
// Object miuiNotification = miuiNotificationClass.newInstance();
|
||||
// Field field = miuiNotification.getClass().getDeclaredField("messageCount");
|
||||
// field.setAccessible(true);
|
||||
// field.set(miuiNotification, String.valueOf(count == 0 ? "" : count)); // 设置信息数-->这种发送必须是miui 6才行
|
||||
|
||||
Field field = notification.getClass().getDeclaredField("extraNotification"); |
||||
|
||||
Object extraNotification = field.get(notification); |
||||
|
||||
Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class); |
||||
|
||||
method.invoke(extraNotification, count); |
||||
|
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
// miui 6之前的版本
|
||||
Intent localIntent = new Intent( |
||||
"android.intent.action.APPLICATION_MESSAGE_UPDATE"); |
||||
localIntent.putExtra( |
||||
"android.intent.extra.update_application_component_name", |
||||
context.getPackageName() + "/" + getLauncherClassName(context)); |
||||
localIntent.putExtra( |
||||
"android.intent.extra.update_application_message_text", String.valueOf(count == 0 ? "" : count)); |
||||
context.sendBroadcast(localIntent); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 向索尼手机发送未读消息数广播<br/> |
||||
* 据说:需添加权限:<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" /> [未验证] |
||||
* @param count |
||||
*/ |
||||
private static void sendToSony(Context context, int count){ |
||||
String launcherClassName = getLauncherClassName(context); |
||||
if (launcherClassName == null) { |
||||
return; |
||||
} |
||||
|
||||
boolean isShow = true; |
||||
if (count == 0) { |
||||
isShow = false; |
||||
} |
||||
Intent localIntent = new Intent(); |
||||
localIntent.setAction("com.sonyericsson.home.action.UPDATE_BADGE"); |
||||
localIntent.putExtra("com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE",isShow);//是否显示
|
||||
localIntent.putExtra("com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME",launcherClassName );//启动页
|
||||
localIntent.putExtra("com.sonyericsson.home.intent.extra.badge.MESSAGE", String.valueOf(count));//数字
|
||||
localIntent.putExtra("com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME", context.getPackageName());//包名
|
||||
context.sendBroadcast(localIntent); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 向三星手机发送未读消息数广播 |
||||
* @param count |
||||
*/ |
||||
private static void sendToSamsumg(Context context, int count){ |
||||
String launcherClassName = getLauncherClassName(context); |
||||
if (launcherClassName == null) { |
||||
return; |
||||
} |
||||
Intent intent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); |
||||
intent.putExtra("badge_count", count); |
||||
intent.putExtra("badge_count_package_name", context.getPackageName()); |
||||
intent.putExtra("badge_count_class_name", launcherClassName); |
||||
context.sendBroadcast(intent); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 重置、清除Badge未读显示数<br/> |
||||
* @param context |
||||
*/ |
||||
/* public static void resetBadgeCount(Notification notification,Context context) { |
||||
setBadgeCount(notification, context, 0); |
||||
}*/ |
||||
|
||||
|
||||
/** |
||||
* Retrieve launcher activity name of the application from the context |
||||
* |
||||
* @param context The context of the application package. |
||||
* @return launcher activity name of this application. From the |
||||
* "android:name" attribute. |
||||
*/ |
||||
private static String getLauncherClassName(Context context) { |
||||
PackageManager packageManager = context.getPackageManager(); |
||||
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN); |
||||
// To limit the components this Intent will resolve to, by setting an
|
||||
// explicit package name.
|
||||
intent.setPackage(context.getPackageName()); |
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER); |
||||
|
||||
// All Application must have 1 Activity at least.
|
||||
// Launcher activity must be found!
|
||||
ResolveInfo info = packageManager |
||||
.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); |
||||
|
||||
// get a ResolveInfo containing ACTION_MAIN, CATEGORY_LAUNCHER
|
||||
// if there is no Activity which has filtered by CATEGORY_DEFAULT
|
||||
if (info == null) { |
||||
info = packageManager.resolveActivity(intent, 0); |
||||
} |
||||
|
||||
return info.activityInfo.name; |
||||
} |
||||
} |
@ -1,8 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
|
||||
|
||||
|
||||
public class CacheFileNameHelper { |
||||
|
||||
} |
@ -1,31 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import java.io.UnsupportedEncodingException; |
||||
|
||||
|
||||
public class ChschtUtil { |
||||
|
||||
public static String big5ToChinese(String s) { |
||||
try { |
||||
if (s == null || s.equals("")) |
||||
return (""); |
||||
String newstring = null; |
||||
newstring = new String(s.getBytes("big5"), "gb2312"); |
||||
return (newstring); |
||||
} catch (UnsupportedEncodingException e) { |
||||
return (s); |
||||
} |
||||
} |
||||
|
||||
public static String ChineseTobig5(String s) { |
||||
try { |
||||
if (s == null || s.equals("")) |
||||
return (""); |
||||
String newstring = null; |
||||
newstring = new String(s.getBytes("gb2312"), "big5"); |
||||
return (newstring); |
||||
} catch (UnsupportedEncodingException e) { |
||||
return (s); |
||||
} |
||||
} |
||||
} |
@ -1,150 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
|
||||
public class GreenDaoUpgrade { |
||||
/*private static final String CONVERSION_CLASS_NOT_FOUND_EXCEPTION = "MIGRATION HELPER - CLASS DOESN'T MATCH WITH THE CURRENT PARAMETERS"; |
||||
private static GreenDaoUpgrade instance; |
||||
|
||||
public static GreenDaoUpgrade getInstance() { |
||||
if (instance == null) { |
||||
instance = new GreenDaoUpgrade(); |
||||
} |
||||
return instance; |
||||
} |
||||
|
||||
private static List<String> getColumns(Database db, String tableName) { |
||||
List<String> columns = new ArrayList<>(); |
||||
Cursor cursor = null; |
||||
try { |
||||
cursor = db.rawQuery("SELECT * FROM " + tableName + " limit 1", null); |
||||
if (cursor != null) { |
||||
columns = new ArrayList<>(Arrays.asList(cursor.getColumnNames())); |
||||
} |
||||
} catch (Exception e) { |
||||
Log.v(tableName, e.getMessage(), e); |
||||
e.printStackTrace(); |
||||
} finally { |
||||
if (cursor != null) |
||||
cursor.close(); |
||||
} |
||||
return columns; |
||||
} |
||||
|
||||
public void migrate(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
generateTempTables(db, daoClasses); |
||||
DaoMaster.dropAllTables(db, true); |
||||
DaoMaster.createAllTables(db, false); |
||||
restoreData(db, daoClasses); |
||||
} |
||||
|
||||
private void generateTempTables(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
for (int i = 0; i < daoClasses.length; i++) { |
||||
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]); |
||||
|
||||
String divider = ""; |
||||
String tableName = daoConfig.tablename; |
||||
String tempTableName = daoConfig.tablename.concat("_TEMP"); |
||||
ArrayList<String> properties = new ArrayList<>(); |
||||
|
||||
StringBuilder createTableStringBuilder = new StringBuilder(); |
||||
|
||||
createTableStringBuilder.append("CREATE TABLE ").append(tempTableName).append(" ("); |
||||
|
||||
for (int j = 0; j < daoConfig.properties.length; j++) { |
||||
String columnName = daoConfig.properties[j].columnName; |
||||
|
||||
if (getColumns(db, tableName).contains(columnName)) { |
||||
properties.add(columnName); |
||||
|
||||
String type = null; |
||||
|
||||
try { |
||||
type = getTypeByClass(daoConfig.properties[j].type); |
||||
} catch (Exception exception) { |
||||
exception.printStackTrace(); |
||||
} |
||||
|
||||
createTableStringBuilder.append(divider).append(columnName).append(" ").append(type); |
||||
|
||||
if (daoConfig.properties[j].primaryKey) { |
||||
createTableStringBuilder.append(" PRIMARY KEY"); |
||||
} |
||||
|
||||
divider = ","; |
||||
} |
||||
} |
||||
createTableStringBuilder.append(");"); |
||||
|
||||
db.execSQL(createTableStringBuilder.toString()); |
||||
|
||||
StringBuilder insertTableStringBuilder = new StringBuilder(); |
||||
|
||||
insertTableStringBuilder.append("INSERT INTO ").append(tempTableName).append(" ("); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(") SELECT "); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(" FROM ").append(tableName).append(";"); |
||||
|
||||
db.execSQL(insertTableStringBuilder.toString()); |
||||
} |
||||
} |
||||
|
||||
private void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { |
||||
for (int i = 0; i < daoClasses.length; i++) { |
||||
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]); |
||||
|
||||
String tableName = daoConfig.tablename; |
||||
String tempTableName = daoConfig.tablename.concat("_TEMP"); |
||||
ArrayList<String> properties = new ArrayList(); |
||||
ArrayList<String> propertiesQuery = new ArrayList(); |
||||
for (int j = 0; j < daoConfig.properties.length; j++) { |
||||
String columnName = daoConfig.properties[j].columnName; |
||||
|
||||
if (getColumns(db, tempTableName).contains(columnName)) { |
||||
properties.add(columnName); |
||||
propertiesQuery.add(columnName); |
||||
} else { |
||||
try { |
||||
if (getTypeByClass(daoConfig.properties[j].type).equals("INTEGER")) { |
||||
propertiesQuery.add("0 as " + columnName); |
||||
properties.add(columnName); |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
StringBuilder insertTableStringBuilder = new StringBuilder(); |
||||
|
||||
insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" ("); |
||||
insertTableStringBuilder.append(TextUtils.join(",", properties)); |
||||
insertTableStringBuilder.append(") SELECT "); |
||||
insertTableStringBuilder.append(TextUtils.join(",", propertiesQuery)); |
||||
insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";"); |
||||
|
||||
StringBuilder dropTableStringBuilder = new StringBuilder(); |
||||
|
||||
dropTableStringBuilder.append("DROP TABLE ").append(tempTableName); |
||||
|
||||
db.execSQL(insertTableStringBuilder.toString()); |
||||
db.execSQL(dropTableStringBuilder.toString()); |
||||
} |
||||
} |
||||
|
||||
private String getTypeByClass(Class<?> type) throws Exception { |
||||
if (type.equals(String.class)) { |
||||
return "TEXT"; |
||||
} |
||||
if (type.equals(Long.class) || type.equals(Integer.class) || type.equals(long.class) || type.equals(int.class)) { |
||||
return "INTEGER"; |
||||
} |
||||
if (type.equals(Boolean.class) || type.equals(boolean.class)) { |
||||
return "BOOLEAN"; |
||||
} |
||||
|
||||
Exception exception = new Exception(CONVERSION_CLASS_NOT_FOUND_EXCEPTION.concat(" - Class: ").concat(type.toString())); |
||||
exception.printStackTrace(); |
||||
throw exception; |
||||
}*/ |
||||
} |
@ -0,0 +1,121 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import android.os.Build; |
||||
import android.text.TextUtils; |
||||
|
||||
import java.io.BufferedReader; |
||||
import java.io.IOException; |
||||
import java.io.InputStreamReader; |
||||
|
||||
/** |
||||
* @ClassName: OSUtils |
||||
* @Description:Rom类型判断的工具类 |
||||
* @Author: dingchao |
||||
* @Date: 2018/11/8 15:25 |
||||
*/ |
||||
public class OSUtils { |
||||
public static final String ROM_MIUI = "MIUI"; |
||||
public static final String ROM_EMUI = "EMUI"; |
||||
public static final String ROM_FLYME = "FLYME"; |
||||
public static final String ROM_OPPO = "OPPO"; |
||||
public static final String ROM_SMARTISAN = "SMARTISAN"; |
||||
public static final String ROM_VIVO = "VIVO"; |
||||
public static final String ROM_QIKU = "QIKU"; |
||||
private static final String KEY_VERSION_MIUI = "ro.miui.ui.version.name"; |
||||
private static final String KEY_VERSION_EMUI = "ro.build.version.emui"; |
||||
private static final String KEY_VERSION_OPPO = "ro.build.version.opporom"; |
||||
private static final String KEY_VERSION_SMARTISAN = "ro.smartisan.version"; |
||||
private static final String KEY_VERSION_VIVO = "ro.vivo.os.version"; |
||||
private static String sName; |
||||
private static String sVersion; |
||||
|
||||
public static boolean isEmui() { |
||||
return check(ROM_EMUI); |
||||
} |
||||
|
||||
public static boolean isMiui() { |
||||
return check(ROM_MIUI); |
||||
} |
||||
|
||||
public static boolean isVivo() { |
||||
return check(ROM_VIVO); |
||||
} |
||||
|
||||
public static boolean isOppo() { |
||||
return check(ROM_OPPO); |
||||
} |
||||
|
||||
public static boolean isFlyme() { |
||||
return check(ROM_FLYME); |
||||
} |
||||
|
||||
public static boolean is360() { |
||||
return check(ROM_QIKU) || check("360"); |
||||
} |
||||
|
||||
public static boolean isSmartisan() { |
||||
return check(ROM_SMARTISAN); |
||||
} |
||||
|
||||
public static String getName() { |
||||
if (sName == null) { |
||||
check(""); |
||||
} |
||||
return sName; |
||||
} |
||||
|
||||
public static String getVersion() { |
||||
if (sVersion == null) { |
||||
check(""); |
||||
} |
||||
return sVersion; |
||||
} |
||||
|
||||
public static boolean check(String rom) { |
||||
if (sName != null) { |
||||
return sName.equals(rom); |
||||
} |
||||
if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) { |
||||
sName = ROM_MIUI; |
||||
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) { |
||||
sName = ROM_EMUI; |
||||
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) { |
||||
sName = ROM_OPPO; |
||||
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) { |
||||
sName = ROM_VIVO; |
||||
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) { |
||||
sName = ROM_SMARTISAN; |
||||
} else { |
||||
sVersion = Build.DISPLAY; |
||||
if (sVersion.toUpperCase().contains(ROM_FLYME)) { |
||||
sName = ROM_FLYME; |
||||
} else { |
||||
sVersion = Build.UNKNOWN; |
||||
sName = Build.MANUFACTURER.toUpperCase(); |
||||
} |
||||
} |
||||
return sName.equals(rom); |
||||
} |
||||
|
||||
public static String getProp(String name) { |
||||
String line = null; |
||||
BufferedReader input = null; |
||||
try { |
||||
Process p = Runtime.getRuntime().exec("getprop " + name); |
||||
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); |
||||
line = input.readLine(); |
||||
input.close(); |
||||
} catch (IOException ex) { |
||||
return null; |
||||
} finally { |
||||
if (input != null) { |
||||
try { |
||||
input.close(); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
return line; |
||||
} |
||||
} |
@ -1,71 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.Context; |
||||
import android.graphics.Color; |
||||
import android.os.Build; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.view.Window; |
||||
import android.view.WindowManager; |
||||
import xyz.fycz.myreader.R; |
||||
|
||||
/** |
||||
* Created by newbiechen on 17-4-15. |
||||
*/ |
||||
|
||||
public class StatusBarCompat |
||||
{ |
||||
private static final int INVALID_VAL = -1; |
||||
private static final int COLOR_DEFAULT = Color.parseColor("#20000000"); |
||||
|
||||
public static void compat(Activity activity, int statusColor) |
||||
{ |
||||
//在SDK21以上,设置StatusBar的Color
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) |
||||
{ |
||||
Window window = activity.getWindow(); |
||||
//取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
||||
//需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
||||
//设置状态栏颜色
|
||||
window.setStatusBarColor(statusColor); |
||||
} |
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) |
||||
{ |
||||
int color = COLOR_DEFAULT; |
||||
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content); |
||||
if (statusColor != INVALID_VAL) |
||||
{ |
||||
color = statusColor; |
||||
} |
||||
View statusBarView = activity.findViewById(R.id.status_bar); |
||||
if (statusBarView == null){ |
||||
statusBarView = new View(activity); |
||||
statusBarView.setId(R.id.status_bar); |
||||
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, |
||||
getStatusBarHeight(activity)); |
||||
contentView.addView(statusBarView, lp); |
||||
} |
||||
statusBarView.setBackgroundColor(color); |
||||
} |
||||
} |
||||
|
||||
public static void compat(Activity activity) |
||||
{ |
||||
compat(activity, INVALID_VAL); |
||||
} |
||||
|
||||
|
||||
public static int getStatusBarHeight(Context context) |
||||
{ |
||||
int result = 0; |
||||
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); |
||||
if (resourceId > 0) |
||||
{ |
||||
result = context.getResources().getDimensionPixelSize(resourceId); |
||||
} |
||||
return result; |
||||
} |
||||
} |
@ -0,0 +1,208 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.annotation.TargetApi; |
||||
import android.app.Activity; |
||||
import android.content.Context; |
||||
import android.graphics.Color; |
||||
import android.os.Build; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.view.Window; |
||||
import android.view.WindowManager; |
||||
import androidx.annotation.IntDef; |
||||
import androidx.appcompat.app.AppCompatActivity; |
||||
|
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.reflect.Field; |
||||
import java.lang.reflect.Method; |
||||
|
||||
/** |
||||
* @ClassName: StatusBarUtil |
||||
* @Description: |
||||
* @Author: dingchao |
||||
* @Date: 2018/11/8 15:15 |
||||
*/ |
||||
public class StatusBarUtil { |
||||
public final static int TYPE_MIUI = 0; |
||||
public final static int TYPE_FLYME = 1; |
||||
public final static int TYPE_M = 3;//6.0
|
||||
|
||||
@IntDef({TYPE_MIUI, TYPE_FLYME, TYPE_M}) |
||||
@Retention(RetentionPolicy.SOURCE) |
||||
@interface ViewType { |
||||
} |
||||
|
||||
/** |
||||
* 修改状态栏颜色,支持4.4以上版本 |
||||
* |
||||
* @param colorId 颜色 |
||||
*/ |
||||
public static void setStatusBarColor(AppCompatActivity activity, int colorId) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
||||
Window window = activity.getWindow(); |
||||
window.setStatusBarColor(colorId); |
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
||||
//使用SystemBarTintManager,需要先将状态栏设置为透明
|
||||
setTranslucentStatus(activity); |
||||
SystemBarTintManager systemBarTintManager = new SystemBarTintManager(activity); |
||||
systemBarTintManager.setStatusBarTintEnabled(true);//显示状态栏
|
||||
systemBarTintManager.setStatusBarTintColor(colorId);//设置状态栏颜色
|
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置状态栏透明 |
||||
*/ |
||||
@TargetApi(19) |
||||
public static void setTranslucentStatus(Activity activity) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
||||
//5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色
|
||||
Window window = activity.getWindow(); |
||||
View decorView = window.getDecorView(); |
||||
//两个 flag 要结合使用,表示让应用的主体内容占用系统状态栏的空间
|
||||
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; |
||||
decorView.setSystemUiVisibility(option); |
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
||||
window.setStatusBarColor(Color.TRANSPARENT); |
||||
//导航栏颜色也可以正常设置
|
||||
//window.setNavigationBarColor(Color.TRANSPARENT);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
||||
Window window = activity.getWindow(); |
||||
WindowManager.LayoutParams attributes = window.getAttributes(); |
||||
int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; |
||||
attributes.flags |= flagTranslucentStatus; |
||||
//int flagTranslucentNavigation = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; //attributes.flags |= flagTranslucentNavigation;
|
||||
window.setAttributes(attributes); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 代码实现android:fitsSystemWindows |
||||
* |
||||
* @param activity |
||||
*/ |
||||
public static void setRootViewFitsSystemWindows(Activity activity, boolean fitSystemWindows) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
||||
ViewGroup winContent = (ViewGroup) activity.findViewById(android.R.id.content); |
||||
if (winContent.getChildCount() > 0) { |
||||
ViewGroup rootView = (ViewGroup) winContent.getChildAt(0); |
||||
if (rootView != null) { |
||||
rootView.setFitsSystemWindows(fitSystemWindows); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置状态栏深色浅色切换 |
||||
*/ |
||||
public static boolean setStatusBarDarkTheme(Activity activity, boolean dark) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
||||
setStatusBarFontIconDark(activity, TYPE_M, dark); |
||||
} else if (OSUtils.isMiui()) { |
||||
setStatusBarFontIconDark(activity, TYPE_MIUI, dark); |
||||
} else if (OSUtils.isFlyme()) { |
||||
setStatusBarFontIconDark(activity, TYPE_FLYME, dark); |
||||
} else {//其他情况
|
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 设置 状态栏深色浅色切换 |
||||
*/ |
||||
public static boolean setStatusBarFontIconDark(Activity activity, @ViewType int type, boolean dark) { |
||||
switch (type) { |
||||
case TYPE_MIUI: |
||||
return setMiuiUI(activity, dark); |
||||
case TYPE_FLYME: |
||||
return setFlymeUI(activity, dark); |
||||
case TYPE_M: |
||||
default: |
||||
return setCommonUI(activity, dark); |
||||
} |
||||
} |
||||
|
||||
//设置6.0 状态栏深色浅色切换
|
||||
public static boolean setCommonUI(Activity activity, boolean dark) { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
||||
View decorView = activity.getWindow().getDecorView(); |
||||
if (decorView != null) { |
||||
int vis = decorView.getSystemUiVisibility(); |
||||
if (dark) { |
||||
vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; |
||||
} else { |
||||
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; |
||||
} |
||||
if (decorView.getSystemUiVisibility() != vis) { |
||||
decorView.setSystemUiVisibility(vis); |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
//设置Flyme 状态栏深色浅色切换
|
||||
public static boolean setFlymeUI(Activity activity, boolean dark) { |
||||
try { |
||||
Window window = activity.getWindow(); |
||||
WindowManager.LayoutParams lp = window.getAttributes(); |
||||
Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON"); |
||||
Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags"); |
||||
darkFlag.setAccessible(true); |
||||
meizuFlags.setAccessible(true); |
||||
int bit = darkFlag.getInt(null); |
||||
int value = meizuFlags.getInt(lp); |
||||
if (dark) { |
||||
value |= bit; |
||||
} else { |
||||
value &= ~bit; |
||||
} |
||||
meizuFlags.setInt(lp, value); |
||||
window.setAttributes(lp); |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
//设置MIUI 状态栏深色浅色切换
|
||||
public static boolean setMiuiUI(Activity activity, boolean dark) { |
||||
try { |
||||
Window window = activity.getWindow(); |
||||
Class<?> clazz = activity.getWindow().getClass(); |
||||
@SuppressLint("PrivateApi") Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams"); |
||||
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE"); |
||||
int darkModeFlag = field.getInt(layoutParams); |
||||
Method extraFlagField = clazz.getDeclaredMethod("setExtraFlags", int.class, int.class); |
||||
extraFlagField.setAccessible(true); |
||||
if (dark) { //状态栏亮色且黑色字体.
|
||||
extraFlagField.invoke(window, darkModeFlag, darkModeFlag); |
||||
} else { |
||||
extraFlagField.invoke(window, 0, darkModeFlag); |
||||
} |
||||
return true; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
//获取状态栏高度
|
||||
public static int getStatusBarHeight(Context context) { |
||||
int result = 0; |
||||
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); |
||||
if (resourceId > 0) { |
||||
result = context.getResources().getDimensionPixelSize(resourceId); |
||||
} |
||||
return result; |
||||
} |
||||
} |
@ -1,21 +0,0 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import android.widget.Toast; |
||||
|
||||
import xyz.fycz.myreader.application.MyApplication; |
||||
|
||||
|
||||
|
||||
|
||||
public class TextHelper { |
||||
|
||||
public static void showText(final String text){ |
||||
|
||||
MyApplication.runOnUiThread(() -> Toast.makeText(MyApplication.getApplication(),text, Toast.LENGTH_SHORT).show()); |
||||
} |
||||
|
||||
public static void showLongText(final String text){ |
||||
|
||||
MyApplication.runOnUiThread(() -> Toast.makeText(MyApplication.getApplication(),text, Toast.LENGTH_LONG).show()); |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
package xyz.fycz.myreader.util; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import es.dmoral.toasty.Toasty; |
||||
import xyz.fycz.myreader.R; |
||||
import xyz.fycz.myreader.application.MyApplication; |
||||
|
||||
/** |
||||
* Toast工具类:对Toasty的二次封装 |
||||
* https://github.com/GrenderG/Toasty
|
||||
*/ |
||||
public class ToastUtils { |
||||
|
||||
static { |
||||
Toasty.Config.getInstance().setTextSize(14).apply(); |
||||
} |
||||
|
||||
public static void show(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.custom(MyApplication.getmContext(), msg, |
||||
MyApplication.getmContext().getDrawable(R.drawable.ic_smile_face), |
||||
MyApplication.getmContext().getColor(R.color.toast_default), |
||||
MyApplication.getmContext().getColor(R.color.white), |
||||
Toasty.LENGTH_SHORT, true, true).show()); |
||||
} |
||||
|
||||
//红色
|
||||
public static void showError(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.custom(MyApplication.getmContext(), msg, |
||||
MyApplication.getmContext().getDrawable(R.drawable.ic_error), |
||||
MyApplication.getmContext().getColor(R.color.toast_red), |
||||
MyApplication.getmContext().getColor(R.color.white), |
||||
Toasty.LENGTH_SHORT, true, true).show()); |
||||
} |
||||
|
||||
//绿色
|
||||
public static void showSuccess(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.custom(MyApplication.getmContext(), msg, |
||||
MyApplication.getmContext().getDrawable(R.drawable.ic_success), |
||||
MyApplication.getmContext().getColor(R.color.toast_green), |
||||
MyApplication.getmContext().getColor(R.color.white), |
||||
Toasty.LENGTH_SHORT, true, true).show()); |
||||
} |
||||
|
||||
//蓝色
|
||||
public static void showInfo(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.custom(MyApplication.getmContext(), msg, |
||||
MyApplication.getmContext().getDrawable(R.drawable.ic_smile_face), |
||||
MyApplication.getmContext().getColor(R.color.toast_blue), |
||||
MyApplication.getmContext().getColor(R.color.white), |
||||
Toasty.LENGTH_SHORT, true, true).show()); |
||||
} |
||||
|
||||
//黄色
|
||||
public static void showWarring(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.warning(MyApplication.getmContext(), msg, Toasty.LENGTH_SHORT, true).show()); |
||||
} |
||||
|
||||
public static void showExit(@NonNull String msg) { |
||||
MyApplication.runOnUiThread(() -> Toasty.custom(MyApplication.getmContext(), msg, |
||||
MyApplication.getmContext().getDrawable(R.drawable.ic_cry_face), |
||||
MyApplication.getmContext().getColor(R.color.toast_blue), |
||||
MyApplication.getmContext().getColor(R.color.white), |
||||
Toasty.LENGTH_SHORT, true, true).show()); |
||||
} |
||||
} |
@ -0,0 +1,147 @@ |
||||
package xyz.fycz.myreader.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.content.res.TypedArray; |
||||
import android.graphics.Canvas; |
||||
import android.graphics.drawable.GradientDrawable; |
||||
import android.util.AttributeSet; |
||||
import androidx.appcompat.widget.AppCompatButton; |
||||
import xyz.fycz.myreader.R; |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2020/8/24 21:17 |
||||
*/ |
||||
public class ProgressButton extends AppCompatButton { |
||||
private float mCornerRadius = 0; |
||||
private float mProgressMargin = 0; |
||||
|
||||
private boolean mFinish; |
||||
|
||||
private int mProgress; |
||||
private int mMaxProgress = 100; |
||||
private int mMinProgress = 0; |
||||
|
||||
private GradientDrawable mDrawableButton; |
||||
private GradientDrawable mDrawableProgressBackground; |
||||
private GradientDrawable mDrawableProgress; |
||||
|
||||
public ProgressButton(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
initialize(context, attrs); |
||||
} |
||||
|
||||
public ProgressButton(Context context, AttributeSet attrs, int defStyle) { |
||||
super(context, attrs, defStyle); |
||||
initialize(context, attrs); |
||||
} |
||||
|
||||
private void initialize(Context context, AttributeSet attrs) { |
||||
//Progress background drawable
|
||||
mDrawableProgressBackground = new GradientDrawable(); |
||||
//Progress drawable
|
||||
mDrawableProgress = new GradientDrawable(); |
||||
//Normal drawable
|
||||
mDrawableButton = new GradientDrawable(); |
||||
|
||||
//Get default normal color
|
||||
int defaultButtonColor = getResources().getColor(R.color.toast_default); |
||||
//Get default progress color
|
||||
int defaultProgressColor = getResources().getColor(R.color.colorAccent, null); |
||||
//Get default progress background color
|
||||
int defaultBackColor = getResources().getColor(R.color.toast_default, null); |
||||
|
||||
TypedArray attr = context.obtainStyledAttributes(attrs, R.styleable.ProgressButton); |
||||
|
||||
try { |
||||
mProgressMargin = attr.getDimension(R.styleable.ProgressButton_progressMargin, mProgressMargin); |
||||
mCornerRadius = attr.getDimension(R.styleable.ProgressButton_cornerRadius, mCornerRadius); |
||||
//Get custom normal color
|
||||
int buttonColor = attr.getColor(R.styleable.ProgressButton_buttonColor, defaultButtonColor); |
||||
//Set normal color
|
||||
mDrawableButton.setColor(buttonColor); |
||||
//Get custom progress background color
|
||||
int progressBackColor = attr.getColor(R.styleable.ProgressButton_progressBackColor, defaultBackColor); |
||||
//Set progress background drawable color
|
||||
mDrawableProgressBackground.setColor(progressBackColor); |
||||
//Get custom progress color
|
||||
int progressColor = attr.getColor(R.styleable.ProgressButton_progressColor, defaultProgressColor); |
||||
//Set progress drawable color
|
||||
mDrawableProgress.setColor(progressColor); |
||||
|
||||
//Get default progress
|
||||
mProgress = attr.getInteger(R.styleable.ProgressButton_progress, mProgress); |
||||
//Get minimum progress
|
||||
mMinProgress = attr.getInteger(R.styleable.ProgressButton_minProgress, mMinProgress); |
||||
//Get maximize progress
|
||||
mMaxProgress = attr.getInteger(R.styleable.ProgressButton_maxProgress, mMaxProgress); |
||||
|
||||
} finally { |
||||
attr.recycle(); |
||||
} |
||||
|
||||
//Set corner radius
|
||||
mDrawableButton.setCornerRadius(mCornerRadius); |
||||
mDrawableProgressBackground.setCornerRadius(mCornerRadius); |
||||
mDrawableProgress.setCornerRadius(mCornerRadius - mProgressMargin); |
||||
setBackgroundDrawable(mDrawableButton); |
||||
|
||||
mFinish = false; |
||||
} |
||||
|
||||
@Override |
||||
protected void onDraw(Canvas canvas) { |
||||
if (mProgress > mMinProgress && mProgress <= mMaxProgress && !mFinish) { |
||||
//Calculate the width of progress
|
||||
float progressWidth = |
||||
(float) getMeasuredWidth() * ((float) (mProgress - mMinProgress) / mMaxProgress - mMinProgress); |
||||
|
||||
//If progress width less than 2x corner radius, the radius of progress will be wrong
|
||||
if (progressWidth < mCornerRadius * 2) { |
||||
progressWidth = mCornerRadius * 2; |
||||
} |
||||
|
||||
//Set rect of progress
|
||||
mDrawableProgress.setBounds((int) mProgressMargin, (int) mProgressMargin, |
||||
(int) (progressWidth - mProgressMargin), getMeasuredHeight() - (int) mProgressMargin); |
||||
|
||||
//Draw progress
|
||||
mDrawableProgress.draw(canvas); |
||||
|
||||
if (mProgress == mMaxProgress) { |
||||
setBackgroundDrawable(mDrawableButton); |
||||
mFinish = true; |
||||
} |
||||
} |
||||
super.onDraw(canvas); |
||||
} |
||||
|
||||
/** |
||||
* Set current progress |
||||
*/ |
||||
public void setProgress(int progress) { |
||||
if (!mFinish) { |
||||
mProgress = progress; |
||||
setBackgroundDrawable(mDrawableProgressBackground); |
||||
invalidate(); |
||||
} |
||||
} |
||||
|
||||
public void setButtonColor(int color){ |
||||
mDrawableButton.setColor(color); |
||||
invalidate(); |
||||
} |
||||
|
||||
public void setMaxProgress(int maxProgress) { |
||||
mMaxProgress = maxProgress; |
||||
} |
||||
|
||||
public void setMinProgress(int minProgress) { |
||||
mMinProgress = minProgress; |
||||
} |
||||
|
||||
public void reset() { |
||||
mFinish = false; |
||||
mProgress = mMinProgress; |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:fillColor="#FFFFFF" |
||||
android:pathData="M514,114.3c-219.9,0 -398.9,178.9 -398.9,398.8 0.1,220 179,398.9 398.9,398.9 219.9,0 398.8,-178.9 398.8,-398.8S733.9,114.3 514,114.3zM732.3,603.3v1.7c0,0.5 -0.1,1 -0.1,1.6 0,0.3 0,0.6 -0.1,0.9 0,0.5 -0.1,1 -0.2,1.5 0,0.3 -0.1,0.7 -0.1,1 -0.1,0.4 -0.1,0.8 -0.2,1.2 -0.1,0.4 -0.2,0.9 -0.2,1.3 -0.1,0.3 -0.1,0.6 -0.2,0.8 -0.1,0.6 -0.3,1.2 -0.4,1.8 0,0.1 -0.1,0.2 -0.1,0.3 -2.2,8.5 -6.6,16.6 -13.3,23.3L600.7,755.4c-20,20 -52.7,20 -72.6,0 -20,-20 -20,-52.7 0,-72.6l28.9,-28.9L347,653.9c-28.3,0 -51.4,-23.1 -51.4,-51.4 0,-28.3 23.1,-51.4 51.4,-51.4h334c13.2,0 26.4,5 36.4,15s15,23.2 15,36.4c0,0.3 -0.1,0.6 -0.1,0.8zM732.4,423.8c0,28.3 -23.1,51.4 -51.4,51.4L347,475.2c-13.2,0 -26.4,-5 -36.4,-15s-15,-23.2 -15,-36.4v-0.8,-1.6c0,-0.5 0.1,-1.1 0.1,-1.6 0,-0.3 0,-0.6 0.1,-0.9 0,-0.5 0.1,-1 0.2,-1.5 0,-0.3 0.1,-0.7 0.1,-1 0.1,-0.4 0.1,-0.8 0.2,-1.2 0.1,-0.4 0.2,-0.9 0.2,-1.3 0.1,-0.3 0.1,-0.6 0.2,-0.8 0.1,-0.6 0.3,-1.2 0.4,-1.8 0,-0.1 0.1,-0.2 0.1,-0.3 2.2,-8.5 6.6,-16.6 13.3,-23.3l116.6,-116.6c20,-20 52.7,-20 72.6,0 20,20 20,52.7 0,72.6L471,372.5h210c28.2,0 51.4,23.1 51.4,51.3z"/> |
||||
</vector> |
@ -0,0 +1,7 @@ |
||||
<vector android:height="24dp" android:viewportHeight="1024" |
||||
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#ffffff" android:pathData="M512,953.82c244.02,0 441.82,-197.8 441.82,-441.82C953.82,267.98 756.02,70.18 512,70.18 267.98,70.18 70.18,267.98 70.18,512c0,244.02 197.8,441.82 441.82,441.82zM512,888.36a376.36,376.36 0,1 1,0 -752.73,376.36 376.36,0 0,1 0,752.73z"/> |
||||
<path android:fillColor="#ffffff" android:pathData="M730.54,699.53c-121.95,-121.95 -317.66,-124.49 -437.07,-5.07a32.73,32.73 0,1 0,46.31 46.27c93.56,-93.56 247.83,-91.55 344.45,5.07a32.73,32.73 0,1 0,46.31 -46.23z"/> |
||||
<path android:fillColor="#ffffff" android:pathData="M358.59,433.95m-51.14,0a51.14,51.14 0,1 0,102.27 0,51.14 51.14,0 1,0 -102.27,0Z"/> |
||||
<path android:fillColor="#ffffff" android:pathData="M665.41,433.95m-51.14,0a51.14,51.14 0,1 0,102.27 0,51.14 51.14,0 1,0 -102.27,0Z"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M696.6,257.2L326.1,257.2c-145.1,0 -262.8,114.7 -262.8,256s117.7,256 262.8,256h370.5c145.1,0 262.8,-114.7 262.8,-256 -0.1,-141.4 -117.7,-256 -262.8,-256zM703.3,705.2c-106,0 -192,-86 -192,-192s86,-192 192,-192 192,86 192,192 -85.9,192 -192,192z" |
||||
android:fillColor="#FFFFFF"/> |
||||
</vector> |
@ -0,0 +1,4 @@ |
||||
<vector android:height="24dp" android:viewportHeight="1024" |
||||
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FFFFFF" android:pathData="M512,64c247.42,0 448,200.58 448,448s-200.58,448 -448,448S64,759.42 64,512 264.58,64 512,64zM512,128C299.93,128 128,299.93 128,512s171.93,384 384,384 384,-171.93 384,-384S724.07,128 512,128zM684.42,299.31l45.27,45.25L562.24,512l167.45,167.45 -45.27,45.25 -167.45,-167.45 -167.42,167.47 -45.27,-45.27L471.72,512l-167.45,-167.45 45.27,-45.25 167.42,167.42 167.47,-167.42z"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:fillColor="#FF000000" |
||||
android:pathData="M512,77C271.8,77 77,271.8 77,512c0,240.2 194.8,435 435,435 240.2,0 435,-194.8 435,-435C947,271.8 752.2,77 512,77L512,77zM509.2,816.4c-35.4,0 -64.2,-28.2 -64.2,-62.9s28.7,-62.9 64.2,-62.9c35.4,0 64.2,28.2 64.2,62.9S544.7,816.4 509.2,816.4L509.2,816.4zM681.6,460.5c-12.6,19.8 -39.3,46.7 -80.3,80.8 -21.2,17.6 -34.4,31.8 -39.5,42.6 -5.1,10.7 -7.5,29.9 -7,57.6l-91.4,0c-0.2,-13.1 -0.4,-21.1 -0.4,-24 0,-29.6 4.9,-53.9 14.7,-73 9.8,-19.1 29.4,-40.6 58.7,-64.4 29.3,-23.9 46.9,-39.5 52.6,-46.9 8.8,-11.7 13.3,-24.6 13.3,-38.6 0,-19.5 -7.9,-36.2 -23.5,-50.2 -15.6,-13.9 -36.8,-20.9 -63.3,-20.9 -25.6,0 -47,7.3 -64.2,21.8 -17.2,14.5 -32,46.5 -35.5,66.3 -3.3,18.7 -93.4,26.6 -92.3,-11.3 1.1,-37.9 20.8,-79 54.6,-108.8 33.8,-29.8 78.2,-44.7 133.1,-44.7 57.8,0 103.7,15.1 137.9,45.3 34.2,30.2 51.2,65.3 51.2,105.4C700.4,419.7 694.1,440.7 681.6,460.5L681.6,460.5z"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M816.51,368.19l-55.36,32A285.63,285.63 0,0 1,800 544c0,158.82 -129.18,288 -288,288 -106.37,0 -199.26,-58.14 -249.12,-144.16A285.86,285.86 0,0 1,224 544c0,-158.82 129.22,-288 288,-288v96l192,-128 -192,-128v96C317.92,192 160,349.89 160,544c0,64.06 17.5,124 47.52,175.81C268.48,824.96 381.98,896 512,896c194.11,0 352,-157.92 352,-352 0,-64.06 -17.47,-124 -47.49,-175.81" |
||||
android:fillColor="#FFFFFF"/> |
||||
</vector> |
@ -0,0 +1,14 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="24" |
||||
android:viewportHeight="24"> |
||||
|
||||
<path |
||||
android:fillColor="#595757" |
||||
android:pathData="M12,15.43 C10.109,15.43,8.572,13.891,8.572,12 S10.109,8.57,12,8.57 S15.428,10.109,15.428,12 S13.891,15.43,12,15.43 Z M12,10.096 C10.949,10.096,10.096,10.95,10.096,12 S10.95,13.904,12,13.904 S13.904,13.05,13.904,12 S13.051,10.096,12,10.096 Z" /> |
||||
<path |
||||
android:fillColor="#595757" |
||||
android:pathData="M13.735,20 L10.261,20 L10.12,18.065 C10.102,17.807,9.944,17.585,9.721,17.492 C9.472,17.387,9.214,17.429,9.024,17.592 L7.568,18.848 L5.113,16.391 L6.369,14.937 C6.531,14.749,6.573,14.49,6.477,14.258 C6.376,14.013,6.166,13.857,5.913,13.836 L4,13.697 L4,10.226 L5.916,10.085 C6.164,10.066,6.378,9.913,6.473,9.683 C6.574,9.438,6.536,9.185,6.371,8.992 L5.113,7.539 L7.573,5.094 L9.026,6.376 C9.222,6.544,9.495,6.605,9.703,6.522 L9.844,6.461 C10.026,6.273,10.107,6.141,10.119,5.974 L10.262,4 L13.734,4 L13.877,5.894 C13.895,6.139,14.041,6.335,14.277,6.43 C14.527,6.537,14.786,6.494,14.975,6.332 L16.427,5.073 L18.886,7.531 L17.629,8.984 C17.467,9.172,17.426,9.431,17.521,9.664 C17.622,9.909,17.833,10.066,18.085,10.085 L20,10.227 L20,13.698 L18.085,13.837 C17.837,13.858,17.623,14.011,17.528,14.242 C17.426,14.487,17.465,14.747,17.63,14.94 L18.886,16.391 L16.429,18.85 L14.975,17.594 C14.799,17.444,14.544,17.398,14.322,17.479 L14.295,17.493 C14.051,17.594,13.894,17.816,13.876,18.068 L13.735,20 Z M11.561,18.604 L12.437,18.604 L12.482,17.963 C12.538,17.216,13.011,16.538,13.691,16.232 L13.737,16.211 C14.526,15.883,15.308,16.04,15.886,16.54 L16.358,16.945 L16.98,16.321 L16.574,15.852 C16.064,15.26,15.933,14.446,16.231,13.725 C16.535,12.993,17.206,12.502,17.982,12.446 L18.604,12.399 L18.604,11.524 L17.984,11.477 C17.207,11.421,16.536,10.938,16.239,10.215 C15.935,9.485,16.065,8.664,16.574,8.07 L16.98,7.601 L16.358,6.979 L15.886,7.386 C15.308,7.885,14.472,8.022,13.761,7.729 C13.029,7.428,12.54,6.763,12.482,5.996 L12.438,5.397 L11.558,5.397 L11.514,6 C11.457,6.773,10.973,7.438,10.252,7.733 L10.091,7.789 C9.416,8.008,8.652,7.856,8.112,7.392 L7.639,6.982 L7.02,7.602 L7.426,8.075 C7.936,8.665,8.067,9.479,7.77,10.202 C7.467,10.931,6.796,11.422,6.02,11.477 L5.397,11.524 L5.397,12.399 L6.019,12.446 C6.796,12.503,7.465,12.987,7.762,13.71 C8.066,14.44,7.935,15.261,7.426,15.852 L7.02,16.32 L7.64,16.941 L8.112,16.535 C8.692,16.035,9.528,15.898,10.239,16.194 C10.958,16.488,11.458,17.181,11.515,17.961 L11.561,18.604 Z" /> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24.046875dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1026" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:fillColor="#FFFFFF" |
||||
android:pathData="M495.46,830.66c-187.14,0 -264.95,-168.22 -268.19,-175.4l62.97,-28.31c2.49,5.49 62.21,134.67 205.19,134.67 153.07,-1.79 211.3,-129.21 213.68,-134.63l63.1,28c-3.14,7.08 -79.05,173.36 -273.13,175.64l-3.63,0.03zM500.16,991.22c-256.97,0 -466.03,-209.06 -466.03,-466.03s209.06,-466.03 466.03,-466.03 466.03,209.06 466.03,466.03 -209.06,466.03 -466.03,466.03zM500.16,128.2c-218.9,0 -396.99,178.09 -396.99,396.99s178.09,396.99 396.99,396.99 396.99,-178.09 396.99,-396.99 -178.06,-396.99 -396.99,-396.99zM311.09,444.27c0,29.69 24.06,53.82 53.82,53.82s53.82,-24.1 53.82,-53.82 -24.06,-53.82 -53.82,-53.82 -53.82,24.1 -53.82,53.82zM580.77,444.27c0,29.69 24.06,53.82 53.82,53.82s53.82,-24.1 53.82,-53.82 -24.06,-53.82 -53.82,-53.82 -53.82,24.1 -53.82,53.82z"/> |
||||
</vector> |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M960,512c0,97.76 -28.7,185.22 -85.66,263.26 -56.96,78.02 -130.5,131.84 -220.64,161.86 -10.3,1.82 -18.37,0.45 -22.85,-4.03a22.4,22.4 0,0 1,-7.2 -17.5v-122.88c0,-37.63 -10.3,-65.44 -30.46,-82.91a409.86,409.86 0,0 0,59.62 -10.37,222.75 222.75,0 0,0 54.72,-22.82c18.85,-10.78 34.53,-23.36 47.1,-38.59 12.54,-15.23 22.85,-35.9 30.91,-61.44 8.1,-25.57 12.13,-54.69 12.13,-87.9 0,-47.07 -15.23,-86.98 -46.21,-120.16 14.37,-35.46 13.02,-74.91 -4.48,-118.85 -10.75,-3.62 -26.43,-1.34 -47.07,6.27a301.44,301.44 0,0 0,-53.82 25.57l-21.98,13.89A407.78,407.78 0,0 0,512 280.16c-38.56,0 -75.78,4.93 -112.1,15.23a444.48,444.48 0,0 0,-24.67 -15.68c-10.34,-6.27 -26.46,-13.89 -48.9,-22.43 -21.95,-8.96 -39.01,-11.23 -50.24,-8.06 -17.02,43.94 -18.37,83.42 -4.03,118.85 -30.5,33.63 -46.18,73.54 -46.18,120.61 0,33.22 4.03,62.34 12.13,87.46 8.03,25.12 18.37,45.76 30.5,61.44 12.54,15.68 28.22,28.7 47.07,39.04 18.85,10.3 37.22,17.92 54.72,22.82a409.6,409.6 0,0 0,59.65 10.37c-15.71,13.86 -25.12,34.05 -28.7,60.06a99.74,99.74 0,0 1,-26.46 8.51,178.21 178.21,0 0,1 -33.18,2.69c-13.02,0 -25.57,-4.03 -38.14,-12.54 -12.54,-8.51 -23.3,-20.64 -32.26,-36.32a97.47,97.47 0,0 0,-28.26 -30.5c-11.23,-8.06 -21.09,-12.58 -28.7,-13.92l-11.65,-1.79c-8.1,0 -13.92,0.93 -17.06,2.69 -3.14,1.79 -4.03,4.03 -2.69,6.72 1.34,2.69 3.14,5.41 5.38,8.1 2.24,2.69 4.93,4.93 7.62,7.17l4.03,2.69c8.54,4.03 17.06,11.23 25.57,21.98 8.54,10.75 14.37,20.64 18.4,29.6l5.82,13.44c4.93,14.82 13.44,26.91 25.57,35.87 12.1,8.99 25.09,14.82 39.01,17.5 13.89,2.69 27.36,4.03 40.35,4.03 12.99,0 23.78,-0.45 32.29,-2.24l13.47,-2.24c0,14.78 0,32.29 0.42,52.03 0,19.74 0.48,30.5 0.48,31.39a22.62,22.62 0,0 1,-7.65 17.47c-4.93,4.48 -12.99,5.82 -23.3,4.03 -90.14,-30.05 -163.68,-83.84 -220.64,-161.89C92.26,697.22 64,609.31 64,512c0,-81.15 20.19,-156.06 60.1,-224.67a445.18,445.18 0,0 1,163.23 -163.23C355.94,84.19 430.82,64 512,64s156.06,20.19 224.67,60.1a445.18,445.18 0,0 1,163.23 163.23C939.81,355.49 960,430.85 960,512" |
||||
android:fillColor="#000000"/> |
||||
</vector> |
@ -0,0 +1,4 @@ |
||||
<vector android:height="24dp" android:viewportHeight="1024" |
||||
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FFFFFF" android:pathData="M512,1015.34c-277.91,0 -503.2,-225.29 -503.2,-503.2s225.29,-503.2 503.2,-503.2c277.91,0 503.2,225.29 503.2,503.2s-225.29,503.2 -503.2,503.2zM512,71.85c-243.16,0 -440.3,197.13 -440.3,440.3s197.13,440.3 440.3,440.3 440.3,-197.13 440.3,-440.3 -197.13,-440.3 -440.3,-440.3zM713.04,337.11c8.68,-15.05 3.54,-34.27 -11.51,-42.96s-34.27,-3.54 -42.96,11.51l-201.15,348.36 -112.53,-103.77c-11.86,-12.67 -31.76,-13.33 -44.45,-1.45 -12.68,11.88 -13.31,31.78 -1.43,44.45l143.78,132.62c11.88,12.67 31.78,13.31 44.45,1.43 3.83,-3.58 225.79,-390.19 225.79,-390.19z"/> |
||||
</vector> |
@ -0,0 +1,334 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<include layout="@layout/toolbar"/> |
||||
|
||||
<ScrollView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="25dp" |
||||
android:paddingLeft="5dp" |
||||
android:paddingRight="5dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_centerInParent="true" |
||||
android:textColor="@color/btn_black" |
||||
android:text="@string/read_setting"/> |
||||
|
||||
</RelativeLayout> |
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_volume" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:textColor="@color/title_black" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:text="@string/volume_turn_page"/> |
||||
|
||||
<androidx.appcompat.widget.SwitchCompat |
||||
android:id="@+id/more_setting_sc_volume" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_reset_screen" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/title_black" |
||||
android:layout_centerVertical="true" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:text="@string/reset_screen_time"/> |
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner |
||||
android:id="@+id/more_setting_sc_reset_screen" |
||||
android:layout_width="115dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:gravity="center" |
||||
android:dropDownWidth="75dp" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="25dp" |
||||
android:paddingLeft="5dp" |
||||
android:paddingRight="5dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_centerInParent="true" |
||||
android:textColor="@color/btn_black" |
||||
android:text="@string/bookcase_setting"/> |
||||
</RelativeLayout> |
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_auto_refresh" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" |
||||
android:layout_centerVertical="true" |
||||
android:background="@drawable/selector_common_bg"> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:textColor="@color/title_black" |
||||
android:text="@string/auto_refresh"/> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingTop="5dp" |
||||
android:textColor="@color/gray" |
||||
android:text="@string/auto_refresh_tip"/> |
||||
</LinearLayout> |
||||
|
||||
<androidx.appcompat.widget.SwitchCompat |
||||
android:id="@+id/more_setting_sc_auto_refresh" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/more_setting_ll_close_refresh" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:paddingTop="8dp" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/selector_common_bg"> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:textColor="@color/title_black" |
||||
android:text="@string/close_refresh"/> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingTop="5dp" |
||||
android:textColor="@color/gray" |
||||
android:text="@string/close_refresh_tip"/> |
||||
</LinearLayout> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="25dp" |
||||
android:paddingLeft="5dp" |
||||
android:paddingRight="5dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_centerInParent="true" |
||||
android:textColor="@color/btn_black" |
||||
android:text="@string/change_source_setting"/> |
||||
<ImageView |
||||
android:id="@+id/more_setting_iv_match_chapter_tip" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentEnd="true" |
||||
android:src="@drawable/ic_question" |
||||
android:tint="@color/grey"/> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_match_chapter" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:textColor="@color/title_black" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:text="@string/match_chapters"/> |
||||
|
||||
<androidx.appcompat.widget.SwitchCompat |
||||
android:id="@+id/more_setting_sc_match_chapter" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_match_chapter_suitability" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:textColor="@color/title_black" |
||||
android:text="@string/match_chapters_sui"/> |
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner |
||||
android:id="@+id/more_setting_sc_match_chapter_suitability" |
||||
android:layout_width="100dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:gravity="center" |
||||
android:dropDownWidth="60dp" |
||||
android:textColor="@color/title_black" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="25dp" |
||||
android:paddingLeft="5dp" |
||||
android:paddingRight="5dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_centerInParent="true" |
||||
android:textColor="@color/btn_black" |
||||
android:text="@string/cathe_setting"/> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_cathe_gap" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:gravity="center" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:textColor="@color/title_black" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:text="@string/cathe_gap"/> |
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner |
||||
android:id="@+id/more_setting_sc_cathe_gap" |
||||
android:layout_width="115dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentEnd="true" |
||||
android:gravity="center" |
||||
android:dropDownWidth="75dp" |
||||
android:textColor="@color/title_black" |
||||
android:clickable="false" |
||||
android:longClickable="false"/> |
||||
</RelativeLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/more_setting_ll_download_all" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="60dp" |
||||
android:paddingTop="8dp" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/selector_common_bg"> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:textColor="@color/title_black" |
||||
android:text="@string/download_all"/> |
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:paddingTop="5dp" |
||||
android:textColor="@color/gray" |
||||
android:text="@string/download_all_tip"/> |
||||
</LinearLayout> |
||||
<RelativeLayout |
||||
android:id="@+id/more_setting_rl_delete_cathe" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:paddingLeft="20dp" |
||||
android:paddingRight="20dp" |
||||
android:background="@drawable/selector_common_bg"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:textColor="@color/title_black" |
||||
android:textSize="@dimen/text_normal_size" |
||||
android:text="@string/clear_cathe"/> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
</ScrollView> |
||||
</LinearLayout> |
@ -1,51 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical" |
||||
android:fitsSystemWindows="true" |
||||
android:background="@color/sys_bg2" |
||||
tools:context="xyz.fycz.myreader.ui.activity.FontsActivity"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<include layout="@layout/title_base"> |
||||
</include> |
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:padding="8dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="0dp" |
||||
android:layout_weight="8" |
||||
android:layout_height="match_parent" |
||||
android:gravity="center_vertical" |
||||
android:text="音量键翻页" |
||||
/> |
||||
|
||||
<Switch |
||||
android:id="@+id/switch_hide_status" |
||||
android:layout_width="0dp" |
||||
android:layout_weight="2" |
||||
android:layout_height="match_parent" /> |
||||
</LinearLayout> |
||||
|
||||
|
||||
</LinearLayout> |
||||
|
||||
<ProgressBar |
||||
android:id="@+id/pb_loading" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:visibility="gone"/> |
||||
|
||||
|
||||
|
||||
</RelativeLayout> |
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<androidx.appcompat.widget.Toolbar |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/toolbar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:background="@color/colorPrimary" |
||||
android:minHeight="?attr/actionBarSize" |
||||
android:fitsSystemWindows="true" |
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" |
||||
> |
||||
<!-- android:theme="@style/Theme.ToolBar.Menu"--> |
||||
</androidx.appcompat.widget.Toolbar> |
@ -1,19 +1,30 @@ |
||||
<?xml version ="1.0" encoding ="utf-8"?> |
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<item |
||||
android:id="@+id/action_change_source" |
||||
android:icon="@mipmap/ic_menu_exchange" |
||||
android:title="更换书源" |
||||
app:showAsAction="always" /> |
||||
android:id="@+id/action_change_source" |
||||
android:icon="@drawable/ic_change_source" |
||||
android:title="@string/menu_change_source" |
||||
app:showAsAction="ifRoom"/> |
||||
<item |
||||
android:id="@+id/action_reload" |
||||
android:icon="@mipmap/ic_menu_refresh" |
||||
android:title="重新加载"/> |
||||
android:id="@+id/action_reload" |
||||
android:icon="@drawable/ic_refresh" |
||||
android:title="@string/menu_reload" |
||||
app:showAsAction="never"/> |
||||
|
||||
<item |
||||
android:id="@+id/action_open_link" |
||||
android:title="打开链接" /> |
||||
android:id="@+id/action_open_link" |
||||
android:icon="@drawable/ic_link" |
||||
android:title="@string/menu_open_link" |
||||
app:showAsAction="never"/> |
||||
|
||||
<item |
||||
android:id="@+id/action_is_update" |
||||
android:title="@string/menu_is_update" |
||||
android:icon="@drawable/ic_enable" |
||||
android:checkable="true" |
||||
android:checked="true" |
||||
app:showAsAction="never"/> |
||||
</menu> |
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,2 +1,2 @@ |
||||
#Mon Aug 17 18:44:13 CST 2020 |
||||
VERSION_CODE=142 |
||||
#Sat Aug 29 22:36:36 CST 2020 |
||||
VERSION_CODE=143 |
||||
|
Loading…
Reference in new issue