├── LICENSE
├── README.md
├── extras
├── chat-ss-1.png
├── chat-ss.png
├── chats-ss-1.png
├── chats-ss.png
├── contacts-ss.png
├── create-profile-ss.png
├── edited-message-ss.png
├── login-change-ip-ss.png
├── login-ss.png
├── messages-table-ss.png
├── profile-table-ss.png
├── register-change-ip-ss.png
├── signup-ss.png
└── splash-screen-ss.png
└── src
├── .gitignore
├── .idea
├── .gitignore
├── .name
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
└── vcs.xml
├── PHP_Files
├── conn.php
├── deleteMessage.php
├── get.php
├── getMessages.php
├── getProfileByEmail.php
├── insert.php
├── login.php
├── postMessage.php
└── updateMessage.php
├── README.md
├── app
├── .gitignore
├── build.gradle
├── google-services.json
├── libs
│ └── sinch-android-rtc-3.12.9.aar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── hamzaamin
│ │ └── i180550_i170298
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── call.html
│ │ ├── call.js
│ │ └── style.css
│ ├── java
│ │ └── com
│ │ │ └── hamzaamin
│ │ │ └── i180550_i170298
│ │ │ ├── AddContact.java
│ │ │ ├── CallActivity.java
│ │ │ ├── CallFragment.java
│ │ │ ├── CallRVAdapter.java
│ │ │ ├── CameraActivity.java
│ │ │ ├── CameraFragment.java
│ │ │ ├── ChatActivity.java
│ │ │ ├── ChatFragment.java
│ │ │ ├── ContactFragment.java
│ │ │ ├── ContactRVAdapter.java
│ │ │ ├── CreateProfile.java
│ │ │ ├── DBHelper.java
│ │ │ ├── Dashboard.java
│ │ │ ├── Id.java
│ │ │ ├── Login.java
│ │ │ ├── Message.java
│ │ │ ├── MessageRVAdapter.java
│ │ │ ├── MyApp.java
│ │ │ ├── MyContactContract.java
│ │ │ ├── Profile.java
│ │ │ ├── Register.java
│ │ │ ├── ScreenShotContentObserver.java
│ │ │ ├── Splash.java
│ │ │ ├── main
│ │ │ ├── PageViewModel.java
│ │ │ ├── PlaceholderFragment.java
│ │ │ └── SectionsPagerAdapter.java
│ │ │ └── placeholder
│ │ │ └── PlaceholderContent.java
│ └── res
│ │ ├── drawable-v24
│ │ ├── back.png
│ │ ├── back_button.png
│ │ ├── call.png
│ │ ├── call_dp.jpg
│ │ ├── callgradient.xml
│ │ ├── deletebutton.xml
│ │ ├── emoji.png
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_launcher_foreground.xml
│ │ ├── ic_outline_camera_white.xml
│ │ ├── ic_outline_videocam_24.xml
│ │ ├── ic_round_arrow_back_24.xml
│ │ ├── ic_round_arrow_back_50.xml
│ │ ├── ic_round_close_24.xml
│ │ ├── ic_sharp_add_24.xml
│ │ ├── ic_twotone_camera_alt_24.xml
│ │ ├── ic_twotone_chat_bubble.xml
│ │ ├── ic_twotone_people.xml
│ │ ├── ic_twotone_phone_24.xml
│ │ ├── ic_twotone_photo_camera.xml
│ │ ├── insta_logo.png
│ │ ├── logo.png
│ │ ├── newcontact.png
│ │ ├── newgroup.png
│ │ ├── photo_icon.png
│ │ ├── recbubble.xml
│ │ ├── sendbubble.xml
│ │ ├── toolbar.xml
│ │ ├── upload.png
│ │ └── voice_icon.png
│ │ ├── drawable
│ │ ├── ic_baseline_call_24.xml
│ │ ├── ic_baseline_call_end_24.xml
│ │ ├── ic_baseline_mic_24.xml
│ │ ├── ic_baseline_mic_off_24.xml
│ │ ├── ic_baseline_video_call_24.xml
│ │ ├── ic_baseline_videocam_24.xml
│ │ ├── ic_baseline_videocam_off_24.xml
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_add_contact.xml
│ │ ├── activity_call.xml
│ │ ├── activity_camera.xml
│ │ ├── activity_chat.xml
│ │ ├── activity_create_profile.xml
│ │ ├── activity_dashboard.xml
│ │ ├── activity_login_screen.xml
│ │ ├── activity_register.xml
│ │ ├── activity_splash.xml
│ │ ├── contact_item.xml
│ │ ├── fragment_call.xml
│ │ ├── fragment_call_items.xml
│ │ ├── fragment_camera.xml
│ │ ├── fragment_chat.xml
│ │ ├── fragment_chat_list.xml
│ │ ├── fragment_contact.xml
│ │ ├── fragment_dashboard.xml
│ │ ├── message_rec.xml
│ │ ├── message_rec_img.xml
│ │ ├── message_sent.xml
│ │ └── message_sent_img.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── dimens
│ │ └── dimens.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── hamzaamin
│ └── i180550_i170298
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Sameet Asadullah
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Bisto Chat using Java and PHP
2 |
3 | ### Description
4 | An `Android Chatting Application` coded in `Java Language` using `Android Studio`. Backend is implemented in `PHP Language` i.e, APIs. It works exactly like `WhatsApp` i.e, user accounts get detected by their `Phone Numbers` and `Synced Automatically` with the application. User can then select any contact and start chatting with it.
5 |
6 | ### Functionalities
7 | - User can `Login/Signup`.
8 | - User can set his `Profile Picture`.
9 | - User can set his `Personal Details`.
10 | - Users can `Send Text Messages` to eachother.
11 | - Users can `Send Image Messages` to eachother.
12 | - Users can `Edit Message` by clicking on it.
13 | - Users can `Delete Message` by long pressing it.
14 | - If a user `Takes Screenshot` of the chat, it gets send in the chat automatically.
15 |
16 | ### Manual
17 | 1) [Download](https://www.apachefriends.org/download.html) and install `XAMPP` from the given link (`C:\xampp` folder should be there after installation).
18 | ```
19 | https://www.apachefriends.org/download.html
20 | ```
21 | 2) Paste the folder named as `PHP_Files` present [Here](https://github.com/SameetAsadullah/Bisto-Chat-Java-PHP/blob/main/src/PHP_Files/) in `C:\xampp\htdocs` folder.
22 | 3) Open Xampp and `Run Apache and MySQL Services`.
23 | 4) `Click on Admin Button` infront of MySQL Service and a new tab will open in the browser.
24 | 5) `Create a Database` there with the name `bisto_chat`.
25 | 6) `Create the Following Tables` with the `Same Table Names` and `Same Column Names` as displayed in the screenshots below:
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 7) Open the provided project in `Android Studio`.
36 | 8) Get the `Current IP` of your pc and replace it here in the file named as `Login.java`:
37 |
38 |
39 |
40 |
41 |
42 | 8) Get the `Current IP` of your pc and replace it here in the file named as `Register.java`:
43 |
44 |
45 |
46 |
47 |
48 | 10) `Build the Project` and you are good to go :smiley:
49 |
50 | ### Working Screenshots
51 |
57 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | ### Contributors
71 | - [Sameet Asadullah](https://github.com/SameetAsadullah)
72 | - [Tayyab Ali](https://github.com/DarkDragz)
73 |
--------------------------------------------------------------------------------
/extras/chat-ss-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/chat-ss-1.png
--------------------------------------------------------------------------------
/extras/chat-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/chat-ss.png
--------------------------------------------------------------------------------
/extras/chats-ss-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/chats-ss-1.png
--------------------------------------------------------------------------------
/extras/chats-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/chats-ss.png
--------------------------------------------------------------------------------
/extras/contacts-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/contacts-ss.png
--------------------------------------------------------------------------------
/extras/create-profile-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/create-profile-ss.png
--------------------------------------------------------------------------------
/extras/edited-message-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/edited-message-ss.png
--------------------------------------------------------------------------------
/extras/login-change-ip-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/login-change-ip-ss.png
--------------------------------------------------------------------------------
/extras/login-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/login-ss.png
--------------------------------------------------------------------------------
/extras/messages-table-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/messages-table-ss.png
--------------------------------------------------------------------------------
/extras/profile-table-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/profile-table-ss.png
--------------------------------------------------------------------------------
/extras/register-change-ip-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/register-change-ip-ss.png
--------------------------------------------------------------------------------
/extras/signup-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/signup-ss.png
--------------------------------------------------------------------------------
/extras/splash-screen-ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/extras/splash-screen-ss.png
--------------------------------------------------------------------------------
/src/.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 | local.properties
16 |
--------------------------------------------------------------------------------
/src/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/src/.idea/.name:
--------------------------------------------------------------------------------
1 | assignment_4
--------------------------------------------------------------------------------
/src/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/PHP_Files/conn.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/deleteMessage.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/get.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/getMessages.php:
--------------------------------------------------------------------------------
1 | query($sql);
10 |
11 | if ($res->num_rows > 0) {
12 | // output data of each row
13 | while($row = $res->fetch_assoc()) {
14 |
15 | $temp=array();
16 | $temp["senderId"]=$row["senderId"];
17 | $temp["receiverId"]=$row["receiverId"];
18 | $temp["text"]=$row["text"];
19 | $temp["image"]=$row["image"];
20 | $temp["timestamp"]=$row["timestamp"];
21 | array_push($responce,$temp);
22 | }
23 | } else {
24 | echo "0 results";
25 | }
26 |
27 | $x = json_encode($responce); #Converts Array into JSON
28 | echo $x;
29 |
30 |
31 | function utf8ize($d) {
32 | if (is_array($d)) {
33 | foreach ($d as $k => $v)
34 | {
35 | $d[$k] = utf8ize($v);
36 | }
37 | }
38 | else if (is_string ($d)) {
39 | return utf8_encode($d);
40 | }
41 | return $d;
42 | }
43 |
44 |
45 | ?>
--------------------------------------------------------------------------------
/src/PHP_Files/getProfileByEmail.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/insert.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/login.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/PHP_Files/postMessage.php:
--------------------------------------------------------------------------------
1 | $v)
67 | {
68 | $d[$k] = utf8ize($v);
69 | }
70 | }
71 | else if (is_string ($d)) {
72 | return utf8_encode($d);
73 | }
74 | return $d;
75 | }
76 | ?>
--------------------------------------------------------------------------------
/src/PHP_Files/updateMessage.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/README.md:
--------------------------------------------------------------------------------
1 | # Bisto_Chat-Android--PHP-
2 |
3 | Functionalities:
4 |
5 | Contacts Sync with your Mobile Contacts.
6 | App to App messaging.
7 | Audio Call Feature (via Sinch SDK)
8 |
9 | Dependencies:
10 |
11 |
12 | Android Studio
13 | XAMPP (Apache + MySQL)
14 |
15 | Instructions:
16 |
17 |
18 | 1. Download XAMPP.
19 | 2. After installation, go to XAMPP/htdocs folder and paste the files from PHP_Files to the htdocs folder.
20 | 3. Configure the IP of your XAMPP server in Register and Login Activity once. IP can be found via ipconfig in Windows and ifconfig in Linux
21 | 4. A SQL database should be created. This can be done by visiting mysql admin from XAMPP.
22 | 5. Create the database by the name of Bisto_Chat and make a table inside this database.
23 | 6. The details for the table structure is provided in the profile.jpeg inside PHP_Files.
24 | 7. After doing all these steps, build your android gradle and its done.
25 |
26 | 
27 | 
28 | 
29 | 
30 | 
31 |
32 |
--------------------------------------------------------------------------------
/src/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/src/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
3 | id 'com.android.application'
4 | }
5 |
6 | android {
7 | compileSdk 30
8 |
9 | defaultConfig {
10 | applicationId "com.hamzaamin.i180550_i170298"
11 | minSdk 21
12 | targetSdk 30
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled true
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | buildFeatures {
30 | viewBinding true
31 | }
32 | }
33 |
34 | dependencies {
35 | implementation 'de.hdodenhof:circleimageview:3.1.0'
36 | implementation 'androidx.appcompat:appcompat:1.3.1'
37 | implementation "androidx.activity:activity-ktx:1.2.3"
38 | implementation "androidx.fragment:fragment-ktx:1.3.3"
39 | implementation 'com.google.android.material:material:1.4.0'
40 | implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
41 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
42 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
43 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
44 | implementation 'androidx.recyclerview:recyclerview:1.2.1'
45 | testImplementation 'junit:junit:4.+'
46 | implementation 'androidx.cardview:cardview:1.0.0'
47 | implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
48 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
49 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
50 | implementation 'com.github.dhaval2404:imagepicker:2.1'
51 | implementation 'com.jaeger.statusbarutil:library:1.5.1'
52 | implementation 'com.squareup.picasso:picasso:2.71828'
53 | implementation 'com.android.volley:volley:1.2.1'
54 | implementation files('libs/sinch-android-rtc-3.12.9.aar')
55 | implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
56 | }
--------------------------------------------------------------------------------
/src/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "1052085604042",
4 | "project_id": "assignment4-57e5c",
5 | "storage_bucket": "assignment4-57e5c.appspot.com"
6 | },
7 | "client": [
8 | {
9 | "client_info": {
10 | "mobilesdk_app_id": "1:1052085604042:android:46930fce72cd8c25b96e33",
11 | "android_client_info": {
12 | "package_name": "com.abubakar.i180449_i180564"
13 | }
14 | },
15 | "oauth_client": [
16 | {
17 | "client_id": "1052085604042-eb54vie47abdui2q07jjl31qodgcgi5r.apps.googleusercontent.com",
18 | "client_type": 3
19 | }
20 | ],
21 | "api_key": [
22 | {
23 | "current_key": "AIzaSyCAjEdHqNwjV1UDAFfO87Vyl_Dlwr6NpMI"
24 | }
25 | ],
26 | "services": {
27 | "appinvite_service": {
28 | "other_platform_oauth_client": [
29 | {
30 | "client_id": "1052085604042-eb54vie47abdui2q07jjl31qodgcgi5r.apps.googleusercontent.com",
31 | "client_type": 3
32 | }
33 | ]
34 | }
35 | }
36 | }
37 | ],
38 | "configuration_version": "1"
39 | }
--------------------------------------------------------------------------------
/src/app/libs/sinch-android-rtc-3.12.9.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/libs/sinch-android-rtc-3.12.9.aar
--------------------------------------------------------------------------------
/src/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
--------------------------------------------------------------------------------
/src/app/src/androidTest/java/com/hamzaamin/i180550_i170298/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
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 | assertEquals("com.abubakar.i180449_i180564", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/src/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
23 |
26 |
31 |
34 |
37 |
39 |
42 |
44 |
46 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/app/src/main/assets/call.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/app/src/main/assets/call.js:
--------------------------------------------------------------------------------
1 | let localVideo = document.getElementById("local-video")
2 | let remoteVideo = document.getElementById("remote-video")
3 |
4 | localVideo.style.opacity = 0
5 | remoteVideo.style.opacity = 0
6 |
7 | localVideo.onplaying = () => {
8 | localVideo.style.opacity = 1
9 | }
10 |
11 | remoteVideo.onplaying = () => {
12 | remoteVideo.style.opacity = 1
13 | }
14 |
15 | let peer
16 | function init(userId) {
17 | peer = new Peer(userId, {
18 | host: '192.168.1.10',
19 | port: 9000,
20 | path: '/androidcall'
21 | })
22 |
23 | peer.on('open', () => {
24 | //WE WILL MAKE A CALL TO A FUNCTION IN ANDROID.
25 | })
26 |
27 | listen()
28 | }
29 |
30 | let localStream
31 | function listen() {
32 | peer.on('call', (call) => {
33 | navigator.getUserMedia({
34 | audio: true,
35 | video: true
36 | }, (stream) => {
37 | localVideo.srcObject = stream
38 | localStream = stream
39 |
40 | call.answer(stream)
41 | call.on('stream', (remoteStream) => {
42 | remoteVideo.srcObject = remoteStream
43 |
44 | remoteVideo.className = "primary-video"
45 | localVideo.className = "secondary-video"
46 | })
47 | })
48 | })
49 | }
50 |
51 | function startCall(otherUserId) {
52 | navigator.getUserMedia({
53 | audio: true,
54 | video: true
55 | }, (stream) => {
56 | localVideo.srcObject = stream
57 | localStream = stream
58 |
59 | const call = peer.call(otherUserId, stream)
60 | call.on('stream', (remoteStream) => {
61 | remoteVideo.srcObject = remoteStream
62 |
63 | remoteVideo.className = "primary-video"
64 | localVideo.className = "secondary-video"
65 | })
66 | })
67 | }
68 |
69 | function toggleVideo(b) {
70 | if(b == "true") {
71 | localStream.getVideoTracks()[0].enabled = true
72 | } else {
73 | localStream.getVideoTracks()[0].enabled = false
74 | }
75 | }
76 |
77 | function toggleAudio(b) {
78 | if(b == "true") {
79 | localStream.getAudioTracks()[0].enabled = true
80 | } else {
81 | localStream.getAudioTracks()[0].enabled = false
82 | }
83 | }
--------------------------------------------------------------------------------
/src/app/src/main/assets/style.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | padding: 0;
3 | margin: 0;
4 | }
5 |
6 | .primary-video {
7 | position: absolute;
8 | width: 100%;
9 | height: 100%;
10 | object-fit: cover;
11 | }
12 |
13 | .secondary-video {
14 | position: absolute;
15 | max-width: 30%;
16 | height: 30%;
17 | margin: 16px;
18 | border-radius: 16px;
19 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/AddContact.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.annotation.Nullable;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.content.ContentValues;
7 | import android.content.Intent;
8 | import android.database.sqlite.SQLiteDatabase;
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 |
15 | import com.github.dhaval2404.imagepicker.ImagePicker;
16 |
17 | import de.hdodenhof.circleimageview.CircleImageView;
18 |
19 | public class AddContact extends AppCompatActivity {
20 |
21 | CircleImageView dp;
22 | Uri imgURI;
23 |
24 | Button back,uploadImg, post;
25 | EditText name, number;
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_add_contact);
30 |
31 | back = findViewById(R.id.backbtn);
32 | name = findViewById(R.id.Name);
33 | number = findViewById(R.id.Number);
34 | dp = findViewById(R.id.dp);
35 | post = findViewById(R.id.post);
36 |
37 |
38 |
39 | dp.setOnClickListener(new View.OnClickListener() {
40 | @Override
41 | public void onClick(View view) {
42 | ImagePicker.with(AddContact.this)
43 | .galleryOnly()
44 | .crop() //Crop image(Optional), Check Customization for more option
45 | .compress(1024) //Final image size will be less than 1 MB(Optional)
46 | .maxResultSize(1080, 1080) //Final image resolution will be less than 1080 x 1080(Optional)*/
47 | .start();
48 | }
49 | });
50 |
51 | post.setOnClickListener(new View.OnClickListener() {
52 | @Override
53 | public void onClick(View view) {
54 | DBHelper helper = new DBHelper(AddContact.this);
55 | SQLiteDatabase database = helper.getWritableDatabase();
56 | ContentValues cv = new ContentValues();
57 | cv.put(MyContactContract.Contact._NAME, name.getText().toString());
58 | cv.put(MyContactContract.Contact._PHNO, number.getText().toString());
59 | cv.put(MyContactContract.Contact._IMAGE, imgURI.toString());
60 | database.insert(MyContactContract.Contact.TABLENAME, null, cv);
61 | database.close();
62 | helper.close();
63 | finish();
64 | }
65 | });
66 | }
67 |
68 | @Override
69 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
70 | super.onActivityResult(requestCode, resultCode, data);
71 |
72 | imgURI = data.getData();
73 | dp.setImageURI(imgURI);
74 | }
75 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/CallActivity.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.TextView;
8 |
9 | import androidx.appcompat.app.AppCompatActivity;
10 |
11 | import com.google.android.material.floatingactionbutton.FloatingActionButton;
12 |
13 | import de.hdodenhof.circleimageview.CircleImageView;
14 |
15 | public class CallActivity extends AppCompatActivity {
16 | CircleImageView profile;
17 | TextView text;
18 | FloatingActionButton fab;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_call);
24 | Intent data= getIntent();
25 |
26 | String uriString = data.getStringExtra("img");
27 | String name = data.getStringExtra("name");
28 | Uri uri = Uri.parse(uriString);
29 |
30 | profile = findViewById(R.id.profileImage);
31 | text = findViewById(R.id.CallerName);
32 | fab = findViewById(R.id.endCall);
33 |
34 | profile.setImageURI(uri);
35 | text.setText(name);
36 | fab.setOnClickListener(new View.OnClickListener() {
37 | @Override
38 | public void onClick(View view) {
39 | finish();
40 | }
41 | });
42 | }
43 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/CallRVAdapter.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.Filter;
9 | import android.widget.Filterable;
10 | import android.widget.TextView;
11 |
12 | import androidx.annotation.NonNull;
13 | import androidx.recyclerview.widget.RecyclerView;
14 |
15 | import com.google.android.material.floatingactionbutton.FloatingActionButton;
16 | import com.squareup.picasso.Picasso;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | import de.hdodenhof.circleimageview.CircleImageView;
22 |
23 | public class CallRVAdapter extends RecyclerView.Adapter implements Filterable {
24 |
25 | List list;
26 | List filteredList;
27 | Context c;
28 | CallFragment fragment;
29 | public CallRVAdapter(List list, Context c, CallFragment fragment) {
30 | this.c=c;
31 | this.list=list;
32 | this.filteredList = list;
33 | this.fragment = fragment;
34 | }
35 |
36 | @NonNull
37 | @Override
38 | public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
39 | View itemView= LayoutInflater.from(c).inflate(R.layout.fragment_call_items,parent, false);
40 | return new MyViewHolder(itemView);
41 | }
42 |
43 | @Override
44 | public void onBindViewHolder(@NonNull MyViewHolder holder, @SuppressLint("RecyclerView") final int position) {
45 | holder.name.setText(filteredList.get(position).getName());
46 | holder.contactNo.setText(filteredList.get(position).getPhoneNo());
47 | Picasso.get().load(Id.getIp()+filteredList.get(position).getDp()).fit().centerCrop().into(holder.profile);
48 | holder.callbtn.setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View v) {
51 | fragment.callUser(filteredList.get(position));
52 | }
53 | });
54 | }
55 |
56 | @Override
57 | public int getItemCount() {
58 | return filteredList.size();
59 | }
60 |
61 | @Override
62 | public Filter getFilter() {
63 | return new Filter() {
64 | @Override
65 | protected FilterResults performFiltering(CharSequence constraint) {
66 | String Key = constraint.toString();
67 | if(Key.isEmpty()){
68 | filteredList = list;
69 | }
70 | else{
71 | List listFiltered = new ArrayList<>();
72 | for (Profile row: list){
73 | if(row.getName().toLowerCase().contains(Key.toLowerCase())){
74 | listFiltered.add(row);
75 |
76 | }
77 | }
78 | filteredList = listFiltered;
79 | }
80 | FilterResults filterResults = new FilterResults();
81 | filterResults.values = filteredList;
82 | return filterResults;
83 |
84 | }
85 |
86 | @Override
87 | protected void publishResults(CharSequence constraint, FilterResults results) {
88 | filteredList = (List) results.values;
89 | notifyDataSetChanged();
90 | }
91 | };
92 | }
93 |
94 | public static class MyViewHolder extends RecyclerView.ViewHolder {
95 | TextView name, contactNo;
96 | CircleImageView profile;
97 | FloatingActionButton callbtn;
98 | public MyViewHolder(@NonNull View itemView) {
99 | super(itemView);
100 | name=itemView.findViewById(R.id.name);
101 | contactNo= itemView.findViewById(R.id.contactNo);
102 | profile=itemView.findViewById(R.id.profile);
103 | callbtn = itemView.findViewById(R.id.callbtn);
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/CameraActivity.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.annotation.Nullable;
4 | import androidx.appcompat.app.AppCompatActivity;
5 | import androidx.recyclerview.widget.LinearLayoutManager;
6 | import androidx.recyclerview.widget.RecyclerView;
7 |
8 | import android.annotation.SuppressLint;
9 | import android.content.Context;
10 | import android.content.Intent;
11 | import android.content.SharedPreferences;
12 | import android.database.sqlite.SQLiteDatabase;
13 | import android.net.Uri;
14 | import android.os.Bundle;
15 | import android.widget.ImageView;
16 |
17 | import com.github.dhaval2404.imagepicker.ImagePicker;
18 |
19 | import java.io.File;
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | public class CameraActivity extends AppCompatActivity {
24 | RecyclerView rv;
25 | ContactRVAdapter rvAdapter;
26 | List list = new ArrayList<>();
27 | ImageView imageView;
28 | Uri imgURI;
29 |
30 |
31 | private final int ADD_CONTACT = 0;
32 | DBHelper helper;
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_camera);
38 | imageView = findViewById(R.id.takenImage);
39 |
40 | SharedPreferences pref = getSharedPreferences("UserData", Context.MODE_PRIVATE);
41 |
42 |
43 |
44 |
45 | rv = findViewById(R.id.list);
46 | rv.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
47 | rvAdapter = new ContactRVAdapter(list, this);
48 | rv.setAdapter(rvAdapter);
49 |
50 | ImagePicker.with(CameraActivity.this)
51 | .cameraOnly()
52 | .crop() //Crop image(Optional), Check Customization for more option
53 | .compress(1024) //Final image size will be less than 1 MB(Optional)
54 | .maxResultSize(1080, 1080) //Final image resolution will be less than 1080 x 1080(Optional)*/
55 | .saveDir(new File(getFilesDir(), "ImagePicker"))
56 | .start();
57 | }
58 |
59 |
60 | @SuppressLint("Range")
61 | void getData() {
62 | helper = new DBHelper(this);
63 | SQLiteDatabase database = helper.getReadableDatabase();
64 | String[] projection = new String[] {
65 | MyContactContract.Contact._NAME,
66 | MyContactContract.Contact._PHNO,
67 | MyContactContract.Contact._IMAGE
68 | };
69 | String sort = MyContactContract.Contact._NAME + " ASC";
70 |
71 | rvAdapter = new ContactRVAdapter(list, this);
72 |
73 | }
74 |
75 |
76 | @Override
77 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
78 | super.onActivityResult(requestCode, resultCode, data);
79 | list.clear();
80 | getData();
81 | imgURI = data.getData();
82 | imageView.setImageURI(imgURI);
83 | }
84 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/CameraFragment.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 |
7 | import androidx.fragment.app.Fragment;
8 |
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 |
15 |
16 | /**
17 | * A simple {@link Fragment} subclass.
18 | * Use the {@link CameraFragment#newInstance} factory method to
19 | * create an instance of this fragment.
20 | */
21 | public class CameraFragment extends Fragment {
22 |
23 | // TODO: Rename parameter arguments, choose names that match
24 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
25 | private static final String ARG_PARAM1 = "param1";
26 | private static final String ARG_PARAM2 = "param2";
27 | ImageView imageView;
28 | Uri imgURI;
29 |
30 | // TODO: Rename and change types of parameters
31 | private String mParam1;
32 | private String mParam2;
33 |
34 | public CameraFragment() {
35 | // Required empty public constructor
36 | }
37 |
38 | /**
39 | * Use this factory method to create a new instance of
40 | * this fragment using the provided parameters.
41 | *
42 | * @param param1 Parameter 1.
43 | * @param param2 Parameter 2.
44 | * @return A new instance of fragment CameraFragment.
45 | */
46 | // TODO: Rename and change types and number of parameters
47 | public static CameraFragment newInstance(String param1, String param2) {
48 | CameraFragment fragment = new CameraFragment();
49 | Bundle args = new Bundle();
50 | args.putString(ARG_PARAM1, param1);
51 | args.putString(ARG_PARAM2, param2);
52 | fragment.setArguments(args);
53 | return fragment;
54 | }
55 |
56 | @Override
57 | public void onCreate(Bundle savedInstanceState) {
58 | super.onCreate(savedInstanceState);
59 | if (getArguments() != null) {
60 | mParam1 = getArguments().getString(ARG_PARAM1);
61 | mParam2 = getArguments().getString(ARG_PARAM2);
62 | }
63 | }
64 |
65 | @Override
66 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
67 | Bundle savedInstanceState) {
68 |
69 |
70 | // Inflate the layout for this fragment
71 | View view = inflater.inflate(R.layout.fragment_camera, container, false);
72 |
73 | Button b = view.findViewById(R.id.takeImage);
74 | b.setVisibility(View.VISIBLE);
75 |
76 | b.setOnClickListener(new View.OnClickListener() {
77 | @Override
78 | public void onClick(View view) {
79 | startCameraActivity();
80 | b.setVisibility(View.INVISIBLE);
81 | }
82 | });
83 |
84 |
85 | return view;
86 | }
87 |
88 | protected void startCameraActivity(){
89 | startActivity(new Intent(getActivity(), CameraActivity.class));
90 | }
91 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/ChatFragment.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.Manifest;
4 | import android.annotation.SuppressLint;
5 | import android.content.ContentResolver;
6 | import android.content.Context;
7 | import android.content.pm.PackageManager;
8 | import android.database.Cursor;
9 | import android.os.Bundle;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.core.content.ContextCompat;
13 | import androidx.fragment.app.Fragment;
14 | import androidx.recyclerview.widget.LinearLayoutManager;
15 | import androidx.recyclerview.widget.RecyclerView;
16 |
17 | import android.provider.ContactsContract;
18 | import android.util.Log;
19 | import android.view.LayoutInflater;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 | import android.widget.Button;
23 | import android.widget.EditText;
24 | import android.widget.TextView;
25 | import android.widget.Toast;
26 |
27 |
28 | import com.android.volley.Request;
29 | import com.android.volley.RequestQueue;
30 | import com.android.volley.Response;
31 | import com.android.volley.VolleyError;
32 | import com.android.volley.toolbox.StringRequest;
33 | import com.android.volley.toolbox.Volley;
34 |
35 | import org.json.JSONArray;
36 | import org.json.JSONException;
37 | import org.json.JSONObject;
38 |
39 | import java.util.ArrayList;
40 | import java.util.List;
41 |
42 | import de.hdodenhof.circleimageview.CircleImageView;
43 |
44 |
45 |
46 |
47 | public class ChatFragment extends Fragment {
48 |
49 | private static final String ARG_COLUMN_COUNT = "column-count";
50 | RecyclerView rv;
51 | Button nContact;
52 | List contactList;
53 | List mutualContacts;
54 | ArrayList arrayList;
55 | ContactRVAdapter adapter;
56 | private final int ADD_CONTACT = 0;
57 | EditText searchView;
58 | CharSequence search ="";
59 | CircleImageView profileImage;
60 | String senderId;
61 | Context context;
62 | TextView name;
63 |
64 | public ChatFragment() {
65 | }
66 |
67 | // TODO: Customize parameter initialization
68 | @SuppressWarnings("unused")
69 | public static ChatFragment newInstance(int columnCount) {
70 | ChatFragment fragment = new ChatFragment();
71 | Bundle args = new Bundle();
72 | args.putInt(ARG_COLUMN_COUNT, columnCount);
73 | fragment.setArguments(args);
74 | return fragment;
75 | }
76 |
77 | @Override
78 | public void onCreate(Bundle savedInstanceState) {
79 | super.onCreate(savedInstanceState);
80 |
81 | }
82 |
83 | @Override
84 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
85 | Bundle savedInstanceState) {
86 |
87 | View view = inflater.inflate(R.layout.fragment_chat_list, container, false);
88 | rv = view.findViewById(R.id.list);
89 | arrayList=new ArrayList<>();
90 | contactList=new ArrayList<>();
91 | mutualContacts=new ArrayList<>();
92 | name = view.findViewById(R.id.name);
93 |
94 | // Set the adapter
95 | if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
96 | // requesting to the user for permission.
97 | requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, 100);
98 |
99 | } else {
100 | //if app already has permission this block will execute.
101 | readContacts();
102 | }
103 |
104 |
105 | getAllUsers();
106 |
107 | RecyclerView.LayoutManager lm= new LinearLayoutManager(getContext());
108 | rv.setLayoutManager(lm);
109 | adapter=new ContactRVAdapter(mutualContacts, getContext());
110 | rv.setAdapter(adapter);
111 | return view;
112 | }
113 |
114 | @Override
115 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
116 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
117 | readContacts();
118 | }
119 |
120 | @SuppressLint("Range")
121 | private void readContacts() {
122 | ContentResolver contentResolver=getContext().getContentResolver();
123 | Cursor phones=contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,null,null,null);
124 | String number;
125 | while (phones.moveToNext())
126 | {
127 | number = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)).replace("+92","0");
128 | arrayList.add(number);
129 | // Log.d("Hello",phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
130 | }
131 |
132 | phones.close();
133 | }
134 |
135 |
136 | public void getAllUsers(){
137 | ArrayList temp=new ArrayList<>();
138 | String url=Id.getIp()+"get.php";
139 | StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new Response.Listener() {
140 | @Override
141 | public void onResponse(String response) {
142 | try {
143 | JSONArray arr = new JSONArray(response);
144 | for(int i=0;i contactList;
55 | List mutualContacts;
56 | ArrayList arrayList;
57 | ContactRVAdapter adapter;
58 | private final int ADD_CONTACT = 0;
59 | EditText searchView;
60 | CharSequence search ="";
61 | CircleImageView profileImage;
62 | String senderId;
63 | Context context;
64 | TextView name;
65 | /**
66 | * Mandatory empty constructor for the fragment manager to instantiate the
67 | * fragment (e.g. upon screen orientation changes).
68 | */
69 | public ContactFragment() {
70 | }
71 |
72 | // TODO: Customize parameter initialization
73 | @SuppressWarnings("unused")
74 | public static ContactFragment newInstance(int columnCount) {
75 | ContactFragment fragment = new ContactFragment();
76 | Bundle args = new Bundle();
77 | args.putInt(ARG_COLUMN_COUNT, columnCount);
78 | fragment.setArguments(args);
79 | return fragment;
80 | }
81 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
82 | @Override
83 | public void onCreate(Bundle savedInstanceState) {
84 | super.onCreate(savedInstanceState);
85 | }
86 |
87 | @Override
88 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
89 | Bundle savedInstanceState) {
90 | View view = inflater.inflate(R.layout.fragment_contact, container, false);
91 | nContact = view.findViewById(R.id.newContact);
92 | nContact.setOnClickListener(new View.OnClickListener() {
93 | @Override
94 | public void onClick(View view) {
95 | startActivityForResult(new Intent(getActivity(), AddContact.class), ADD_CONTACT);
96 | }
97 | });
98 |
99 |
100 |
101 |
102 | rv = view.findViewById(R.id.list);
103 | arrayList=new ArrayList<>();
104 | contactList=new ArrayList<>();
105 | mutualContacts=new ArrayList<>();
106 | profileImage = view.findViewById(R.id.profilePicc);
107 | Picasso.get().load(Id.getIp()+Id.getDp()).fit().centerCrop().into(profileImage);
108 | name = view.findViewById(R.id.name);
109 | name.setText(Id.getName());
110 |
111 | if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
112 | // requesting to the user for permission.
113 | requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, 100);
114 |
115 | } else {
116 | //if app already has permission this block will execute.
117 | readContacts();
118 | }
119 |
120 | getAllUsers();
121 |
122 | RecyclerView.LayoutManager lm= new LinearLayoutManager(getContext());
123 | rv.setLayoutManager(lm);
124 | adapter=new ContactRVAdapter(mutualContacts, getContext());
125 | rv.setAdapter(adapter);
126 |
127 | return view;
128 | }
129 |
130 | public void getAllUsers(){
131 | ArrayList temp=new ArrayList<>();
132 | String url=Id.getIp()+"get.php";
133 | StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new Response.Listener() {
134 | @Override
135 | public void onResponse(String response) {
136 | try {
137 | JSONArray arr = new JSONArray(response);
138 | for(int i=0;i implements Filterable {
25 |
26 | List list;
27 | List filteredList;
28 | Context c;
29 | public ContactRVAdapter(List list, Context c) {
30 | this.c=c;
31 | this.list=list;
32 | this.filteredList = list;
33 | }
34 |
35 | @NonNull
36 | @Override
37 | public ContactRVAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
38 | View itemView= LayoutInflater.from(c).inflate(R.layout.contact_item,parent, false);
39 | return new MyViewHolder(itemView);
40 | }
41 |
42 | @Override
43 | public void onBindViewHolder(@NonNull ContactRVAdapter.MyViewHolder holder, @SuppressLint("RecyclerView") final int position) {
44 | holder.name.setText(filteredList.get(position).getName());
45 | holder.contactNo.setText(filteredList.get(position).getPhoneNo());
46 | Picasso.get().load(Id.getIp()+filteredList.get(position).getDp()).fit().centerCrop().into(holder.profile);
47 |
48 | holder.name.setOnClickListener(new View.OnClickListener() {
49 | @Override
50 | public void onClick(View view) {
51 |
52 | Intent intent = new Intent(c, ChatActivity.class);
53 | intent.putExtra("profileName",filteredList.get(position).getName());
54 | intent.putExtra("id",filteredList.get(position).getId());
55 | intent.putExtra("image",filteredList.get(position).getDp());
56 |
57 | c.startActivity(intent);
58 | }
59 |
60 | });
61 |
62 | }
63 |
64 | @Override
65 | public int getItemCount() {
66 | return filteredList.size();
67 | }
68 |
69 | @Override
70 | public Filter getFilter() {
71 | return new Filter() {
72 | @Override
73 | protected FilterResults performFiltering(CharSequence constraint) {
74 | String Key = constraint.toString();
75 | if(Key.isEmpty()){
76 | filteredList = list;
77 | }
78 | else{
79 | List listFiltered = new ArrayList<>();
80 | for (Profile row: list){
81 | if(row.getName().toLowerCase().contains(Key.toLowerCase())){
82 | listFiltered.add(row);
83 |
84 | }
85 | }
86 | filteredList = listFiltered;
87 | }
88 | FilterResults filterResults = new FilterResults();
89 | filterResults.values = filteredList;
90 | return filterResults;
91 |
92 | }
93 |
94 | @Override
95 | protected void publishResults(CharSequence constraint, FilterResults results) {
96 | filteredList = (List) results.values;
97 | notifyDataSetChanged();
98 | }
99 | };
100 | }
101 |
102 | public static class MyViewHolder extends RecyclerView.ViewHolder {
103 | TextView name, contactNo;
104 | CircleImageView profile;
105 | public MyViewHolder(@NonNull View itemView) {
106 | super(itemView);
107 | name=itemView.findViewById(R.id.name);
108 | contactNo= itemView.findViewById(R.id.ContactNo);
109 | profile=itemView.findViewById(R.id.profile);
110 | }
111 | }
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/CreateProfile.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.annotation.Nullable;
4 | import androidx.annotation.RequiresApi;
5 | import androidx.appcompat.app.AppCompatActivity;
6 | import androidx.core.content.ContextCompat;
7 |
8 | import android.annotation.SuppressLint;
9 | import android.content.Intent;
10 | import android.graphics.Bitmap;
11 | import android.graphics.BitmapFactory;
12 | import android.net.Uri;
13 | import android.os.Build;
14 | import android.os.Bundle;
15 | import android.util.Base64;
16 | import android.view.View;
17 | import android.widget.Button;
18 | import android.widget.EditText;
19 | import android.widget.Toast;
20 |
21 | import com.android.volley.AuthFailureError;
22 | import com.android.volley.Request;
23 | import com.android.volley.RequestQueue;
24 | import com.android.volley.Response;
25 | import com.android.volley.VolleyError;
26 | import com.android.volley.toolbox.StringRequest;
27 | import com.android.volley.toolbox.Volley;
28 | import com.github.dhaval2404.imagepicker.ImagePicker;
29 |
30 | import org.json.JSONException;
31 | import org.json.JSONObject;
32 |
33 | import java.io.ByteArrayOutputStream;
34 | import java.io.FileNotFoundException;
35 | import java.io.InputStream;
36 | import java.util.HashMap;
37 | import java.util.Map;
38 |
39 | import de.hdodenhof.circleimageview.CircleImageView;
40 |
41 | public class CreateProfile extends AppCompatActivity {
42 |
43 | CircleImageView dp;
44 | Uri imgURI;
45 | Bitmap bitmap;
46 | Button back, post;
47 | EditText firstName, lastName, gender, phoneNo, aboutMe;
48 | String encodedImage;
49 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
50 | @SuppressLint("ResourceAsColor")
51 | @Override
52 | protected void onCreate(Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 | setContentView(R.layout.activity_create_profile);
55 | getWindow().setStatusBarColor(ContextCompat.getColor(CreateProfile.this, R.color.white));
56 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
57 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
58 | }
59 | Intent data = getIntent();
60 | String id = data.getStringExtra("id");
61 | String email = data.getStringExtra("email");
62 |
63 | back = findViewById(R.id.backbtn);
64 | firstName = findViewById(R.id.FirstName);
65 | lastName = findViewById(R.id.LastName);
66 | gender = findViewById(R.id.Gender);
67 | dp = findViewById(R.id.dp);
68 | post = findViewById(R.id.post);
69 | phoneNo = findViewById(R.id.phoneNo);
70 | aboutMe = findViewById(R.id.AboutMe);
71 |
72 | back.setOnClickListener(view -> login());
73 |
74 | dp.setOnClickListener(new View.OnClickListener() {
75 | @Override
76 | public void onClick(View view) {
77 | ImagePicker.with(CreateProfile.this)
78 | .galleryOnly()
79 | .crop() //Crop image(Optional), Check Customization for more option
80 | .compress(1024) //Final image size will be less than 1 MB(Optional)
81 | .maxResultSize(1080, 1080) //Final image resolution will be less than 1080 x 1080(Optional)*/
82 | //.saveDir(new File(getFilesDir(), "ImagePicker"))
83 | .start();
84 | }
85 | });
86 |
87 | post.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View view) {
90 | String name = firstName.getText().toString() + " " + lastName.getText().toString();
91 | String email = getIntent().getStringExtra("email").toString();
92 | String password = getIntent().getStringExtra("password").toString();
93 | String Gender = gender.getText().toString();
94 | String phoneno = phoneNo.getText().toString();
95 | String bio = aboutMe.getText().toString();
96 | String url = Id.getIp()+"insert.php";
97 | RequestQueue requestQueue = Volley.newRequestQueue(CreateProfile.this);
98 | StringRequest request = new StringRequest(Request.Method.POST, url,
99 | new Response.Listener() {
100 | @Override
101 | public void onResponse(String response) {
102 | try {
103 | JSONObject x=new JSONObject(response);
104 | Id.setId(x.getString("id"));
105 | Id.setPath(x.getString("dp"));
106 | Toast.makeText(CreateProfile.this,"Data Inserted", Toast.LENGTH_SHORT).show();
107 | Intent intent=new Intent(CreateProfile.this,Dashboard.class);
108 | startActivity(intent);
109 | finish();
110 | } catch (JSONException e) {
111 | e.printStackTrace();
112 | }
113 | }
114 | }, new Response.ErrorListener() {
115 | @Override
116 | public void onErrorResponse(VolleyError error) {
117 | Toast.makeText(CreateProfile.this,"Data not Inserted", Toast.LENGTH_SHORT).show();
118 | }
119 | }
120 | ) {
121 | @Nullable
122 | @Override
123 | protected Map getParams() throws AuthFailureError {
124 | Map params = new HashMap();
125 | params.put("name",name);
126 | params.put("email",email);
127 | params.put("password",password);
128 | params.put("gender",Gender);
129 | params.put("phoneno", phoneno);
130 | params.put("bio",bio);
131 | params.put("dp",encodedImage);
132 |
133 | return params;
134 | }
135 | };
136 | requestQueue.add(request);
137 | }
138 | });
139 | }
140 |
141 | protected void login() {
142 | startActivity(new Intent(CreateProfile.this, Login.class));
143 | }
144 |
145 | @Override
146 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
147 | super.onActivityResult(requestCode, resultCode, data);
148 | imgURI = data.getData();
149 | dp.setImageURI(imgURI);
150 |
151 | try {
152 | InputStream inputStream = getContentResolver().openInputStream(imgURI);
153 | bitmap = BitmapFactory.decodeStream(inputStream);
154 |
155 |
156 | imageStore(bitmap);
157 |
158 |
159 | } catch (FileNotFoundException e) {
160 | e.printStackTrace();
161 | }
162 | }
163 |
164 | private void imageStore(Bitmap bitmap) {
165 |
166 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
167 | bitmap.compress(Bitmap.CompressFormat.JPEG,80,stream);
168 |
169 | byte[] imageBytes = stream.toByteArray();
170 |
171 | encodedImage = android.util.Base64.encodeToString(imageBytes, Base64.DEFAULT);
172 |
173 | }
174 |
175 | }
176 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/DBHelper.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | import androidx.annotation.Nullable;
8 |
9 | public class DBHelper extends SQLiteOpenHelper {
10 |
11 | String CREATE_CONTACTS_TABLE="CREATE TABLE " + MyContactContract.Contact.TABLENAME + "("+MyContactContract.Contact._ID+" INTEGER PRIMARY KEY AUTOINCREMENT,"+
12 | MyContactContract.Contact._NAME+" TEXT NOT NULL,"+
13 | MyContactContract.Contact._PHNO+" TEXT,"+
14 | MyContactContract.Contact._IMAGE+ " TEXT);";
15 |
16 | String CREATE_CHAT_TABLE="CREATE TABLE " + MyContactContract.Chat.TABLENAME + "("+MyContactContract.Chat._ID+" INTEGER PRIMARY KEY AUTOINCREMENT,"+MyContactContract.Chat._RECV_PHNO+" TEXT NOT NULL,"+
17 | MyContactContract.Chat._Receiver+" TEXT NOT NULL,"+
18 | MyContactContract.Chat._MESSAGE+ " TEXT);";
19 |
20 | String DELETE_CONTACTS_TABLE = "DROP TABLE IF EXISTS " + MyContactContract.Contact.TABLENAME;
21 | String DELETE_CHAT_TABLE = "DROP TABLE IF EXISTS " + MyContactContract.Chat.TABLENAME;
22 |
23 | public DBHelper(@Nullable Context context) {
24 | super(context, MyContactContract.DB_NAME, null, MyContactContract.DB_VERSION);
25 | }
26 |
27 | @Override
28 | public void onCreate(SQLiteDatabase sqLiteDatabase) {
29 | sqLiteDatabase.execSQL(CREATE_CONTACTS_TABLE);
30 | sqLiteDatabase.execSQL(CREATE_CHAT_TABLE);
31 | }
32 |
33 | @Override
34 | public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
35 | sqLiteDatabase.execSQL(DELETE_CONTACTS_TABLE);
36 | sqLiteDatabase.execSQL(DELETE_CHAT_TABLE);
37 | onCreate(sqLiteDatabase);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Dashboard.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.appcompat.app.AppCompatActivity;
6 | import androidx.viewpager.widget.ViewPager;
7 |
8 | import com.google.android.material.tabs.TabLayout;
9 | import com.hamzaamin.i180550_i170298.databinding.ActivityDashboardBinding;
10 | import com.hamzaamin.i180550_i170298.main.SectionsPagerAdapter;
11 |
12 | public class Dashboard extends AppCompatActivity {
13 |
14 | private ActivityDashboardBinding binding;
15 |
16 | TabLayout tabLayout;
17 |
18 | private int[] tabIcons = {
19 | R.drawable.ic_twotone_phone_24,
20 | R.drawable.ic_twotone_photo_camera,
21 | R.drawable.ic_twotone_chat_bubble,
22 | R.drawable.ic_twotone_people
23 | };
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 |
29 | binding = ActivityDashboardBinding.inflate(getLayoutInflater());
30 | setContentView(binding.getRoot());
31 |
32 | SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
33 |
34 |
35 | ViewPager viewPager = binding.viewPager;
36 | viewPager.setAdapter(sectionsPagerAdapter);
37 |
38 |
39 | tabLayout = binding.tabs;
40 | tabLayout.setupWithViewPager(viewPager);
41 | setupTabIcons();
42 | }
43 |
44 | private void setupTabIcons() {
45 | tabLayout.getTabAt(0).setIcon(tabIcons[0]);
46 | tabLayout.getTabAt(1).setIcon(tabIcons[1]);
47 | tabLayout.getTabAt(2).setIcon(tabIcons[2]);
48 | tabLayout.getTabAt(3).setIcon(tabIcons[3]);
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Id.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.app.Application;
4 |
5 | public class Id extends Application {
6 | private static String id;
7 | private static String path;
8 | private static String ip;
9 | private static String name;
10 | private static String dp;
11 |
12 | public static String getName() {
13 | return name;
14 | }
15 |
16 | public static void setName(String name) {
17 | Id.name = name;
18 | }
19 |
20 | public static String getDp() {
21 | return dp;
22 | }
23 |
24 | public static void setDp(String dp) {
25 | Id.dp = dp;
26 | }
27 |
28 | public static String getId() {
29 | return id;
30 | }
31 |
32 | public static String getIp() {
33 | return ip;
34 | }
35 |
36 | public static void setIp(String ip) {
37 | Id.ip = ip;
38 | }
39 |
40 | public static void setId(String id) {
41 | Id.id = id;
42 | }
43 |
44 | public static String getPath() {
45 | return path;
46 | }
47 |
48 | public static void setPath(String path) {
49 | Id.path = path;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Login.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.Intent;
6 | import android.content.SharedPreferences;
7 | import android.os.Bundle;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import android.widget.TextView;
13 | import android.widget.Toast;
14 |
15 | import com.android.volley.Request;
16 | import com.android.volley.RequestQueue;
17 | import com.android.volley.Response;
18 | import com.android.volley.VolleyError;
19 | import com.android.volley.toolbox.StringRequest;
20 | import com.android.volley.toolbox.Volley;
21 | import com.jaeger.library.StatusBarUtil;
22 |
23 | import org.json.JSONArray;
24 | import org.json.JSONException;
25 |
26 | public class Login extends AppCompatActivity {
27 | TextView register;
28 | EditText email, password;
29 | Button login;
30 | String id;
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_login_screen);
35 | StatusBarUtil.setTranslucent(Login.this, 75);
36 | register = findViewById(R.id.Register);
37 | email = findViewById(R.id.EmailAddress);
38 | password = findViewById(R.id.Password);
39 | register.setOnClickListener(view -> register());
40 | login = findViewById(R.id.Login);
41 | Id.setIp("http://192.168.18.81/PHP_Files/");
42 |
43 | login.setOnClickListener(new View.OnClickListener() {
44 | @Override
45 | public void onClick(View view) {
46 | final String email1=email.getText().toString().trim();
47 | final String password1=password.getText().toString().trim();
48 | if(email1.isEmpty()){
49 | email.setError("Provide email id");
50 | email.requestFocus();
51 | }
52 |
53 | else if(password1.isEmpty()){
54 | password.setError("Provide password");
55 | password.requestFocus();
56 | }
57 |
58 | else if(!email1.isEmpty() && !password1.isEmpty()){
59 | String url=Id.getIp()+"login.php?email="+email.getText().toString()+"&password="+password.getText().toString();
60 | StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new Response.Listener() {
61 | @Override
62 | public void onResponse(String response) {
63 | try {
64 | JSONArray arr = new JSONArray(response);
65 | Log.d("length",Integer.toString(arr.length()));
66 | if(arr.length()>0){
67 | id = arr.getJSONObject(0).getString("id");
68 | String dp = arr.getJSONObject(0).getString("dp");
69 | Id.setDp(dp);
70 | Id.setName(arr.getJSONObject(0).getString("name"));
71 | Intent toHome=new Intent(Login.this,Dashboard.class);
72 | toHome.putExtra("id",id);
73 | SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
74 | SharedPreferences.Editor editor = pref.edit();
75 | editor.putString("id",id);
76 | editor.apply(); // commit changes
77 |
78 | Id.setId(arr.getJSONObject(0).getString("id"));
79 | Id.setPath(arr.getJSONObject(0).getString("dp"));
80 |
81 | startActivity(toHome);
82 | finish();
83 | }
84 | else{
85 | Toast.makeText(Login.this,"Error in Login",Toast.LENGTH_LONG).show();
86 | }
87 |
88 | } catch (JSONException e) {
89 | e.printStackTrace();
90 | }
91 | }
92 | }, new Response.ErrorListener() {
93 | @Override
94 | public void onErrorResponse(VolleyError error) {
95 | Toast.makeText(Login.this,"Error in volley",Toast.LENGTH_LONG).show();
96 | }
97 | });
98 | RequestQueue queue= Volley.newRequestQueue(Login.this);
99 | queue.add(stringRequest);
100 | }
101 | else{
102 | Toast.makeText(Login.this,"Error occurred",Toast.LENGTH_SHORT).show();
103 | }
104 | }
105 | });
106 |
107 | }
108 | protected void register(){
109 | startActivity(new Intent(Login.this, Register.class));
110 | }
111 | @Override
112 | protected void onStart(){
113 | super.onStart();
114 | }
115 |
116 | protected String getId() {
117 | return id;
118 | }
119 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Message.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 |
4 | public class Message {
5 | String senderId;
6 | String receiverId;
7 | String text;
8 | Long timestamp;
9 | String imgSrc;
10 |
11 | public Message(String senderId, String receiverId, String text,String imgSrc) {
12 | this.senderId = senderId;
13 | this.receiverId = receiverId;
14 | this.text = text;
15 | this.timestamp=System.currentTimeMillis()/1000;
16 | this.imgSrc=imgSrc;
17 | }
18 |
19 | public Message(String senderId, String receiverId, String text, String timestamp ,String imgSrc) {
20 | this.senderId = senderId;
21 | this.receiverId = receiverId;
22 | this.text = text;
23 | System.out.println("HEYYYYYYYYYYYYYYYYYYYYYYYYYY"+timestamp);
24 | this.timestamp= Long.parseLong(timestamp, 10);
25 | this.imgSrc=imgSrc;
26 | }
27 |
28 | public Message(){
29 |
30 | }
31 |
32 | public String getImgSrc() {
33 | return imgSrc;
34 | }
35 |
36 | public void setImgSrc(String imgSrc) {
37 | this.imgSrc = imgSrc;
38 | }
39 |
40 |
41 | public Long getTimestamp() {
42 | return timestamp;
43 | }
44 |
45 | public void setTimestamp(Long timestamp) {
46 | this.timestamp = timestamp;
47 | }
48 |
49 | public String getSenderId() {
50 | return senderId;
51 | }
52 |
53 | public void setSenderId(String senderId) {
54 | this.senderId = senderId;
55 | }
56 |
57 | public String getReceiverId() {
58 | return receiverId;
59 | }
60 |
61 | public void setReceiverId(String receiverId) {
62 | this.receiverId = receiverId;
63 | }
64 |
65 | public String getText() {
66 | return text;
67 | }
68 |
69 | public void setText(String text) {
70 | this.text = text;
71 | }
72 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/MyApp.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.app.Application;
4 |
5 | import com.onesignal.OneSignal;
6 |
7 | public class MyApp extends Application {
8 | private static final String ONESIGNAL_APP_ID = "a639dd08-3cbf-4992-8ce2-1c28ccdb8695";
9 |
10 | @Override
11 | public void onCreate() {
12 | super.onCreate();
13 |
14 | // Enable verbose OneSignal logging to debug issues if needed.
15 | OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
16 |
17 | // OneSignal Initialization
18 | OneSignal.initWithContext(this);
19 | OneSignal.setAppId(ONESIGNAL_APP_ID);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/MyContactContract.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.provider.BaseColumns;
4 |
5 | public class MyContactContract {
6 | public static String DB_NAME = "myContacts.db";
7 | public static int DB_VERSION = 5;
8 |
9 | public static class Contact implements BaseColumns {
10 | public static String TABLENAME = "contactsTable";
11 | public static String _NAME = "name";
12 | public static String _PHNO = "phoneNo";
13 | public static String _IMAGE = "image";
14 | }
15 |
16 | public static class Chat implements BaseColumns {
17 | public static String TABLENAME = "chatTable";
18 | public static String _RECV_PHNO = "recv_phno";
19 | public static String _Receiver = "receiver";
20 | public static String _MESSAGE = "message";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Profile.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | public class Profile {
4 | String id;
5 | String email;
6 | String name;
7 | String gender;
8 | String bio;
9 | String phoneNo;
10 | String dp;
11 | //Boolean isOnline;
12 |
13 | public Profile(String id, String email, String name, String gender, String phoneNo, String bio, String dp) {
14 | this.id = id;
15 | this.email = email;
16 | this.name = name;
17 | this.gender = gender;
18 | this.phoneNo = phoneNo;
19 | this.bio = bio;
20 | this.dp=dp;
21 | }
22 | public Profile(){
23 |
24 | }
25 |
26 | public String getDp() {
27 | return dp;
28 | }
29 |
30 | public void setDp(String dp) {
31 | this.dp = dp;
32 | }
33 |
34 | public String getId() {
35 | return id;
36 | }
37 |
38 | public void setId(String id) {
39 | this.id = id;
40 | }
41 |
42 | public String getEmail() {
43 | return email;
44 | }
45 |
46 | public void setEmail(String email) {
47 | this.email = email;
48 | }
49 |
50 | public String getName() {
51 | return name;
52 | }
53 |
54 | public void setName(String name) {
55 | this.name = name;
56 | }
57 |
58 | public String getGender() {
59 | return gender;
60 | }
61 |
62 | public void setGender(String gender) {
63 | this.gender = gender;
64 | }
65 |
66 | public String getBio() {
67 | return bio;
68 | }
69 |
70 | public void setBio(String bio) {
71 | this.bio = bio;
72 | }
73 |
74 | public String getPhoneNo() {
75 | return phoneNo;
76 | }
77 |
78 | public void setPhoneNo(String phoneNo) {
79 | this.phoneNo = phoneNo;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Register.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.widget.EditText;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import com.android.volley.Request;
13 | import com.android.volley.RequestQueue;
14 | import com.android.volley.Response;
15 | import com.android.volley.VolleyError;
16 | import com.android.volley.toolbox.StringRequest;
17 | import com.android.volley.toolbox.Volley;
18 |
19 | import org.json.JSONArray;
20 | import org.json.JSONException;
21 |
22 | public class Register extends AppCompatActivity {
23 | EditText email, pass, confirmPass;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_register);
29 |
30 | email = findViewById(R.id.EmailAddress);
31 | pass = findViewById(R.id.Password);
32 | confirmPass = findViewById(R.id.ConfirmPassword);
33 | Id.setIp("http://192.168.18.81/PHP_Files/");
34 | TextView login = findViewById(R.id.Login);
35 | login.setOnClickListener(view -> login());
36 |
37 | TextView register = findViewById(R.id.Signup);
38 | register.setOnClickListener(view -> register());
39 | }
40 |
41 |
42 | protected void register(){
43 | createProfile(email.getText().toString(),pass.getText().toString());
44 | }
45 |
46 |
47 | protected void login(){
48 | Intent signIn=new Intent(Register.this, Login.class);
49 | startActivity(signIn);
50 | finish();
51 | }
52 |
53 | protected void createProfile(String email, String password) {
54 | String url=Id.getIp()+"getProfileByEmail.php?email="+email;
55 | StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new Response.Listener() {
56 | @Override
57 | public void onResponse(String response) {
58 | try {
59 | JSONArray arr = new JSONArray(response);
60 | Log.d("length",Integer.toString(arr.length()));
61 | if(arr.length()>0){
62 | Toast.makeText(Register.this,"A user with same email exists,change email", Toast.LENGTH_SHORT).show();
63 | }
64 | else{
65 | Intent intent = new Intent(Register.this, CreateProfile.class);
66 | intent.putExtra("email",email);
67 | intent.putExtra("password",password);
68 | startActivity(intent);
69 | }
70 |
71 | } catch (JSONException e) {
72 | e.printStackTrace();
73 | }
74 | }
75 | }, new Response.ErrorListener() {
76 | @Override
77 | public void onErrorResponse(VolleyError error) {
78 | Toast.makeText(Register.this,"Error in volley",Toast.LENGTH_LONG).show();
79 | }
80 | });
81 |
82 | RequestQueue queue= Volley.newRequestQueue(Register.this);
83 | queue.add(stringRequest);
84 | }
85 |
86 | @Override
87 | public void onStart() {
88 | super.onStart();
89 | }
90 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/ScreenShotContentObserver.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import android.content.Context;
4 | import android.database.ContentObserver;
5 | import android.database.Cursor;
6 | import android.net.Uri;
7 | import android.os.Handler;
8 | import android.provider.MediaStore;
9 |
10 | import java.io.File;
11 | import java.io.FileNotFoundException;
12 |
13 | public abstract class ScreenShotContentObserver extends ContentObserver {
14 |
15 | private Context context;
16 | private boolean isFromEdit = false;
17 | private String previousPath;
18 |
19 | public ScreenShotContentObserver(Handler handler, Context context) {
20 | super(handler);
21 | this.context = context;
22 | }
23 |
24 | @Override
25 | public boolean deliverSelfNotifications() {
26 | return super.deliverSelfNotifications();
27 | }
28 |
29 | @Override
30 | public void onChange(boolean selfChange) {
31 | super.onChange(selfChange);
32 | }
33 |
34 | @Override
35 | public void onChange(boolean selfChange, Uri uri) {
36 | try (Cursor cursor = context.getContentResolver().query(uri, new String[]{
37 | MediaStore.Images.Media.DISPLAY_NAME,
38 | MediaStore.Images.Media.DATA
39 | }, null, null, null)) {
40 | if (cursor != null && cursor.moveToLast()) {
41 | int displayNameColumnIndex = cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME);
42 | int dataColumnIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
43 | String fileName = cursor.getString(displayNameColumnIndex);
44 | String path = cursor.getString(dataColumnIndex);
45 | if (new File(path).lastModified() >= System.currentTimeMillis() - 10000) {
46 | if (isScreenshot(path) && !isFromEdit && !(previousPath != null && previousPath.equals(path))) {
47 | onScreenShot(path, fileName);
48 | }
49 | previousPath = path;
50 | isFromEdit = false;
51 | } else {
52 | cursor.close();
53 | return;
54 | }
55 | }
56 | } catch (Throwable t) {
57 | isFromEdit = true;
58 | }
59 | super.onChange(selfChange, uri);
60 | }
61 |
62 | private boolean isScreenshot(String path) {
63 | return path != null && path.toLowerCase().contains("screenshot");
64 | }
65 |
66 | protected abstract void onScreenShot(String path, String fileName) throws FileNotFoundException;
67 |
68 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/Splash.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 |
9 | public class Splash extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_splash);
15 |
16 | int secondsDelayed = 1;
17 | new Handler().postDelayed(() -> {
18 | startActivity(new Intent(Splash.this, Login.class));
19 | finish();
20 | }, secondsDelayed * 1500);
21 | }
22 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/main/PageViewModel.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298.main;
2 |
3 | import androidx.arch.core.util.Function;
4 | import androidx.lifecycle.LiveData;
5 | import androidx.lifecycle.MutableLiveData;
6 | import androidx.lifecycle.Transformations;
7 | import androidx.lifecycle.ViewModel;
8 |
9 | public class PageViewModel extends ViewModel {
10 |
11 | private MutableLiveData mIndex = new MutableLiveData<>();
12 | private LiveData mText = Transformations.map(mIndex, new Function() {
13 | @Override
14 | public String apply(Integer input) {
15 | return "Hello world from section: " + input;
16 | }
17 | });
18 |
19 | public void setIndex(int index) {
20 | mIndex.setValue(index);
21 | }
22 |
23 | public LiveData getText() {
24 | return mText;
25 | }
26 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/main/PlaceholderFragment.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298.main;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import androidx.annotation.NonNull;
10 | import androidx.annotation.Nullable;
11 | import androidx.fragment.app.Fragment;
12 | import androidx.lifecycle.Observer;
13 | import androidx.lifecycle.ViewModelProvider;
14 |
15 | import com.hamzaamin.i180550_i170298.databinding.FragmentDashboardBinding;
16 |
17 | /**
18 | * A placeholder fragment containing a simple view.
19 | */
20 | public class PlaceholderFragment extends Fragment {
21 |
22 | private static final String ARG_SECTION_NUMBER = "section_number";
23 |
24 | private PageViewModel pageViewModel;
25 | private FragmentDashboardBinding binding;
26 |
27 | public static PlaceholderFragment newInstance(int index) {
28 | PlaceholderFragment fragment = new PlaceholderFragment();
29 | Bundle bundle = new Bundle();
30 | bundle.putInt(ARG_SECTION_NUMBER, index);
31 | fragment.setArguments(bundle);
32 | return fragment;
33 | }
34 |
35 | @Override
36 | public void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | pageViewModel = new ViewModelProvider(this).get(PageViewModel.class);
39 | int index = 3;
40 | if (getArguments() != null) {
41 | index = getArguments().getInt(ARG_SECTION_NUMBER);
42 | }
43 | pageViewModel.setIndex(index);
44 | }
45 |
46 | @Override
47 | public View onCreateView(
48 | @NonNull LayoutInflater inflater, ViewGroup container,
49 | Bundle savedInstanceState) {
50 |
51 | binding = FragmentDashboardBinding.inflate(inflater, container, false);
52 | View root = binding.getRoot();
53 |
54 | final TextView textView = binding.sectionLabel;
55 | pageViewModel.getText().observe(getViewLifecycleOwner(), new Observer() {
56 | @Override
57 | public void onChanged(@Nullable String s) {
58 | textView.setText(s);
59 | }
60 | });
61 | return root;
62 | }
63 |
64 | @Override
65 | public void onDestroyView() {
66 | super.onDestroyView();
67 | binding = null;
68 | }
69 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/main/SectionsPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298.main;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.annotation.Nullable;
6 | import androidx.annotation.StringRes;
7 | import androidx.fragment.app.Fragment;
8 | import androidx.fragment.app.FragmentManager;
9 | import androidx.fragment.app.FragmentPagerAdapter;
10 |
11 | import com.hamzaamin.i180550_i170298.CallFragment;
12 | //import com.abubakar.i180449_i180564.CameraFragment;
13 | //import com.mhassanakbar.i180564_i180449.ChatFragment;
14 | //import com.mhassanakbar.i180564_i180449.ContactFragment;
15 | import com.hamzaamin.i180550_i170298.CameraFragment;
16 | import com.hamzaamin.i180550_i170298.ChatFragment;
17 | import com.hamzaamin.i180550_i170298.ContactFragment;
18 | import com.hamzaamin.i180550_i170298.R;
19 |
20 | /**
21 | * A [FragmentPagerAdapter] that returns a fragment corresponding to
22 | * one of the sections/tabs/pages.
23 | */
24 | public class SectionsPagerAdapter extends FragmentPagerAdapter {
25 |
26 | @StringRes
27 | private static final int[] TAB_TITLES = new int[]{R.string.tab_text_1, R.string.tab_text_2, R.string.tab_text_3, R.string.tab_text_4};
28 | private final Context mContext;
29 |
30 | public SectionsPagerAdapter(Context context, FragmentManager fm) {
31 | super(fm);
32 | mContext = context;
33 | }
34 |
35 | @Override
36 | public Fragment getItem(int position) {
37 | // getItem is called to instantiate the fragment for the given page.
38 | // Return a PlaceholderFragment (defined as a static inner class below).
39 | if(position == 3){
40 | return ContactFragment.newInstance(1);
41 | }
42 | if(position == 1){
43 | return CameraFragment.newInstance("1", "1");
44 | }
45 | if(position == 2) {
46 | return ChatFragment.newInstance(1);
47 | }
48 | if(position == 0) {
49 | return CallFragment.newInstance(1);
50 | }
51 | return PlaceholderFragment.newInstance(position + 1);
52 | }
53 |
54 | @Nullable
55 | @Override
56 | public CharSequence getPageTitle(int position) {
57 | return null;
58 | }
59 |
60 | @Override
61 | public int getCount() {
62 | // Show 2 total pages.
63 | return 4;
64 | }
65 | }
--------------------------------------------------------------------------------
/src/app/src/main/java/com/hamzaamin/i180550_i170298/placeholder/PlaceholderContent.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298.placeholder;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | /**
9 | * Helper class for providing sample content for user interfaces created by
10 | * Android template wizards.
11 | *
12 | * TODO: Replace all uses of this class before publishing your app.
13 | */
14 | public class PlaceholderContent {
15 |
16 | /**
17 | * An array of sample (placeholder) items.
18 | */
19 | public static final List ITEMS = new ArrayList();
20 |
21 | /**
22 | * A map of sample (placeholder) items, by ID.
23 | */
24 | public static final Map ITEM_MAP = new HashMap();
25 |
26 | private static final int COUNT = 25;
27 |
28 | static {
29 | // Add some sample items.
30 | for (int i = 1; i <= COUNT; i++) {
31 | addItem(createPlaceholderItem(i));
32 | }
33 | }
34 |
35 | private static void addItem(PlaceholderItem item) {
36 | ITEMS.add(item);
37 | ITEM_MAP.put(item.id, item);
38 | }
39 |
40 | private static PlaceholderItem createPlaceholderItem(int position) {
41 | return new PlaceholderItem(String.valueOf(position), "Item " + position, makeDetails(position));
42 | }
43 |
44 | private static String makeDetails(int position) {
45 | StringBuilder builder = new StringBuilder();
46 | builder.append("Details about Item: ").append(position);
47 | for (int i = 0; i < position; i++) {
48 | builder.append("\nMore details information here.");
49 | }
50 | return builder.toString();
51 | }
52 |
53 | /**
54 | * A placeholder item representing a piece of content.
55 | */
56 | public static class PlaceholderItem {
57 | public final String id;
58 | public final String content;
59 | public final String details;
60 |
61 | public PlaceholderItem(String id, String content, String details) {
62 | this.id = id;
63 | this.content = content;
64 | this.details = details;
65 | }
66 |
67 | @Override
68 | public String toString() {
69 | return content;
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/back.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/back_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/back_button.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/call.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/call.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/call_dp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/call_dp.jpg
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/callgradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/deletebutton.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/emoji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/emoji.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/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 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_outline_camera_white.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_outline_videocam_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_round_arrow_back_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_round_arrow_back_50.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_round_close_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_sharp_add_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_twotone_camera_alt_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_twotone_chat_bubble.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_twotone_people.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
17 |
20 |
23 |
26 |
29 |
30 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_twotone_phone_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/ic_twotone_photo_camera.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/insta_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/insta_logo.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/logo.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/newcontact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/newcontact.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/newgroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/newgroup.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/photo_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/photo_icon.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/recbubble.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/sendbubble.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
10 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/upload.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable-v24/voice_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/drawable-v24/voice_icon.png
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_call_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_call_end_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_mic_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_mic_off_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_video_call_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_videocam_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/drawable/ic_baseline_videocam_off_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/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 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_add_contact.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
20 |
21 |
32 |
33 |
34 |
35 |
36 |
45 |
46 |
47 |
60 |
61 |
62 |
63 |
74 |
75 |
76 |
77 |
78 |
88 |
89 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_call.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
19 |
27 |
38 |
39 |
50 |
51 |
56 |
57 |
66 |
67 |
76 |
77 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
28 |
29 |
38 |
39 |
51 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_chat.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
16 |
21 |
29 |
30 |
36 |
37 |
38 |
49 |
50 |
51 |
52 |
53 |
61 |
62 |
71 |
72 |
81 |
82 |
94 |
95 |
101 |
102 |
109 |
110 |
117 |
118 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_create_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
18 |
19 |
30 |
31 |
32 |
41 |
42 |
55 |
56 |
68 |
69 |
81 |
82 |
94 |
95 |
107 |
108 |
109 |
119 |
120 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_dashboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
22 |
23 |
24 |
29 |
30 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_login_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
33 |
34 |
46 |
47 |
59 |
60 |
70 |
71 |
83 |
84 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
33 |
34 |
46 |
47 |
60 |
61 |
73 |
74 |
84 |
85 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/contact_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
18 |
19 |
28 |
29 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_call.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_call_items.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
21 |
22 |
31 |
32 |
41 |
42 |
43 |
44 |
53 |
54 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_chat.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
29 |
30 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_chat_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_contact.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
22 |
30 |
41 |
42 |
51 |
52 |
53 |
54 |
64 |
65 |
74 |
75 |
82 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/fragment_dashboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/message_rec.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
16 |
30 |
31 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/message_rec_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
16 |
17 |
25 |
26 |
39 |
40 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/message_sent.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
34 |
35 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/app/src/main/res/layout/message_sent_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
26 |
27 |
28 |
43 |
44 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/src/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/src/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/src/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 16dp
7 | 8dp
8 | 16dp
9 |
--------------------------------------------------------------------------------
/src/app/src/main/res/values/dimens/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
--------------------------------------------------------------------------------
/src/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | i180564_i180449
3 | Dashboard
4 | Call
5 | Camera
6 | Chat
7 | People
8 |
9 | Hello blank fragment
10 | http://192.168.100.8/assignment4/
11 |
--------------------------------------------------------------------------------
/src/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/src/app/src/test/java/com/hamzaamin/i180550_i170298/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.hamzaamin.i180550_i170298;
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 | }
--------------------------------------------------------------------------------
/src/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | maven { url "https://jitpack.io"
7 | }
8 | gradlePluginPortal()
9 | jcenter()
10 | }
11 | dependencies {
12 | classpath "com.android.tools.build:gradle:7.0.3"
13 | classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | mavenCentral()
23 | jcenter()
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
--------------------------------------------------------------------------------
/src/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=-Xmx2048m -Dfile.encoding=UTF-8
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
--------------------------------------------------------------------------------
/src/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SameetAsadullah/Bisto-Chat-Java-PHP/fd4c455cc800df1384ae04755193ebf6fa3d1cd0/src/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Nov 28 04:29:10 PST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/src/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/src/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/src/settings.gradle:
--------------------------------------------------------------------------------
1 | import org.gradle.api.initialization.resolve.RepositoriesMode
2 |
3 | dependencyResolutionManagement {
4 | repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
5 | repositories {
6 | google()
7 | mavenCentral()
8 | jcenter() // Warning: this repository is going to shut down soon
9 | maven { url "https://jitpack.io" }
10 | }
11 | }
12 | rootProject.name = "assignment_4"
13 | include ':app'
14 |
--------------------------------------------------------------------------------