Refactoring

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-03-03 21:02:29 +01:00
parent 7cdf323353
commit f8bb67f3fe
3 changed files with 6 additions and 53 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -1,41 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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
}
}