Skip to content

Commit

Permalink
update ui for group call on sandbox
Browse files Browse the repository at this point in the history
fix minor bugs
  • Loading branch information
Farhad7d7 committed Oct 5, 2020
1 parent 7bacae2 commit 65985ac
Show file tree
Hide file tree
Showing 11 changed files with 573 additions and 423 deletions.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
tools:ignore="GoogleAppIndexingWarning"
tools:targetApi="n">

<activity android:name="com.example.chat.application.chatexample.CallActivity">
<activity
android:name="com.example.chat.application.chatexample.CallActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;

import java.util.Arrays;
import java.util.List;


public class CallActivity extends AppCompatActivity implements ChatContract.view {



private static final String TAG = "CHAT_SDK_CALL";
public static final long[] VIB_PATTERN = {0, 1000, 1000};
private String TOKEN = BaseApplication.getInstance().getString(R.string.token_zizi);
Expand Down Expand Up @@ -90,14 +90,15 @@ public class CallActivity extends AppCompatActivity implements ChatContract.view
public static int TEST_THREAD_ID = 7090;


private static String sandBoxSSOHost = BaseApplication.getInstance().getString(R.string.ssoHost);
private static String sandBoxSSOHost = BaseApplication.getInstance().getString(R.string.sandbox_ssoHost);
private static String sandBoxServerName = "chat-server";


private static String sandBoxName = BaseApplication.getInstance().getString(R.string.main_server_name);
private static String sandBoxSocketAddress = BaseApplication.getInstance().getString(R.string.socketAddress);
private static String sandBoxPlatformHost = BaseApplication.getInstance().getString(R.string.platformHost);
private static String sandBoxFileServer = BaseApplication.getInstance().getString(R.string.fileServer);
private static String sandBoxName = BaseApplication.getInstance().getString(R.string.sandbox_server_name);
private static String sandBoxSocketAddress = BaseApplication.getInstance().getString(R.string.sandbox_socketAddress);
private static String sandBoxPlatformHost = BaseApplication.getInstance().getString(R.string.sandbox_platformHost);
private static String sandBoxFileServer = BaseApplication.getInstance().getString(R.string.sandbox_fileServer);
private static String podspaceServer = BaseApplication.getInstance().getString(R.string.podspace_file_server_main);


private boolean permissionToRecordAccepted = false;
Expand All @@ -115,7 +116,7 @@ public class CallActivity extends AppCompatActivity implements ChatContract.view
RadioGroup groupPartner;
View callRequestView, inCallView, viewHistory;
ImageButton buttonRejectCall, buttonAcceptCall, buttonEndCall, buttonGetHistory, buttonMute, buttonSpeaker;
EditText etGroupId, etSender, etReceiver, etNumberOrOtp, etSandboxPartnerId;
EditText etGroupId, etSender, etReceiver, etNumberOrOtp, etSandboxPartnerId,etNewParticipantToAdd;
CheckBox checkBoxSSL,
checkBoxGroupCall,
checkboxZiziPartner,
Expand All @@ -140,7 +141,6 @@ public class CallActivity extends AppCompatActivity implements ChatContract.view
private boolean isInCall = false;



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -162,7 +162,8 @@ private void connect() {
TOKEN,
ssoHost,
platformHost,
fileServer
fileServer,
podspaceServer
).build();

presenter.connect(request);
Expand Down Expand Up @@ -305,7 +306,15 @@ private void setListeners() {

});

buttonAddCallParticipant.setOnClickListener(v -> presenter.addCallParticipant(checkboxAddFifi.isChecked(), checkboxAddJiji.isChecked(), checkboxAddZizi.isChecked()));
buttonAddCallParticipant.setOnClickListener(v ->
{

presenter.addCallParticipant(etNewParticipantToAdd.getText().toString(),
checkboxAddFifi.isChecked(),
checkboxAddJiji.isChecked(),
checkboxAddZizi.isChecked());

});

buttonConnectSandBox.setOnClickListener(v -> {

Expand All @@ -323,16 +332,7 @@ private void setListeners() {

buttonStartSandboxCall.setOnClickListener(v -> {
if (chatReady) {

if (!etSandboxPartnerId.getText().toString().isEmpty()) {

int sandBoxPartnerID = Integer.parseInt(etSandboxPartnerId.getText().toString());

presenter.requestCall(sandBoxPartnerID, checkBoxSSL.isChecked());

tvStatus.setText("Calling: " + sandBoxPartnerID);
}

presenter.requestMainOrSandboxCall(etSandboxPartnerId.getText().toString(),checkBoxGroupCall.isChecked());
} else {
Toast.makeText(this, "Chat is not ready", Toast.LENGTH_SHORT).show();
}
Expand Down Expand Up @@ -527,6 +527,7 @@ private void init() {
etReceiver = findViewById(R.id.etReceiver);
etNumberOrOtp = findViewById(R.id.etOtpNumber);
etSandboxPartnerId = findViewById(R.id.etSandBoxPartnerId);
etNewParticipantToAdd = findViewById(R.id.etNewParticipant);

checkBoxSSL = findViewById(R.id.checkboxSSL);
checkBoxGroupCall = findViewById(R.id.checkboxGroupCall);
Expand Down Expand Up @@ -556,7 +557,7 @@ private void init() {

CallInfo callInfo = getIntent().getParcelableExtra(ChatConstant.POD_CALL_INFO);

Log.e(TAG,"Call info: " + callInfo);
Log.e(TAG, "Call info: " + callInfo);

if (callInfo != null) {
presenter.setCallInfo(callInfo);
Expand All @@ -578,6 +579,7 @@ public void onState(String state) {
runOnUiThread(() -> {
buttonConnect.setVisibility(View.INVISIBLE);
buttonCall.setVisibility(View.VISIBLE);
tvStatus.setText("Chat is Ready :)");
});

} else {
Expand All @@ -586,7 +588,10 @@ public void onState(String state) {
runOnUiThread(() -> {
buttonConnect.setVisibility(View.VISIBLE);
buttonCall.setVisibility(View.INVISIBLE);
tvStatus.setText("Connecting...");
});


}


Expand Down Expand Up @@ -679,6 +684,7 @@ private void onCallEnded() {
buttonConnectSandBox.setVisibility(View.VISIBLE);
buttonStartSandboxCall.setVisibility(View.VISIBLE);
Toast.makeText(this, "Call has been ended", Toast.LENGTH_SHORT).show();
tvStatus.setText("Call has been ended");
});
}

Expand Down Expand Up @@ -818,4 +824,9 @@ public void onCallParticipantJoined(String participant) {


}

@Override
public void updateStatus(String message) {
runOnUiThread(()->tvStatus.setText(message));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ default void onMapRouting() {
default void onMapReverse() {
}

default void onError() {
default void onError(String message) {
}

default void onSpam() {
Expand Down Expand Up @@ -247,6 +247,7 @@ default void onCallParticipantLeft(String response){}

default void onCallParticipantJoined(String response){}

default void updateStatus(String message){}
}

interface presenter {
Expand All @@ -257,7 +258,7 @@ interface presenter {

void sendLocationMessage(RequestLocationMessage requestLocationMessage, ProgressHandler.sendFileMessage sendFileMessage);

String requestCall(int partnerId, boolean checked);
String requestMainOrSandboxCall(int partnerId, boolean checked);

void searchMap(String haram, double lat, double lon);

Expand Down Expand Up @@ -524,8 +525,12 @@ void createThread(int threadType, Invitee[] invitee, String threadTitle, String

void requestGroupCall(boolean fifi, boolean zizi, boolean jiji);

void addCallParticipant(boolean fifiChecked, boolean jijiChecked, boolean ziziChecked);
void addCallParticipant(String username, boolean fifiChecked, boolean jijiChecked, boolean ziziChecked);

void setCallInfo(CallInfo callInfo);

void requestMainOrSandboxCall(String query, boolean checked);

void requestCall(int partnerId, boolean checked);
}
}
Loading

0 comments on commit 65985ac

Please sign in to comment.