Skip to content

Commit

Permalink
Merge pull request #64 from cometchat/v4
Browse files Browse the repository at this point in the history
V4
  • Loading branch information
vivekCometChat authored Dec 16, 2023
2 parents 32cd94e + 59b035c commit 4f669c7
Show file tree
Hide file tree
Showing 22 changed files with 885 additions and 13 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.cometchat.javasampleapp"
minSdk 21
targetSdk 33
versionCode 2
versionName "4.0.3"
versionCode 3
versionName "1.0.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [file_provider: "com.cometchat.javasampleapp"]
Expand All @@ -30,12 +30,12 @@ android {
}

dependencies {
implementation 'com.cometchat:chat-uikit-android:4.0.+'
implementation 'com.cometchat:chat-uikit-android:4.1.+'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.cometchat:calls-sdk-android:4.0.1'
implementation 'com.cometchat:calls-sdk-android:4.0.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -13,6 +12,12 @@
import com.cometchat.javasampleapp.AppUtils;
import com.cometchat.javasampleapp.R;
import com.cometchat.javasampleapp.fragments.calls.CallButtonFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogDetailsFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogHistoryFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogParticipantsFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogRecordingFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogWithDetailsFragment;
import com.cometchat.javasampleapp.fragments.calls.CallLogsFragment;
import com.cometchat.javasampleapp.fragments.conversations.ContactsFragment;
import com.cometchat.javasampleapp.fragments.conversations.ConversationsFragment;
import com.cometchat.javasampleapp.fragments.conversations.ConversationsWithMessagesFragment;
Expand Down Expand Up @@ -52,6 +57,7 @@

public class ComponentLaunchActivity extends AppCompatActivity {
private LinearLayout parentView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -123,23 +129,36 @@ protected void onCreate(Bundle savedInstanceState) {
loadFragment(new AudioBubbleFragment());
} else if (id == R.id.files_bubble) {
loadFragment(new FileBubbleFragment());
}else if (id == R.id.form_bubble) {
} else if (id == R.id.form_bubble) {
loadFragment(new FormBubbleFragment());
}else if (id == R.id.card_bubble) {
} else if (id == R.id.card_bubble) {
loadFragment(new CardBubbleFragment());
} else if (id == R.id.media_recorder) {
loadFragment(new MediaRecorderFragment());
} else if (id == R.id.contacts) {
loadFragment(new ContactsFragment());
}else if (id == R.id.messageInformation) {
} else if (id == R.id.messageInformation) {
loadFragment(new MessageInformationFragment());
} else if (id == R.id.call_logs) {
loadFragment(new CallLogsFragment());
} else if (id == R.id.call_logs_details) {
loadFragment(new CallLogDetailsFragment());
} else if (id == R.id.call_logs_with_details) {
loadFragment(new CallLogWithDetailsFragment());
} else if (id == R.id.call_log_participants) {
loadFragment(new CallLogParticipantsFragment());
} else if (id == R.id.call_log_recording) {
loadFragment(new CallLogRecordingFragment());
} else if (id == R.id.call_log_history) {
loadFragment(new CallLogHistoryFragment());
}
}

private void setUpUI() {
if(AppUtils.isNightMode(this)){
Utils.setStatusBarColor(this, ContextCompat.getColor(this,R.color.app_background_dark));
parentView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this,R.color.app_background_dark)));
}else {
if (AppUtils.isNightMode(this)) {
Utils.setStatusBarColor(this, ContextCompat.getColor(this, R.color.app_background_dark));
parentView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.app_background_dark)));
} else {
Utils.setStatusBarColor(this, getResources().getColor(R.color.app_background));
parentView.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.app_background)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ protected void onCreate(Bundle savedInstanceState) {

//calls
findViewById(R.id.call_button).setOnClickListener(view -> handleIntent(R.id.call_button));
findViewById(R.id.call_logs).setOnClickListener(view -> handleIntent(R.id.call_logs));
findViewById(R.id.call_logs_details).setOnClickListener(view -> handleIntent(R.id.call_logs_details));
findViewById(R.id.call_logs_with_details).setOnClickListener(view -> handleIntent(R.id.call_logs_with_details));
findViewById(R.id.call_log_participants).setOnClickListener(view -> handleIntent(R.id.call_log_participants));
findViewById(R.id.call_log_recording).setOnClickListener(view -> handleIntent(R.id.call_log_recording));
findViewById(R.id.call_log_history).setOnClickListener(view -> handleIntent(R.id.call_log_history));

//shared

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.calls.constants.CometChatCallsConstants;
import com.cometchat.calls.model.CallLog;
import com.cometchat.calls.model.CallUser;
import com.cometchat.calls.model.Participant;
import com.cometchat.calls.model.Recording;
import com.cometchat.chatuikit.calls.calldetails.CometChatCallLogDetails;
import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit;
import com.cometchat.javasampleapp.R;

import java.util.ArrayList;
import java.util.List;

public class CallLogDetailsFragment extends Fragment {
private CometChatCallLogDetails cometChatCallLogDetails;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_call_details, container, false);
cometChatCallLogDetails = view.findViewById(R.id.call_logs_details);
createCallLog();
return view;
}

public void createCallLog() {
if (CometChatUIKit.getLoggedInUser() != null) {
CallUser initiator = new CallUser();
initiator.setAvatar(CometChatUIKit.getLoggedInUser().getAvatar());
initiator.setUid(CometChatUIKit.getLoggedInUser().getUid());
initiator.setName(CometChatUIKit.getLoggedInUser().getName());

CallUser receiver = new CallUser();
receiver.setUid("UID233");
receiver.setName("Kevin");
receiver.setAvatar("https://data-us.cometchat.io/assets/images/avatars/spiderman.png");


List<Participant> participants = new ArrayList<>();

Participant participant = new Participant();
participant.setUid(CometChatUIKit.getLoggedInUser().getUid());
participant.setName(CometChatUIKit.getLoggedInUser().getName());
participant.setAvatar(CometChatUIKit.getLoggedInUser().getAvatar());
participant.setJoinedAt(1327349241);
participant.setTotalDurationInMinutes(1327349241);

Participant participant1 = new Participant();
participant1.setUid("UID233");
participant1.setName("Kevin");
participant1.setAvatar("https://data-us.cometchat.io/assets/images/avatars/spiderman.png");
participant1.setJoinedAt(1327349241);
participant1.setHasJoined(true);
participant1.setTotalDurationInMinutes(1327349241);

participants.add(participant);
participants.add(participant1);

List<Recording> recordings = new ArrayList<>();

Recording recording = new Recording();
recording.setRecordingURL("https://recordings-us.cometchat.io/236497dcc2cd529b/2023-12-15/v1.us.236497dcc2cd529b.170264141733632a2e3171d8a5dcb1f82b743fbc2730422263_2023-12-15-11-57-16.mp4");
recording.setDuration(1327349241);
recording.setRid("RID2023");

Recording recording1 = new Recording();
recording1.setRecordingURL("https://recordings-us.cometchat.io/236497dcc2cd529b/2023-12-15/v1.us.236497dcc2cd529b.170264141733632a2e3171d8a5dcb1f82b743fbc2730422263_2023-12-15-11-57-16.mp4");
recording1.setDuration(1327349241);
recording1.setRid("RID2023-1");
recordings.add(recording);
recordings.add(recording1);

CallLog callLog = new CallLog();
callLog.setInitiatedAt(1327349241);
callLog.setInitiator(initiator);
callLog.setReceiver(receiver);
callLog.setStatus(CometChatCallsConstants.CALL_STATUS_BUSY);
callLog.setType(CometChatCallsConstants.CALL_TYPE_AUDIO);
callLog.setParticipants(participants);
callLog.setRecordings(recordings);
callLog.setReceiverType(CometChatCallsConstants.RECEIVER_TYPE_USER);
cometChatCallLogDetails.setCall(callLog);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.chatuikit.calls.callhistory.CometChatCallLogHistory;
import com.cometchat.javasampleapp.R;


public class CallLogHistoryFragment extends Fragment {
private CometChatCallLogHistory cometChatCallLogHistory;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_call_log_history, container, false);

cometChatCallLogHistory = view.findViewById(R.id.call_logs_history);
return view;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.calls.model.Participant;
import com.cometchat.chatuikit.calls.callparticipants.CometChatCallLogParticipants;
import com.cometchat.chatuikit.calls.callrecordings.CometChatCallLogRecordings;
import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit;
import com.cometchat.javasampleapp.R;

import java.util.ArrayList;
import java.util.List;

public class CallLogParticipantsFragment extends Fragment {
private CometChatCallLogParticipants cometChatCallLogParticipants;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_call_log_participants, container, false);
cometChatCallLogParticipants = view.findViewById(R.id.call_logs_participants);
createCallParticipants();
return view;
}

private void createCallParticipants() {
List<Participant> participants = new ArrayList<>();

Participant participant = new Participant();
participant.setUid(CometChatUIKit.getLoggedInUser().getUid());
participant.setName(CometChatUIKit.getLoggedInUser().getName());
participant.setAvatar(CometChatUIKit.getLoggedInUser().getAvatar());
participant.setJoinedAt(1327349241);
participant.setHasJoined(true);
participant.setTotalDurationInMinutes(1327349241);

Participant participant1 = new Participant();
participant1.setUid("UID233");
participant1.setName("Kevin");
participant1.setAvatar("https://data-us.cometchat.io/assets/images/avatars/spiderman.png");
participant1.setJoinedAt(1327349241);
participant1.setHasJoined(true);
participant1.setTotalDurationInMinutes(1327349241);

participants.add(participant);
participants.add(participant1);
cometChatCallLogParticipants.setParticipantList(participants);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.calls.model.Recording;
import com.cometchat.chatuikit.calls.callrecordings.CometChatCallLogRecordings;
import com.cometchat.javasampleapp.R;

import java.util.ArrayList;
import java.util.List;


public class CallLogRecordingFragment extends Fragment {

private CometChatCallLogRecordings cometChatCallLogRecordings;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_call_log_recording, container, false);
cometChatCallLogRecordings = view.findViewById(R.id.call_logs_recordings);
createCallRecordings();
return view;
}

private void createCallRecordings() {
List<Recording> recordings = new ArrayList<>();

Recording recording = new Recording();
recording.setRecordingURL("https://recordings-us.cometchat.io/236497dcc2cd529b/2023-12-15/v1.us.236497dcc2cd529b.170264141733632a2e3171d8a5dcb1f82b743fbc2730422263_2023-12-15-11-57-16.mp4");
recording.setDuration(1327349241);
recording.setRid("RID2023");

Recording recording1 = new Recording();
recording1.setRecordingURL("https://recordings-us.cometchat.io/236497dcc2cd529b/2023-12-15/v1.us.236497dcc2cd529b.170264141733632a2e3171d8a5dcb1f82b743fbc2730422263_2023-12-15-11-57-16.mp4");
recording1.setDuration(1327349241);
recording1.setRid("RID2023-1");
recordings.add(recording);
recordings.add(recording1);
cometChatCallLogRecordings.setRecordingList(recordings);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.javasampleapp.R;

public class CallLogWithDetailsFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_call_log_with_details, container, false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

package com.cometchat.javasampleapp.fragments.calls;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cometchat.javasampleapp.R;

public class CallLogsFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_call_logs, container, false);
}
}
Loading

0 comments on commit 4f669c7

Please sign in to comment.