From b1c579e8772927525ea1372bfbdbf9c44aa5e84a Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 4 Jul 2020 17:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kunfei/bookshelf/view/fragment/BaseFileFragment.java | 4 +++- .../kunfei/bookshelf/view/fragment/BookListFragment.java | 2 +- .../kunfei/bookshelf/view/fragment/BookmarkFragment.java | 2 +- .../bookshelf/view/fragment/ChapterListFragment.java | 2 +- .../bookshelf/view/fragment/FileCategoryFragment.java | 7 ++++--- .../kunfei/bookshelf/view/fragment/FindBookFragment.java | 6 ++++-- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BaseFileFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BaseFileFragment.java index 0f3c80a711..8e9ede6748 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BaseFileFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BaseFileFragment.java @@ -1,5 +1,6 @@ package com.kunfei.bookshelf.view.fragment; +import com.kunfei.basemvplib.impl.IPresenter; import com.kunfei.bookshelf.base.MBaseFragment; import com.kunfei.bookshelf.view.adapter.FileSystemAdapter; @@ -11,7 +12,7 @@ * FileSystemActivity的基础Fragment类 */ -public abstract class BaseFileFragment extends MBaseFragment { +public abstract class BaseFileFragment extends MBaseFragment { protected FileSystemAdapter mAdapter; protected OnFileCheckedListener mListener; @@ -67,6 +68,7 @@ public void deleteCheckedFiles() { //删除选中的文件 for (File file : files) { if (file.exists()) { + //noinspection ResultOfMethodCallIgnored file.delete(); } } diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookListFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookListFragment.java index c71a3ba967..33f95df530 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookListFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookListFragment.java @@ -159,7 +159,7 @@ protected void bindEvent() { ivBack.setOnClickListener(v -> setArrange(false)); ivDel.setOnClickListener(v -> { if (bookShelfAdapter.getSelected().size() == bookShelfAdapter.getBooks().size()) { - AlertDialog alertDialog = new AlertDialog.Builder(getActivity()) + AlertDialog alertDialog = new AlertDialog.Builder(requireContext()) .setTitle(R.string.delete) .setMessage(getString(R.string.sure_del_all_book)) .setPositiveButton(R.string.yes, (dialog, which) -> delSelect()) diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookmarkFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookmarkFragment.java index 1d8be26522..adf8e0405d 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookmarkFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/BookmarkFragment.java @@ -30,7 +30,7 @@ import io.reactivex.Single; import io.reactivex.SingleOnSubscribe; -public class BookmarkFragment extends MBaseFragment { +public class BookmarkFragment extends MBaseFragment { @BindView(R.id.rv_list) FastScrollRecyclerView rvList; diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/ChapterListFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/ChapterListFragment.java index 41540611ba..ba10c327eb 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/ChapterListFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/ChapterListFragment.java @@ -32,7 +32,7 @@ import butterknife.ButterKnife; import butterknife.Unbinder; -public class ChapterListFragment extends MBaseFragment { +public class ChapterListFragment extends MBaseFragment { @BindView(R.id.rv_list) FastScrollRecyclerView rvList; @BindView(R.id.tv_current_chapter_info) diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/FileCategoryFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/FileCategoryFragment.java index 942863d50d..c5ff54cf82 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/FileCategoryFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/FileCategoryFragment.java @@ -155,7 +155,8 @@ private void setTextViewIconColor(TextView textView) { // textView.getCompoundDrawables()[0].mutate(); try { textView.getCompoundDrawables()[0].setColorFilter(getResources().getColor(R.color.tv_text_default), PorterDuff.Mode.SRC_ATOP); - } catch (Exception e) {} + } catch (Exception ignored) { + } } private void toggleFileTree(File file) { @@ -194,7 +195,7 @@ public void onDestroyView() { } - public class FileComparator implements Comparator { + public static class FileComparator implements Comparator { @Override public int compare(File o1, File o2) { if (o1.isDirectory() && o2.isFile()) { @@ -207,7 +208,7 @@ public int compare(File o1, File o2) { } } - public class SimpleFileFilter implements FileFilter { + public static class SimpleFileFilter implements FileFilter { @Override public boolean accept(File pathname) { if (pathname.getName().startsWith(".")) { diff --git a/app/src/main/java/com/kunfei/bookshelf/view/fragment/FindBookFragment.java b/app/src/main/java/com/kunfei/bookshelf/view/fragment/FindBookFragment.java index d0bcad4195..7ba8d1fefd 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/fragment/FindBookFragment.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/fragment/FindBookFragment.java @@ -55,7 +55,9 @@ import static android.app.Activity.RESULT_OK; -public class FindBookFragment extends MBaseFragment implements FindBookContract.View, OnRecyclerViewListener.OnItemClickListener, OnRecyclerViewListener.OnItemLongClickListener { +public class FindBookFragment extends MBaseFragment implements FindBookContract.View, + OnRecyclerViewListener.OnItemClickListener, + OnRecyclerViewListener.OnItemLongClickListener { @BindView(R.id.ll_content) LinearLayout llContent; @BindView(R.id.refresh_layout) @@ -294,7 +296,7 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d } @SuppressWarnings("unused") - public class ScrollLinearLayoutManger extends GridLayoutManager { + public static class ScrollLinearLayoutManger extends GridLayoutManager { public ScrollLinearLayoutManger(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes);