Change editText focus.
On comming back to home from narrowed a fragment, change focus to
stream editText from topic or message editText.
@@ -568,6 +568,7 @@ public class ZulipActivity extends BaseActivity implements
if (narrowedList == null) {
calendar = Calendar.getInstance();
menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_today);
+ checkForChatBoxFocusRequest();
} else if (narrowedList.filter instanceof NarrowFilterByDate) {
menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_one_day_before);
}
@@ -575,6 +576,16 @@ public class ZulipActivity extends BaseActivity implements
});
}
+ private void checkForChatBoxFocusRequest() {
+ if (TextUtils.isEmpty(streamActv.getText().toString())) {
+ streamActv.requestFocus();
+ } else if (TextUtils.isEmpty(topicActv.getText().toString())) {
+ topicActv.requestFocus();
+ } else {
+ messageEt.requestFocus();
+ }
+ }
+
/**
* Change peopleAdapter cursor to default
* Clear text of etSearchPeople
@@ -1047,13 +1058,7 @@ public class ZulipActivity extends BaseActivity implements
displayFAB(false);
fabHidder.start();
showSoftKeyboard();
- if (TextUtils.isEmpty(streamActv.getText().toString())) {
- streamActv.requestFocus();
- } else if (TextUtils.isEmpty(topicActv.getText().toString())) {
- topicActv.requestFocus();
- } else {
- messageEt.requestFocus();
- }
+ checkForChatBoxFocusRequest();
}
});
}
