Improve search
This commit is contained in:
1 parent
cde8aa7f62
commit
b6654f09af
10 files changed
+265
-58
No files matched your search
@@ -31,6 +31,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.data.GalleryListUrlBuilder;
|
||||
import com.hippo.ehviewer.widget.AdvanceSearchTable;
|
||||
import com.hippo.ehviewer.widget.CategoryTable;
|
||||
import com.hippo.util.UiUtils;
|
||||
import com.hippo.util.ViewUtils;
|
||||
@@ -64,6 +65,8 @@ public class SearchFragment extends Fragment implements CompoundButton.OnChecked
|
||||
private CheckBox mCheckSpecifyAuthor;
|
||||
private PrefixEditText mTextSearch;
|
||||
private CheckBox mCheckEnableAdvance;
|
||||
private View mAdvanceView;
|
||||
private AdvanceSearchTable mTableAdvanceSearch;
|
||||
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private SearchAdapter mAdapter;
|
||||
@@ -93,6 +96,7 @@ public class SearchFragment extends Fragment implements CompoundButton.OnChecked
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (buttonView == mCheckSpecifyAuthor) {
|
||||
mTextSearch.setPrefix(isChecked ? "uploader:" : null);
|
||||
|
||||
} else if (buttonView == mCheckEnableAdvance) {
|
||||
mEnableAdvance = isChecked;
|
||||
if (mSearchType == SEARCH_TYPE_NORMAL) {
|
||||
@@ -204,6 +208,15 @@ public class SearchFragment extends Fragment implements CompoundButton.OnChecked
|
||||
|
||||
private void bindAdvanceView(SearchHolder holder) {
|
||||
holder.title.setText(R.string.search_advance);
|
||||
|
||||
if (mAdvanceView == null) {
|
||||
mInflater.inflate(R.layout.search_advance, holder.content);
|
||||
mAdvanceView = holder.content.getChildAt(0);
|
||||
mTableAdvanceSearch = (AdvanceSearchTable) mAdvanceView.findViewById(R.id.search_advance_search_table);
|
||||
} else {
|
||||
ViewUtils.removeFromParent(mAdvanceView);
|
||||
holder.content.addView(mAdvanceView);
|
||||
}
|
||||
}
|
||||
|
||||
private void bindTagView(SearchHolder holder) {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TableLayout;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class AdvanceSearchTable extends TableLayout {
|
||||
|
||||
private CheckBox mSname;
|
||||
private CheckBox mStags;
|
||||
private CheckBox mSdesc;
|
||||
private CheckBox mStorr;
|
||||
private CheckBox mSto;
|
||||
private CheckBox mSdt1;
|
||||
private CheckBox mSdt2;
|
||||
private CheckBox mSh;
|
||||
private CheckBox mSr;
|
||||
private Spinner mMinRating;
|
||||
|
||||
public AdvanceSearchTable(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public AdvanceSearchTable(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
inflater.inflate(R.layout.widget_advance_search_table, this);
|
||||
|
||||
mSname = (CheckBox) findViewById(R.id.search_sname);
|
||||
mStags = (CheckBox) findViewById(R.id.search_stags);
|
||||
mSdesc = (CheckBox) findViewById(R.id.search_sdesc);
|
||||
mStorr = (CheckBox) findViewById(R.id.search_storr);
|
||||
mSto = (CheckBox) findViewById(R.id.search_sto);
|
||||
mSdt1 = (CheckBox) findViewById(R.id.search_sdt1);
|
||||
mSdt2 = (CheckBox) findViewById(R.id.search_sdt2);
|
||||
mSh = (CheckBox) findViewById(R.id.search_sh);
|
||||
mSr = (CheckBox) findViewById(R.id.search_sr);
|
||||
mMinRating = (Spinner) findViewById(R.id.search_min_rating);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,8 +53,6 @@ public class CategoryTable extends TableLayout {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
inflater.inflate(R.layout.widget_category_table, this);
|
||||
|
||||
setStretchAllColumns(true);
|
||||
|
||||
mDoujinshi = (CheckTextView)findViewById(R.id.button_doujinshi);
|
||||
mManga = (CheckTextView)findViewById(R.id.button_manga);
|
||||
mArtistCG = (CheckTextView)findViewById(R.id.button_artistcg);
|
||||
|
||||
Reference in new issue
Block a user