Various usability improvements

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-03-03 22:12:12 +01:00
parent 0d94501d29
commit 062eea5084
5 changed files with 54 additions and 19 deletions

View File

@ -168,7 +168,12 @@ public class CallsListController extends BaseController implements SearchView.On
protected void onAttach(@NonNull View view) {
super.onAttach(view);
eventBus.register(this);
getParentController().getView().findViewById(R.id.navigation).setVisibility(View.VISIBLE);
if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(false);
}
userEntity = userUtils.getCurrentUser();
}
@Override

View File

@ -20,6 +20,7 @@
package com.nextcloud.talk.controllers;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
@ -44,6 +45,7 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.LinearLayout;
@ -159,10 +161,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
public ContactsController() {
super();
setHasOptionsMenu(true);
}
public ContactsController(Bundle args) {
super(args);
setHasOptionsMenu(true);
if (args.containsKey(BundleKeys.KEY_NEW_CONVERSATION)) {
isNewConversationView = true;
}
@ -176,7 +180,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
@Override
protected void onAttach(@NonNull View view) {
super.onAttach(view);
setHasOptionsMenu(true);
eventBus.register(this);
if (isNewConversationView) {
@ -193,10 +196,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
super.onViewBound(view);
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
if (isNewConversationView) {
getParentController().getView().findViewById(R.id.navigation).setVisibility(View.GONE);
}
FlipView.resetLayoutAnimationDelay(true, 1000L);
FlipView.stopLayoutAnimation();
@ -272,6 +271,13 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
callIntent.putExtras(bundle);
if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
}
startActivity(callIntent);
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
}
@ -635,6 +641,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
callIntent.putExtras(bundle);
if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
}
startActivity(callIntent);
}
}
@ -726,19 +738,30 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
bottomSheet.setOnCancelListener(dialog -> {
if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
});
bottomSheet.show();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent) {
if (bottomSheet != null) {
if (!bottomSheetLockEvent.isCancelable()) {
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
} else {
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
new Handler().postDelayed(() -> bottomSheet.cancel(), bottomSheetLockEvent.getDelay());
getRouter().popCurrentController();
new Handler().postDelayed(() -> {
bottomSheet.setOnCancelListener(null);
bottomSheet.cancel();
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
}, bottomSheetLockEvent.getDelay());
}
}
}

View File

@ -239,8 +239,9 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
eventBus.post(new BottomSheetLockEvent(true, 0, false, true));
bundle = new Bundle();
bundle.putBoolean(BundleKeys.KEY_NEW_CONVERSATION, true);
getParentController().getRouter().pushController((RouterTransaction.with(new ContactsController
(bundle))
getParentController().getParentController().getRouter().pushController((RouterTransaction.with
(new ContactsController
(bundle))
.pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler())));
} else {

View File

@ -182,7 +182,7 @@ public class EntryMenuController extends BaseController {
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
editText.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE && proceedButton.isEnabled()) {
if (actionId == EditorInfo.IME_ACTION_DONE && proceedButton != null && proceedButton.isEnabled()) {
proceedButton.callOnClick();
return true;
}

View File

@ -20,15 +20,16 @@
package com.nextcloud.talk.controllers.bottomsheet;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
@ -271,7 +272,7 @@ public class OperationsMenuController extends BaseController {
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
} else {
initiateCall(false);
initiateCall();
}
} else {
showResultImage(false, true);
@ -487,7 +488,7 @@ public class OperationsMenuController extends BaseController {
}
if (localInvitedUsers.size() == 0) {
initiateCall(true);
initiateCall();
}
dispose();
}
@ -498,7 +499,7 @@ public class OperationsMenuController extends BaseController {
}
}
private void initiateCall(boolean fromContactsView) {
private void initiateCall() {
eventBus.post(new BottomSheetLockEvent(true, 0, true, true));
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken());
@ -510,10 +511,15 @@ public class OperationsMenuController extends BaseController {
Intent callIntent = new Intent(getActivity(), CallActivity.class);
callIntent.putExtras(bundle);
startActivity(callIntent);
if (fromContactsView) {
new Handler().postDelayed(() -> getParentController().getRouter().popCurrentController(), 100);
if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
}
startActivity(callIntent);
}
private class OperationsObserver implements Observer {
@ -530,7 +536,7 @@ public class OperationsMenuController extends BaseController {
} else {
CallOverall callOverall = (CallOverall) o;
callSession = callOverall.getOcs().getData().getSessionId();
initiateCall(false);
initiateCall();
}
}