Skip to content

Commit

Permalink
Change application fragment title
Browse files Browse the repository at this point in the history
  • Loading branch information
MlgmXyysd committed Mar 29, 2020
1 parent 4543840 commit 7fa7a8c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> checkedList;

public BlackListAdapter(Context context, boolean isWhiteListMode) {
public ApplicationListAdapter(Context context, boolean isWhiteListMode) {
super(context, "Application");
this.isWhiteListMode = isWhiteListMode;
}
Expand Down

0 comments on commit 7fa7a8c

Please sign in to comment.