From 7fa7a8cb5340948781f1b6720097cd564ffaf6b1 Mon Sep 17 00:00:00 2001 From: Jim Wu Date: Sun, 29 Mar 2020 16:48:57 +0800 Subject: [PATCH] Change application fragment title --- ...stFragment.java => ApplicationFragment.java} | 17 ++++++----------- .../edxposed/manager/WelcomeActivity.java | 2 +- ...Adapter.java => ApplicationListAdapter.java} | 4 ++-- 3 files changed, 9 insertions(+), 14 deletions(-) rename app/src/main/java/org/meowcat/edxposed/manager/{BlackListFragment.java => ApplicationFragment.java} (87%) rename app/src/main/java/org/meowcat/edxposed/manager/adapter/{BlackListAdapter.java => ApplicationListAdapter.java} (93%) diff --git a/app/src/main/java/org/meowcat/edxposed/manager/BlackListFragment.java b/app/src/main/java/org/meowcat/edxposed/manager/ApplicationFragment.java similarity index 87% rename from app/src/main/java/org/meowcat/edxposed/manager/BlackListFragment.java rename to app/src/main/java/org/meowcat/edxposed/manager/ApplicationFragment.java index d5ad7fcc..b6eba67a 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/BlackListFragment.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/ApplicationFragment.java @@ -19,25 +19,20 @@ import org.meowcat.edxposed.manager.adapter.AppAdapter; import org.meowcat.edxposed.manager.adapter.AppHelper; -import org.meowcat.edxposed.manager.adapter.BlackListAdapter; +import org.meowcat.edxposed.manager.adapter.ApplicationListAdapter; -public class BlackListFragment extends Fragment implements AppAdapter.Callback { +public class ApplicationFragment extends Fragment implements AppAdapter.Callback { private SwipeRefreshLayout mSwipeRefreshLayout; - //private RecyclerView mRecyclerView; private SearchView mSearchView; - private BlackListAdapter mAppAdapter; + private ApplicationListAdapter mAppAdapter; private SearchView.OnQueryTextListener mSearchListener; - public BlackListFragment() { + public ApplicationFragment() { setRetainInstance(true); } - //public static BlackListFragment newInstance() { - // return new BlackListFragment(); - //} - @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -70,7 +65,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c } final boolean isWhiteListMode = isWhiteListMode(); - mAppAdapter = new BlackListAdapter(requireActivity(), isWhiteListMode); + mAppAdapter = new ApplicationListAdapter(requireActivity(), isWhiteListMode); mRecyclerView.setAdapter(mAppAdapter); mAppAdapter.setCallback(this); mSwipeRefreshLayout.setRefreshing(true); @@ -94,7 +89,7 @@ public boolean onQueryTextChange(String newText) { private void changeTitle(boolean isBlackListMode, boolean isWhiteListMode) { if (isBlackListMode) { - requireActivity().setTitle(isWhiteListMode ? R.string.title_white_list : R.string.title_black_list); + requireActivity().setTitle(String.format("%s(%s)", getString(R.string.nav_title_black_list), getString(isWhiteListMode ? R.string.title_white_list : R.string.title_black_list))); } else { requireActivity().setTitle(R.string.nav_title_black_list); } diff --git a/app/src/main/java/org/meowcat/edxposed/manager/WelcomeActivity.java b/app/src/main/java/org/meowcat/edxposed/manager/WelcomeActivity.java index 1abd3e14..21d67c34 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/WelcomeActivity.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/WelcomeActivity.java @@ -157,7 +157,7 @@ private void navigate(final int itemId) { case R.id.nav_black_list: mPrevSelectedId = itemId; setTitle(R.string.nav_title_black_list); - navFragment = new BlackListFragment(); + navFragment = new ApplicationFragment(); break; case R.id.nav_compat_list: mPrevSelectedId = itemId; diff --git a/app/src/main/java/org/meowcat/edxposed/manager/adapter/BlackListAdapter.java b/app/src/main/java/org/meowcat/edxposed/manager/adapter/ApplicationListAdapter.java similarity index 93% rename from app/src/main/java/org/meowcat/edxposed/manager/adapter/BlackListAdapter.java rename to app/src/main/java/org/meowcat/edxposed/manager/adapter/ApplicationListAdapter.java index 73ce6999..53bfe736 100644 --- a/app/src/main/java/org/meowcat/edxposed/manager/adapter/BlackListAdapter.java +++ b/app/src/main/java/org/meowcat/edxposed/manager/adapter/ApplicationListAdapter.java @@ -15,12 +15,12 @@ import static org.meowcat.edxposed.manager.adapter.AppHelper.FORCE_WHITE_LIST_MODULE; -public class BlackListAdapter extends AppAdapter { +public class ApplicationListAdapter extends AppAdapter { private volatile boolean isWhiteListMode; private List checkedList; - public BlackListAdapter(Context context, boolean isWhiteListMode) { + public ApplicationListAdapter(Context context, boolean isWhiteListMode) { super(context, "Application"); this.isWhiteListMode = isWhiteListMode; }