mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
Refactor intent creation
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
b721e68a1a
commit
719c81d4a6
@ -441,17 +441,10 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
||||
return true;
|
||||
|
||||
case R.id.conversation_video_call:
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken);
|
||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(currentUser));
|
||||
bundle.putString(BundleKeys.KEY_CALL_SESSION, currentCall.getSessionId());
|
||||
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
callIntent.putExtras(bundle);
|
||||
|
||||
startActivity(callIntent);
|
||||
startActivity(getIntentForCall(false));
|
||||
return true;
|
||||
case R.id.conversation_voice_call:
|
||||
startActivity(getIntentForCall(true));
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -459,6 +452,22 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getIntentForCall(boolean isVoiceOnlyCall) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken);
|
||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(currentUser));
|
||||
bundle.putString(BundleKeys.KEY_CALL_SESSION, currentCall.getSessionId());
|
||||
|
||||
if (isVoiceOnlyCall) {
|
||||
bundle.putBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, true);
|
||||
}
|
||||
|
||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||
callIntent.putExtras(bundle);
|
||||
|
||||
return callIntent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectionChanged(int count) {
|
||||
//globalMenu.findItem(R.id.action_delete).setVisible(count > 0);
|
||||
|
@ -47,4 +47,5 @@ public class BundleKeys {
|
||||
public static final String KEY_INVITED_PARTICIPANTS = "KEY_INVITED_PARTICIPANTS";
|
||||
public static final String KEY_CONVERSATION_NAME = "KEY_CONVERSATION_NAME";
|
||||
public static final String KEY_ROOM_PASSWORD = "KEY_ROOM_PASSWORD";
|
||||
public static final String KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user