mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-12 23:34:31 +01:00
Forgot to add things
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
70670baf3a
commit
38d581c5a8
@ -60,7 +60,7 @@
|
||||
android:name=".activities.CallActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:launchMode="singleTask"
|
||||
/>
|
||||
android:noHistory="true"/>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -60,6 +60,7 @@ import com.nextcloud.talk.controllers.bottomsheet.CallMenuController;
|
||||
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
|
||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||
import com.nextcloud.talk.events.MoreMenuClickEvent;
|
||||
import com.nextcloud.talk.events.ShowScreenEvent;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
import com.nextcloud.talk.models.json.rooms.Room;
|
||||
@ -168,6 +169,7 @@ 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -412,6 +414,15 @@ public class CallsListController extends BaseController implements SearchView.On
|
||||
return onQueryTextChange(query);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageEvent(ShowScreenEvent showScreenEvent) {
|
||||
if (showScreenEvent.getScreenType().equals(ShowScreenEvent.ScreenType.CONTACTS_SCREEN)) {
|
||||
getRouter().pushController((RouterTransaction.with(new ContactsController(showScreenEvent.getBundle()))
|
||||
.pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler())));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent) {
|
||||
if (bottomSheet != null) {
|
||||
|
@ -62,6 +62,7 @@ import com.nextcloud.talk.api.NcApi;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.controllers.base.BaseController;
|
||||
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
|
||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||
import com.nextcloud.talk.models.RetrofitBucket;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
@ -73,6 +74,9 @@ import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.parceler.Parcels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -115,6 +119,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
@Inject
|
||||
NcApi ncApi;
|
||||
|
||||
@Inject
|
||||
EventBus eventBus;
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
@ -172,6 +179,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
@Override
|
||||
protected void onAttach(@NonNull View view) {
|
||||
super.onAttach(view);
|
||||
eventBus.register(this);
|
||||
|
||||
if (isNewConversationView) {
|
||||
checkAndHandleBottomButtons();
|
||||
|
||||
@ -186,6 +195,10 @@ 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();
|
||||
|
||||
@ -239,26 +252,65 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
@Optional
|
||||
@OnClick(R.id.done_button)
|
||||
public void onDoneButtonClick() {
|
||||
Bundle bundle = new Bundle();
|
||||
Room.RoomType roomType;
|
||||
if (isPublicCall) {
|
||||
roomType = Room.RoomType.ROOM_PUBLIC_CALL;
|
||||
} else {
|
||||
roomType = Room.RoomType.ROOM_GROUP_CALL;
|
||||
}
|
||||
bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType));
|
||||
ArrayList<String> userIds = new ArrayList<>();
|
||||
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
|
||||
for (int selectedPosition : selectedPositions) {
|
||||
if (adapter.getItem(selectedPosition) instanceof UserItem) {
|
||||
UserItem userItem = (UserItem) adapter.getItem(selectedPosition);
|
||||
userIds.add(userItem.getModel().getUserId());
|
||||
}
|
||||
|
||||
if (!isPublicCall && adapter.getSelectedPositions().size() == 1) {
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1",
|
||||
((UserItem) adapter.getItem(adapter.getSelectedPositions().get(0))).getModel().getUserId(), null);
|
||||
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
|
||||
retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<RoomOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOverall roomOverall) {
|
||||
if (getActivity() != null) {
|
||||
overridePushHandler(new NoOpControllerChangeHandler());
|
||||
overridePopHandler(new NoOpControllerChangeHandler());
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
|
||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
|
||||
callIntent.putExtras(bundle);
|
||||
startActivity(callIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
Room.RoomType roomType;
|
||||
if (isPublicCall) {
|
||||
roomType = Room.RoomType.ROOM_PUBLIC_CALL;
|
||||
} else {
|
||||
roomType = Room.RoomType.ROOM_GROUP_CALL;
|
||||
}
|
||||
bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType));
|
||||
ArrayList<String> userIds = new ArrayList<>();
|
||||
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
|
||||
for (int selectedPosition : selectedPositions) {
|
||||
if (adapter.getItem(selectedPosition) instanceof UserItem) {
|
||||
UserItem userItem = (UserItem) adapter.getItem(selectedPosition);
|
||||
userIds.add(userItem.getModel().getUserId());
|
||||
}
|
||||
}
|
||||
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
|
||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
|
||||
prepareAndShowBottomSheetWithBundle(bundle);
|
||||
}
|
||||
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
|
||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
|
||||
prepareAndShowBottomSheetWithBundle(bundle);
|
||||
}
|
||||
|
||||
private void initSearchView() {
|
||||
@ -588,7 +640,6 @@ 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);
|
||||
startActivity(callIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -681,4 +732,25 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
|
||||
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()) {
|
||||
bottomSheet.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetach(@NonNull View view) {
|
||||
super.onDetach(view);
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,9 +38,9 @@ import com.nextcloud.talk.R;
|
||||
import com.nextcloud.talk.adapters.items.AppItem;
|
||||
import com.nextcloud.talk.adapters.items.MenuItem;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.controllers.ContactsController;
|
||||
import com.nextcloud.talk.controllers.base.BaseController;
|
||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||
import com.nextcloud.talk.events.ShowScreenEvent;
|
||||
import com.nextcloud.talk.models.json.rooms.Room;
|
||||
import com.nextcloud.talk.utils.ShareUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
@ -237,12 +237,7 @@ 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);
|
||||
if (getParentController() != null && getParentController().getParentController() != null) {
|
||||
getParentController().getParentController().getRouter().pushController(
|
||||
(RouterTransaction.with(new ContactsController(bundle))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler())));
|
||||
}
|
||||
eventBus.post(new ShowScreenEvent(ShowScreenEvent.ScreenType.CONTACTS_SCREEN, bundle));
|
||||
} else {
|
||||
bundle = new Bundle();
|
||||
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 10);
|
||||
|
@ -507,6 +507,7 @@ public class OperationsMenuController extends BaseController {
|
||||
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, baseUrl);
|
||||
}
|
||||
bundle.putString(BundleKeys.KEY_CALL_SESSION, callSession);
|
||||
|
||||
overridePushHandler(new NoOpControllerChangeHandler());
|
||||
overridePopHandler(new NoOpControllerChangeHandler());
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
|
Loading…
Reference in New Issue
Block a user