replace CallMenuController with ConversationOperationDialog.kt

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-02-09 22:30:48 +01:00
parent 90a99d4994
commit cb9189da19
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
5 changed files with 775 additions and 101 deletions

View File

@ -70,11 +70,9 @@ import com.nextcloud.talk.adapters.items.GenericTextHeaderItem;
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.CallMenuController;
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
import com.nextcloud.talk.events.BottomSheetLockEvent;
import com.nextcloud.talk.events.EventStatus;
import com.nextcloud.talk.events.MoreMenuClickEvent;
import com.nextcloud.talk.interfaces.ConversationMenuInterface;
import com.nextcloud.talk.jobs.AccountRemovalWorker;
import com.nextcloud.talk.jobs.ContactAddressBookWorker;
@ -85,6 +83,7 @@ import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.conversations.Conversation;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.ui.dialog.ChooseAccountDialogFragment;
import com.nextcloud.talk.ui.dialog.ConversationOperationDialog;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.ClosedInterfaceImpl;
import com.nextcloud.talk.utils.ConductorRemapping;
@ -217,6 +216,8 @@ public class ConversationsListController extends BaseController implements Searc
private HashMap<String, GenericTextHeaderItem> callHeaderItems = new HashMap<>();
private ConversationOperationDialog conversationOperationDialog;
public ConversationsListController(Bundle bundle) {
super();
setHasOptionsMenu(true);
@ -828,15 +829,15 @@ public class ConversationsListController extends BaseController implements Searc
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(MoreMenuClickEvent moreMenuClickEvent) {
Bundle bundle = new Bundle();
Conversation conversation = moreMenuClickEvent.getConversation();
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ROOM(), Parcels.wrap(conversation));
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_MENU_TYPE(), Parcels.wrap(CallMenuController.MenuType.REGULAR));
prepareAndShowBottomSheetWithBundle(bundle, true);
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onMessageEvent(MoreMenuClickEvent moreMenuClickEvent) {
//// Bundle bundle = new Bundle();
//// Conversation conversation = moreMenuClickEvent.getConversation();
//// bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ROOM(), Parcels.wrap(conversation));
//// bundle.putParcelable(BundleKeys.INSTANCE.getKEY_MENU_TYPE(), Parcels.wrap(CallMenuController.MenuType.REGULAR));
////
//// prepareAndShowBottomSheetWithBundle(bundle, true);
// }
private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean shouldShowCallMenuController) {
if (view == null) {
@ -844,10 +845,12 @@ public class ConversationsListController extends BaseController implements Searc
}
if (shouldShowCallMenuController) {
getChildRouter((ViewGroup) view).setRoot(
RouterTransaction.with(new CallMenuController(bundle, this))
.popChangeHandler(new VerticalChangeHandler())
.pushChangeHandler(new VerticalChangeHandler()));
// getChildRouter((ViewGroup) view).setRoot(
// RouterTransaction.with(new CallMenuController(bundle, this))
// .popChangeHandler(new VerticalChangeHandler())
// .pushChangeHandler(new VerticalChangeHandler()));
} else {
getChildRouter((ViewGroup) view).setRoot(
RouterTransaction.with(new EntryMenuController(bundle))
@ -855,13 +858,13 @@ public class ConversationsListController extends BaseController implements Searc
.pushChangeHandler(new VerticalChangeHandler()));
}
if (bottomSheet == null) {
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
}
// bottomSheet.setOnShowListener(dialog -> new KeyboardUtils(getActivity(), bottomSheet.getLayout(), true));
bottomSheet.setOnDismissListener(dialog -> showSearchOrToolbar());
bottomSheet.show();
// if (bottomSheet == null) {
// bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
// }
//
//// bottomSheet.setOnShowListener(dialog -> new KeyboardUtils(getActivity(), bottomSheet.getLayout(), true));
// bottomSheet.setOnDismissListener(dialog -> showSearchOrToolbar());
// bottomSheet.show();
}
@Override
@ -949,8 +952,12 @@ public class ConversationsListController extends BaseController implements Searc
Object clickedItem = adapter.getItem(position);
if (clickedItem != null) {
Conversation conversation = ((ConversationItem) clickedItem).getModel();
MoreMenuClickEvent moreMenuClickEvent = new MoreMenuClickEvent(conversation);
onMessageEvent(moreMenuClickEvent);
conversationOperationDialog = new ConversationOperationDialog(
getActivity(),
this,
userUtils.getCurrentUser(),
conversation);
conversationOperationDialog.show();
}
}
}
@ -1239,7 +1246,6 @@ public class ConversationsListController extends BaseController implements Searc
default:
break;
}
}
@Override

View File

@ -151,82 +151,82 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
menuItems = new ArrayList<>();
if (menuType.equals(MenuType.REGULAR)) {
if (!TextUtils.isEmpty(conversation.getDisplayName())) {
menuItems.add(new MenuItem(conversation.getDisplayName(), 0, null));
} else if (!TextUtils.isEmpty(conversation.getName())) {
menuItems.add(new MenuItem(conversation.getName(), 0, null));
} else {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_configure_room), 0, null));
}
currentUser = userUtils.getCurrentUser();
if (conversation.isFavorite()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_remove_from_favorites), 97, DisplayUtils.getTintedDrawable(getResources(), R.drawable.ic_star_border_black_24dp, R.color.grey_600)));
} else if (CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "favorites")) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_add_to_favorites),
98,
DisplayUtils.getTintedDrawable(getResources(),
R.drawable.ic_star_black_24dp,
R.color.grey_600)));
}
if(conversation.unreadMessages > ALL_MESSAGES_READ && CapabilitiesUtil.canSetChatReadMarker(currentUser)) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_mark_as_read),
96,
ContextCompat.getDrawable(context, R.drawable.ic_eye)));
}
if (conversation.isNameEditable(currentUser)) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_rename),
2,
ContextCompat.getDrawable(context,
R.drawable.ic_pencil_grey600_24dp)));
}
if (conversation.canModerate(currentUser)) {
if (!conversation.isPublic()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_make_call_public),
3, ContextCompat.getDrawable(context,
R.drawable.ic_link_grey600_24px)));
} else {
if (conversation.isHasPassword()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_change_password),
4, ContextCompat.getDrawable(context,
R.drawable.ic_lock_grey600_24px)));
menuItems.add(new MenuItem(getResources().getString(R.string.nc_clear_password),
5,
ContextCompat.getDrawable(context,
R.drawable.ic_lock_open_grey600_24dp)));
} else {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_set_password),
6, ContextCompat.getDrawable(context,
R.drawable.ic_lock_plus_grey600_24dp)));
}
}
menuItems.add(new MenuItem(getResources().getString(R.string.nc_delete_call),
9, ContextCompat.getDrawable(context,
R.drawable.ic_delete_grey600_24dp)));
}
if (conversation.isPublic()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_share_link),
7, ContextCompat.getDrawable(context,
R.drawable.ic_link_grey600_24px)));
if (conversation.canModerate(currentUser)) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_make_call_private),
8, ContextCompat.getDrawable(context,
R.drawable.ic_group_grey600_24px)));
}
}
if (conversation.canLeave(currentUser)) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_leave), 1,
DisplayUtils.getTintedDrawable(getResources(),
R.drawable.ic_exit_to_app_black_24dp, R.color.grey_600)
));
}
// if (!TextUtils.isEmpty(conversation.getDisplayName())) {
// menuItems.add(new MenuItem(conversation.getDisplayName(), 0, null));
// } else if (!TextUtils.isEmpty(conversation.getName())) {
// menuItems.add(new MenuItem(conversation.getName(), 0, null));
// } else {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_configure_room), 0, null));
// }
//
// currentUser = userUtils.getCurrentUser();
//
// if (conversation.isFavorite()) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_remove_from_favorites), 97, DisplayUtils.getTintedDrawable(getResources(), R.drawable.ic_star_border_black_24dp, R.color.grey_600)));
// } else if (CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "favorites")) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_add_to_favorites),
// 98,
// DisplayUtils.getTintedDrawable(getResources(),
// R.drawable.ic_star_black_24dp,
// R.color.grey_600)));
// }
//
// if(conversation.unreadMessages > ALL_MESSAGES_READ && CapabilitiesUtil.canSetChatReadMarker(currentUser)) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_mark_as_read),
// 96,
// ContextCompat.getDrawable(context, R.drawable.ic_eye)));
// }
//
// if (conversation.isNameEditable(currentUser)) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_rename),
// 2,
// ContextCompat.getDrawable(context,
// R.drawable.ic_pencil_grey600_24dp)));
// }
//
// if (conversation.canModerate(currentUser)) {
// if (!conversation.isPublic()) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_make_call_public),
// 3, ContextCompat.getDrawable(context,
// R.drawable.ic_link_grey600_24px)));
// } else {
// if (conversation.isHasPassword()) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_change_password),
// 4, ContextCompat.getDrawable(context,
// R.drawable.ic_lock_grey600_24px)));
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_clear_password),
// 5,
// ContextCompat.getDrawable(context,
// R.drawable.ic_lock_open_grey600_24dp)));
// } else {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_set_password),
// 6, ContextCompat.getDrawable(context,
// R.drawable.ic_lock_plus_grey600_24dp)));
// }
// }
//
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_delete_call),
// 9, ContextCompat.getDrawable(context,
// R.drawable.ic_delete_grey600_24dp)));
// }
//
// if (conversation.isPublic()) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_share_link),
// 7, ContextCompat.getDrawable(context,
// R.drawable.ic_link_grey600_24px)));
// if (conversation.canModerate(currentUser)) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_make_call_private),
// 8, ContextCompat.getDrawable(context,
// R.drawable.ic_group_grey600_24px)));
// }
// }
//
// if (conversation.canLeave(currentUser)) {
// menuItems.add(new MenuItem(getResources().getString(R.string.nc_leave), 1,
// DisplayUtils.getTintedDrawable(getResources(),
// R.drawable.ic_exit_to_app_black_24dp, R.color.grey_600)
// ));
// }
} else if (menuType.equals(MenuType.SHARE)) {
prepareIntent();
List<AppAdapter.AppInfo> appInfoList = ShareUtils.getShareApps(getActivity(), shareIntent, null,
@ -282,13 +282,20 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
}
eventBus.post(new BottomSheetLockEvent(true, 0, false, true));
} else {
// TODO: continue here to extract more setOnClickListeners to ConversationOperationDialog.kt
bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), tag);
if (tag != 2 && tag != 4 && tag != 6 && tag != 7) {
// 3=make call public, 5=clear pw, 8=make call private ..
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
getRouter().pushController(RouterTransaction.with(new OperationsMenuController(bundle))
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
} else if (tag != 7) {
// 3=make call public, 5=clear pw, 8=make call private ..
// rename and set password !?
getRouter().pushController(RouterTransaction.with(new EntryMenuController(bundle))
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));

View File

@ -0,0 +1,314 @@
package com.nextcloud.talk.ui.dialog
import android.app.Activity
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import androidx.work.Data
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import autodagger.AutoInjector
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.nextcloud.talk.R
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.controllers.ConversationsListController
import com.nextcloud.talk.controllers.bottomsheet.CallMenuController
import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController
import com.nextcloud.talk.controllers.bottomsheet.OperationsMenuController
import com.nextcloud.talk.databinding.DialogConversationOperationsBinding
import com.nextcloud.talk.jobs.LeaveConversationWorker
import com.nextcloud.talk.models.database.CapabilitiesUtil
import com.nextcloud.talk.models.database.UserEntity
import com.nextcloud.talk.models.json.conversations.Conversation
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPERATION_CODE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import org.parceler.Parcels
import javax.inject.Inject
@AutoInjector(NextcloudTalkApplication::class)
class ConversationOperationDialog(
val activity: Activity,
val controller: ConversationsListController,
val currentUser: UserEntity,
val conversation: Conversation
) : BottomSheetDialog(activity) {
private lateinit var binding: DialogConversationOperationsBinding
@Inject
@JvmField
var ncApi: NcApi? = null
init {
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DialogConversationOperationsBinding.inflate(layoutInflater)
setContentView(binding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
initHeaderDescription()
initItemsVisibility()
initClickListeners()
}
private fun initHeaderDescription() {
if (!TextUtils.isEmpty(conversation.getDisplayName())) {
binding.conversationOperationHeader.text = conversation.getDisplayName()
} else if (!TextUtils.isEmpty(conversation.getName())) {
binding.conversationOperationHeader.text = conversation.getName()
}
}
private fun initItemsVisibility() {
val hasFavoritesCapability = CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "favorites")
val canModerate = conversation.canModerate(currentUser)
binding.conversationOperationRemoveFavorite.visibility = setVisibleIf(
hasFavoritesCapability && conversation.isFavorite()
)
binding.conversationOperationAddFavorite.visibility = setVisibleIf(
hasFavoritesCapability && !conversation.isFavorite()
)
binding.conversationOperationMarkAsRead.visibility = setVisibleIf(
conversation.unreadMessages > CallMenuController.ALL_MESSAGES_READ
&& CapabilitiesUtil.canSetChatReadMarker(currentUser)
)
binding.conversationOperationRename.visibility = setVisibleIf(
conversation.isNameEditable(currentUser)
)
binding.conversationOperationMakePublic.visibility = setVisibleIf(
canModerate && !conversation.isPublic
)
binding.conversationOperationChangePassword.visibility = setVisibleIf(
canModerate && conversation.isHasPassword
)
binding.conversationOperationClearPassword.visibility = setVisibleIf(
canModerate && conversation.isHasPassword
)
binding.conversationOperationSetPassword.visibility = setVisibleIf(
canModerate && !conversation.isHasPassword
)
binding.conversationOperationDelete.visibility = setVisibleIf(
canModerate
)
binding.conversationOperationShareLink.visibility = setVisibleIf(
conversation.isPublic
)
binding.conversationOperationMakePrivate.visibility = setVisibleIf(
conversation.isPublic && canModerate
)
binding.conversationOperationLeave.visibility = setVisibleIf(
conversation.canLeave(currentUser)
)
}
private fun setVisibleIf(boolean: Boolean): Int {
return if (boolean) {
View.VISIBLE
} else {
View.GONE
}
}
private fun initClickListeners() {
// // val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token)
// // val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
//
// binding.conversationOperationAddFavorite.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 98)
//
// // controller.router.pushController(
// // RouterTransaction.with(OperationsMenuController(bundle))
// // .pushChangeHandler(HorizontalChangeHandler())
// // .popChangeHandler(HorizontalChangeHandler())
// // )
//
//
//
// // var view = activity.layoutInflater.inflate(R.layout.bottom_sheet, null, true)
// // controller.getChildRouter((view as ViewGroup?)!!).setRoot(
// // RouterTransaction.with(OperationsMenuController(bundle))
// // .popChangeHandler(VerticalChangeHandler())
// // .pushChangeHandler(VerticalChangeHandler())
// // )
//
//
//
// // dismiss()
// }
//
// binding.conversationOperationRemoveFavorite.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 97)
//
// controller.router.pushController(
// RouterTransaction.with(OperationsMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
//
// dismiss()
// }
//
// binding.conversationOperationClearPassword.setOnClickListener {
// conversation.setPassword("")
// }
//
// binding.conversationOperationLeave.setOnClickListener {
// val dataBuilder = Data.Builder()
// dataBuilder.putString(KEY_ROOM_TOKEN, conversation.getToken())
// dataBuilder.putLong(KEY_INTERNAL_USER_ID, currentUser.id)
// val data = dataBuilder.build()
//
// val leaveConversationWorker =
// OneTimeWorkRequest.Builder(LeaveConversationWorker::class.java).setInputData(
// data
// ).build()
// WorkManager.getInstance().enqueue(leaveConversationWorker)
//
// dismiss()
// }
//
// binding.conversationOperationDelete.setOnClickListener {
// if (!TextUtils.isEmpty(conversation.getToken())) {
// val bundle = Bundle()
// bundle.putLong(KEY_INTERNAL_USER_ID, currentUser.id)
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
//
// controller.openLovelyDialogWithIdAndBundle(
// ConversationsListController.ID_DELETE_CONVERSATION_DIALOG,
// bundle
// )
// }
//
// dismiss()
// }
//
// binding.conversationOperationMakePublic.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 3)
//
// controller.router.pushController(
// RouterTransaction.with(OperationsMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
// }
//
// binding.conversationOperationMakePrivate.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 8)
//
// controller.router.pushController(
// RouterTransaction.with(OperationsMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
// }
//
// binding.conversationOperationClearPassword.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 5)
//
// controller.router.pushController(
// RouterTransaction.with(OperationsMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
// }
//
// binding.conversationOperationRename.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 2)
//
// controller.router.pushController(
// RouterTransaction.with(EntryMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
// }
//
// binding.conversationOperationSetPassword.setOnClickListener {
// // TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
// // CallMenuController was replaced with the class you're in here.
// // This KEY_OPERATION_CODE stuff still needs to be deleted/rewritten in the classes where it's passed to.
//
// val bundle = Bundle()
// bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
// bundle.putInt(KEY_OPERATION_CODE, 6)
//
// controller.router.pushController(
// RouterTransaction.with(EntryMenuController(bundle))
// .pushChangeHandler(HorizontalChangeHandler())
// .popChangeHandler(HorizontalChangeHandler())
// )
// }
//
// binding.conversationOperationShareLink.setOnClickListener {
// // TODO share by intent
// }
}
override fun onStart() {
super.onStart()
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
companion object {
private const val TAG = "ConversationOperationDialog"
}
}

View File

@ -19,6 +19,7 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/controller_operations_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_default">

View File

@ -0,0 +1,346 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_call_screen_dialog"
android:orientation="vertical"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding">
<TextView
android:id="@+id/conversation_operation_header"
android:layout_width="wrap_content"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="start|center_vertical"
android:textColor="@color/medium_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size"
tools:text="conversation name"/>
<LinearLayout
android:id="@+id/conversation_operation_remove_favorite"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_star_border_black_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_remove_from_favorites"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_add_favorite"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_star_black_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_add_to_favorites"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_mark_as_read"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_eye"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_mark_as_read"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_rename"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_pencil_grey600_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_rename"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_make_public"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_link_grey600_24px"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_make_call_public"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_change_password"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_lock_grey600_24px"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_change_password"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_clear_password"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_lock_open_grey600_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_clear_password"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_set_password"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_lock_plus_grey600_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_set_password"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_delete"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_delete_grey600_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_delete_call"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_share_link"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_link_grey600_24px"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_share_link"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_make_private"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_group_grey600_24px"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_make_call_private"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/conversation_operation_leave"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/ic_exit_to_app_black_24dp"
app:tint="@color/grey_600" />
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="@dimen/standard_double_padding"
android:paddingEnd="@dimen/zero"
android:text="@string/nc_leave"
android:textAlignment="viewStart"
android:textColor="@color/high_emphasis_text_dark_background"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
</LinearLayout>