mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Fix update of text in menu after removal of static methods
This commit is contained in:
parent
337191ff1a
commit
4ec4b66921
1 changed files with 13 additions and 4 deletions
|
@ -88,7 +88,12 @@ public class OCFileListFragment extends ExtendedListFragment
|
|||
private OCFile mTargetFile;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -213,6 +218,11 @@ public class OCFileListFragment extends ExtendedListFragment
|
|||
outState.putParcelable(KEY_FILE, mFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu (Menu menu) {
|
||||
changeGridIcon(menu); // this is enough if the option stays out of the action bar
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this, when the user presses the up button.
|
||||
*
|
||||
|
@ -340,7 +350,6 @@ public class OCFileListFragment extends ExtendedListFragment
|
|||
// String.format(mContext.getString(R.string.subject_token),
|
||||
// getClient().getCredentials().getUsername(), file.getFileName()));
|
||||
|
||||
changeGridIcon(menu, targetFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,9 +649,9 @@ public class OCFileListFragment extends ExtendedListFragment
|
|||
}
|
||||
}
|
||||
|
||||
private void changeGridIcon(ContextMenu menu, OCFile targetFile){
|
||||
private void changeGridIcon(Menu menu){
|
||||
MenuItem menuItem = menu.findItem(R.id.action_switch_view);
|
||||
if (isGridViewPreferred(targetFile)){
|
||||
if (isGridViewPreferred(mFile)){
|
||||
menuItem.setTitle(getString(R.string.action_switch_list_view));
|
||||
menuItem.setIcon(R.drawable.ic_view_list);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue