forked from mirrors/Fedilab
Fix #144 - Null pointer on BottomMenu
This commit is contained in:
parent
87eba3db2f
commit
85da5043b0
2 changed files with 14 additions and 12 deletions
|
@ -93,17 +93,19 @@ public class BottomMenu implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPosition(BottomMenu bottomMenu, @IdRes int idRes) {
|
public static int getPosition(BottomMenu bottomMenu, @IdRes int idRes) {
|
||||||
for (MenuItem menuItem : bottomMenu.bottom_menu) {
|
if (bottomMenu != null && bottomMenu.bottom_menu != null) {
|
||||||
if (idRes == R.id.nav_home && menuItem.item_menu_type == ItemMenuType.HOME) {
|
for (MenuItem menuItem : bottomMenu.bottom_menu) {
|
||||||
return menuItem.position;
|
if (idRes == R.id.nav_home && menuItem.item_menu_type == ItemMenuType.HOME) {
|
||||||
} else if (idRes == R.id.nav_local && menuItem.item_menu_type == ItemMenuType.LOCAL) {
|
return menuItem.position;
|
||||||
return menuItem.position;
|
} else if (idRes == R.id.nav_local && menuItem.item_menu_type == ItemMenuType.LOCAL) {
|
||||||
} else if (idRes == R.id.nav_public && menuItem.item_menu_type == ItemMenuType.PUBLIC) {
|
return menuItem.position;
|
||||||
return menuItem.position;
|
} else if (idRes == R.id.nav_public && menuItem.item_menu_type == ItemMenuType.PUBLIC) {
|
||||||
} else if (idRes == R.id.nav_notifications && menuItem.item_menu_type == ItemMenuType.NOTIFICATION) {
|
return menuItem.position;
|
||||||
return menuItem.position;
|
} else if (idRes == R.id.nav_notifications && menuItem.item_menu_type == ItemMenuType.NOTIFICATION) {
|
||||||
} else if (idRes == R.id.nav_privates && menuItem.item_menu_type == ItemMenuType.DIRECT) {
|
return menuItem.position;
|
||||||
return menuItem.position;
|
} else if (idRes == R.id.nav_privates && menuItem.item_menu_type == ItemMenuType.DIRECT) {
|
||||||
|
return menuItem.position;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
*/
|
*/
|
||||||
private void manageMentions(Context context, Status statusDraft, ComposeViewHolder holder) {
|
private void manageMentions(Context context, Status statusDraft, ComposeViewHolder holder) {
|
||||||
|
|
||||||
if (statusDraft.mentions != null && (statusDraft.text == null || statusDraft.text.length() == 0)) {
|
if (statusDraft.mentions != null && (statusDraft.text == null || statusDraft.text.length() == 0) && statusDraft.mentions.size() > 0) {
|
||||||
//Retrieves mentioned accounts + OP and adds them at the beginin of the toot
|
//Retrieves mentioned accounts + OP and adds them at the beginin of the toot
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
Mention inReplyToUser = null;
|
Mention inReplyToUser = null;
|
||||||
|
|
Loading…
Reference in a new issue