Add option for saving progress in quick search
This commit is contained in:
1 parent
b4aa5ec593
commit
51546f6fea
4 files changed
+20
-1
No files matched your search
@@ -194,6 +194,8 @@ public class Settings {
|
||||
private static final String KEY_REQUEST_NEWS = "request_news";
|
||||
private static final boolean DEFAULT_REQUEST_NEWS = true;
|
||||
private static final String KEY_ARCHIVE_PASSWDS = "archive_passwds";
|
||||
private static final String KEY_QS_SAVE_PROGRESS = "qs_save_progress";
|
||||
private static final boolean DEFAULT_QS_SAVE_PROGRESS = true;
|
||||
public static boolean LIST_THUMB_SIZE_INITED = false;
|
||||
public static SharedPreferences sSettingsPre;
|
||||
private static int LIST_THUMB_SIZE = 40;
|
||||
@@ -629,6 +631,14 @@ public class Settings {
|
||||
putInt(KEY_DEFAULT_FAV_SLOT, value);
|
||||
}
|
||||
|
||||
public static boolean getQSSaveProgress() {
|
||||
return getBoolean(KEY_QS_SAVE_PROGRESS, DEFAULT_QS_SAVE_PROGRESS);
|
||||
}
|
||||
|
||||
public static void putQSSaveProgress(boolean value) {
|
||||
putBoolean(KEY_QS_SAVE_PROGRESS, value);
|
||||
}
|
||||
|
||||
public static boolean getSaveParseErrorBody() {
|
||||
return getBoolean(KEY_SAVE_PARSE_ERROR_BODY, DEFAULT_SAVE_PARSE_ERROR_BODY);
|
||||
}
|
||||
|
||||
@@ -685,6 +685,10 @@ public final class GalleryListScene extends SearchBarScene
|
||||
getSuitableTitleForUrlBuilder(context.getResources(), urlBuilder, false), getString(R.string.quick_search));
|
||||
builder.setTitle(R.string.add_quick_search_dialog_title);
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
// TODO: It's ugly
|
||||
final boolean[] checked = {Settings.getQSSaveProgress()};
|
||||
final String[] hint = {getString(R.string.save_progress)};
|
||||
builder.setMultiChoiceItems(hint, checked, (dialog, which, isChecked) -> checked[which] = isChecked);
|
||||
final AlertDialog dialog = builder.show();
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(v -> {
|
||||
String text = builder.getText().trim();
|
||||
@@ -695,8 +699,11 @@ public final class GalleryListScene extends SearchBarScene
|
||||
return;
|
||||
}
|
||||
|
||||
if (next != null) {
|
||||
if (checked[0] && next != null) {
|
||||
text += next;
|
||||
Settings.putQSSaveProgress(true);
|
||||
} else {
|
||||
Settings.putQSSaveProgress(false);
|
||||
}
|
||||
|
||||
// Check name duplicate
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
<string name="image_search_not_quick_search">无法添加图片搜索为快速搜索</string>
|
||||
<string name="duplicate_quick_search">已存在相同的快速搜索,名称为“%s”。</string>
|
||||
<string name="duplicate_name">已存在相同名称</string>
|
||||
<string name="save_progress">保存进度</string>
|
||||
|
||||
<string name="go_to_hint">第 %1$d 页,共 %2$d 页</string>
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
<string name="image_search_not_quick_search">Can\'t add image search as quick search</string>
|
||||
<string name="duplicate_quick_search">A duplicate quick search exists. The name is \"%s\".</string>
|
||||
<string name="duplicate_name">This name is already in use.</string>
|
||||
<string name="save_progress">Save progress</string>
|
||||
|
||||
<string name="go_to_hint">Page %1$d, total %2$d pages</string>
|
||||
|
||||
|
||||
Reference in new issue
Block a user