mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
fix actions that are clicked in Conversation Bottom Dialog
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
d76203a093
commit
76451c1649
@ -566,15 +566,6 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromBottomSheet) {
|
|
||||||
new Handler().postDelayed(() -> {
|
|
||||||
bottomSheet.setCancelable(true);
|
|
||||||
if (bottomSheet.isShowing()) {
|
|
||||||
bottomSheet.cancel();
|
|
||||||
}
|
|
||||||
}, 2500);
|
|
||||||
}
|
|
||||||
|
|
||||||
isRefreshing = false;
|
isRefreshing = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1249,16 +1240,6 @@ 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
|
@Override
|
||||||
public AppBarLayoutType getAppBarLayoutType() {
|
public AppBarLayoutType getAppBarLayoutType() {
|
||||||
return AppBarLayoutType.SEARCH_BAR;
|
return AppBarLayoutType.SEARCH_BAR;
|
||||||
|
@ -44,7 +44,6 @@ class ConversationOperationDialog(
|
|||||||
|
|
||||||
private var dialogRouter: Router? = null
|
private var dialogRouter: Router? = null
|
||||||
|
|
||||||
|
|
||||||
private lateinit var binding: DialogConversationOperationsBinding
|
private lateinit var binding: DialogConversationOperationsBinding
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -99,15 +98,15 @@ class ConversationOperationDialog(
|
|||||||
)
|
)
|
||||||
|
|
||||||
binding.conversationOperationChangePassword.visibility = setVisibleIf(
|
binding.conversationOperationChangePassword.visibility = setVisibleIf(
|
||||||
canModerate && conversation.isHasPassword
|
canModerate && conversation.isHasPassword && conversation.isPublic
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.conversationOperationClearPassword.visibility = setVisibleIf(
|
binding.conversationOperationClearPassword.visibility = setVisibleIf(
|
||||||
canModerate && conversation.isHasPassword
|
canModerate && conversation.isHasPassword && conversation.isPublic
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.conversationOperationSetPassword.visibility = setVisibleIf(
|
binding.conversationOperationSetPassword.visibility = setVisibleIf(
|
||||||
canModerate && !conversation.isHasPassword
|
canModerate && !conversation.isHasPassword && conversation.isPublic
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.conversationOperationDelete.visibility = setVisibleIf(
|
binding.conversationOperationDelete.visibility = setVisibleIf(
|
||||||
@ -136,53 +135,12 @@ class ConversationOperationDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initClickListeners() {
|
private fun initClickListeners() {
|
||||||
// val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
|
||||||
// val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
|
|
||||||
|
|
||||||
binding.conversationOperationAddFavorite.setOnClickListener {
|
binding.conversationOperationAddFavorite.setOnClickListener {
|
||||||
|
executeOperationsMenuController(98)
|
||||||
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 {
|
binding.conversationOperationRemoveFavorite.setOnClickListener {
|
||||||
// TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
|
executeOperationsMenuController(97)
|
||||||
// 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 {
|
binding.conversationOperationLeave.setOnClickListener {
|
||||||
@ -216,83 +174,27 @@ class ConversationOperationDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.conversationOperationMakePublic.setOnClickListener {
|
binding.conversationOperationMakePublic.setOnClickListener {
|
||||||
// TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
|
executeOperationsMenuController(3)
|
||||||
// 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 {
|
binding.conversationOperationMakePrivate.setOnClickListener {
|
||||||
// TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
|
executeOperationsMenuController(8)
|
||||||
// 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()
|
binding.conversationOperationChangePassword.setOnClickListener {
|
||||||
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
executeEntryMenuController(4)
|
||||||
bundle.putInt(KEY_OPERATION_CODE, 8)
|
|
||||||
|
|
||||||
controller.router.pushController(
|
|
||||||
RouterTransaction.with(OperationsMenuController(bundle))
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.conversationOperationClearPassword.setOnClickListener {
|
binding.conversationOperationClearPassword.setOnClickListener {
|
||||||
// TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
|
executeOperationsMenuController(5)
|
||||||
// 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 {
|
binding.conversationOperationSetPassword.setOnClickListener {
|
||||||
// TODO: this weird KEY_OPERATION_CODE stuff came from CallMenuController.
|
executeEntryMenuController(6)
|
||||||
// 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()
|
binding.conversationOperationRename.setOnClickListener {
|
||||||
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
executeEntryMenuController(2)
|
||||||
bundle.putInt(KEY_OPERATION_CODE, 6)
|
|
||||||
|
|
||||||
controller.router.pushController(
|
|
||||||
RouterTransaction.with(EntryMenuController(bundle))
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.conversationOperationShareLink.setOnClickListener {
|
binding.conversationOperationShareLink.setOnClickListener {
|
||||||
@ -300,6 +202,46 @@ class ConversationOperationDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun executeOperationsMenuController(operationCode: Int) {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
||||||
|
bundle.putInt(KEY_OPERATION_CODE, operationCode)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun executeEntryMenuController(operationCode: Int) {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putParcelable(KEY_ROOM, Parcels.wrap(conversation))
|
||||||
|
bundle.putInt(KEY_OPERATION_CODE, operationCode)
|
||||||
|
|
||||||
|
binding.operationItemsLayout.visibility = View.GONE
|
||||||
|
|
||||||
|
dialogRouter = Conductor.attachRouter(activity, binding.root, null)
|
||||||
|
|
||||||
|
dialogRouter!!.pushController(
|
||||||
|
|
||||||
|
// TODO: refresh conversation list after EntryMenuController finished (throw event? / pass controller
|
||||||
|
// into EntryMenuController to execute fetch data... ?!)
|
||||||
|
// for example if you set a password, the dialog items should be refreshed for the next time you open it
|
||||||
|
// without to manually have to refresh the conversations list
|
||||||
|
|
||||||
|
RouterTransaction.with(EntryMenuController(bundle))
|
||||||
|
.pushChangeHandler(HorizontalChangeHandler())
|
||||||
|
.popChangeHandler(HorizontalChangeHandler())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
||||||
|
Loading…
Reference in New Issue
Block a user