diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java
index e82ed3f9d..c14b097c2 100644
--- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java
+++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java
@@ -71,6 +71,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.controllers.bottomsheet.OperationsMenuController;
import com.nextcloud.talk.events.BottomSheetLockEvent;
import com.nextcloud.talk.events.EventStatus;
import com.nextcloud.talk.interfaces.ConversationMenuInterface;
@@ -469,7 +470,7 @@ public class ConversationsListController extends BaseController implements Searc
}
@SuppressLint("LongLogTag")
- private void fetchData(boolean fromBottomSheet) {
+ public void fetchData(boolean fromBottomSheet) {
dispose(null);
isRefreshing = true;
@@ -1248,6 +1249,16 @@ public class ConversationsListController extends BaseController implements Searc
}
}
+
+ public void pushSomeOtherController(Bundle bundle) {
+
+ getRouter().pushController(
+ RouterTransaction.with(new OperationsMenuController(bundle))
+ .pushChangeHandler(new HorizontalChangeHandler())
+ .popChangeHandler(new HorizontalChangeHandler()));
+
+ }
+
@Override
public AppBarLayoutType getAppBarLayoutType() {
return AppBarLayoutType.SEARCH_BAR;
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationOperationDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationOperationDialog.kt
index e776915d5..7495c2156 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationOperationDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationOperationDialog.kt
@@ -9,9 +9,10 @@ import androidx.work.Data
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import autodagger.AutoInjector
+import com.bluelinelabs.conductor.Conductor
+import com.bluelinelabs.conductor.Router
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
@@ -41,6 +42,9 @@ class ConversationOperationDialog(
val conversation: Conversation
) : BottomSheetDialog(activity) {
+ private var dialogRouter: Router? = null
+
+
private lateinit var binding: DialogConversationOperationsBinding
@Inject
@@ -132,173 +136,168 @@ class ConversationOperationDialog(
}
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
- // }
+ // val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token)
+ // val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
+
+ binding.conversationOperationAddFavorite.setOnClickListener {
+
+ binding.textEditWrapper.visibility = View.VISIBLE
+ binding.operationItemsLayout.visibility = View.GONE
+
+
+ // 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)
+
+ dismiss()
+
+ // just a test
+ controller.pushSomeOtherController(bundle)
+
+ }
+
+ 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)
+
+ binding.operationItemsLayout.visibility = View.GONE
+
+ dialogRouter = Conductor.attachRouter(activity, binding.root, null)
+
+ dialogRouter!!.pushController(
+ RouterTransaction.with(OperationsMenuController(bundle))
+ .pushChangeHandler(HorizontalChangeHandler())
+ .popChangeHandler(HorizontalChangeHandler())
+ )
+
+ controller.fetchData(false)
+ }
+
+ 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() {
diff --git a/app/src/main/res/layout/dialog_conversation_operations.xml b/app/src/main/res/layout/dialog_conversation_operations.xml
index a5d08c28b..eabf675d9 100644
--- a/app/src/main/res/layout/dialog_conversation_operations.xml
+++ b/app/src/main/res/layout/dialog_conversation_operations.xml
@@ -10,337 +10,378 @@
android:paddingEnd="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding">
-
-
+ android:layout_height="wrap_content"
+ android:id="@+id/text_edit_wrapper"
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
-
+ 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"
+ android:text="aaaaaaaaaaa"
+ tools:text="conversation name"/>
-
+ android:text="joooo"
+ android:textColor="@color/white"
+ android:background="@android:color/transparent" >
+
+
+
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:id="@+id/operation_items_layout"
+ android:orientation="vertical">
-
+ 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"/>
-
+ android:layout_height="@dimen/bottom_sheet_item_height"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ tools:ignore="UseCompoundDrawables">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file