├── Chat
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ └── Project.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── google-services.json
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── royalbimrah
│ │ │ └── chat
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── royalbimrah
│ │ │ │ └── chat
│ │ │ │ ├── CallingActivity.java
│ │ │ │ ├── Contacts.java
│ │ │ │ ├── ContactsActivity.java
│ │ │ │ ├── FindPeopleActivity.java
│ │ │ │ ├── NotificationActivity.java
│ │ │ │ ├── ProfileActivity.java
│ │ │ │ ├── RegisterActivity.java
│ │ │ │ ├── SettingsActivity.java
│ │ │ │ └── VideoChatActivity.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ ├── back.png
│ │ │ ├── cancel_call.png
│ │ │ ├── edit_profile.png
│ │ │ ├── edit_status.png
│ │ │ ├── email.png
│ │ │ ├── find_people.png
│ │ │ ├── ic_dashboard_black_24dp.xml
│ │ │ ├── ic_home_black_24dp.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── ic_notifications_black_24dp.xml
│ │ │ ├── logout.png
│ │ │ ├── make_call.png
│ │ │ ├── password.png
│ │ │ ├── profile_image.png
│ │ │ ├── register.png
│ │ │ ├── search.png
│ │ │ ├── settings.png
│ │ │ ├── splash.png
│ │ │ └── video_call.png
│ │ │ ├── layout
│ │ │ ├── activity_calling.xml
│ │ │ ├── activity_contacts.xml
│ │ │ ├── activity_find_people.xml
│ │ │ ├── activity_notification.xml
│ │ │ ├── activity_profile.xml
│ │ │ ├── activity_register.xml
│ │ │ ├── activity_settings.xml
│ │ │ ├── activity_video_chat.xml
│ │ │ ├── contact_design.xml
│ │ │ └── find_friend_design.xml
│ │ │ ├── menu
│ │ │ └── bottom_nav_menu.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── raw
│ │ │ └── iphone.mp3
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── royalbimrah
│ │ └── chat
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
└── README.md
/Chat/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/Chat/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/Chat/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Chat/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Chat/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Chat/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Chat/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Chat/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion "29.0.2"
6 | defaultConfig {
7 | applicationId "com.royalbimrah.chat"
8 | minSdkVersion 21
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'androidx.appcompat:appcompat:1.1.0'
25 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
26 | implementation 'com.google.android.material:material:1.1.0'
27 | implementation 'androidx.navigation:navigation-fragment:2.0.0'
28 | implementation 'androidx.navigation:navigation-ui:2.0.0'
29 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
32 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
33 |
34 | implementation 'com.google.firebase:firebase-core:11.8.0'
35 | implementation 'com.google.firebase:firebase-database:11.8.0'
36 | implementation 'com.google.firebase:firebase-storage:11.8.0'
37 | implementation 'com.google.firebase:firebase-auth:11.8.0'
38 | implementation 'com.firebaseui:firebase-ui-database:3.2.2'
39 | implementation 'com.hbb20:ccp:2.1.9'
40 | implementation 'pub.devrel:easypermissions:0.4.0'
41 | implementation 'com.squareup.picasso:picasso:2.71828'
42 | implementation 'com.opentok.android:opentok-android-sdk:2.15.3'
43 | }
44 | apply plugin: 'com.google.gms.google-services'
45 |
--------------------------------------------------------------------------------
/Chat/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "676448931233",
4 | "firebase_url": "https://chat-app-inc.firebaseio.com",
5 | "project_id": "chat-app-inc",
6 | "storage_bucket": "chat-app-inc.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:676448931233:android:03d3463b350ee673574fe0",
12 | "android_client_info": {
13 | "package_name": "com.royalbimrah.chat"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "676448931233-sai5af30pr4m5ojjde15mhnbqfap5qcc.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "AIzaSyAg7geTLXoAVUuJnWjL-h5012x_kJWKCvA"
25 | }
26 | ],
27 | "services": {
28 | "appinvite_service": {
29 | "other_platform_oauth_client": [
30 | {
31 | "client_id": "676448931233-sai5af30pr4m5ojjde15mhnbqfap5qcc.apps.googleusercontent.com",
32 | "client_type": 3
33 | }
34 | ]
35 | }
36 | }
37 | }
38 | ],
39 | "configuration_version": "1"
40 | }
--------------------------------------------------------------------------------
/Chat/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Chat/app/src/androidTest/java/com/royalbimrah/chat/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("com.royalbimrah.chat", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Chat/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/CallingActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.content.Intent;
7 | import android.media.MediaPlayer;
8 | import android.os.Bundle;
9 | import android.view.View;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.google.android.gms.tasks.OnCompleteListener;
14 | import com.google.android.gms.tasks.Task;
15 | import com.google.firebase.auth.FirebaseAuth;
16 | import com.google.firebase.database.DataSnapshot;
17 | import com.google.firebase.database.DatabaseError;
18 | import com.google.firebase.database.DatabaseReference;
19 | import com.google.firebase.database.FirebaseDatabase;
20 | import com.google.firebase.database.ValueEventListener;
21 | import com.squareup.picasso.Picasso;
22 |
23 | import java.util.HashMap;
24 |
25 | public class CallingActivity extends AppCompatActivity {
26 |
27 | private TextView nameContact;
28 | private ImageView profileImage;
29 | private ImageView cancelCallBtn, acceptCallBtn;
30 | private String receiverUserId="", receiverUserImage="", receiverUserName="";
31 | private String senderUserId="", senderUserImage="", senderUserName="", checker="";
32 | private String callingID="", ringingID="";
33 | private DatabaseReference userRef;
34 |
35 | private MediaPlayer mediaPlayer;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_calling);
41 |
42 | receiverUserId = getIntent().getExtras().get("visit_user_id").toString();
43 | userRef = FirebaseDatabase.getInstance().getReference().child("Users");
44 | senderUserId = FirebaseAuth.getInstance().getCurrentUser().getUid();
45 |
46 | mediaPlayer = MediaPlayer.create(this, R.raw.iphone);
47 |
48 | nameContact = findViewById(R.id.name_calling);
49 | profileImage = findViewById(R.id.profile_image_calling);
50 | cancelCallBtn = findViewById(R.id.cancel_call);
51 | acceptCallBtn = findViewById(R.id.make_call);
52 |
53 |
54 | cancelCallBtn.setOnClickListener(new View.OnClickListener() {
55 | @Override
56 | public void onClick(View v) {
57 | mediaPlayer.stop();
58 | checker = "Clicked";
59 |
60 | cancelCallingUser();
61 | }
62 | });
63 |
64 | acceptCallBtn.setOnClickListener(new View.OnClickListener() {
65 | @Override
66 | public void onClick(View v) {
67 | mediaPlayer.stop();
68 |
69 | final HashMapcallingPickUpMap = new HashMap<>();
70 | callingPickUpMap.put("picked", "picked");
71 | userRef.child(senderUserId).child("Ringing")
72 | .updateChildren(callingPickUpMap)
73 | .addOnCompleteListener(new OnCompleteListener() {
74 | @Override
75 | public void onComplete(@NonNull Task task) {
76 | if (task.isComplete()){
77 | Intent intent = new Intent(CallingActivity.this, VideoChatActivity.class);
78 | startActivity(intent);
79 | }
80 | }
81 | });
82 | }
83 | });
84 |
85 | getAndSetReceiverProfileInfo();
86 | }
87 |
88 | private void getAndSetReceiverProfileInfo() {
89 | userRef.addValueEventListener(new ValueEventListener() {
90 | @Override
91 | public void onDataChange(DataSnapshot dataSnapshot) {
92 | if (dataSnapshot.child(receiverUserId).exists()){
93 | receiverUserImage = dataSnapshot.child(receiverUserId).child("image").getValue().toString();
94 | receiverUserImage = dataSnapshot.child(receiverUserId).child("name").getValue().toString();
95 |
96 | nameContact.setText(receiverUserName);
97 | Picasso.get().load(receiverUserImage).placeholder(R.drawable.profile_image).into(profileImage);
98 | }
99 | if (dataSnapshot.child(senderUserId).exists()){
100 | senderUserImage = dataSnapshot.child(senderUserId).child("image").getValue().toString();
101 | senderUserImage = dataSnapshot.child(senderUserId).child("name").getValue().toString();
102 | }
103 | }
104 |
105 | @Override
106 | public void onCancelled(DatabaseError databaseError) {
107 |
108 | }
109 | });
110 | }
111 |
112 | @Override
113 | protected void onStart() {
114 | super.onStart();
115 |
116 | mediaPlayer.start();
117 |
118 | userRef.child(receiverUserId).addListenerForSingleValueEvent(new ValueEventListener() {
119 | @Override
120 | public void onDataChange(DataSnapshot dataSnapshot) {
121 | if (!checker.equals("clicked") && !dataSnapshot.hasChild("Calling") && !dataSnapshot.hasChild("Ringing")){
122 |
123 | final HashMap callingInfo = new HashMap<>();
124 | callingInfo.put("calling",receiverUserId);
125 |
126 | userRef.child(senderUserId).child("Calling").updateChildren(callingInfo).addOnCompleteListener(new OnCompleteListener() {
127 | @Override
128 | public void onComplete(@NonNull Task task) {
129 |
130 | if (task.isSuccessful()){
131 | final HashMapringingInfo = new HashMap<>();
132 | callingInfo.put("calling",senderUserId);
133 |
134 | userRef.child(receiverUserId).child("Ringing").updateChildren(ringingInfo);
135 | }
136 | }
137 | });
138 | }
139 | }
140 |
141 | @Override
142 | public void onCancelled(DatabaseError databaseError) {
143 |
144 | }
145 | });
146 |
147 | userRef.addValueEventListener(new ValueEventListener() {
148 | @Override
149 | public void onDataChange(DataSnapshot dataSnapshot) {
150 | if (dataSnapshot.child(senderUserId).hasChild("Ringing") && !dataSnapshot.child(senderUserId).hasChild("Calling")){
151 |
152 | acceptCallBtn.setVisibility(View.VISIBLE);
153 | }
154 |
155 | if (dataSnapshot.child(receiverUserId).child("Ringing").hasChild("picked")){
156 | mediaPlayer.stop();
157 | Intent intent = new Intent(CallingActivity.this, VideoChatActivity.class);
158 | startActivity(intent);
159 | }
160 | }
161 |
162 | @Override
163 | public void onCancelled(DatabaseError databaseError) {
164 |
165 | }
166 | });
167 | }
168 |
169 | private void cancelCallingUser() {
170 |
171 | // from sender side
172 | userRef.child(senderUserId).child("Calling").addListenerForSingleValueEvent(new ValueEventListener() {
173 | @Override
174 | public void onDataChange(DataSnapshot dataSnapshot) {
175 | if (dataSnapshot.exists() && dataSnapshot.hasChild("calling")){
176 | callingID = dataSnapshot.child("calling").getValue().toString();
177 |
178 | userRef.child(callingID).child("Ringing").removeValue().addOnCompleteListener(new OnCompleteListener() {
179 | @Override
180 | public void onComplete(@NonNull Task task) {
181 |
182 | if (task.isSuccessful()){
183 | userRef.child(senderUserId).child("Calling").removeValue().addOnCompleteListener(new OnCompleteListener() {
184 | @Override
185 | public void onComplete(@NonNull Task task) {
186 | startActivity(new Intent(CallingActivity.this, RegisterActivity.class));
187 | finish();
188 | }
189 | });
190 | }
191 | }
192 | });
193 | }
194 | else {
195 | startActivity(new Intent(CallingActivity.this, RegisterActivity.class));
196 | finish();
197 | }
198 | }
199 |
200 | @Override
201 | public void onCancelled(DatabaseError databaseError) {
202 |
203 | }
204 | });
205 |
206 |
207 |
208 | // from receiver side
209 | userRef.child(senderUserId).child("Ringing").addListenerForSingleValueEvent(new ValueEventListener() {
210 | @Override
211 | public void onDataChange(DataSnapshot dataSnapshot) {
212 | if (dataSnapshot.exists() && dataSnapshot.hasChild("ringing")){
213 |
214 | ringingID = dataSnapshot.child("ringing").getValue().toString();
215 |
216 | userRef.child(ringingID).child("Calling").removeValue().addOnCompleteListener(new OnCompleteListener() {
217 | @Override
218 | public void onComplete(@NonNull Task task) {
219 |
220 | if (task.isSuccessful()){
221 | userRef.child(senderUserId).child("Ringing").removeValue().addOnCompleteListener(new OnCompleteListener() {
222 | @Override
223 | public void onComplete(@NonNull Task task) {
224 | startActivity(new Intent(CallingActivity.this, RegisterActivity.class));
225 | finish();
226 | }
227 | });
228 | }
229 | }
230 | });
231 | }
232 | else {
233 | startActivity(new Intent(CallingActivity.this, RegisterActivity.class));
234 | finish();
235 | }
236 | }
237 |
238 | @Override
239 | public void onCancelled(DatabaseError databaseError) {
240 |
241 | }
242 | });
243 | }
244 | }
245 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/Contacts.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | public class Contacts {
4 |
5 | String name, image, status, uid;
6 |
7 | public Contacts() {
8 | }
9 |
10 |
11 | public Contacts(String name, String image, String status, String uid) {
12 | this.name = name;
13 | this.image = image;
14 | this.status = status;
15 | this.uid = uid;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public void setName(String name) {
23 | this.name = name;
24 | }
25 |
26 | public String getImage() {
27 | return image;
28 | }
29 |
30 | public void setImage(String image) {
31 | this.image = image;
32 | }
33 |
34 | public String getStatus() {
35 | return status;
36 | }
37 |
38 | public void setStatus(String status) {
39 | this.status = status;
40 | }
41 |
42 | public String getUid() {
43 | return uid;
44 | }
45 |
46 | public void setUid(String uid) {
47 | this.uid = uid;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/ContactsActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.MenuItem;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.Button;
10 | import android.widget.ImageView;
11 | import android.widget.RelativeLayout;
12 | import android.widget.Switch;
13 | import android.widget.TextView;
14 |
15 | import com.firebase.ui.database.FirebaseRecyclerAdapter;
16 | import com.firebase.ui.database.FirebaseRecyclerOptions;
17 | import com.google.android.material.bottomnavigation.BottomNavigationView;
18 | import com.google.firebase.auth.FirebaseAuth;
19 | import com.google.firebase.database.DataSnapshot;
20 | import com.google.firebase.database.DatabaseError;
21 | import com.google.firebase.database.DatabaseReference;
22 | import com.google.firebase.database.FirebaseDatabase;
23 | import com.google.firebase.database.ValueEventListener;
24 | import com.squareup.picasso.Picasso;
25 |
26 | import androidx.annotation.NonNull;
27 | import androidx.appcompat.app.AppCompatActivity;
28 | import androidx.recyclerview.widget.LinearLayoutManager;
29 | import androidx.recyclerview.widget.RecyclerView;
30 |
31 | public class ContactsActivity extends AppCompatActivity {
32 |
33 | BottomNavigationView navView;
34 | RecyclerView myContactList;
35 | ImageView findPeopleBtn;
36 | private DatabaseReference contactsRef, usersRef;
37 | private FirebaseAuth mAuth;
38 | private String currentUserId;
39 | private String userName="", profileImage="";
40 | private String calledBy="";
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | setContentView(R.layout.activity_contacts);
46 | navView = findViewById(R.id.nav_view);
47 | navView.setOnNavigationItemSelectedListener(navigationItemSelectedListener);
48 |
49 | mAuth = FirebaseAuth.getInstance();
50 | currentUserId = mAuth.getCurrentUser().getUid();
51 | contactsRef = FirebaseDatabase.getInstance().getReference().child("Contacts");
52 | usersRef = FirebaseDatabase.getInstance().getReference().child("Users");
53 |
54 | findPeopleBtn = findViewById(R.id.find_people_btn);
55 | myContactList = findViewById(R.id.contact_list);
56 | myContactList.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
57 |
58 | findPeopleBtn.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View v) {
61 | Intent findPeopleIntent = new Intent(ContactsActivity.this, FindPeopleActivity.class);
62 | startActivity(findPeopleIntent);
63 | }
64 | });
65 |
66 | }
67 |
68 | private BottomNavigationView.OnNavigationItemSelectedListener navigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
69 | @Override
70 | public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
71 |
72 | switch (menuItem.getItemId()){
73 | case R.id.navigation_home:
74 | Intent mainIntent = new Intent(ContactsActivity.this, ContactsActivity.class);
75 | startActivity(mainIntent);
76 | break;
77 |
78 | case R.id.navigation_settings:
79 | Intent settingsIntent = new Intent(ContactsActivity.this, SettingsActivity.class);
80 | startActivity(settingsIntent);
81 | break;
82 |
83 | case R.id.navigation_notifications:
84 | Intent notificationsIntent = new Intent(ContactsActivity.this, NotificationActivity.class);
85 | startActivity(notificationsIntent);
86 | break;
87 |
88 | case R.id.navigation_logout:
89 | FirebaseAuth.getInstance().signOut();
90 | Intent logoutIntent = new Intent(ContactsActivity.this, RegisterActivity.class);
91 | startActivity(logoutIntent);
92 | finish();
93 | break;
94 | }
95 | return true;
96 | }
97 | };
98 |
99 | @Override
100 | protected void onStart() {
101 | super.onStart();
102 |
103 |
104 | checkForReceivingCall();
105 |
106 |
107 | validateUser();
108 |
109 |
110 | FirebaseRecyclerOptions options
111 | = new FirebaseRecyclerOptions.Builder()
112 | .setQuery(contactsRef.child(currentUserId), Contacts.class).build();
113 |
114 | FirebaseRecyclerAdapter firebaseRecyclerAdapter
115 | = new FirebaseRecyclerAdapter(options) {
116 | @Override
117 | protected void onBindViewHolder(@NonNull final ContactsViewHolder holder, int i, @NonNull Contacts contacts) {
118 | final String listUserId = getRef(i).getKey();
119 |
120 | usersRef.child(listUserId).addValueEventListener(new ValueEventListener() {
121 | @Override
122 | public void onDataChange(DataSnapshot dataSnapshot) {
123 |
124 | if (dataSnapshot.exists()){
125 |
126 | userName = dataSnapshot.child("name").getValue().toString();
127 | profileImage = dataSnapshot.child("image").getValue().toString();
128 |
129 | holder.userNameTxt.setText(userName);
130 | Picasso.get().load(profileImage).into(holder.profileImageView);
131 |
132 | }
133 |
134 | holder.callBtn.setOnClickListener(new View.OnClickListener() {
135 | @Override
136 | public void onClick(View v) {
137 | Intent callingIntent = new Intent(ContactsActivity.this, CallingActivity.class);
138 | callingIntent.putExtra("visit_user_id", listUserId);
139 | finish();
140 | }
141 | });
142 |
143 | }
144 |
145 | @Override
146 | public void onCancelled(DatabaseError databaseError) {
147 |
148 | }
149 | });
150 | }
151 |
152 | @NonNull
153 | @Override
154 | public ContactsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
155 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.contact_design, parent, false);
156 | ContactsViewHolder viewHolder = new ContactsViewHolder(view);
157 | return viewHolder;
158 | }
159 | };
160 | myContactList.setAdapter(firebaseRecyclerAdapter);
161 | firebaseRecyclerAdapter.startListening();
162 | }
163 |
164 | public static class ContactsViewHolder extends RecyclerView.ViewHolder {
165 |
166 | TextView userNameTxt;
167 | Button callBtn;
168 | ImageView profileImageView;
169 |
170 |
171 | public ContactsViewHolder(@NonNull View itemView){
172 | super(itemView);
173 |
174 | userNameTxt = itemView.findViewById(R.id.name_contact);
175 | callBtn = itemView.findViewById(R.id.call_btn);
176 | profileImageView = itemView.findViewById(R.id.image_contact);
177 | }
178 | }
179 |
180 | private void validateUser() {
181 |
182 | DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
183 | reference.child("Users").child(currentUserId).addValueEventListener(new ValueEventListener() {
184 | @Override
185 | public void onDataChange(DataSnapshot dataSnapshot) {
186 | if (!dataSnapshot.exists()){
187 | Intent settingIntent = new Intent(ContactsActivity.this, SettingsActivity.class);
188 | startActivity(settingIntent);
189 | finish();
190 | }
191 | }
192 |
193 | @Override
194 | public void onCancelled(DatabaseError databaseError) {
195 |
196 | }
197 | });
198 | }
199 |
200 | private void checkForReceivingCall() {
201 |
202 | usersRef.child(currentUserId).child("Ringing").addValueEventListener(new ValueEventListener() {
203 | @Override
204 | public void onDataChange(DataSnapshot dataSnapshot) {
205 | if (dataSnapshot.hasChild("ringing")){
206 | calledBy = dataSnapshot.child("ringing").getValue().toString();
207 | Intent callingIntent = new Intent(ContactsActivity.this, CallingActivity.class);
208 | callingIntent.putExtra("visit_user_id", calledBy);
209 | startActivity(callingIntent);
210 | }
211 | }
212 |
213 | @Override
214 | public void onCancelled(DatabaseError databaseError) {
215 |
216 | }
217 | });
218 |
219 | }
220 |
221 | }
222 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/FindPeopleActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 | import androidx.recyclerview.widget.LinearLayoutManager;
6 | import androidx.recyclerview.widget.RecyclerView;
7 |
8 | import android.content.Intent;
9 | import android.os.Bundle;
10 | import android.text.Editable;
11 | import android.text.TextWatcher;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.Button;
16 | import android.widget.EditText;
17 | import android.widget.ImageView;
18 | import android.widget.RelativeLayout;
19 | import android.widget.TextView;
20 | import android.widget.Toast;
21 |
22 | import com.firebase.ui.database.FirebaseRecyclerAdapter;
23 | import com.firebase.ui.database.FirebaseRecyclerOptions;
24 | import com.google.firebase.database.DatabaseReference;
25 | import com.google.firebase.database.FirebaseDatabase;
26 | import com.squareup.picasso.Picasso;
27 |
28 | public class FindPeopleActivity extends AppCompatActivity {
29 |
30 | private RecyclerView findPeopleFriend;
31 | private EditText searchET;
32 | private String str ="";
33 | private DatabaseReference usersRef;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.activity_find_people);
39 |
40 | usersRef = FirebaseDatabase.getInstance().getReference().child("Users");
41 | findPeopleFriend = findViewById(R.id.find_friends_list);
42 | searchET = findViewById(R.id.search_user_text);
43 | findPeopleFriend.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
44 |
45 | searchET.addTextChangedListener(new TextWatcher() {
46 | @Override
47 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
48 |
49 | }
50 |
51 | @Override
52 | public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
53 | if (searchET.getText().toString().equals("")){
54 | Toast.makeText(FindPeopleActivity.this, "Please write name to search", Toast.LENGTH_SHORT).show();
55 | }
56 | else {
57 | str = charSequence.toString();
58 | onStart();
59 | }
60 | }
61 |
62 | @Override
63 | public void afterTextChanged(Editable s) {
64 |
65 | }
66 | });
67 |
68 | }
69 |
70 | @Override
71 | protected void onStart() {
72 | super.onStart();
73 |
74 | FirebaseRecyclerOptions options = null;
75 | if (str.equals("")){
76 | options = new FirebaseRecyclerOptions.Builder()
77 | .setQuery(usersRef, Contacts.class).build();
78 |
79 | }
80 |
81 | else {
82 | options = new FirebaseRecyclerOptions.Builder()
83 | .setQuery(usersRef.orderByChild("name")
84 | .startAt(str).endAt(str + "\uf8ff"), Contacts.class).build();
85 |
86 | }
87 |
88 | FirebaseRecyclerAdapter firebaseRecyclerAdapter
89 | = new FirebaseRecyclerAdapter(options) {
90 | @Override
91 | protected void onBindViewHolder(@NonNull FindFriendsViewHolder holder, final int positions, @NonNull final Contacts model) {
92 | holder.userNameTxt.setText(model.getName());
93 | Picasso.get().load(model.getImage()).into(holder.profileImageView);
94 |
95 | holder.itemView.setOnClickListener(new View.OnClickListener() {
96 | @Override
97 | public void onClick(View v) {
98 | String visit_user_id = getRef(positions).getKey();
99 | Intent intent = new Intent(FindPeopleActivity.this, ProfileActivity.class);
100 | intent.putExtra("visit_user_id", visit_user_id);
101 | intent.putExtra("profile_image", model.getImage());
102 | intent.putExtra("profile_name", model.getName());
103 | startActivity(intent);
104 | }
105 | });
106 | }
107 |
108 | @NonNull
109 | @Override
110 | public FindFriendsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
111 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.contact_design, parent, false);
112 | FindFriendsViewHolder viewHolder = new FindFriendsViewHolder(view);
113 | return viewHolder;
114 | }
115 | };
116 | findPeopleFriend.setAdapter(firebaseRecyclerAdapter);
117 | firebaseRecyclerAdapter.startListening();
118 | }
119 |
120 | public static class FindFriendsViewHolder extends RecyclerView.ViewHolder {
121 |
122 | TextView userNameTxt;
123 | Button videoCallBtn;
124 | ImageView profileImageView;
125 | RelativeLayout cardView;
126 |
127 | public FindFriendsViewHolder(@NonNull View itemView){
128 | super(itemView);
129 |
130 | userNameTxt = itemView.findViewById(R.id.name_contact);
131 | videoCallBtn = itemView.findViewById(R.id.call_btn);
132 | profileImageView = itemView.findViewById(R.id.image_contact);
133 | cardView = itemView.findViewById(R.id.card_view1);
134 |
135 | videoCallBtn.setVisibility(View.GONE);
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/NotificationActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 | import androidx.recyclerview.widget.LinearLayoutManager;
6 | import androidx.recyclerview.widget.RecyclerView;
7 |
8 | import android.os.Bundle;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.Button;
13 | import android.widget.ImageView;
14 | import android.widget.RelativeLayout;
15 | import android.widget.TextView;
16 | import android.widget.Toast;
17 |
18 | import com.firebase.ui.database.FirebaseRecyclerAdapter;
19 | import com.firebase.ui.database.FirebaseRecyclerOptions;
20 | import com.google.android.gms.tasks.OnCompleteListener;
21 | import com.google.android.gms.tasks.Task;
22 | import com.google.firebase.auth.FirebaseAuth;
23 | import com.google.firebase.database.DataSnapshot;
24 | import com.google.firebase.database.DatabaseError;
25 | import com.google.firebase.database.DatabaseReference;
26 | import com.google.firebase.database.FirebaseDatabase;
27 | import com.google.firebase.database.ThrowOnExtraProperties;
28 | import com.google.firebase.database.ValueEventListener;
29 | import com.squareup.picasso.Picasso;
30 |
31 | public class NotificationActivity extends AppCompatActivity {
32 |
33 | private RecyclerView notifications_list;
34 | private DatabaseReference friendRequestRef, contactsRef, usersRef;
35 | private FirebaseAuth mAuth;
36 | private String currentUserId;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_notification);
42 |
43 | mAuth = FirebaseAuth.getInstance();
44 | currentUserId = mAuth.getCurrentUser().getUid();
45 | friendRequestRef = FirebaseDatabase.getInstance().getReference().child("Friend Requests");
46 | contactsRef = FirebaseDatabase.getInstance().getReference().child("Contacts");
47 | usersRef = FirebaseDatabase.getInstance().getReference().child("Users");
48 |
49 |
50 | notifications_list = findViewById(R.id.notifications_list);
51 | notifications_list.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
52 | }
53 |
54 | @Override
55 | protected void onStart() {
56 | super.onStart();
57 | FirebaseRecyclerOptions options = new FirebaseRecyclerOptions.Builder()
58 | .setQuery(friendRequestRef.child(currentUserId), Contacts.class).build();
59 |
60 | FirebaseRecyclerAdapter firebaseRecyclerAdapter
61 | = new FirebaseRecyclerAdapter(options) {
62 | @Override
63 | protected void onBindViewHolder(@NonNull final NotificationsViewHolder notificationsViewHolder, int i, @NonNull Contacts contacts) {
64 |
65 | notificationsViewHolder.acceptBtn.setVisibility(View.VISIBLE);
66 | notificationsViewHolder.cancelBtn.setVisibility(View.VISIBLE);
67 |
68 | final String listUserId = getRef(i).getKey();
69 | DatabaseReference requestTypeRef = getRef(i).child("request_type").getRef();
70 | requestTypeRef.addValueEventListener(new ValueEventListener() {
71 | @Override
72 | public void onDataChange(DataSnapshot dataSnapshot) {
73 | if (dataSnapshot.exists()){
74 | String type = dataSnapshot.getValue().toString();
75 | if (type.equals("received")){
76 | notificationsViewHolder.cardView.setVisibility(View.VISIBLE);
77 | usersRef.child(listUserId).addValueEventListener(new ValueEventListener() {
78 | @Override
79 | public void onDataChange(DataSnapshot dataSnapshot) {
80 | if (dataSnapshot.hasChild("image")){
81 | final String imageStr = dataSnapshot.child("image").getValue().toString();
82 |
83 | Picasso.get().load(imageStr).into(notificationsViewHolder.profileImageView);
84 | }
85 | else {
86 | final String nameStr = dataSnapshot.child("name").getValue().toString();
87 | notificationsViewHolder.userNameTxt.setText(nameStr);
88 | }
89 | notificationsViewHolder.acceptBtn.setOnClickListener(new View.OnClickListener() {
90 | @Override
91 | public void onClick(View v) {
92 |
93 | contactsRef.child(currentUserId).child(listUserId).child("Contacts").setValue("Saved").addOnCompleteListener(new OnCompleteListener() {
94 | @Override
95 | public void onComplete(@NonNull Task task) {
96 | if (task.isSuccessful()){
97 | contactsRef.child(listUserId).child(currentUserId)
98 | .child("Contacts").setValue("Saved").addOnCompleteListener(new OnCompleteListener() {
99 | @Override
100 | public void onComplete(@NonNull Task task) {
101 | if (task.isSuccessful()){
102 | friendRequestRef.child(currentUserId).child(listUserId).removeValue()
103 | .addOnCompleteListener(new OnCompleteListener() {
104 | @Override
105 | public void onComplete(@NonNull Task task) {
106 | if (task.isSuccessful()){
107 | friendRequestRef.child(listUserId).child(currentUserId).removeValue().addOnCompleteListener(new OnCompleteListener() {
108 | @Override
109 | public void onComplete(@NonNull Task task) {
110 |
111 | if (task.isSuccessful()){
112 | Toast.makeText(NotificationActivity.this, "Contact saved", Toast.LENGTH_SHORT).show();
113 | }
114 | }
115 | });
116 | }
117 | }
118 | });
119 | }
120 | }
121 | });
122 | }
123 | }
124 | });
125 | }
126 | });
127 |
128 | notificationsViewHolder.cancelBtn.setOnClickListener(new View.OnClickListener() {
129 | @Override
130 | public void onClick(View v) {
131 | friendRequestRef.child(currentUserId).child(listUserId).removeValue()
132 | .addOnCompleteListener(new OnCompleteListener() {
133 | @Override
134 | public void onComplete(@NonNull Task task) {
135 | if (task.isSuccessful()){
136 | friendRequestRef.child(listUserId).child(currentUserId).removeValue().addOnCompleteListener(new OnCompleteListener() {
137 | @Override
138 | public void onComplete(@NonNull Task task) {
139 |
140 | if (task.isSuccessful()){
141 | Toast.makeText(NotificationActivity.this,"Friend Request Cancel", Toast.LENGTH_SHORT).show();
142 | }
143 | }
144 | });
145 | }
146 | }
147 | });
148 | }
149 | });
150 | }
151 |
152 | @Override
153 | public void onCancelled(DatabaseError databaseError) {
154 |
155 | }
156 | });
157 | }
158 | else {
159 | notificationsViewHolder.cardView.setVisibility(View.GONE);
160 | }
161 | }
162 | }
163 |
164 | @Override
165 | public void onCancelled(DatabaseError databaseError) {
166 |
167 | }
168 | });
169 | }
170 |
171 | @NonNull
172 | @Override
173 | public NotificationsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
174 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.find_friend_design, parent, false);
175 | NotificationsViewHolder viewHolder = new NotificationsViewHolder(view);
176 | return viewHolder;
177 | }
178 | };
179 | notifications_list.setAdapter(firebaseRecyclerAdapter);
180 | firebaseRecyclerAdapter.startListening();
181 |
182 | }
183 |
184 | public static class NotificationsViewHolder extends RecyclerView.ViewHolder {
185 |
186 | TextView userNameTxt;
187 | Button acceptBtn, cancelBtn;
188 | ImageView profileImageView;
189 | RelativeLayout cardView;
190 |
191 | public NotificationsViewHolder(@NonNull View itemView){
192 | super(itemView);
193 |
194 | userNameTxt = itemView.findViewById(R.id.name_notification);
195 | acceptBtn = itemView.findViewById(R.id.request_accept_btn);
196 | cancelBtn = itemView.findViewById(R.id.request_decline_btn);
197 | profileImageView = itemView.findViewById(R.id.image_notification);
198 | cardView = itemView.findViewById(R.id.card_view);
199 | }
200 | }
201 |
202 |
203 | // private void CancelFriendRequest() {
204 | //
205 | //
206 | // }
207 |
208 |
209 |
210 | // private void AcceptFriendRequest() {
211 | //
212 | // }
213 | }
214 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/ProfileActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.google.android.gms.tasks.OnCompleteListener;
14 | import com.google.android.gms.tasks.Task;
15 | import com.google.firebase.auth.FirebaseAuth;
16 | import com.google.firebase.database.DataSnapshot;
17 | import com.google.firebase.database.DatabaseError;
18 | import com.google.firebase.database.DatabaseReference;
19 | import com.google.firebase.database.FirebaseDatabase;
20 | import com.google.firebase.database.ValueEventListener;
21 | import com.squareup.picasso.Picasso;
22 |
23 | public class ProfileActivity extends AppCompatActivity {
24 |
25 | private String receiverUserID="", receiverUserImage="", receiverUserName="";
26 | private ImageView background_profile_view;
27 | private TextView name_profile;
28 | private Button add_friend, decline_friend_request;
29 |
30 | private FirebaseAuth mAuth;
31 | private String currentUserId;
32 | private String senderUserId;
33 | private String currentState = "new";
34 |
35 | private DatabaseReference friendRequestRef, contactsRef;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_profile);
41 |
42 | mAuth = FirebaseAuth.getInstance();
43 | senderUserId = mAuth.getCurrentUser().getUid();
44 | friendRequestRef = FirebaseDatabase.getInstance().getReference().child("Friend Requests");
45 | contactsRef = FirebaseDatabase.getInstance().getReference().child("Contacts");
46 |
47 |
48 | receiverUserID = getIntent().getExtras().get("visit_user_id").toString();
49 | receiverUserImage = getIntent().getExtras().get("profile_image").toString();
50 | receiverUserName = getIntent().getExtras().get("profile_image").toString();
51 |
52 | background_profile_view = findViewById(R.id.background_profile_view);
53 | name_profile = findViewById(R.id.name_profile);
54 | add_friend = findViewById(R.id.add_friend_button);
55 | decline_friend_request = findViewById(R.id.decline_friend_request);
56 |
57 | Picasso.get().load(receiverUserImage).into(background_profile_view);
58 | name_profile.setText(receiverUserName);
59 |
60 | manageClickEvents();
61 | }
62 |
63 | private void manageClickEvents() {
64 |
65 | friendRequestRef.child(senderUserId).addListenerForSingleValueEvent(new ValueEventListener() {
66 | @Override
67 | public void onDataChange(DataSnapshot dataSnapshot) {
68 | if (dataSnapshot.hasChild(receiverUserID)){
69 | String requestType = dataSnapshot.child(receiverUserID).child("request_type").getValue().toString();
70 | if (requestType.equals("sent")){
71 | currentState = "request_sent";
72 | add_friend.setText("Cancel Friend Request");
73 | }
74 | else if (requestType.equals("received")){
75 | currentState = "request_received";
76 | add_friend.setText("Accept Friend Request");
77 | decline_friend_request.setVisibility(View.VISIBLE);
78 | decline_friend_request.setOnClickListener(new View.OnClickListener() {
79 | @Override
80 | public void onClick(View v) {
81 | CancelFriendRequest();
82 | }
83 | });
84 | }
85 | }
86 | else {
87 | contactsRef.child(senderUserId).addListenerForSingleValueEvent(new ValueEventListener() {
88 | @Override
89 | public void onDataChange(DataSnapshot dataSnapshot) {
90 | if (dataSnapshot.hasChild(receiverUserID)){
91 | currentState = "friends";
92 | add_friend.setText("Delete Contact");
93 | }
94 | else {
95 | currentState = "new";
96 | }
97 | }
98 |
99 | @Override
100 | public void onCancelled(DatabaseError databaseError) {
101 |
102 | }
103 | });
104 | }
105 | }
106 |
107 | @Override
108 | public void onCancelled(DatabaseError databaseError) {
109 |
110 | }
111 | });
112 | if (senderUserId.equals(receiverUserID)){
113 | add_friend.setVisibility(View.GONE);
114 | }
115 | else {
116 | add_friend.setOnClickListener(new View.OnClickListener() {
117 | @Override
118 | public void onClick(View v) {
119 | if (currentState.equals("new")){
120 | SendFriendRequest();
121 | }
122 | if (currentState.equals("request_sent")){
123 | CancelFriendRequest();
124 | }
125 | if (currentState.equals("request_received")){
126 | AcceptFriendRequest();
127 | }
128 | if (currentState.equals("request_sent")){
129 | CancelFriendRequest();
130 | }
131 | }
132 | });
133 | }
134 | }
135 |
136 | private void AcceptFriendRequest() {
137 | contactsRef.child(senderUserId).child(receiverUserID).child("Contacts").setValue("Saved").addOnCompleteListener(new OnCompleteListener() {
138 | @Override
139 | public void onComplete(@NonNull Task task) {
140 | if (task.isSuccessful()){
141 | contactsRef.child(receiverUserID).child(senderUserId)
142 | .child("Contacts").setValue("Saved")
143 | .addOnCompleteListener(new OnCompleteListener() {
144 | @Override
145 | public void onComplete(@NonNull Task task) {
146 | if (task.isSuccessful()){
147 | friendRequestRef.child(senderUserId).child(receiverUserID).removeValue()
148 | .addOnCompleteListener(new OnCompleteListener() {
149 | @Override
150 | public void onComplete(@NonNull Task task) {
151 | if (task.isSuccessful()){
152 | friendRequestRef.child(receiverUserID).child(senderUserId).removeValue().addOnCompleteListener(new OnCompleteListener() {
153 | @Override
154 | public void onComplete(@NonNull Task task) {
155 |
156 | if (task.isSuccessful()){
157 | currentState = "friends";
158 | add_friend.setText("Delete Contacts");
159 | decline_friend_request.setVisibility(View.GONE);
160 | }
161 | }
162 | });
163 | }
164 | }
165 | });
166 | }
167 | }
168 | });
169 | }
170 | }
171 | });
172 | }
173 |
174 | private void CancelFriendRequest() {
175 |
176 | friendRequestRef.child(senderUserId).child(receiverUserID).removeValue()
177 | .addOnCompleteListener(new OnCompleteListener() {
178 | @Override
179 | public void onComplete(@NonNull Task task) {
180 | if (task.isSuccessful()){
181 | friendRequestRef.child(receiverUserID).child(senderUserId).removeValue().addOnCompleteListener(new OnCompleteListener() {
182 | @Override
183 | public void onComplete(@NonNull Task task) {
184 |
185 | if (task.isSuccessful()){
186 | currentState = "new";
187 | add_friend.setText("Add Friend");
188 | }
189 | }
190 | });
191 | }
192 | }
193 | });
194 | }
195 |
196 | private void SendFriendRequest() {
197 |
198 | friendRequestRef.child(senderUserId).child(receiverUserID).child("request_type").setValue("sent")
199 | .addOnCompleteListener(new OnCompleteListener() {
200 | @Override
201 | public void onComplete(@NonNull Task task) {
202 | if (task.isSuccessful()){
203 | friendRequestRef.child(receiverUserID).child(senderUserId)
204 | .child("request_type").setValue("received")
205 | .addOnCompleteListener(new OnCompleteListener() {
206 | @Override
207 | public void onComplete(@NonNull Task task) {
208 | if (task.isSuccessful()){
209 | currentState = "request_sent";
210 | add_friend.setText("Cancel Friend Request");
211 | Toast.makeText(ProfileActivity.this, "Friend Request Sent", Toast.LENGTH_SHORT).show();
212 | }
213 | }
214 | });
215 | }
216 | }
217 | });
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/RegisterActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.app.ProgressDialog;
7 | import android.content.Intent;
8 | import android.os.Bundle;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import android.widget.RelativeLayout;
13 | import android.widget.Toast;
14 |
15 | import com.google.android.gms.tasks.OnCompleteListener;
16 | import com.google.android.gms.tasks.Task;
17 | import com.google.firebase.FirebaseException;
18 | import com.google.firebase.auth.AuthResult;
19 | import com.google.firebase.auth.FirebaseAuth;
20 | import com.google.firebase.auth.FirebaseUser;
21 | import com.google.firebase.auth.PhoneAuthCredential;
22 | import com.google.firebase.auth.PhoneAuthProvider;
23 | import com.hbb20.CountryCodePicker;
24 |
25 | import java.util.concurrent.TimeUnit;
26 |
27 | public class RegisterActivity extends AppCompatActivity {
28 |
29 | private CountryCodePicker ccp;
30 | private EditText phoneText, codeText;
31 | private Button continueAndNxtBtn;
32 | private String checker = "", phoneNumber = "";
33 | private RelativeLayout relativeLayout;
34 | private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks;
35 | private FirebaseAuth mAuth;
36 | private String mVerificationId;
37 | private PhoneAuthProvider.ForceResendingToken mResendToken;
38 | private ProgressDialog loadingBar;
39 |
40 | @Override
41 | protected void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | setContentView(R.layout.activity_register);
44 |
45 | mAuth = FirebaseAuth.getInstance();
46 | loadingBar = new ProgressDialog(this);
47 |
48 | phoneText = findViewById(R.id.phoneText);
49 | codeText = findViewById(R.id.codeText);
50 | continueAndNxtBtn = findViewById(R.id.continueNextButton);
51 | relativeLayout = findViewById(R.id.phoneAuth);
52 | ccp = findViewById(R.id.ccp);
53 | ccp.registerCarrierNumberEditText(phoneText);
54 |
55 | continueAndNxtBtn.setOnClickListener(new View.OnClickListener() {
56 | @Override
57 | public void onClick(View v) {
58 | if (continueAndNxtBtn.getText().equals("Submit") || checker.equals("Code Sent")) {
59 | String verificationCode = codeText.getText().toString();
60 | if (verificationCode.equals("")){
61 | Toast.makeText(RegisterActivity.this, "Please write verification code", Toast.LENGTH_SHORT).show();
62 | } else {
63 | loadingBar.setTitle("Code Verification");
64 | loadingBar.setMessage("Please wait, While we are verifying your code");
65 | loadingBar.setCanceledOnTouchOutside(false);
66 | loadingBar.show();
67 |
68 | PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, verificationCode);
69 | signInWithPhoneAuthCredential(credential);
70 | }
71 |
72 | } else {
73 | phoneNumber = ccp.getFullNumberWithPlus();
74 | if (!phoneNumber.equals("")){
75 |
76 | loadingBar.setTitle("Phone Number Verification");
77 | loadingBar.setMessage("Please wait, While we are verifying your phone number");
78 | loadingBar.setCanceledOnTouchOutside(false);
79 | loadingBar.show();
80 |
81 | PhoneAuthProvider.getInstance().verifyPhoneNumber(phoneNumber, 60, TimeUnit.SECONDS, RegisterActivity.this, mCallbacks);
82 | }
83 | else {
84 | Toast.makeText(RegisterActivity.this, "Please Enter Valid Phone Number", Toast.LENGTH_SHORT).show();
85 | }
86 | }
87 | }
88 | });
89 | mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
90 | @Override
91 | public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
92 | signInWithPhoneAuthCredential(phoneAuthCredential);
93 | }
94 |
95 | @Override
96 | public void onVerificationFailed(FirebaseException e) {
97 | Toast.makeText(RegisterActivity.this, "Invalid Phone Number...", Toast.LENGTH_SHORT).show();
98 | loadingBar.dismiss();
99 | relativeLayout.setVisibility(View.VISIBLE);
100 | continueAndNxtBtn.setText("Continue");
101 | codeText.setVisibility(View.GONE);
102 | }
103 |
104 | @Override
105 | public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
106 | super.onCodeSent(s, forceResendingToken);
107 | mVerificationId = s;
108 | mResendToken = forceResendingToken;
109 |
110 | relativeLayout.setVisibility(View.GONE);
111 | checker = "Code Sent";
112 | continueAndNxtBtn.setText("Submit");
113 | codeText.setVisibility(View.VISIBLE);
114 |
115 | loadingBar.dismiss();
116 | Toast.makeText(RegisterActivity.this, "Code has been sent, Please check", Toast.LENGTH_SHORT).show();
117 | }
118 | };
119 | }
120 |
121 | @Override
122 | protected void onStart() {
123 | super.onStart();
124 |
125 | FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
126 | if (firebaseUser != null){
127 | Intent homeIntent = new Intent(RegisterActivity.this, ContactsActivity.class);
128 | startActivity(homeIntent);
129 | finish();
130 | }
131 | }
132 |
133 | private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
134 | mAuth.signInWithCredential(credential)
135 | .addOnCompleteListener(this, new OnCompleteListener() {
136 | @Override
137 | public void onComplete(@NonNull Task task) {
138 | if (task.isSuccessful()) {
139 | loadingBar.dismiss();
140 | Toast.makeText(RegisterActivity.this, "Congratulations, you are logged in successfully", Toast.LENGTH_SHORT).show();
141 | } else {
142 | loadingBar.dismiss();
143 | String e = task.getException().toString();
144 | Toast.makeText(RegisterActivity.this, "Error: " + e, Toast.LENGTH_SHORT).show();
145 | }
146 | }
147 | });
148 | }
149 | private void sendUserToMainActivity(){
150 | Intent intent = new Intent(RegisterActivity.this, ContactsActivity.class);
151 | startActivity(intent);
152 | finish();
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.annotation.Nullable;
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | import android.app.ProgressDialog;
8 | import android.content.Intent;
9 | import android.net.Uri;
10 | import android.os.Bundle;
11 | import android.view.View;
12 | import android.widget.Button;
13 | import android.widget.EditText;
14 | import android.widget.ImageView;
15 | import android.widget.Toast;
16 |
17 | import com.google.android.gms.tasks.Continuation;
18 | import com.google.android.gms.tasks.OnCompleteListener;
19 | import com.google.android.gms.tasks.Task;
20 | import com.google.firebase.auth.FirebaseAuth;
21 | import com.google.firebase.database.DataSnapshot;
22 | import com.google.firebase.database.DatabaseError;
23 | import com.google.firebase.database.DatabaseReference;
24 | import com.google.firebase.database.FirebaseDatabase;
25 | import com.google.firebase.database.ValueEventListener;
26 | import com.google.firebase.storage.FirebaseStorage;
27 | import com.google.firebase.storage.StorageReference;
28 | import com.google.firebase.storage.UploadTask;
29 | import com.squareup.picasso.Picasso;
30 |
31 | import java.util.HashMap;
32 |
33 | public class SettingsActivity extends AppCompatActivity {
34 |
35 | private Button btnSave;
36 | private EditText userNameET, userBioET;
37 | private ImageView profileImageView;
38 |
39 | private static int GalleryPick = 1;
40 | private Uri ImageUri;
41 | private StorageReference userProfileImgRef;
42 | private String downloadUrl;
43 | private DatabaseReference userRef;
44 |
45 | private ProgressDialog progressDialog;
46 |
47 | @Override
48 | protected void onCreate(Bundle savedInstanceState) {
49 | super.onCreate(savedInstanceState);
50 | setContentView(R.layout.activity_settings);
51 |
52 | userProfileImgRef = FirebaseStorage.getInstance().getReference().child("Profile Images");
53 | userRef = FirebaseDatabase.getInstance().getReference().child("Users");
54 |
55 | btnSave = findViewById(R.id.save_settings_btn);
56 | userNameET = findViewById(R.id.username_settings);
57 | userBioET = findViewById(R.id.bio_settings);
58 | profileImageView = findViewById(R.id.settings_profile_image);
59 | progressDialog = new ProgressDialog(this);
60 |
61 |
62 | profileImageView.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | Intent galleryIntent = new Intent();
66 | galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
67 | galleryIntent.setType("image/*");
68 | startActivityForResult(galleryIntent, GalleryPick);
69 | }
70 | });
71 |
72 | btnSave.setOnClickListener(new View.OnClickListener() {
73 | @Override
74 | public void onClick(View v) {
75 | saveUserData();
76 | }
77 | });
78 |
79 | retrieveUserInfo();
80 | }
81 |
82 | @Override
83 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
84 | super.onActivityResult(requestCode, resultCode, data);
85 | if (requestCode==GalleryPick && resultCode==RESULT_OK && data!=null){
86 | ImageUri = data.getData();
87 | profileImageView.setImageURI(ImageUri);
88 | }
89 | }
90 |
91 |
92 | private void saveUserData() {
93 | final String getUserName = userNameET.getText().toString();
94 | final String getUserStatus = userBioET.getText().toString();
95 |
96 | if (ImageUri == null){
97 |
98 | userRef.addValueEventListener(new ValueEventListener() {
99 | @Override
100 | public void onDataChange(DataSnapshot dataSnapshot) {
101 | if (dataSnapshot.child(FirebaseAuth.getInstance().getCurrentUser().getUid()).hasChild("images")){
102 | saveInfoOnlyWithoutImage();
103 | }else {
104 | Toast.makeText(SettingsActivity.this, "Please select Image first", Toast.LENGTH_SHORT).show();
105 | }
106 | }
107 |
108 | @Override
109 | public void onCancelled(DatabaseError databaseError) {
110 |
111 | }
112 | });
113 | }
114 | else if (getUserName.equals("")){
115 | Toast.makeText(SettingsActivity.this, "Name is mandatory", Toast.LENGTH_SHORT).show();
116 | }
117 | else if (getUserStatus.equals("")){
118 | Toast.makeText(SettingsActivity.this, "Bio is mandatory", Toast.LENGTH_SHORT).show();
119 | }
120 | else {
121 |
122 | progressDialog.setTitle("Account Settings");
123 | progressDialog.setMessage("Please wait...");
124 | progressDialog.show();
125 |
126 | final StorageReference filePath = userProfileImgRef.child(FirebaseAuth.getInstance().getCurrentUser().getUid());
127 | final UploadTask uploadTask = filePath.putFile(ImageUri);
128 | uploadTask.continueWithTask(new Continuation>() {
129 | @Override
130 | public Task then(@NonNull Task task) throws Exception {
131 | if (!task.isSuccessful()){
132 | throw task.getException();
133 | }
134 | downloadUrl = filePath.getDownloadUrl().toString();
135 | return filePath.getDownloadUrl();
136 | }
137 | }).addOnCompleteListener(new OnCompleteListener() {
138 | @Override
139 | public void onComplete(@NonNull Task task) {
140 | if (task.isSuccessful()){
141 | downloadUrl = task.getResult().toString();
142 | HashMap profileMap = new HashMap<>();
143 | profileMap.put("uid", FirebaseAuth.getInstance().getCurrentUser().getUid());
144 | profileMap.put("name", getUserName);
145 | profileMap.put("status", getUserStatus);
146 | profileMap.put("image", downloadUrl);
147 |
148 | userRef.child(FirebaseAuth.getInstance().getCurrentUser().getUid()).updateChildren(profileMap).addOnCompleteListener(new OnCompleteListener() {
149 | @Override
150 | public void onComplete(@NonNull Task task) {
151 | if (task.isSuccessful()){
152 | Intent intent = new Intent(SettingsActivity.this, ContactsActivity.class);
153 | startActivity(intent);
154 | finish();
155 | progressDialog.dismiss();
156 | Toast.makeText(SettingsActivity.this, "Profile has been updated", Toast.LENGTH_SHORT).show();
157 |
158 | }
159 | }
160 | });
161 | }
162 | }
163 | });
164 | }
165 | }
166 |
167 | private void saveInfoOnlyWithoutImage() {
168 | final String getUserName = userNameET.getText().toString();
169 | final String getUserStatus = userBioET.getText().toString();
170 |
171 | if (getUserName.equals("")){
172 | Toast.makeText(SettingsActivity.this, "Name is mandatory", Toast.LENGTH_SHORT).show();
173 | }
174 | else if (getUserStatus.equals("")){
175 | Toast.makeText(SettingsActivity.this, "Bio is mandatory", Toast.LENGTH_SHORT).show();
176 | }
177 | else {
178 | progressDialog.setTitle("Account Settings");
179 | progressDialog.setMessage("Please wait...");
180 | progressDialog.show();
181 |
182 | final HashMap profileMap = new HashMap<>();
183 | profileMap.put("uid", FirebaseAuth.getInstance().getCurrentUser().getUid());
184 | profileMap.put("name", getUserName);
185 | profileMap.put("status", getUserStatus);
186 |
187 | userRef.child(FirebaseAuth.getInstance().getCurrentUser().getUid()).updateChildren(profileMap).addOnCompleteListener(new OnCompleteListener() {
188 | @Override
189 | public void onComplete(@NonNull Task task) {
190 | if (task.isSuccessful()){
191 | Intent intent = new Intent(SettingsActivity.this, ContactsActivity.class);
192 | startActivity(intent);
193 | finish();
194 | progressDialog.dismiss();
195 | Toast.makeText(SettingsActivity.this, "Profile has been updated", Toast.LENGTH_SHORT).show();
196 |
197 | }
198 | }
199 | });
200 | }
201 | }
202 |
203 | private void retrieveUserInfo(){
204 | userRef.child(FirebaseAuth.getInstance().getCurrentUser().getUid()).addValueEventListener(new ValueEventListener() {
205 | @Override
206 | public void onDataChange(DataSnapshot dataSnapshot) {
207 | if (dataSnapshot.exists()){
208 | String imageDb = dataSnapshot.child("image").getValue().toString();
209 | String nameDb = dataSnapshot.child("name").getValue().toString();
210 | String bioDb = dataSnapshot.child("status").getValue().toString();
211 |
212 | userNameET.setText(nameDb);
213 | userBioET.setText(bioDb);
214 |
215 | Picasso.get().load(imageDb).placeholder(R.drawable.profile_image).into(profileImageView);
216 | }
217 | }
218 |
219 | @Override
220 | public void onCancelled(DatabaseError databaseError) {
221 |
222 | }
223 | });
224 | }
225 | }
226 |
--------------------------------------------------------------------------------
/Chat/app/src/main/java/com/royalbimrah/chat/VideoChatActivity.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.Manifest;
7 | import android.content.Intent;
8 | import android.opengl.GLSurfaceView;
9 | import android.os.Bundle;
10 | import android.util.Log;
11 | import android.view.View;
12 | import android.widget.FrameLayout;
13 | import android.widget.ImageView;
14 |
15 | import com.google.firebase.auth.FirebaseAuth;
16 | import com.google.firebase.database.DataSnapshot;
17 | import com.google.firebase.database.DatabaseError;
18 | import com.google.firebase.database.DatabaseReference;
19 | import com.google.firebase.database.FirebaseDatabase;
20 | import com.google.firebase.database.ValueEventListener;
21 | import com.opentok.android.OpentokError;
22 | import com.opentok.android.Publisher;
23 | import com.opentok.android.PublisherKit;
24 | import com.opentok.android.Session;
25 | import com.opentok.android.Stream;
26 | import com.opentok.android.Subscriber;
27 |
28 | import pub.devrel.easypermissions.AfterPermissionGranted;
29 | import pub.devrel.easypermissions.EasyPermissions;
30 |
31 | public class VideoChatActivity extends AppCompatActivity implements Session.SessionListener, PublisherKit.PublisherListener {
32 |
33 | private static String API_KEY ="46521322";
34 | private static String SESSION_ID ="2_MX40NjUyMTMyMn5-MTU4MjY0MTg3NjE5N35JcmFlZE82YnlDeU12RFljR0ExV2hldGx-fg";
35 | private static String TOKEN ="T1==cGFydG5lcl9pZD00NjUyMTMyMiZzaWc9YmE4NGE0NmVhOGM0MzcwNjg4NTgzZTAzYWVjMjRiNzI0ZTA0OTI5NzpzZXNzaW9uX2lkPTJfTVg0ME5qVXlNVE15TW41LU1UVTRNalkwTVRnM05qRTVOMzVKY21GbFpFODJZbmxEZVUxMlJGbGpSMEV4VjJobGRHeC1mZyZjcmVhdGVfdGltZT0xNTgyNjQxOTYyJm5vbmNlPTAuMjA5MTcwNjkxOTcyMjE1MTYmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTU4NTIzMDM2MCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==";
36 | private static final String LOG_TAG = VideoChatActivity.class.getSimpleName();
37 | private static final int RC_VIDEO_APP_PERM = 124;
38 |
39 | private FrameLayout mPublisherViewController;
40 | private FrameLayout mSubscriberViewController;
41 | private Session mSession;
42 | private Publisher mPublisher;
43 | private Subscriber msubscriber;
44 |
45 |
46 | private ImageView closeVideoChatBtn;
47 | private DatabaseReference userRef;
48 | private String userID="";
49 |
50 | @Override
51 | protected void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | setContentView(R.layout.activity_video_chat);
54 |
55 | userID = FirebaseAuth.getInstance().getCurrentUser().getUid();
56 | userRef = FirebaseDatabase.getInstance().getReference().child("Users");
57 |
58 | closeVideoChatBtn = findViewById(R.id.close_video_chat_btn);
59 | closeVideoChatBtn.setOnClickListener(new View.OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 |
63 | userRef.addValueEventListener(new ValueEventListener() {
64 | @Override
65 | public void onDataChange(DataSnapshot dataSnapshot) {
66 |
67 | if (dataSnapshot.child(userID).hasChild("Ringing")){
68 | userRef.child(userID).child("Ringing").removeValue();
69 |
70 | if (mPublisher != null){
71 | mPublisher.destroy();
72 | }
73 | if (msubscriber != null){
74 | msubscriber.destroy();
75 | }
76 | startActivity(new Intent(VideoChatActivity.this, RegisterActivity.class));
77 | finish();
78 | }
79 | if (dataSnapshot.child(userID).hasChild("Calling")){
80 | userRef.child(userID).child("Calling").removeValue();
81 |
82 | if (mPublisher != null){
83 | mPublisher.destroy();
84 | }
85 | if (msubscriber != null){
86 | msubscriber.destroy();
87 | }
88 |
89 | startActivity(new Intent(VideoChatActivity.this, RegisterActivity.class));
90 | finish();
91 | }
92 | else {
93 | if (mPublisher != null){
94 | mPublisher.destroy();
95 | }
96 | if (msubscriber != null){
97 | msubscriber.destroy();
98 | }
99 | startActivity(new Intent(VideoChatActivity.this, RegisterActivity.class));
100 | finish();
101 | }
102 | }
103 |
104 | @Override
105 | public void onCancelled(DatabaseError databaseError) {
106 |
107 | }
108 | });
109 | }
110 | });
111 |
112 | requestPermissions();
113 | }
114 |
115 | @Override
116 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
117 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
118 |
119 | EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, VideoChatActivity.this);
120 | }
121 | @AfterPermissionGranted(RC_VIDEO_APP_PERM)
122 | private void requestPermissions(){
123 | String [] perms = {Manifest.permission.INTERNET, Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA};
124 |
125 | if (EasyPermissions.hasPermissions(this, perms)){
126 |
127 | mPublisherViewController = findViewById(R.id.publisher_container);
128 | mSubscriberViewController = findViewById(R.id.subscriber_container);
129 |
130 |
131 | //initialize and connect the session
132 | mSession = new Session.Builder(this, API_KEY, SESSION_ID).build();
133 | mSession.setSessionListener(VideoChatActivity.this);
134 | mSession.connect(TOKEN);
135 | }
136 | else {
137 | EasyPermissions.requestPermissions(this, "Hey! this app needs Mic and Camera, Please allow.", RC_VIDEO_APP_PERM, perms);
138 |
139 | }
140 | }
141 |
142 | @Override
143 | public void onStreamCreated(PublisherKit publisherKit, Stream stream) {
144 |
145 | }
146 |
147 | @Override
148 | public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) {
149 |
150 | }
151 |
152 | @Override
153 | public void onError(PublisherKit publisherKit, OpentokError opentokError) {
154 |
155 | }
156 |
157 | @Override
158 | public void onConnected(Session session) {
159 |
160 | Log.i(LOG_TAG, "Session Connected");
161 | mPublisher = new Publisher.Builder(this).build();
162 | mPublisher.setPublisherListener(VideoChatActivity.this);
163 | mPublisherViewController.addView(mPublisher.getView());
164 |
165 | if (mPublisher.getView() instanceof GLSurfaceView){
166 | ((GLSurfaceView) mPublisher.getView()).setZOrderOnTop(true);
167 | }
168 | mSession.publish(mPublisher);
169 | }
170 |
171 | @Override
172 | public void onDisconnected(Session session) {
173 | Log.i(LOG_TAG, "Stream Disconnected");
174 | }
175 |
176 | @Override
177 | public void onStreamReceived(Session session, Stream stream) {
178 |
179 | Log.i(LOG_TAG,"Stream Received");
180 | if (msubscriber == null){
181 | msubscriber = new Subscriber.Builder(this, stream).build();
182 | mSession.subscribe(msubscriber);
183 | mSubscriberViewController.addView(msubscriber.getView());
184 | }
185 | }
186 |
187 | @Override
188 | public void onStreamDropped(Session session, Stream stream) {
189 | Log.i(LOG_TAG, "Stream Dropped");
190 |
191 | if (msubscriber != null){
192 | msubscriber = null;
193 | mSubscriberViewController.removeAllViews();
194 | }
195 | }
196 |
197 | @Override
198 | public void onError(Session session, OpentokError opentokError) {
199 | Log.i(LOG_TAG, "Stream Error");
200 | }
201 |
202 | @Override
203 | public void onPointerCaptureChanged(boolean hasCapture) {
204 |
205 | }
206 | }
207 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/back.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/cancel_call.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/cancel_call.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/edit_profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/edit_profile.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/edit_status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/edit_status.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/email.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/find_people.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/find_people.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/ic_dashboard_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/logout.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/make_call.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/make_call.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/password.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/profile_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/profile_image.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/register.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/register.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/search.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/settings.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/splash.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/drawable/video_call.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/drawable/video_call.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_calling.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
28 |
29 |
41 |
42 |
50 |
51 |
59 |
60 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_contacts.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
13 |
14 |
18 |
19 |
22 |
23 |
31 |
32 |
40 |
41 |
42 |
43 |
44 |
45 |
51 |
52 |
61 |
62 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_find_people.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
22 |
23 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
22 |
23 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
42 |
43 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
28 |
29 |
44 |
45 |
61 |
62 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
29 |
30 |
35 |
36 |
43 |
44 |
48 |
49 |
55 |
56 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
89 |
90 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
36 |
37 |
53 |
54 |
65 |
66 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/activity_video_chat.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
18 |
19 |
20 |
27 |
28 |
29 |
30 |
31 |
39 |
40 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/contact_design.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
24 |
25 |
36 |
37 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/layout/find_friend_design.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
37 |
38 |
54 |
55 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/menu/bottom_nav_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Chat/app/src/main/res/raw/iphone.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/app/src/main/res/raw/iphone.mp3
--------------------------------------------------------------------------------
/Chat/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #38E827
4 | #38E827
5 | #27323E
6 | #FFFFFF
7 | #000000
8 |
9 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Chat
3 | Log out
4 | Settings
5 | Home
6 | Notifications
7 | Phone Number
8 | Enter phone number
9 | Continue
10 | Write your code here
11 | Contacts
12 | User Name
13 | Accept Friend Request
14 | Cancel Friend Request
15 | User Name
16 | Add Friend
17 | Cancel Friend Request
18 | Calling...
19 |
20 |
--------------------------------------------------------------------------------
/Chat/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Chat/app/src/test/java/com/royalbimrah/chat/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.royalbimrah.chat;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Chat/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.6.0'
11 | classpath 'com.google.gms:google-services:4.3.3'
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | maven { url 'https://maven.google.com'}
22 | maven { url 'https://tokbox.bintray.com/maven'}
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/Chat/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/Chat/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Android-archive/Video-Chat-App/9ae3328fc5b8a7a71d65d2e72ce6c2438e0c995d/Chat/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Chat/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Feb 25 09:02:53 IST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/Chat/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/Chat/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Chat/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name='Chat'
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Video-Chat-App
2 | This app allows you to make a video Call
3 |
4 | [](https://kanwarpartapsingh.com)
5 |
6 |
7 |
8 | Just a video chat app. This app is mostly completed but some bugs would be there.
9 | **google-services.json file has been deleted for security reasons. Place your google-services.json in /app folder**
10 |
11 | ## Available feautres
12 |
13 | * Registration
14 | - Registration and logging in using firebase using Mobile OTP **(stable)**
15 | * Notification
16 | - Instant messaging using notifications using firebase functions **(stable)**
17 | * Make new friends
18 | - Friend request and accepted notifications **(stable)**
19 | * Profile
20 | - Manage your profile either online or offline **(stable)**
21 |
22 | ## Screenshots
23 |
24 |
25 | 
26 |
27 | 
28 |
29 | 
30 |
31 | 
32 |
33 |
34 | ## Developer
35 |
36 | This whole project is maintained only by **Kanwarpartap Singh**.
37 | If you like to contribute, please let me know
38 |
39 |
40 | ## Important Notes
41 | **This app has a lot bugs** and isn't yet completed. It is in progress
42 |
--------------------------------------------------------------------------------