Skip to content

Commit

Permalink
Fixed the lists tab order. This should partially fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGGamerM committed Dec 11, 2022
1 parent cce6ba0 commit 1f51331
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public ListTimelinesFragment() {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args=getArguments();
setTitle(R.string.sk_list_timelines);
// setTitle(R.string.sk_list_timelines);
accountId=args.getString("account");

if(args.containsKey("profileAccount")){
profileAccountId=args.getString("profileAccount");
profileDisplayUsername=args.getString("profileDisplayUsername");
setTitle(getString(R.string.sk_lists_with_user, profileDisplayUsername));
// setHasOptionsMenu(true);
setHasOptionsMenu(true);
}
// toolbarTitle=new TextView(getActivity());
// toolbarTitle.setText(R.string.sk_list_timelines);
Expand All @@ -85,27 +85,24 @@ protected void onShown(){
loadData();
}

// @Override
// public void onAttach(Activity activity){
// super.onAttach(activity);
// setHasOptionsMenu(false);
// setTitle(R.string.sk_list_timelines);
// }

// @Override
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Button saveButton=new Button(getActivity());
// saveButton.setText(R.string.save);
// saveButton.setOnClickListener(this::onSaveClick);
// LinearLayout wrap=new LinearLayout(getActivity());
// wrap.setOrientation(LinearLayout.HORIZONTAL);
// wrap.addView(saveButton, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
// wrap.setPadding(V.dp(16), V.dp(4), V.dp(16), V.dp(8));
// wrap.setClipToPadding(false);
// MenuItem item=menu.add(R.string.save);
// item.setActionView(wrap);
// item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
// }
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
Button saveButton=new Button(getActivity());
saveButton.setText(R.string.save);
saveButton.setOnClickListener(this::onSaveClick);
LinearLayout wrap=new LinearLayout(getActivity());
wrap.setOrientation(LinearLayout.HORIZONTAL);
wrap.addView(saveButton, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
wrap.setPadding(V.dp(16), V.dp(4), V.dp(16), V.dp(8));
wrap.setClipToPadding(false);
MenuItem item=menu.add(R.string.save);
item.setActionView(wrap);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

private void onSaveClick(View view) {
System.out.println("Save");
}

private void saveListMembership(String listId, boolean isMember) {
userInList.put(listId, isMember);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
tabView.setId(switch(switchIndex){
case 0 -> R.id.discover_local_timeline;
case 1 -> R.id.discover_federated_timeline;
case 2 -> R.id.discover_hashtags;
case 3 -> R.id.discover_posts;
case 4 -> R.id.discover_news;
case 5 -> R.id.discover_users;
case 6 -> R.id.discover_lists;
case 2 -> R.id.discover_lists;
case 3 -> R.id.discover_hashtags;
case 4 -> R.id.discover_posts;
case 5 -> R.id.discover_news;
case 6 -> R.id.discover_users;
default -> throw new IllegalStateException("Unexpected value: "+switchIndex);
});
tabView.setVisibility(View.GONE);
Expand Down Expand Up @@ -165,11 +165,12 @@ public void onConfigureTab(@NonNull TabLayout.Tab tab, int position){
tab.setText(switch(position){
case 0 -> R.string.local_timeline;
case 1 -> R.string.sk_federated_timeline;
case 2 -> R.string.hashtags;
case 3 -> R.string.posts;
case 4 -> R.string.news;
case 5 -> R.string.for_you;
case 6 -> R.string.sk_list_timelines;
case 2 -> R.string.sk_list_timelines;
case 3 -> R.string.hashtags;
case 4 -> R.string.posts;
case 5 -> R.string.news;
case 6 -> R.string.for_you;

default -> throw new IllegalStateException("Unexpected value: "+position);
});
tab.view.textView.setAllCaps(true);
Expand Down

0 comments on commit 1f51331

Please sign in to comment.