Fix a bug

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-02-11 14:15:14 +01:00
parent d18498ea9d
commit 45847abf4f

View File

@ -126,6 +126,8 @@ public class CallsListController extends BaseController implements SearchView.On
private SearchView searchView; private SearchView searchView;
private String searchQuery; private String searchQuery;
private View view;
public CallsListController() { public CallsListController() {
super(); super();
setHasOptionsMenu(true); setHasOptionsMenu(true);
@ -322,7 +324,7 @@ public class CallsListController extends BaseController implements SearchView.On
new Handler().postDelayed(() -> { new Handler().postDelayed(() -> {
bottomSheet.setCancelable(true); bottomSheet.setCancelable(true);
if (bottomSheet.isShowing()) { if (bottomSheet.isShowing()) {
bottomSheet.cancel(); bottomSheet.dismiss();
} }
}, 2500); }, 2500);
} }
@ -350,7 +352,7 @@ public class CallsListController extends BaseController implements SearchView.On
adapter.setFastScroller(fastScroller); adapter.setFastScroller(fastScroller);
fastScroller.setBubbleTextCreator(position -> { fastScroller.setBubbleTextCreator(position -> {
String displayName = adapter.getItem(position).getModel().getDisplayName(); String displayName = adapter.getItem(position).getModel().getDisplayName();
if(displayName.length() > 8) { if (displayName.length() > 8) {
displayName = displayName.substring(0, 4) + "..."; displayName = displayName.substring(0, 4) + "...";
} }
return displayName; return displayName;
@ -426,7 +428,7 @@ public class CallsListController extends BaseController implements SearchView.On
} else { } else {
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable()); bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) { if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
bottomSheet.cancel(); bottomSheet.dismiss();
} }
} }
} }
@ -444,7 +446,9 @@ public class CallsListController extends BaseController implements SearchView.On
} }
private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean shouldShowCallMenuController) { private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean shouldShowCallMenuController) {
View view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false); if (view == null) {
view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
}
if (shouldShowCallMenuController) { if (shouldShowCallMenuController) {
getChildRouter((ViewGroup) view).setRoot( getChildRouter((ViewGroup) view).setRoot(
@ -458,14 +462,9 @@ public class CallsListController extends BaseController implements SearchView.On
.pushChangeHandler(new VerticalChangeHandler())); .pushChangeHandler(new VerticalChangeHandler()));
} }
boolean isNew = false;
if (bottomSheet == null) { if (bottomSheet == null) {
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create(); bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
isNew = true; } else if (bottomSheet.getWindow() != null) {
}
if (bottomSheet.getWindow() != null && isNew) {
bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
} }