Add disable default filters options
This commit is contained in:
1 parent
6775246d4c
commit
871c0a43ca
7 files changed
+157
-32
No files matched your search
@@ -405,6 +405,21 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
advanceSearch |= AdvanceSearchTable.SH;
|
||||
}
|
||||
break;
|
||||
case "f_sfl":
|
||||
if ("on".equals(value)) {
|
||||
advanceSearch |= AdvanceSearchTable.SFL;
|
||||
}
|
||||
break;
|
||||
case "f_sfu":
|
||||
if ("on".equals(value)) {
|
||||
advanceSearch |= AdvanceSearchTable.SFU;
|
||||
}
|
||||
break;
|
||||
case "f_sft":
|
||||
if ("on".equals(value)) {
|
||||
advanceSearch |= AdvanceSearchTable.SFT;
|
||||
}
|
||||
break;
|
||||
case "f_sr":
|
||||
if ("on".equals(value)) {
|
||||
enableMinRating = true;
|
||||
@@ -490,6 +505,9 @@ public class ListUrlBuilder implements Cloneable, Parcelable {
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SDT1) != 0) ub.addQuery("f_sdt1", "on");
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SDT2) != 0) ub.addQuery("f_sdt2", "on");
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SH) != 0) ub.addQuery("f_sh", "on");
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SFL) != 0) ub.addQuery("f_sfl", "on");
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SFU) != 0) ub.addQuery("f_sfu", "on");
|
||||
if((mAdvanceSearch & AdvanceSearchTable.SFT) != 0) ub.addQuery("f_sft", "on");
|
||||
// Set min star
|
||||
if (mMinRating != -1) {
|
||||
ub.addQuery("f_sr", "on");
|
||||
|
||||
@@ -25,12 +25,12 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TableLayout;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.yorozuya.NumberUtils;
|
||||
|
||||
public class AdvanceSearchTable extends TableLayout {
|
||||
public class AdvanceSearchTable extends LinearLayout {
|
||||
|
||||
private static final String STATE_KEY_SUPER = "super";
|
||||
private static final String STATE_KEY_ADVANCE_SEARCH = "advance_search";
|
||||
@@ -46,6 +46,9 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
public static final int SDT1 = 0x20;
|
||||
public static final int SDT2 = 0x40;
|
||||
public static final int SH = 0x80;
|
||||
public static final int SFL = 0x100;
|
||||
public static final int SFU = 0x200;
|
||||
public static final int SFT = 0x400;
|
||||
|
||||
private CheckBox mSname;
|
||||
private CheckBox mStags;
|
||||
@@ -60,6 +63,9 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
private CheckBox mSp;
|
||||
private EditText mSpf;
|
||||
private EditText mSpt;
|
||||
private CheckBox mSfl;
|
||||
private CheckBox mSfu;
|
||||
private CheckBox mSft;
|
||||
|
||||
public AdvanceSearchTable(Context context) {
|
||||
super(context);
|
||||
@@ -72,6 +78,8 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
inflater.inflate(R.layout.widget_advance_search_table, this);
|
||||
|
||||
@@ -100,6 +108,11 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
mSpf = (EditText) row5.getChildAt(1);
|
||||
mSpt = (EditText) row5.getChildAt(3);
|
||||
|
||||
ViewGroup row7 = (ViewGroup) getChildAt(7);
|
||||
mSfl = (CheckBox) row7.getChildAt(0);
|
||||
mSfu = (CheckBox) row7.getChildAt(1);
|
||||
mSft = (CheckBox) row7.getChildAt(2);
|
||||
|
||||
// Avoid java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus!
|
||||
mSpt.setOnEditorActionListener((v, actionId, event) -> {
|
||||
View nextView = v.focusSearch(View.FOCUS_DOWN);
|
||||
@@ -120,6 +133,9 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
if (mSdt1.isChecked()) advanceSearch |= SDT1;
|
||||
if (mSdt2.isChecked()) advanceSearch |= SDT2;
|
||||
if (mSh.isChecked()) advanceSearch |= SH;
|
||||
if (mSfl.isChecked()) advanceSearch |= SFL;
|
||||
if (mSfu.isChecked()) advanceSearch |= SFU;
|
||||
if (mSft.isChecked()) advanceSearch |= SFT;
|
||||
return advanceSearch;
|
||||
}
|
||||
|
||||
@@ -155,6 +171,9 @@ public class AdvanceSearchTable extends TableLayout {
|
||||
mSdt1.setChecked(NumberUtils.int2boolean(advanceSearch & SDT1));
|
||||
mSdt2.setChecked(NumberUtils.int2boolean(advanceSearch & SDT2));
|
||||
mSh.setChecked(NumberUtils.int2boolean(advanceSearch & SH));
|
||||
mSfl.setChecked(NumberUtils.int2boolean(advanceSearch & SFL));
|
||||
mSfu.setChecked(NumberUtils.int2boolean(advanceSearch & SFU));
|
||||
mSft.setChecked(NumberUtils.int2boolean(advanceSearch & SFT));
|
||||
}
|
||||
|
||||
public void setMinRating(int minRating) {
|
||||
|
||||
Reference in new issue
Block a user