修复部分bug

pull/5/head
fengyuecanzhu 4 years ago
parent f17c8e1406
commit 08b2194769
  1. 8
      app/src/main/assets/updatelog.fy
  2. 4
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  3. 2
      app/src/main/java/xyz/fycz/myreader/custom/DragSortGridView.java
  4. 9
      app/src/main/java/xyz/fycz/myreader/entity/SearchBookBean.java
  5. 3
      app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java
  6. 1
      app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java
  7. 15
      app/src/main/java/xyz/fycz/myreader/ui/search/SearchBookActivity.java
  8. 59
      app/src/main/java/xyz/fycz/myreader/ui/search/SearchBookAdapter.java
  9. 72
      app/src/main/java/xyz/fycz/myreader/ui/search/SearchBookPrensenter.java
  10. 14
      app/src/main/res/layout/activity_search_book.xml
  11. 3
      app/src/main/res/layout/fragment_bookcase.xml
  12. 1
      app/src/main/res/layout/listview_search_book_item.xml
  13. 2
      app/version_code.properties

@ -1,11 +1,17 @@
2020.08.07
风月读书v1.20.080709
1、修复搜索书籍滑动混乱的问题
2、优化搜索书籍滑动显示
2020.07.31 2020.07.31
风月读书v1.20.073114 风月读书v1.20.073120
1、新增书架同步功能(需要注册登录) 1、新增书架同步功能(需要注册登录)
2、新增每日自动同步书架功能(默认关闭) 2、新增每日自动同步书架功能(默认关闭)
3、新增书籍一键缓存功能(实验功能,存在bug) 3、新增书籍一键缓存功能(实验功能,存在bug)
4、新增关于界面(检查更新、免责声明移至此界面) 4、新增关于界面(检查更新、免责声明移至此界面)
5、修复正在自动翻页退出阅读时闪退的问题 5、修复正在自动翻页退出阅读时闪退的问题
6、修复软件\字体下载api 6、修复软件\字体下载api
7、修复翻页切换章节时保存出错的问题
2020.07.25 2020.07.25
风月读书v1.20.072519 风月读书v1.20.072519

@ -10,10 +10,10 @@ import java.io.File;
public class APPCONST { public class APPCONST {
public static String publicKey = "";//服务端公钥 public static String publicKey = "fyds1.0";//服务端公钥
public static String privateKey;//app私钥 public static String privateKey;//app私钥
public final static String s = "11940364935628058505"; public final static String s = "11940364935628058505";
public static final String KEY = ""; public static final String KEY = "readerByFengyue";
public static final String ALARM_SCHEDULE_MSG = "alarm_schedule_msg"; public static final String ALARM_SCHEDULE_MSG = "alarm_schedule_msg";

@ -522,9 +522,11 @@ public class DragSortGridView extends FrameLayout {
} }
this.adapter = adapter; this.adapter = adapter;
mGridView.setAdapter(adapter); mGridView.setAdapter(adapter);
if (adapter != null) {
adapter.registerDataSetObserver(observer); adapter.registerDataSetObserver(observer);
mChildCount = adapter.getCount(); mChildCount = adapter.getCount();
} }
}
public int getNumColumns() { public int getNumColumns() {
return mNumColumns; return mNumColumns;

@ -9,6 +9,7 @@ import java.util.Objects;
public class SearchBookBean { public class SearchBookBean {
private String name;//书名 private String name;//书名
private String author;//作者 private String author;//作者
private int sourceCount;//书源数量
public SearchBookBean() { public SearchBookBean() {
} }
@ -34,6 +35,14 @@ public class SearchBookBean {
this.author = author; this.author = author;
} }
public int getSourceCount() {
return sourceCount;
}
public void setSourceCount(int sourceCount) {
this.sourceCount = sourceCount;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;

@ -804,8 +804,11 @@ public class BookcasePresenter implements BasePresenter {
* @return * @return
*/ */
public boolean ismEditState() { public boolean ismEditState() {
if (mBookcaseAdapter != null) {
return mBookcaseAdapter.ismEditState(); return mBookcaseAdapter.ismEditState();
} }
return false;
}
/** /**
* 取消编辑状态 * 取消编辑状态

@ -560,6 +560,7 @@ public class ReadPresenter implements BasePresenter {
preLoad(pos - 1 + i); preLoad(pos - 1 + i);
} }
mBook.setHistoryChapterId(mChapters.get(pos).getTitle()); mBook.setHistoryChapterId(mChapters.get(pos).getTitle());
mHandler.sendMessage(mHandler.obtainMessage(4));
MyApplication.getApplication().newThread(() -> { MyApplication.getApplication().newThread(() -> {
if (mPageLoader.getPageStatus() == PageLoader.STATUS_LOADING) { if (mPageLoader.getPageStatus() == PageLoader.STATUS_LOADING) {
if (!NetworkUtils.isNetWorkAvailable()) { if (!NetworkUtils.isNetWorkAvailable()) {

@ -13,6 +13,7 @@ import xyz.fycz.myreader.base.BaseActivity;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.BindView; import butterknife.BindView;
import me.gujun.android.taggroup.TagGroup; import me.gujun.android.taggroup.TagGroup;
import xyz.fycz.myreader.custom.DragSortGridView;
public class SearchBookActivity extends BaseActivity { public class SearchBookActivity extends BaseActivity {
@ -29,8 +30,10 @@ public class SearchBookActivity extends BaseActivity {
@BindView(R.id.ll_refresh_suggest_books) @BindView(R.id.ll_refresh_suggest_books)
LinearLayout llRefreshSuggestBooks; LinearLayout llRefreshSuggestBooks;
@BindView(R.id.lv_search_books_list) /*@BindView(R.id.lv_search_books_list)
ListView lvSearchBooksList; ListView lvSearchBooksList;*/
@BindView(R.id.gv_search_books_list)
DragSortGridView gvSearchBooksList;
@BindView(R.id.ll_suggest_books_view) @BindView(R.id.ll_suggest_books_view)
LinearLayout llSuggestBooksView; LinearLayout llSuggestBooksView;
@BindView(R.id.pb_loading) @BindView(R.id.pb_loading)
@ -98,8 +101,12 @@ public class SearchBookActivity extends BaseActivity {
return llRefreshSuggestBooks; return llRefreshSuggestBooks;
} }
public ListView getLvSearchBooksList() { // public ListView getLvSearchBooksList() {
return lvSearchBooksList; // return lvSearchBooksList;
// }
public DragSortGridView getGvSearchBooksList() {
return gvSearchBooksList;
} }
public LinearLayout getLlSuggestBooksView() { public LinearLayout getLlSuggestBooksView() {

@ -20,6 +20,7 @@ import xyz.fycz.myreader.callback.ResultCallback;
import xyz.fycz.myreader.crawler.BookInfoCrawler; import xyz.fycz.myreader.crawler.BookInfoCrawler;
import xyz.fycz.myreader.crawler.ReadCrawler; import xyz.fycz.myreader.crawler.ReadCrawler;
import xyz.fycz.myreader.crawler.ReadCrawlerUtil; import xyz.fycz.myreader.crawler.ReadCrawlerUtil;
import xyz.fycz.myreader.custom.DragAdapter;
import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.entity.SearchBookBean;
import xyz.fycz.myreader.enums.BookSource; import xyz.fycz.myreader.enums.BookSource;
import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Book;
@ -37,17 +38,21 @@ import java.util.Map;
* Created by zhao on 2017/7/26. * Created by zhao on 2017/7/26.
*/ */
public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> { public class SearchBookAdapter extends DragAdapter {
private int mResourceId; private int mResourceId;
private Context mContext;
private ConcurrentMultiValueMap<SearchBookBean, Book> mBooks; private ConcurrentMultiValueMap<SearchBookBean, Book> mBooks;
private ArrayList<SearchBookBean> mTempBooks = new ArrayList<>(); private ArrayList<SearchBookBean> mSearchBookBeans;
private Handler mHandle = new Handler(new Handler.Callback() { private ArrayList<SearchBookBean> mTempSearchBookBeans = new ArrayList<>();
@Override
public boolean handleMessage(Message message) { private HashMap<SearchBookBean, Book> mTempBooks = new HashMap<>();
private Handler mHandle = new Handler(message -> {
switch (message.what) { switch (message.what) {
case 1: case 1:
@ -57,22 +62,38 @@ public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> {
break; break;
} }
return false; return false;
}
}); });
public SearchBookAdapter(Context context, int resourceId, ArrayList<SearchBookBean> datas, public SearchBookAdapter(Context context, int resourceId, ArrayList<SearchBookBean> datas,
ConcurrentMultiValueMap<SearchBookBean, Book> mBooks){ ConcurrentMultiValueMap<SearchBookBean, Book> mBooks){
super(context, resourceId, datas); mContext = context;
mSearchBookBeans = datas;
mResourceId = resourceId; mResourceId = resourceId;
this.mBooks = mBooks; this.mBooks = mBooks;
} }
@Override
public int getCount() {
return mSearchBookBeans.size();
}
@Override
public SearchBookBean getItem(int position) {
return mSearchBookBeans.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@NonNull @NonNull
@Override @Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
ViewHolder viewHolder = null; ViewHolder viewHolder = null;
if (convertView == null){ if (convertView == null){
viewHolder = new ViewHolder(); viewHolder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(mResourceId,null); convertView = LayoutInflater.from(mContext).inflate(mResourceId,null);
viewHolder.ivBookImg = convertView.findViewById(R.id.iv_book_img); viewHolder.ivBookImg = convertView.findViewById(R.id.iv_book_img);
viewHolder.tvBookName = convertView.findViewById(R.id.tv_book_name); viewHolder.tvBookName = convertView.findViewById(R.id.tv_book_name);
viewHolder.tvAuthor = convertView.findViewById(R.id.tv_book_author); viewHolder.tvAuthor = convertView.findViewById(R.id.tv_book_author);
@ -92,17 +113,15 @@ public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> {
private void initView(final int position, final ViewHolder viewHolder){ private void initView(final int position, final ViewHolder viewHolder){
List<Book> aBooks = mBooks.getValues(getItem(position)); List<Book> aBooks = mBooks.getValues(getItem(position));
int bookCount = aBooks.size(); int bookCount = aBooks.size();
final Book book = aBooks.get(0); Book book = aBooks.get(0);
SearchBookBean ssb = new SearchBookBean(book.getName(), book.getAuthor()); SearchBookBean ssb = new SearchBookBean(book.getName(), book.getAuthor());
//判断是否已经加载,防止多次加载 //判断是否已经加载,防止多次加载
for (SearchBookBean temp : mTempBooks){//已加载 /*for (SearchBookBean temp : mTempSearchBookBeans){//已加载
if (ssb.equals(temp)){ if (ssb.equals(temp)){
viewHolder.tvSource.setText("书源:" + BookSource.fromString(book.getSource()).text book = mTempBooks.get(ssb);
+ " 共" + bookCount + "个源");
return;
}
} }
}*/
if (StringHelper.isEmpty(book.getImgUrl())){ if (StringHelper.isEmpty(book.getImgUrl())){
book.setImgUrl(""); book.setImgUrl("");
@ -120,7 +139,7 @@ public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> {
CommonApi.getBookInfo(book, bic, new ResultCallback() { CommonApi.getBookInfo(book, bic, new ResultCallback() {
@Override @Override
public void onFinish(Object o, int code) { public void onFinish(Object o, int code) {
mHandle.sendMessage(mHandle.obtainMessage(1,position,0,viewHolder)); mHandle.sendMessage(mHandle.obtainMessage(1, position,0,viewHolder));
} }
@Override @Override
@ -133,12 +152,13 @@ public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> {
} }
//viewHolder.tvNewestChapter.setText(book.getNewestChapterTitle()); //viewHolder.tvNewestChapter.setText(book.getNewestChapterTitle());
//添加已经加载的书籍 //添加已经加载的书籍
mTempBooks.add(ssb); /*mTempSearchBookBeans.add(ssb);
mTempBooks.put(ssb, book);*/
} }
private void initOtherInfo(final int position, final ViewHolder holder){ private void initOtherInfo(final int position, final ViewHolder holder){
Book book = mBooks.getValue(getItem(position), 0); Book book = mBooks.getValue(getItem(position), 0);
//图片 //图片
Glide.with(getContext()) Glide.with(mContext)
.load(book.getImgUrl()) .load(book.getImgUrl())
// .override(DipPxUtil.dip2px(getContext(), 80), DipPxUtil.dip2px(getContext(), 150)) // .override(DipPxUtil.dip2px(getContext(), 80), DipPxUtil.dip2px(getContext(), 150))
.error(R.mipmap.no_image) .error(R.mipmap.no_image)
@ -151,6 +171,11 @@ public class SearchBookAdapter extends ArrayAdapter<SearchBookBean> {
holder.tvType.setText(book.getType()); holder.tvType.setText(book.getType());
} }
@Override
public void onDataModelMove(int from, int to) {
}
class ViewHolder{ class ViewHolder{
ImageView ivBookImg; ImageView ivBookImg;
TextView tvBookName; TextView tvBookName;

@ -3,6 +3,7 @@ package xyz.fycz.myreader.ui.search;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.text.Editable; import android.text.Editable;
@ -49,6 +50,7 @@ public class SearchBookPrensenter implements BasePresenter {
private String searchKey;//搜索关键字 private String searchKey;//搜索关键字
private ArrayList<SearchBookBean> mBooksBean = new ArrayList<>(); private ArrayList<SearchBookBean> mBooksBean = new ArrayList<>();
private ConcurrentMultiValueMap<SearchBookBean, Book> mBooks = new ConcurrentMultiValueMap<>(); private ConcurrentMultiValueMap<SearchBookBean, Book> mBooks = new ConcurrentMultiValueMap<>();
private ArrayList<Book> mAdapterBooks = new ArrayList<>();
private ArrayList<SearchHistory> mSearchHistories = new ArrayList<>(); private ArrayList<SearchHistory> mSearchHistories = new ArrayList<>();
private ArrayList<String> mSuggestions = new ArrayList<>(); private ArrayList<String> mSuggestions = new ArrayList<>();
@ -56,7 +58,6 @@ public class SearchBookPrensenter implements BasePresenter {
private SearchHistoryAdapter mSearchHistoryAdapter; private SearchHistoryAdapter mSearchHistoryAdapter;
private int curThreadCount; private int curThreadCount;
private int allThreadCount; private int allThreadCount;
@ -102,15 +103,12 @@ public class SearchBookPrensenter implements BasePresenter {
mSearchBookActivity.getTvTitleText().setText("搜索"); mSearchBookActivity.getTvTitleText().setText("搜索");
mSearchBookActivity.etSearchKey.requestFocus();//get the focus mSearchBookActivity.etSearchKey.requestFocus();//get the focus
//enter事件 //enter事件
mSearchBookActivity.getEtSearchKey().setOnEditorActionListener(new TextView.OnEditorActionListener() { mSearchBookActivity.getEtSearchKey().setOnEditorActionListener((textView, i, keyEvent) -> {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_UNSPECIFIED) { if (i == EditorInfo.IME_ACTION_UNSPECIFIED) {
mHandler.sendMessage(mHandler.obtainMessage(1)); mHandler.sendMessage(mHandler.obtainMessage(1));
return (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER); return (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER);
} }
return false; return false;
}
}); });
//换一批点击事件 //换一批点击事件
mSearchBookActivity.getRenewByImage().setOnClickListener(new RenewSuggestionBook()); mSearchBookActivity.getRenewByImage().setOnClickListener(new RenewSuggestionBook());
@ -142,66 +140,43 @@ public class SearchBookPrensenter implements BasePresenter {
}); });
//进入书籍详情页 //进入书籍详情页
mSearchBookActivity.getLvSearchBooksList().setOnItemClickListener(new AdapterView.OnItemClickListener() { mSearchBookActivity.getGvSearchBooksList().setOnItemClickListener((adapterView, view, i, l) -> {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(mSearchBookActivity, BookInfoActivity.class); Intent intent = new Intent(mSearchBookActivity, BookInfoActivity.class);
intent.putExtra(APPCONST.SEARCH_BOOK_BEAN, new ArrayList<>(mBooks.getValues(mBooksBean.get(i)))); intent.putExtra(APPCONST.SEARCH_BOOK_BEAN, new ArrayList<>(mBooks.getValues(mBooksBean.get(i))));
mSearchBookActivity.startActivity(intent); mSearchBookActivity.startActivity(intent);
}
}); });
//搜索按钮点击事件 //搜索按钮点击事件
mSearchBookActivity.getTvSearchConform().setOnClickListener(new View.OnClickListener() { mSearchBookActivity.getTvSearchConform().setOnClickListener(view -> mHandler.sendMessage(mHandler.obtainMessage(1)));
@Override
public void onClick(View view) {
mHandler.sendMessage(mHandler.obtainMessage(1));
}
});
//suggestion搜索事件 //suggestion搜索事件
mSearchBookActivity.getTgSuggestBook().setOnTagClickListener(new TagGroup.OnTagClickListener() { mSearchBookActivity.getTgSuggestBook().setOnTagClickListener(tag -> {
@Override
public void onTagClick(String tag) {
mSearchBookActivity.getEtSearchKey().setText(tag); mSearchBookActivity.getEtSearchKey().setText(tag);
mSearchBookActivity.getEtSearchKey().setSelection(tag.length()); mSearchBookActivity.getEtSearchKey().setSelection(tag.length());
mHandler.sendMessage(mHandler.obtainMessage(1)); mHandler.sendMessage(mHandler.obtainMessage(1));
}
}); });
//历史记录搜索事件 //历史记录搜索事件
mSearchBookActivity.getLvHistoryList().setOnItemClickListener(new AdapterView.OnItemClickListener() { mSearchBookActivity.getLvHistoryList().setOnItemClickListener((parent, view, position, id) -> {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mSearchBookActivity.getEtSearchKey().setText(mSearchHistories.get(position).getContent()); mSearchBookActivity.getEtSearchKey().setText(mSearchHistories.get(position).getContent());
mSearchBookActivity.getEtSearchKey().setSelection(mSearchHistories.get(position).getContent().length()); mSearchBookActivity.getEtSearchKey().setSelection(mSearchHistories.get(position).getContent().length());
mHandler.sendMessage(mHandler.obtainMessage(1)); mHandler.sendMessage(mHandler.obtainMessage(1));
}
}); });
//清空历史记录 //清空历史记录
mSearchBookActivity.getLlClearHistory().setOnClickListener(new View.OnClickListener() { mSearchBookActivity.getLlClearHistory().setOnClickListener(v -> {
@Override
public void onClick(View v) {
mSearchHistoryService.clearHistory(); mSearchHistoryService.clearHistory();
initHistoryList(); initHistoryList();
}
}); });
//清除单个历史记录 //清除单个历史记录
mSearchBookActivity.getLvHistoryList().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { mSearchBookActivity.getLvHistoryList().setOnItemLongClickListener((parent, view, position, id) -> {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (mSearchHistories.get(position) != null) { if (mSearchHistories.get(position) != null) {
mSearchHistoryService.deleteHistory(mSearchHistories.get(position)); mSearchHistoryService.deleteHistory(mSearchHistories.get(position));
initHistoryList(); initHistoryList();
} }
return true; return true;
}
}); });
//上拉刷新 //上拉刷新
mSearchBookActivity.getSrlSearchBookList().setOnRefreshListener(new OnRefreshListener() { mSearchBookActivity.getSrlSearchBookList().setOnRefreshListener(refreshLayout -> mHandler.sendMessage(mHandler.obtainMessage(1)));
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
mHandler.sendMessage(mHandler.obtainMessage(1));
}
});
mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(false); mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(false);
mSearchBookActivity.getGvSearchBooksList().setNumColumns(1);
mSearchBookActivity.getGvSearchBooksList().setDragModel(-1);
initSuggestionBook(); initSuggestionBook();
initHistoryList(); initHistoryList();
} }
@ -247,8 +222,8 @@ public class SearchBookPrensenter implements BasePresenter {
initmBooksBean(); initmBooksBean();
mSearchBookAdapter = new SearchBookAdapter(mSearchBookActivity, mSearchBookAdapter = new SearchBookAdapter(mSearchBookActivity,
R.layout.listview_search_book_item, mBooksBean, mBooks); R.layout.listview_search_book_item, mBooksBean, mBooks);
mSearchBookActivity.getLvSearchBooksList().setAdapter(mSearchBookAdapter); mSearchBookActivity.getGvSearchBooksList().setAdapter(mSearchBookAdapter);
mSearchBookActivity.getLvSearchBooksList().setVisibility(View.VISIBLE); mSearchBookActivity.getGvSearchBooksList().setVisibility(View.VISIBLE);
mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.GONE); mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.GONE);
mSearchBookActivity.getLlHistoryView().setVisibility(View.GONE); mSearchBookActivity.getLlHistoryView().setVisibility(View.GONE);
} }
@ -272,9 +247,7 @@ public class SearchBookPrensenter implements BasePresenter {
mBooksBean.addAll(mBooks.keySet()); mBooksBean.addAll(mBooks.keySet());
//排序,基于最符合关键字的搜书结果应该是最短的 //排序,基于最符合关键字的搜书结果应该是最短的
//TODO ;这里只做了简单的比较排序,还需要继续完善 //TODO ;这里只做了简单的比较排序,还需要继续完善
Collections.sort(mBooksBean, new Comparator<SearchBookBean>() { Collections.sort(mBooksBean, (o1, o2) -> {
@Override
public int compare(SearchBookBean o1, SearchBookBean o2) {
if (searchKey.equals(o1.getName())) if (searchKey.equals(o1.getName()))
return -1; return -1;
if (searchKey.equals(o2.getName())) if (searchKey.equals(o2.getName()))
@ -288,7 +261,6 @@ public class SearchBookPrensenter implements BasePresenter {
if (o1.getName().length() == o2.getName().length()) if (o1.getName().length() == o2.getName().length())
return 0; return 0;
return 1; return 1;
}
}); });
/*MyApplication.runOnUiThread(new Runnable() { /*MyApplication.runOnUiThread(new Runnable() {
@Override @Override
@ -320,17 +292,25 @@ public class SearchBookPrensenter implements BasePresenter {
mSearchBookActivity.getPbLoading().setVisibility(View.VISIBLE); mSearchBookActivity.getPbLoading().setVisibility(View.VISIBLE);
if (StringHelper.isEmpty(searchKey)) { if (StringHelper.isEmpty(searchKey)) {
mSearchBookActivity.getPbLoading().setVisibility(View.GONE); mSearchBookActivity.getPbLoading().setVisibility(View.GONE);
mSearchBookActivity.getLvSearchBooksList().setVisibility(View.GONE); mSearchBookActivity.getGvSearchBooksList().setVisibility(View.GONE);
mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.VISIBLE); mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.VISIBLE);
initHistoryList(); initHistoryList();
mSearchBookActivity.getLvSearchBooksList().setAdapter(null); mSearchBookActivity.getGvSearchBooksList().setAdapter(null);
mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(false); mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(false);
} else { } else {
mSearchBookActivity.getLvSearchBooksList().setVisibility(View.VISIBLE); mSearchBookActivity.getGvSearchBooksList().setVisibility(View.VISIBLE);
mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.GONE); mSearchBookActivity.getLlSuggestBooksView().setVisibility(View.GONE);
mSearchBookActivity.getLlHistoryView().setVisibility(View.GONE); mSearchBookActivity.getLlHistoryView().setVisibility(View.GONE);
getData(); getData();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (mSearchBookActivity.getGvSearchBooksList().getmScrollView().getScrollY() == 0){
mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(true); mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(true);
}
//滑动监听器
mSearchBookActivity.getGvSearchBooksList().getmScrollView().setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
mSearchBookActivity.getSrlSearchBookList().setEnableRefresh(scrollY == 0);
});
}
mSearchHistoryService.addOrUpadteHistory(searchKey); mSearchHistoryService.addOrUpadteHistory(searchKey);
//收起软键盘 //收起软键盘
InputMethodManager imm = (InputMethodManager) MyApplication.getmContext().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) MyApplication.getmContext().getSystemService(Context.INPUT_METHOD_SERVICE);

@ -151,15 +151,23 @@
<com.scwang.smartrefresh.header.MaterialHeader <com.scwang.smartrefresh.header.MaterialHeader
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<ListView <!--<ListView
android:id="@+id/lv_search_books_list" android:id="@+id/lv_search_books_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fadingEdge="none" android:fadingEdge="none"
android:overScrollMode="never" android:overScrollMode="never"
android:scrollbars="none"> android:scrollbars="none">
</ListView>-->
</ListView> <xyz.fycz.myreader.custom.DragSortGridView
android:id="@+id/gv_search_books_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:listSelector="@android:color/transparent"
android:numColumns="auto_fit"
android:scrollbars="none"
android:padding="5dp">
</xyz.fycz.myreader.custom.DragSortGridView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>

@ -1,4 +1,5 @@
<com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.scwang.smartrefresh.layout.SmartRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/srl_content" android:id="@+id/srl_content"

@ -35,6 +35,7 @@
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:text="bookname" android:text="bookname"
android:maxLength="15"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/black"/> android:textColor="@color/black"/>

@ -1,2 +1,2 @@
#Fri Jul 31 14:26:22 CST 2020 #Fri Aug 07 09:42:27 CST 2020
VERSION_CODE=140 VERSION_CODE=140

Loading…
Cancel
Save