From f8bb67f3fe587bf7cb9ebd2d32faffa1eb86f0c5 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Sat, 3 Mar 2018 21:02:29 +0100 Subject: [PATCH] Refactoring Signed-off-by: Mario Danic --- .../talk/controllers/CallsListController.java | 10 ----- .../bottomsheet/CallMenuController.java | 8 +++- .../talk/events/ShowScreenEvent.java | 41 ------------------- 3 files changed, 6 insertions(+), 53 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/events/ShowScreenEvent.java diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java index a2c36c332..58d2cded7 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java @@ -60,7 +60,6 @@ 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; @@ -414,15 +413,6 @@ 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) { diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java index 79e69a51d..de0a6c4da 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java @@ -33,14 +33,15 @@ import android.view.ViewGroup; import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; +import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler; import com.kennyc.bottomsheet.adapters.AppAdapter; 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; @@ -238,7 +239,10 @@ 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); - eventBus.post(new ShowScreenEvent(ShowScreenEvent.ScreenType.CONTACTS_SCREEN, bundle)); + getParentController().getRouter().pushController((RouterTransaction.with(new ContactsController + (bundle)) + .pushChangeHandler(new VerticalChangeHandler()) + .popChangeHandler(new VerticalChangeHandler()))); } else { bundle = new Bundle(); bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 10); diff --git a/app/src/main/java/com/nextcloud/talk/events/ShowScreenEvent.java b/app/src/main/java/com/nextcloud/talk/events/ShowScreenEvent.java deleted file mode 100644 index 4f721fea1..000000000 --- a/app/src/main/java/com/nextcloud/talk/events/ShowScreenEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.talk.events; - -import android.os.Bundle; -import android.support.annotation.Nullable; - -import lombok.Data; - -@Data -public class ShowScreenEvent { - @Nullable - private final Bundle bundle; - private final ScreenType screenType; - public ShowScreenEvent(ScreenType screenType, @Nullable Bundle bundle) { - this.bundle = bundle; - this.screenType = screenType; - } - - public enum ScreenType { - CONTACTS_SCREEN - } -}