remove useless bundle entries etc.

- add strings for breakout room toasts
- remove useless boilerplate code
- dismiss call actions dialog when chlicked raise/lower hand

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-02-16 13:49:56 +01:00
parent 2637884a83
commit 3abb9db9dc
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
5 changed files with 42 additions and 23 deletions

View file

@ -1935,17 +1935,18 @@ public class CallActivity extends CallBaseActivity {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean(KEY_SWITCH_TO_ROOM_AND_START_CALL, true); bundle.putBoolean(KEY_SWITCH_TO_ROOM_AND_START_CALL, true);
bundle.putString(KEY_ROOM_TOKEN, switchToRoomToken); bundle.putString(KEY_ROOM_TOKEN, switchToRoomToken);
// bundle.putString(KEY_ROOM_ID, roomId);
bundle.putParcelable(KEY_USER_ENTITY, conversationUser); bundle.putParcelable(KEY_USER_ENTITY, conversationUser);
// conversationName = extras.getString(KEY_CONVERSATION_NAME, "");
bundle.putBoolean(KEY_CALL_VOICE_ONLY, isVoiceOnlyCall); bundle.putBoolean(KEY_CALL_VOICE_ONLY, isVoiceOnlyCall);
bundle.putBoolean(KEY_CALL_WITHOUT_NOTIFICATION, true);
bundle.putBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO, canPublishAudioStream);
bundle.putBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO, canPublishVideoStream);
intent.putExtras(bundle); intent.putExtras(bundle);
startActivity(intent); startActivity(intent);
Toast.makeText(context, "going to breakout room...", Toast.LENGTH_LONG).show(); if (isBreakoutRoom) {
Toast.makeText(context, context.getResources().getString(R.string.switch_to_main_room),
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(context, context.getResources().getString(R.string.switch_to_breakout_room),
Toast.LENGTH_LONG).show();
}
finish(); finish();
} else if (shutDownView) { } else if (shutDownView) {

View file

@ -356,7 +356,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
handleActionFromContact(intent) handleActionFromContact(intent)
if (intent.getBooleanExtra(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL, false)) { if (intent.getBooleanExtra(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL, false)) {
logRouterBackStack(router!!) logRouterBackStack(router!!)
remapChatController( remapChatController(
router!!, router!!,

View file

@ -316,10 +316,10 @@ class ChatController(args: Bundle) :
setHasOptionsMenu(true) setHasOptionsMenu(true)
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
this.conversationUser = args.getParcelable(KEY_USER_ENTITY) conversationUser = args.getParcelable(KEY_USER_ENTITY)
this.roomId = args.getString(KEY_ROOM_ID, "") roomId = args.getString(KEY_ROOM_ID, "")
this.roomToken = args.getString(KEY_ROOM_TOKEN, "") roomToken = args.getString(KEY_ROOM_TOKEN, "")
this.sharedText = args.getString(BundleKeys.KEY_SHARED_TEXT, "") sharedText = args.getString(BundleKeys.KEY_SHARED_TEXT, "")
Log.d(TAG, " roomToken = $roomToken") Log.d(TAG, " roomToken = $roomToken")
if (roomToken.isNullOrEmpty()) { if (roomToken.isNullOrEmpty()) {
@ -327,11 +327,11 @@ class ChatController(args: Bundle) :
} }
if (args.containsKey(KEY_ACTIVE_CONVERSATION)) { if (args.containsKey(KEY_ACTIVE_CONVERSATION)) {
this.currentConversation = Parcels.unwrap<Conversation>(args.getParcelable(KEY_ACTIVE_CONVERSATION)) currentConversation = Parcels.unwrap<Conversation>(args.getParcelable(KEY_ACTIVE_CONVERSATION))
this.participantPermissions = ParticipantPermissions(conversationUser!!, currentConversation!!) participantPermissions = ParticipantPermissions(conversationUser!!, currentConversation!!)
} }
this.roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "") roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "")
credentials = if (conversationUser?.userId == "?") { credentials = if (conversationUser?.userId == "?") {
null null
@ -340,14 +340,14 @@ class ChatController(args: Bundle) :
} }
if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) { if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL) startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)
} }
if (args.containsKey(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)) { if (args.containsKey(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)) {
this.startCallFromRoomSwitch = args.getBoolean(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL) startCallFromRoomSwitch = args.getBoolean(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)
} }
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false) voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
} }
private fun getRoomInfo() { private fun getRoomInfo() {
@ -935,13 +935,26 @@ class ChatController(args: Bundle) :
return return
} }
val conversationIntent = Intent(activity, CallActivity::class.java)
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
bundle.putString(KEY_ROOM_TOKEN, token)
if (conversationUser != null) { if (conversationUser != null) {
conversationIntent.putExtras(bundle) activity?.runOnUiThread {
if (currentConversation?.objectType == BREAKOUT_ROOM_TYPE) {
Toast.makeText(
context,
context.resources.getString(R.string.switch_to_main_room),
Toast.LENGTH_LONG
).show()
} else {
Toast.makeText(
context,
context.resources.getString(R.string.switch_to_breakout_room),
Toast.LENGTH_LONG
).show()
}
}
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
bundle.putString(KEY_ROOM_TOKEN, token)
ConductorRemapping.remapChatController( ConductorRemapping.remapChatController(
router, router,

View file

@ -130,12 +130,14 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
binding.raiseHandIcon.setImageDrawable( binding.raiseHandIcon.setImageDrawable(
ContextCompat.getDrawable(context, R.drawable.ic_baseline_do_not_touch_24) ContextCompat.getDrawable(context, R.drawable.ic_baseline_do_not_touch_24)
) )
dismiss()
} }
is RaiseHandViewModel.LoweredHandState -> { is RaiseHandViewModel.LoweredHandState -> {
binding.raiseHandText.text = context.getText(R.string.raise_hand) binding.raiseHandText.text = context.getText(R.string.raise_hand)
binding.raiseHandIcon.setImageDrawable( binding.raiseHandIcon.setImageDrawable(
ContextCompat.getDrawable(context, R.drawable.ic_hand_back_left) ContextCompat.getDrawable(context, R.drawable.ic_hand_back_left)
) )
dismiss()
} }
else -> {} else -> {}
} }

View file

@ -633,6 +633,10 @@
<string name="nc_expire_message_one_hour">1 hour</string> <string name="nc_expire_message_one_hour">1 hour</string>
<string name="nc_expire_messages_explanation">Chat messages can be expired after a certain time. Note: Files shared in chat will not be deleted for the owner, but will no longer be shared in the conversation.</string> <string name="nc_expire_messages_explanation">Chat messages can be expired after a certain time. Note: Files shared in chat will not be deleted for the owner, but will no longer be shared in the conversation.</string>
<!-- Breakout rooms -->
<string name="switch_to_main_room">Switch to main room</string>
<string name="switch_to_breakout_room">Switch to breakout room</string>
<string name="nc_not_allowed_to_activate_audio">You are not allowed to activate audio!</string> <string name="nc_not_allowed_to_activate_audio">You are not allowed to activate audio!</string>
<string name="nc_not_allowed_to_activate_video">You are not allowed to activate video!</string> <string name="nc_not_allowed_to_activate_video">You are not allowed to activate video!</string>
<string name="scroll_to_bottom">Scroll to bottom</string> <string name="scroll_to_bottom">Scroll to bottom</string>