├── .gitignore ├── .gradle ├── 4.4 │ ├── fileChanges │ │ └── last-build.bin │ ├── fileContent │ │ └── fileContent.lock │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── javaCompile │ │ ├── classAnalysis.bin │ │ ├── jarAnalysis.bin │ │ ├── javaCompile.lock │ │ ├── taskHistory.bin │ │ └── taskJars.bin │ └── taskHistory │ │ ├── taskHistory.bin │ │ └── taskHistory.lock ├── 4.6 │ ├── fileChanges │ │ └── last-build.bin │ ├── fileContent │ │ ├── annotation-processors.bin │ │ └── fileContent.lock │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── javaCompile │ │ ├── classAnalysis.bin │ │ ├── jarAnalysis.bin │ │ ├── javaCompile.lock │ │ ├── taskHistory.bin │ │ └── taskJars.bin │ └── taskHistory │ │ ├── taskHistory.bin │ │ └── taskHistory.lock ├── buildOutputCleanup │ ├── buildOutputCleanup.lock │ ├── cache.properties │ └── outputFiles.bin └── vcsWorkingDirs │ └── gc.properties ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── libraries │ ├── Gradle__android_arch_core_common_1_1_0_jar.xml │ ├── Gradle__android_arch_core_runtime_1_1_0.xml │ ├── Gradle__android_arch_lifecycle_common_1_1_0_jar.xml │ ├── Gradle__android_arch_lifecycle_livedata_core_1_1_0.xml │ ├── Gradle__android_arch_lifecycle_runtime_1_1_0.xml │ ├── Gradle__android_arch_lifecycle_viewmodel_1_1_0.xml │ ├── Gradle__com_android_support_animated_vector_drawable_27_1_1.xml │ ├── Gradle__com_android_support_appcompat_v7_27_1_1.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_1_1_2.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_solver_1_1_2_jar.xml │ ├── Gradle__com_android_support_customtabs_27_1_1.xml │ ├── Gradle__com_android_support_design_27_1_1.xml │ ├── Gradle__com_android_support_recyclerview_v7_27_1_1.xml │ ├── Gradle__com_android_support_support_annotations_27_1_1_jar.xml │ ├── Gradle__com_android_support_support_compat_27_1_1.xml │ ├── Gradle__com_android_support_support_core_ui_27_1_1.xml │ ├── Gradle__com_android_support_support_core_utils_27_1_1.xml │ ├── Gradle__com_android_support_support_fragment_27_1_1.xml │ ├── Gradle__com_android_support_support_media_compat_27_1_1.xml │ ├── Gradle__com_android_support_support_v4_27_1_1.xml │ ├── Gradle__com_android_support_support_vector_drawable_27_1_1.xml │ ├── Gradle__com_android_support_test_espresso_espresso_core_3_0_2.xml │ ├── Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2.xml │ ├── Gradle__com_android_support_test_monitor_1_0_2.xml │ ├── Gradle__com_android_support_test_runner_1_0_2.xml │ ├── Gradle__com_android_support_transition_27_1_1.xml │ ├── Gradle__com_facebook_fresco_drawee_1_10_0.xml │ ├── Gradle__com_facebook_fresco_fbcore_1_10_0.xml │ ├── Gradle__com_facebook_fresco_fresco_1_10_0.xml │ ├── Gradle__com_facebook_fresco_imagepipeline_1_10_0.xml │ ├── Gradle__com_facebook_fresco_imagepipeline_base_1_10_0.xml │ ├── Gradle__com_facebook_soloader_soloader_0_5_0.xml │ ├── Gradle__com_github_bumptech_glide_annotations_4_8_0_jar.xml │ ├── Gradle__com_github_bumptech_glide_disklrucache_4_8_0_jar.xml │ ├── Gradle__com_github_bumptech_glide_gifdecoder_4_8_0.xml │ ├── Gradle__com_github_bumptech_glide_glide_4_8_0.xml │ ├── Gradle__com_github_stfalcon_frescoimageviewer_0_5_0.xml │ ├── Gradle__com_google_android_gms_play_services_ads_identifier_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_base_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_basement_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_flags_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_gcm_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_gcm_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_gcm_license_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_iid_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_iid_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_iid_license_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_location_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_location_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_location_license_12_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_measurement_base_16_0_0.xml │ ├── Gradle__com_google_android_gms_play_services_places_placereport_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_stats_15_0_1.xml │ ├── Gradle__com_google_android_gms_play_services_tasks_15_0_1.xml │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml │ ├── Gradle__com_google_firebase_firebase_analytics_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_analytics_impl_16_1_1.xml │ ├── Gradle__com_google_firebase_firebase_auth_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_auth_interop_16_0_0.xml │ ├── Gradle__com_google_firebase_firebase_common_16_0_0.xml │ ├── Gradle__com_google_firebase_firebase_core_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_database_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_database_collection_15_0_1.xml │ ├── Gradle__com_google_firebase_firebase_database_connection_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_iid_16_0_0.xml │ ├── Gradle__com_google_firebase_firebase_iid_interop_16_0_0.xml │ ├── Gradle__com_google_firebase_firebase_measurement_connector_16_0_0.xml │ ├── Gradle__com_google_firebase_firebase_measurement_connector_impl_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_storage_16_0_1.xml │ ├── Gradle__com_google_firebase_firebase_storage_common_16_0_1.xml │ ├── Gradle__com_onesignal_OneSignal_3_8_3.xml │ ├── Gradle__com_parse_bolts_bolts_tasks_1_4_0_jar.xml │ ├── Gradle__com_squareup_javawriter_2_1_1_jar.xml │ ├── Gradle__javax_inject_javax_inject_1_jar.xml │ ├── Gradle__junit_junit_4_12_jar.xml │ ├── Gradle__me_relex_photodraweeview_1_1_0.xml │ ├── Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml │ └── Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── vcs.xml └── workspace.xml ├── LICENSE.md ├── README.md ├── WhatsAppClone.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── simcoder │ │ └── whatsappclone │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── simcoder │ │ │ └── whatsappclone │ │ │ ├── Chat │ │ │ ├── ChatListAdapter.java │ │ │ ├── ChatObject.java │ │ │ ├── MediaAdapter.java │ │ │ ├── MessageAdapter.java │ │ │ └── MessageObject.java │ │ │ ├── ChatActivity.java │ │ │ ├── FindUserActivity.java │ │ │ ├── LoginActivity.java │ │ │ ├── MainPageActivity.java │ │ │ ├── User │ │ │ ├── UserListAdapter.java │ │ │ └── UserObject.java │ │ │ └── Utils │ │ │ ├── CountryToPhonePrefix.java │ │ │ └── SendNotification.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_chat.xml │ │ ├── activity_find_user.xml │ │ ├── activity_main.xml │ │ ├── activity_main_page.xml │ │ ├── item_chat.xml │ │ ├── item_media.xml │ │ ├── item_message.xml │ │ └── item_user.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── simcoder │ └── whatsappclone │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | -------------------------------------------------------------------------------- /.gradle/4.4/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/4.4/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/4.4/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/4.4/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/4.4/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/4.4/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /.gradle/4.4/javaCompile/jarAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/javaCompile/jarAnalysis.bin -------------------------------------------------------------------------------- /.gradle/4.4/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/4.4/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.4/javaCompile/taskJars.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/javaCompile/taskJars.bin -------------------------------------------------------------------------------- /.gradle/4.4/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.4/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.4/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /.gradle/4.6/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/4.6/fileContent/annotation-processors.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/fileContent/annotation-processors.bin -------------------------------------------------------------------------------- /.gradle/4.6/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/4.6/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/4.6/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/4.6/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/4.6/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /.gradle/4.6/javaCompile/jarAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/javaCompile/jarAnalysis.bin -------------------------------------------------------------------------------- /.gradle/4.6/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/4.6/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.6/javaCompile/taskJars.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/javaCompile/taskJars.bin -------------------------------------------------------------------------------- /.gradle/4.6/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.6/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/4.6/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 26 14:36:29 BST 2018 2 | gradle.version=4.6 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/vcsWorkingDirs/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.gradle/vcsWorkingDirs/gc.properties -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimCoderYoutube/WhatsAppClone/1c568503152d54eef5589daf7f8f757b580fe528/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_core_common_1_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_core_runtime_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_common_1_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_livedata_core_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_viewmodel_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_animated_vector_drawable_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_appcompat_v7_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_1_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_solver_1_1_2_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_customtabs_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_design_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_recyclerview_v7_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_annotations_27_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_compat_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_ui_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_utils_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_fragment_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_media_compat_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_v4_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_vector_drawable_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_3_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_monitor_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_runner_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_transition_27_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_fresco_drawee_1_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_fresco_fbcore_1_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_fresco_fresco_1_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_1_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_1_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_facebook_soloader_soloader_0_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_bumptech_glide_annotations_4_8_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_bumptech_glide_disklrucache_4_8_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_bumptech_glide_gifdecoder_4_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_bumptech_glide_glide_4_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_stfalcon_frescoimageviewer_0_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_ads_identifier_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_base_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_basement_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_flags_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_gcm_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_gcm_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_gcm_license_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_iid_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_iid_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_iid_license_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_location_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_location_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_location_license_12_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_measurement_base_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_places_placereport_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_stats_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_tasks_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_analytics_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_analytics_impl_16_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_auth_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_auth_interop_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_common_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_core_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_collection_15_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_connection_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_iid_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_iid_interop_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_measurement_connector_16_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_measurement_connector_impl_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_storage_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_storage_common_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_onesignal_OneSignal_3_8_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_parse_bolts_bolts_tasks_1_4_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_12_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__me_relex_photodraweeview_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WhatsAppClone 2 | # WhatsApp_Android_Clone 3 | 4 | ▷ Create an android app like whatsApp 5 | 6 | ▷ Full Video Tutorial Playlist here: https://www.youtube.com/watch?v=wdcH58Nzm-o&index=1&list=PLxabZQCAe5fgGQggJxp5nuI1ESzP-oMED
7 | 8 | ▷ Become a Patreon: https://www.patreon.com/simpleCoder
9 | ▷ Donate with PayPal: https://www.paypal.me/simcoder
10 | ▷ Twitter: https://twitter.com/S1mpleCoder
11 | ▷ GitHub : https://goo.gl/88FHk4
12 | 13 | ▷ If you have any question please ask, I'll try to answer to every question and even look at your code if that is necessary. 14 | 15 | 16 | **Important Links** 17 | 18 | Firebase: https://goo.gl/9Wahb1
19 | Glide: https://github.com/bumptech/glide
20 | 21 | P.S: If ou're going to download the full project please use your own firebase API, the one in the project will NOT be mantained and the app may not work. 22 | 23 | 24 | # Implementation Guide
25 | **1 - Project**
26 | 1 - Open the Project in your android studio;
27 | 2 - !!!!IMPORTANT!!!! Change the Package Name. You can check how to do that here (https://stackoverflow.com/questions/16804093/android-studio-rename-package)
28 | 29 | 30 | **2 - Firebase Panel**
31 | 1 - Create Firebase Project (https://console.firebase.google.com/);
32 | 2 - import the file google-service.json into your project as the instructions say;
33 | 3 - Change Pay Plan to either Flame or Blaze; !optional
34 | 4 - Go to Firebase -> Registration and activate Login/Registrtion with Phone Number
35 | 5 - Go to Firebase -> storage and activate it;
36 | -------------------------------------------------------------------------------- /WhatsAppClone.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'https://plugins.gradle.org/m2/'} 4 | } 5 | dependencies { 6 | classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.11.2' 7 | } 8 | } 9 | apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' 10 | 11 | repositories { 12 | maven { url 'https://maven.google.com' } 13 | } 14 | 15 | apply plugin: 'com.android.application' 16 | 17 | android { 18 | compileSdkVersion 27 19 | defaultConfig { 20 | applicationId "com.simcoder.whatsappclone" 21 | minSdkVersion 18 22 | targetSdkVersion 27 23 | versionCode 1 24 | versionName "1.0" 25 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 26 | manifestPlaceholders = [ 27 | onesignal_app_id: 'f1dd85e2-3dff-4049-bac7-067512c7968d', 28 | // Project number pulled from dashboard, local value is ignored. 29 | onesignal_google_project_number: 'REMOTE' 30 | ] 31 | } 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation fileTree(dir: 'libs', include: ['*.jar']) 42 | //noinspection GradleCompatible 43 | implementation 'com.android.support:appcompat-v7:27.1.1' 44 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 45 | implementation 'com.android.support:design:27.1.1' 46 | 47 | implementation 'com.google.firebase:firebase-core:16.0.1' 48 | implementation 'com.google.firebase:firebase-auth:16.0.1' 49 | implementation 'com.google.firebase:firebase-database:16.0.1' 50 | implementation 'com.google.firebase:firebase-storage:16.0.1' 51 | implementation 'com.onesignal:OneSignal:3.8.3' 52 | 53 | implementation 'com.facebook.fresco:fresco:1.10.0' 54 | implementation 'com.github.stfalcon:frescoimageviewer:0.5.0' 55 | 56 | implementation 'com.github.bumptech.glide:glide:4.8.0' 57 | annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' 58 | 59 | testImplementation 'junit:junit:4.12' 60 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 61 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 62 | } 63 | 64 | apply plugin: 'com.google.gms.google-services' 65 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/simcoder/whatsappclone/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.simcoder.whatsappclone", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Chat/ChatListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Chat; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.annotation.NonNull; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.LinearLayout; 12 | import android.widget.TextView; 13 | 14 | import com.google.firebase.auth.FirebaseAuth; 15 | import com.google.firebase.database.FirebaseDatabase; 16 | import com.simcoder.whatsappclone.ChatActivity; 17 | import com.simcoder.whatsappclone.R; 18 | 19 | import java.util.ArrayList; 20 | 21 | public class ChatListAdapter extends RecyclerView.Adapter { 22 | 23 | ArrayList chatList; 24 | 25 | public ChatListAdapter(ArrayList chatList){ 26 | this.chatList = chatList; 27 | } 28 | 29 | @NonNull 30 | @Override 31 | public ChatListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 32 | View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_chat, null, false); 33 | RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 34 | layoutView.setLayoutParams(lp); 35 | 36 | ChatListViewHolder rcv = new ChatListViewHolder(layoutView); 37 | return rcv; 38 | } 39 | 40 | @Override 41 | public void onBindViewHolder(@NonNull final ChatListViewHolder holder, final int position) { 42 | holder.mTitle.setText(chatList.get(position).getChatId()); 43 | 44 | holder.mLayout.setOnClickListener(new View.OnClickListener() { 45 | @Override 46 | public void onClick(View v) { 47 | Intent intent = new Intent(v.getContext(), ChatActivity.class); 48 | intent.putExtra("chatObject", chatList.get(holder.getAdapterPosition())); 49 | v.getContext().startActivity(intent); 50 | } 51 | }); 52 | } 53 | 54 | @Override 55 | public int getItemCount() { 56 | return chatList.size(); 57 | } 58 | 59 | 60 | 61 | 62 | 63 | public class ChatListViewHolder extends RecyclerView.ViewHolder{ 64 | public TextView mTitle; 65 | public LinearLayout mLayout; 66 | public ChatListViewHolder(View view){ 67 | super(view); 68 | mTitle = view.findViewById(R.id.title); 69 | mLayout = view.findViewById(R.id.layout); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Chat/ChatObject.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Chat; 2 | 3 | import com.simcoder.whatsappclone.User.UserObject; 4 | 5 | import java.io.Serializable; 6 | import java.util.ArrayList; 7 | 8 | public class ChatObject implements Serializable { 9 | private String chatId; 10 | 11 | private ArrayList userObjectArrayList = new ArrayList<>(); 12 | 13 | public ChatObject(String chatId){ 14 | this.chatId = chatId; 15 | } 16 | 17 | public String getChatId() { 18 | return chatId; 19 | } 20 | public ArrayList getUserObjectArrayList() { 21 | return userObjectArrayList; 22 | } 23 | 24 | 25 | 26 | 27 | public void addUserToArrayList(UserObject mUser){ 28 | userObjectArrayList.add(mUser); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Chat/MediaAdapter.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Chat; 2 | 3 | import android.content.Context; 4 | import android.net.Uri; 5 | import android.support.annotation.NonNull; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ImageView; 11 | 12 | import com.bumptech.glide.Glide; 13 | import com.simcoder.whatsappclone.R; 14 | 15 | import java.util.ArrayList; 16 | 17 | public class MediaAdapter extends RecyclerView.Adapter{ 18 | 19 | ArrayList mediaList; 20 | Context context; 21 | 22 | public MediaAdapter(Context context, ArrayList mediaList){ 23 | this.context = context; 24 | this.mediaList = mediaList; 25 | } 26 | 27 | @NonNull 28 | @Override 29 | public MediaViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 30 | View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_media,null, false); 31 | MediaViewHolder mediaViewHolder = new MediaViewHolder(layoutView); 32 | 33 | return mediaViewHolder; 34 | } 35 | 36 | @Override 37 | public void onBindViewHolder(@NonNull MediaViewHolder holder, int position) { 38 | Glide.with(context).load(Uri.parse(mediaList.get(position))).into(holder.mMedia); 39 | } 40 | 41 | @Override 42 | public int getItemCount() { 43 | return mediaList.size(); 44 | } 45 | 46 | 47 | public class MediaViewHolder extends RecyclerView.ViewHolder { 48 | 49 | ImageView mMedia; 50 | 51 | public MediaViewHolder(View itemView) { 52 | super(itemView); 53 | mMedia = itemView.findViewById(R.id.media); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Chat/MessageAdapter.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Chat; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.LinearLayout; 11 | import android.widget.TextView; 12 | 13 | import com.google.firebase.auth.FirebaseAuth; 14 | import com.google.firebase.database.FirebaseDatabase; 15 | import com.simcoder.whatsappclone.R; 16 | import com.stfalcon.frescoimageviewer.ImageViewer; 17 | 18 | import java.util.ArrayList; 19 | 20 | public class MessageAdapter extends RecyclerView.Adapter { 21 | 22 | ArrayList messageList; 23 | 24 | public MessageAdapter(ArrayList messageList){ 25 | this.messageList = messageList; 26 | } 27 | 28 | @NonNull 29 | @Override 30 | public MessageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 31 | View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_message, null, false); 32 | RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 33 | layoutView.setLayoutParams(lp); 34 | 35 | MessageViewHolder rcv = new MessageViewHolder(layoutView); 36 | return rcv; 37 | } 38 | 39 | @Override 40 | public void onBindViewHolder(@NonNull final MessageViewHolder holder, final int position) { 41 | holder.mMessage.setText(messageList.get(position).getMessage()); 42 | holder.mSender.setText(messageList.get(position).getSenderId()); 43 | 44 | if(messageList.get(holder.getAdapterPosition()).getMediaUrlList().isEmpty()) 45 | holder.mViewMedia.setVisibility(View.GONE); 46 | 47 | holder.mViewMedia.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View v) { 50 | new ImageViewer.Builder(v.getContext(), messageList.get(holder.getAdapterPosition()).getMediaUrlList()) 51 | .setStartPosition(0) 52 | .show(); 53 | } 54 | }); 55 | } 56 | 57 | @Override 58 | public int getItemCount() { 59 | return messageList.size(); 60 | } 61 | 62 | 63 | 64 | 65 | 66 | class MessageViewHolder extends RecyclerView.ViewHolder{ 67 | TextView mMessage, 68 | mSender; 69 | Button mViewMedia; 70 | LinearLayout mLayout; 71 | MessageViewHolder(View view){ 72 | super(view); 73 | mLayout = view.findViewById(R.id.layout); 74 | 75 | mMessage = view.findViewById(R.id.message); 76 | mSender = view.findViewById(R.id.sender); 77 | 78 | mViewMedia = view.findViewById(R.id.viewMedia); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Chat/MessageObject.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Chat; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class MessageObject { 6 | 7 | String messageId, 8 | senderId, 9 | message; 10 | 11 | ArrayList mediaUrlList; 12 | 13 | public MessageObject(String messageId, String senderId, String message, ArrayList mediaUrlList){ 14 | this.messageId = messageId; 15 | this.senderId = senderId; 16 | this.message = message; 17 | this.mediaUrlList = mediaUrlList; 18 | } 19 | 20 | public String getMessageId() { 21 | return messageId; 22 | } 23 | public String getSenderId() { 24 | return senderId; 25 | } 26 | public String getMessage() { 27 | return message; 28 | } 29 | public ArrayList getMediaUrlList() { 30 | return mediaUrlList; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/ChatActivity.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.provider.ContactsContract; 6 | import android.support.annotation.NonNull; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.support.v7.widget.LinearLayoutManager; 11 | import android.support.v7.widget.RecyclerView; 12 | import android.view.View; 13 | import android.widget.Button; 14 | import android.widget.EditText; 15 | import android.widget.LinearLayout; 16 | 17 | import com.google.android.gms.tasks.OnSuccessListener; 18 | import com.google.firebase.auth.FirebaseAuth; 19 | import com.google.firebase.database.ChildEventListener; 20 | import com.google.firebase.database.DataSnapshot; 21 | import com.google.firebase.database.DatabaseError; 22 | import com.google.firebase.database.DatabaseReference; 23 | import com.google.firebase.database.FirebaseDatabase; 24 | import com.google.firebase.storage.FirebaseStorage; 25 | import com.google.firebase.storage.StorageReference; 26 | import com.google.firebase.storage.UploadTask; 27 | import com.simcoder.whatsappclone.Chat.ChatObject; 28 | import com.simcoder.whatsappclone.Chat.MediaAdapter; 29 | import com.simcoder.whatsappclone.Chat.MessageAdapter; 30 | import com.simcoder.whatsappclone.Chat.MessageObject; 31 | import com.simcoder.whatsappclone.User.UserObject; 32 | import com.simcoder.whatsappclone.Utils.SendNotification; 33 | 34 | import java.util.ArrayList; 35 | import java.util.HashMap; 36 | import java.util.Map; 37 | 38 | public class ChatActivity extends AppCompatActivity { 39 | 40 | private RecyclerView mChat, mMedia; 41 | private RecyclerView.Adapter mChatAdapter, mMediaAdapter; 42 | private RecyclerView.LayoutManager mChatLayoutManager, mMediaLayoutManager; 43 | 44 | ArrayList messageList; 45 | 46 | ChatObject mChatObject; 47 | 48 | DatabaseReference mChatMessagesDb; 49 | 50 | @Override 51 | protected void onCreate(Bundle savedInstanceState) { 52 | super.onCreate(savedInstanceState); 53 | setContentView(R.layout.activity_chat); 54 | 55 | mChatObject = (ChatObject) getIntent().getSerializableExtra("chatObject"); 56 | 57 | mChatMessagesDb = FirebaseDatabase.getInstance().getReference().child("chat").child(mChatObject.getChatId()).child("messages"); 58 | 59 | Button mSend = findViewById(R.id.send); 60 | Button mAddMedia = findViewById(R.id.addMedia); 61 | 62 | mSend.setOnClickListener(new View.OnClickListener() { 63 | @Override 64 | public void onClick(View v) { 65 | sendMessage(); 66 | } 67 | }); 68 | mAddMedia.setOnClickListener(new View.OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | openGallery(); 72 | } 73 | }); 74 | 75 | initializeMessage(); 76 | initializeMedia(); 77 | getChatMessages(); 78 | } 79 | 80 | private void getChatMessages() { 81 | mChatMessagesDb.addChildEventListener(new ChildEventListener() { 82 | @Override 83 | public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) { 84 | if(dataSnapshot.exists()){ 85 | String text = "", 86 | creatorID = ""; 87 | ArrayList mediaUrlList = new ArrayList<>(); 88 | 89 | if(dataSnapshot.child("text").getValue() != null) 90 | text = dataSnapshot.child("text").getValue().toString(); 91 | if(dataSnapshot.child("creator").getValue() != null) 92 | creatorID = dataSnapshot.child("creator").getValue().toString(); 93 | 94 | if(dataSnapshot.child("media").getChildrenCount() > 0) 95 | for (DataSnapshot mediaSnapshot : dataSnapshot.child("media").getChildren()) 96 | mediaUrlList.add(mediaSnapshot.getValue().toString()); 97 | 98 | MessageObject mMessage = new MessageObject(dataSnapshot.getKey(), creatorID, text, mediaUrlList); 99 | messageList.add(mMessage); 100 | mChatLayoutManager.scrollToPosition(messageList.size()-1); 101 | mChatAdapter.notifyDataSetChanged(); 102 | } 103 | } 104 | 105 | @Override 106 | public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) { 107 | 108 | } 109 | @Override 110 | public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) { 111 | 112 | } 113 | @Override 114 | public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) { 115 | 116 | } 117 | @Override 118 | public void onCancelled(@NonNull DatabaseError databaseError) { 119 | 120 | } 121 | }); 122 | 123 | } 124 | 125 | int totalMediaUploaded = 0; 126 | ArrayList mediaIdList = new ArrayList<>(); 127 | EditText mMessage; 128 | private void sendMessage(){ 129 | mMessage = findViewById(R.id.messageInput); 130 | 131 | String messageId = mChatMessagesDb.push().getKey(); 132 | final DatabaseReference newMessageDb = mChatMessagesDb.child(messageId); 133 | 134 | final Map newMessageMap = new HashMap<>(); 135 | 136 | newMessageMap.put("creator", FirebaseAuth.getInstance().getUid()); 137 | 138 | if(!mMessage.getText().toString().isEmpty()) 139 | newMessageMap.put("text", mMessage.getText().toString()); 140 | 141 | 142 | if(!mediaUriList.isEmpty()){ 143 | for (String mediaUri : mediaUriList){ 144 | String mediaId = newMessageDb.child("media").push().getKey(); 145 | mediaIdList.add(mediaId); 146 | final StorageReference filePath = FirebaseStorage.getInstance().getReference().child("chat").child(mChatObject.getChatId()).child(messageId).child(mediaId); 147 | 148 | UploadTask uploadTask = filePath.putFile(Uri.parse(mediaUri)); 149 | 150 | uploadTask.addOnSuccessListener(new OnSuccessListener() { 151 | @Override 152 | public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { 153 | filePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() { 154 | @Override 155 | public void onSuccess(Uri uri) { 156 | newMessageMap.put("/media/" + mediaIdList.get(totalMediaUploaded) + "/", uri.toString()); 157 | 158 | totalMediaUploaded++; 159 | if(totalMediaUploaded == mediaUriList.size()) 160 | updateDatabaseWithNewMessage(newMessageDb, newMessageMap); 161 | 162 | } 163 | }); 164 | } 165 | }); 166 | } 167 | }else{ 168 | if(!mMessage.getText().toString().isEmpty()) 169 | updateDatabaseWithNewMessage(newMessageDb, newMessageMap); 170 | } 171 | 172 | 173 | } 174 | 175 | 176 | private void updateDatabaseWithNewMessage(DatabaseReference newMessageDb, Map newMessageMap){ 177 | newMessageDb.updateChildren(newMessageMap); 178 | mMessage.setText(null); 179 | mediaUriList.clear(); 180 | mediaIdList.clear(); 181 | totalMediaUploaded=0; 182 | mMediaAdapter.notifyDataSetChanged(); 183 | 184 | String message; 185 | 186 | if(newMessageMap.get("text") != null) 187 | message = newMessageMap.get("text").toString(); 188 | else 189 | message = "Sent Media"; 190 | 191 | for(UserObject mUser : mChatObject.getUserObjectArrayList()){ 192 | if(!mUser.getUid().equals(FirebaseAuth.getInstance().getUid())){ 193 | new SendNotification(message, "New Message", mUser.getNotificationKey()); 194 | } 195 | } 196 | } 197 | 198 | private void initializeMessage() { 199 | messageList = new ArrayList<>(); 200 | mChat= findViewById(R.id.messageList); 201 | mChat.setNestedScrollingEnabled(false); 202 | mChat.setHasFixedSize(false); 203 | mChatLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayout.VERTICAL, false); 204 | mChat.setLayoutManager(mChatLayoutManager); 205 | mChatAdapter = new MessageAdapter(messageList); 206 | mChat.setAdapter(mChatAdapter); 207 | } 208 | 209 | 210 | 211 | int PICK_IMAGE_INTENT = 1; 212 | ArrayList mediaUriList = new ArrayList<>(); 213 | 214 | private void initializeMedia() { 215 | mediaUriList = new ArrayList<>(); 216 | mMedia= findViewById(R.id.mediaList); 217 | mMedia.setNestedScrollingEnabled(false); 218 | mMedia.setHasFixedSize(false); 219 | mMediaLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayout.HORIZONTAL, false); 220 | mMedia.setLayoutManager(mMediaLayoutManager); 221 | mMediaAdapter = new MediaAdapter(getApplicationContext(), mediaUriList); 222 | mMedia.setAdapter(mMediaAdapter); 223 | } 224 | 225 | private void openGallery() { 226 | Intent intent = new Intent(); 227 | intent.setType("image/*"); 228 | intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); 229 | intent.setAction(intent.ACTION_GET_CONTENT); 230 | startActivityForResult(Intent.createChooser(intent, "Select Picture(s)"), PICK_IMAGE_INTENT); 231 | } 232 | 233 | @Override 234 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 235 | super.onActivityResult(requestCode, resultCode, data); 236 | if(resultCode == RESULT_OK){ 237 | if(requestCode == PICK_IMAGE_INTENT){ 238 | if(data.getClipData() == null){ 239 | mediaUriList.add(data.getData().toString()); 240 | }else{ 241 | for(int i = 0; i < data.getClipData().getItemCount(); i++){ 242 | mediaUriList.add(data.getClipData().getItemAt(i).getUri().toString()); 243 | } 244 | } 245 | 246 | mMediaAdapter.notifyDataSetChanged(); 247 | } 248 | } 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/FindUserActivity.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone; 2 | 3 | import android.database.Cursor; 4 | import android.provider.ContactsContract; 5 | import android.support.annotation.NonNull; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.telephony.TelephonyManager; 11 | import android.view.View; 12 | import android.widget.Button; 13 | import android.widget.LinearLayout; 14 | 15 | import com.google.firebase.auth.FirebaseAuth; 16 | import com.google.firebase.database.DataSnapshot; 17 | import com.google.firebase.database.DatabaseError; 18 | import com.google.firebase.database.DatabaseReference; 19 | import com.google.firebase.database.FirebaseDatabase; 20 | import com.google.firebase.database.Query; 21 | import com.google.firebase.database.ValueEventListener; 22 | import com.simcoder.whatsappclone.User.UserListAdapter; 23 | import com.simcoder.whatsappclone.User.UserObject; 24 | import com.simcoder.whatsappclone.Utils.CountryToPhonePrefix; 25 | 26 | import java.util.ArrayList; 27 | import java.util.HashMap; 28 | 29 | public class FindUserActivity extends AppCompatActivity { 30 | 31 | private RecyclerView mUserList; 32 | private RecyclerView.Adapter mUserListAdapter; 33 | private RecyclerView.LayoutManager mUserListLayoutManager; 34 | 35 | ArrayList userList, contactList; 36 | 37 | @Override 38 | protected void onCreate(Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | setContentView(R.layout.activity_find_user); 41 | 42 | contactList= new ArrayList<>(); 43 | userList= new ArrayList<>(); 44 | 45 | Button mCreate = findViewById(R.id.create); 46 | mCreate.setOnClickListener(new View.OnClickListener() { 47 | @Override 48 | public void onClick(View v) { 49 | createChat(); 50 | } 51 | }); 52 | 53 | initializeRecyclerView(); 54 | getContactList(); 55 | } 56 | 57 | private void createChat(){ 58 | String key = FirebaseDatabase.getInstance().getReference().child("chat").push().getKey(); 59 | 60 | DatabaseReference chatInfoDb = FirebaseDatabase.getInstance().getReference().child("chat").child(key).child("info"); 61 | DatabaseReference userDb = FirebaseDatabase.getInstance().getReference().child("user"); 62 | 63 | HashMap newChatMap = new HashMap(); 64 | newChatMap.put("id", key); 65 | newChatMap.put("users/" + FirebaseAuth.getInstance().getUid(), true); 66 | 67 | Boolean validChat = false; 68 | for(UserObject mUser : userList){ 69 | if(mUser.getSelected()){ 70 | validChat = true; 71 | newChatMap.put("users/" + mUser.getUid(), true); 72 | userDb.child(mUser.getUid()).child("chat").child(key).setValue(true); 73 | } 74 | } 75 | 76 | if(validChat){ 77 | chatInfoDb.updateChildren(newChatMap); 78 | userDb.child(FirebaseAuth.getInstance().getUid()).child("chat").child(key).setValue(true); 79 | } 80 | 81 | } 82 | 83 | private void getContactList(){ 84 | 85 | String ISOPrefix = getCountryISO(); 86 | 87 | Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); 88 | while(phones.moveToNext()){ 89 | String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); 90 | String phone = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); 91 | 92 | phone = phone.replace(" ", ""); 93 | phone = phone.replace("-", ""); 94 | phone = phone.replace("(", ""); 95 | phone = phone.replace(")", ""); 96 | 97 | if(!String.valueOf(phone.charAt(0)).equals("+")) 98 | phone = ISOPrefix + phone; 99 | 100 | UserObject mContact = new UserObject("", name, phone); 101 | contactList.add(mContact); 102 | getUserDetails(mContact); 103 | } 104 | } 105 | 106 | private void getUserDetails(UserObject mContact) { 107 | DatabaseReference mUserDB = FirebaseDatabase.getInstance().getReference().child("user"); 108 | Query query = mUserDB.orderByChild("phone").equalTo(mContact.getPhone()); 109 | query.addListenerForSingleValueEvent(new ValueEventListener() { 110 | @Override 111 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 112 | if(dataSnapshot.exists()){ 113 | String phone = "", 114 | name = ""; 115 | for(DataSnapshot childSnapshot : dataSnapshot.getChildren()){ 116 | if(childSnapshot.child("phone").getValue()!=null) 117 | phone = childSnapshot.child("phone").getValue().toString(); 118 | if(childSnapshot.child("name").getValue()!=null) 119 | name = childSnapshot.child("name").getValue().toString(); 120 | 121 | 122 | UserObject mUser = new UserObject(childSnapshot.getKey(), name, phone); 123 | if (name.equals(phone)) 124 | for(UserObject mContactIterator : contactList){ 125 | if(mContactIterator.getPhone().equals(mUser.getPhone())){ 126 | mUser.setName(mContactIterator.getName()); 127 | } 128 | } 129 | 130 | userList.add(mUser); 131 | mUserListAdapter.notifyDataSetChanged(); 132 | return; 133 | } 134 | } 135 | } 136 | 137 | @Override 138 | public void onCancelled(@NonNull DatabaseError databaseError) { 139 | 140 | } 141 | }); 142 | } 143 | 144 | 145 | 146 | private String getCountryISO(){ 147 | String iso = null; 148 | 149 | TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE); 150 | if(telephonyManager.getNetworkCountryIso()!=null) 151 | if (!telephonyManager.getNetworkCountryIso().toString().equals("")) 152 | iso = telephonyManager.getNetworkCountryIso().toString(); 153 | 154 | return CountryToPhonePrefix.getPhone(iso); 155 | } 156 | 157 | private void initializeRecyclerView() { 158 | mUserList= findViewById(R.id.userList); 159 | mUserList.setNestedScrollingEnabled(false); 160 | mUserList.setHasFixedSize(false); 161 | mUserListLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayout.VERTICAL, false); 162 | mUserList.setLayoutManager(mUserListLayoutManager); 163 | mUserListAdapter = new UserListAdapter(userList); 164 | mUserList.setAdapter(mUserListAdapter); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone; 2 | 3 | import android.content.Intent; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.EditText; 10 | 11 | import com.google.android.gms.tasks.OnCompleteListener; 12 | import com.google.android.gms.tasks.Task; 13 | import com.google.firebase.FirebaseApp; 14 | import com.google.firebase.FirebaseException; 15 | import com.google.firebase.auth.AuthResult; 16 | import com.google.firebase.auth.FirebaseAuth; 17 | import com.google.firebase.auth.FirebaseUser; 18 | import com.google.firebase.auth.PhoneAuthCredential; 19 | import com.google.firebase.auth.PhoneAuthProvider; 20 | import com.google.firebase.database.DataSnapshot; 21 | import com.google.firebase.database.DatabaseError; 22 | import com.google.firebase.database.DatabaseReference; 23 | import com.google.firebase.database.FirebaseDatabase; 24 | import com.google.firebase.database.ValueEventListener; 25 | 26 | import java.sql.Time; 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | import java.util.concurrent.TimeUnit; 30 | 31 | public class LoginActivity extends AppCompatActivity { 32 | 33 | private EditText mPhoneNumber, mCode; 34 | private Button mSend; 35 | 36 | private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks; 37 | 38 | String mVerificationId; 39 | 40 | @Override 41 | protected void onCreate(Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.activity_main); 44 | 45 | FirebaseApp.initializeApp(this); 46 | 47 | userIsLoggedIn(); 48 | 49 | mPhoneNumber = findViewById(R.id.phoneNumber); 50 | mCode = findViewById(R.id.code); 51 | 52 | mSend = findViewById(R.id.send); 53 | 54 | mSend.setOnClickListener(new View.OnClickListener() { 55 | @Override 56 | public void onClick(View v) { 57 | if(mVerificationId != null) 58 | verifyPhoneNumberWithCode(); 59 | else 60 | startPhoneNumberVerification(); 61 | } 62 | }); 63 | 64 | 65 | mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { 66 | @Override 67 | public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) { 68 | signInWithPhoneAuthCredential(phoneAuthCredential); 69 | } 70 | 71 | @Override 72 | public void onVerificationFailed(FirebaseException e) { 73 | } 74 | 75 | 76 | @Override 77 | public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) { 78 | super.onCodeSent(verificationId, forceResendingToken); 79 | 80 | mVerificationId = verificationId; 81 | mSend.setText("Verify Code"); 82 | } 83 | }; 84 | 85 | } 86 | 87 | private void verifyPhoneNumberWithCode(){ 88 | PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, mCode.getText().toString()); 89 | signInWithPhoneAuthCredential(credential); 90 | } 91 | 92 | private void signInWithPhoneAuthCredential(PhoneAuthCredential phoneAuthCredential) { 93 | FirebaseAuth.getInstance().signInWithCredential(phoneAuthCredential).addOnCompleteListener(this, new OnCompleteListener() { 94 | @Override 95 | public void onComplete(@NonNull Task task) { 96 | if(task.isSuccessful()){ 97 | 98 | final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); 99 | 100 | if(user != null){ 101 | final DatabaseReference mUserDB = FirebaseDatabase.getInstance().getReference().child("user").child(user.getUid()); 102 | mUserDB.addListenerForSingleValueEvent(new ValueEventListener() { 103 | @Override 104 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 105 | if(!dataSnapshot.exists()){ 106 | Map userMap = new HashMap<>(); 107 | userMap.put("phone", user.getPhoneNumber()); 108 | userMap.put("name", user.getPhoneNumber()); 109 | mUserDB.updateChildren(userMap); 110 | } 111 | userIsLoggedIn(); 112 | } 113 | 114 | @Override 115 | public void onCancelled(@NonNull DatabaseError databaseError) { 116 | 117 | } 118 | }); 119 | } 120 | 121 | } 122 | 123 | } 124 | }); 125 | } 126 | 127 | private void userIsLoggedIn() { 128 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); 129 | if(user != null){ 130 | startActivity(new Intent(getApplicationContext(), MainPageActivity.class)); 131 | finish(); 132 | return; 133 | } 134 | } 135 | 136 | private void startPhoneNumberVerification() { 137 | PhoneAuthProvider.getInstance().verifyPhoneNumber( 138 | mPhoneNumber.getText().toString(), 139 | 60, 140 | TimeUnit.SECONDS, 141 | this, 142 | mCallbacks); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/MainPageActivity.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone; 2 | 3 | import android.Manifest; 4 | import android.content.Intent; 5 | import android.os.Build; 6 | import android.support.annotation.NonNull; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import android.support.v7.widget.LinearLayoutManager; 10 | import android.support.v7.widget.RecyclerView; 11 | import android.view.View; 12 | import android.widget.Button; 13 | import android.widget.LinearLayout; 14 | 15 | import com.facebook.drawee.backends.pipeline.Fresco; 16 | import com.google.firebase.auth.FirebaseAuth; 17 | import com.google.firebase.database.DataSnapshot; 18 | import com.google.firebase.database.DatabaseError; 19 | import com.google.firebase.database.DatabaseReference; 20 | import com.google.firebase.database.FirebaseDatabase; 21 | import com.google.firebase.database.ValueEventListener; 22 | import com.onesignal.OneSignal; 23 | import com.simcoder.whatsappclone.Chat.ChatListAdapter; 24 | import com.simcoder.whatsappclone.Chat.ChatObject; 25 | import com.simcoder.whatsappclone.User.UserObject; 26 | import com.simcoder.whatsappclone.Utils.SendNotification; 27 | 28 | import java.util.ArrayList; 29 | 30 | public class MainPageActivity extends AppCompatActivity { 31 | 32 | private RecyclerView mChatList; 33 | private RecyclerView.Adapter mChatListAdapter; 34 | private RecyclerView.LayoutManager mChatListLayoutManager; 35 | 36 | ArrayList chatList; 37 | 38 | @Override 39 | protected void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_main_page); 42 | 43 | OneSignal.startInit(this).init(); 44 | OneSignal.setSubscription(true); 45 | OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() { 46 | @Override 47 | public void idsAvailable(String userId, String registrationId) { 48 | FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("notificationKey").setValue(userId); 49 | } 50 | }); 51 | OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification); 52 | 53 | Fresco.initialize(this); 54 | 55 | Button mLogout = findViewById(R.id.logout); 56 | Button mFindUser = findViewById(R.id.findUser); 57 | mFindUser.setOnClickListener(new View.OnClickListener() { 58 | @Override 59 | public void onClick(View v) { 60 | startActivity(new Intent(getApplicationContext(), FindUserActivity.class)); 61 | } 62 | }); 63 | mLogout.setOnClickListener(new View.OnClickListener() { 64 | @Override 65 | public void onClick(View v) { 66 | OneSignal.setSubscription(false); 67 | FirebaseAuth.getInstance().signOut(); 68 | Intent intent = new Intent(getApplicationContext(), LoginActivity.class); 69 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 70 | startActivity(intent); 71 | finish(); 72 | return; 73 | } 74 | }); 75 | 76 | getPermissions(); 77 | initializeRecyclerView(); 78 | getUserChatList(); 79 | } 80 | 81 | private void getUserChatList(){ 82 | DatabaseReference mUserChatDB = FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("chat"); 83 | 84 | mUserChatDB.addValueEventListener(new ValueEventListener() { 85 | @Override 86 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 87 | if(dataSnapshot.exists()){ 88 | for (DataSnapshot childSnapshot : dataSnapshot.getChildren()){ 89 | ChatObject mChat = new ChatObject(childSnapshot.getKey()); 90 | boolean exists = false; 91 | for (ChatObject mChatIterator : chatList){ 92 | if (mChatIterator.getChatId().equals(mChat.getChatId())) 93 | exists = true; 94 | } 95 | if (exists) 96 | continue; 97 | chatList.add(mChat); 98 | getChatData(mChat.getChatId()); 99 | } 100 | } 101 | } 102 | 103 | @Override 104 | public void onCancelled(@NonNull DatabaseError databaseError) { 105 | 106 | } 107 | }); 108 | } 109 | 110 | private void getChatData(String chatId) { 111 | DatabaseReference mChatDB = FirebaseDatabase.getInstance().getReference().child("chat").child(chatId).child("info"); 112 | mChatDB.addValueEventListener(new ValueEventListener() { 113 | @Override 114 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 115 | if(dataSnapshot.exists()){ 116 | String chatId = ""; 117 | 118 | if(dataSnapshot.child("id").getValue() != null) 119 | chatId = dataSnapshot.child("id").getValue().toString(); 120 | 121 | for(DataSnapshot userSnapshot : dataSnapshot.child("users").getChildren()){ 122 | for(ChatObject mChat : chatList){ 123 | if(mChat.getChatId().equals(chatId)){ 124 | UserObject mUser = new UserObject(userSnapshot.getKey()); 125 | mChat.addUserToArrayList(mUser); 126 | getUserData(mUser); 127 | } 128 | } 129 | } 130 | } 131 | } 132 | 133 | @Override 134 | public void onCancelled(@NonNull DatabaseError databaseError) { 135 | 136 | } 137 | }); 138 | 139 | } 140 | 141 | private void getUserData(UserObject mUser) { 142 | DatabaseReference mUserDb = FirebaseDatabase.getInstance().getReference().child("user").child(mUser.getUid()); 143 | mUserDb.addValueEventListener(new ValueEventListener() { 144 | @Override 145 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 146 | UserObject mUser = new UserObject(dataSnapshot.getKey()); 147 | 148 | if(dataSnapshot.child("notificationKey").getValue() != null) 149 | mUser.setNotificationKey(dataSnapshot.child("notificationKey").getValue().toString()); 150 | 151 | for(ChatObject mChat : chatList){ 152 | for (UserObject mUserIt : mChat.getUserObjectArrayList()){ 153 | if(mUserIt.getUid().equals(mUser.getUid())){ 154 | mUserIt.setNotificationKey(mUser.getNotificationKey()); 155 | } 156 | } 157 | } 158 | mChatListAdapter.notifyDataSetChanged(); 159 | } 160 | 161 | @Override 162 | public void onCancelled(@NonNull DatabaseError databaseError) { 163 | 164 | } 165 | }); 166 | } 167 | 168 | private void initializeRecyclerView() { 169 | chatList = new ArrayList<>(); 170 | mChatList= findViewById(R.id.chatList); 171 | mChatList.setNestedScrollingEnabled(false); 172 | mChatList.setHasFixedSize(false); 173 | mChatListLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayout.VERTICAL, false); 174 | mChatList.setLayoutManager(mChatListLayoutManager); 175 | mChatListAdapter = new ChatListAdapter(chatList); 176 | mChatList.setAdapter(mChatListAdapter); 177 | } 178 | 179 | private void getPermissions() { 180 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 181 | requestPermissions(new String[]{Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS}, 1); 182 | } 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/User/UserListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.User; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.CheckBox; 10 | import android.widget.CompoundButton; 11 | import android.widget.LinearLayout; 12 | import android.widget.TextView; 13 | 14 | import com.google.firebase.auth.FirebaseAuth; 15 | import com.google.firebase.database.DatabaseReference; 16 | import com.google.firebase.database.FirebaseDatabase; 17 | import com.simcoder.whatsappclone.R; 18 | 19 | import java.util.ArrayList; 20 | import java.util.HashMap; 21 | 22 | public class UserListAdapter extends RecyclerView.Adapter { 23 | 24 | ArrayList userList; 25 | 26 | public UserListAdapter(ArrayList userList){ 27 | this.userList = userList; 28 | } 29 | 30 | @NonNull 31 | @Override 32 | public UserListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 33 | View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_user, null, false); 34 | RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 35 | layoutView.setLayoutParams(lp); 36 | 37 | UserListViewHolder rcv = new UserListViewHolder(layoutView); 38 | return rcv; 39 | } 40 | 41 | @Override 42 | public void onBindViewHolder(@NonNull final UserListViewHolder holder, final int position) { 43 | holder.mName.setText(userList.get(position).getName()); 44 | holder.mPhone.setText(userList.get(position).getPhone()); 45 | 46 | holder.mAdd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 47 | @Override 48 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 49 | userList.get(holder.getAdapterPosition()).setSelected(isChecked); 50 | } 51 | }); 52 | } 53 | 54 | @Override 55 | public int getItemCount() { 56 | return userList.size(); 57 | } 58 | 59 | 60 | 61 | class UserListViewHolder extends RecyclerView.ViewHolder{ 62 | TextView mName, mPhone; 63 | LinearLayout mLayout; 64 | CheckBox mAdd; 65 | UserListViewHolder(View view){ 66 | super(view); 67 | mName = view.findViewById(R.id.name); 68 | mPhone = view.findViewById(R.id.phone); 69 | mAdd = view.findViewById(R.id.add); 70 | mLayout = view.findViewById(R.id.layout); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/User/UserObject.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.User; 2 | 3 | import java.io.Serializable; 4 | 5 | public class UserObject implements Serializable { 6 | 7 | private String uid, 8 | name, 9 | phone, 10 | notificationKey; 11 | 12 | private Boolean selected = false; 13 | 14 | public UserObject(String uid){ 15 | this.uid = uid; 16 | } 17 | public UserObject(String uid, String name, String phone){ 18 | this.uid = uid; 19 | this.name = name; 20 | this.phone = phone; 21 | } 22 | 23 | public String getUid() { 24 | return uid; 25 | } 26 | public String getPhone() { 27 | return phone; 28 | } 29 | public String getName() { 30 | return name; 31 | } 32 | public String getNotificationKey() { 33 | return notificationKey; 34 | } 35 | public Boolean getSelected() { 36 | return selected; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | public void setNotificationKey(String notificationKey) { 43 | this.notificationKey = notificationKey; 44 | } 45 | public void setSelected(Boolean selected) { 46 | this.selected = selected; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Utils/CountryToPhonePrefix.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class CountryToPhonePrefix { 7 | public static String getPhone(String code) { 8 | return country2phone.get(code.toUpperCase()); 9 | } 10 | public static Map getAll(){ 11 | return country2phone; 12 | } 13 | private static Map country2phone = new HashMap(); 14 | static { 15 | country2phone.put("AF", "+93"); 16 | country2phone.put("AL", "+355"); 17 | country2phone.put("DZ", "+213"); 18 | country2phone.put("AD", "+376"); 19 | country2phone.put("AO", "+244"); 20 | country2phone.put("AG", "+1-268"); 21 | country2phone.put("AR", "+54"); 22 | country2phone.put("AM", "+374"); 23 | country2phone.put("AU", "+61"); 24 | country2phone.put("AT", "+43"); 25 | country2phone.put("AZ", "+994"); 26 | country2phone.put("BS", "+1-242"); 27 | country2phone.put("BH", "+973"); 28 | country2phone.put("BD", "+880"); 29 | country2phone.put("BB", "+1-246"); 30 | country2phone.put("BY", "+375"); 31 | country2phone.put("BE", "+32"); 32 | country2phone.put("BZ", "+501"); 33 | country2phone.put("BJ", "+229"); 34 | country2phone.put("BT", "+975"); 35 | country2phone.put("BO", "+591"); 36 | country2phone.put("BA", "+387"); 37 | country2phone.put("BW", "+267"); 38 | country2phone.put("BR", "+55"); 39 | country2phone.put("BN", "+673"); 40 | country2phone.put("BG", "+359"); 41 | country2phone.put("BF", "+226"); 42 | country2phone.put("BI", "+257"); 43 | country2phone.put("KH", "+855"); 44 | country2phone.put("CM", "+237"); 45 | country2phone.put("CA", "+1"); 46 | country2phone.put("CV", "+238"); 47 | country2phone.put("CF", "+236"); 48 | country2phone.put("TD", "+235"); 49 | country2phone.put("CL", "+56"); 50 | country2phone.put("CN", "+86"); 51 | country2phone.put("CO", "+57"); 52 | country2phone.put("KM", "+269"); 53 | country2phone.put("CD", "+243"); 54 | country2phone.put("CG", "+242"); 55 | country2phone.put("CR", "+506"); 56 | country2phone.put("CI", "+225"); 57 | country2phone.put("HR", "+385"); 58 | country2phone.put("CU", "+53"); 59 | country2phone.put("CY", "+357"); 60 | country2phone.put("CZ", "+420"); 61 | country2phone.put("DK", "+45"); 62 | country2phone.put("DJ", "+253"); 63 | country2phone.put("DM", "+1-767"); 64 | country2phone.put("DO", "+1-809and1-829"); 65 | country2phone.put("EC", "+593"); 66 | country2phone.put("EG", "+20"); 67 | country2phone.put("SV", "+503"); 68 | country2phone.put("GQ", "+240"); 69 | country2phone.put("ER", "+291"); 70 | country2phone.put("EE", "+372"); 71 | country2phone.put("ET", "+251"); 72 | country2phone.put("FJ", "+679"); 73 | country2phone.put("FI", "+358"); 74 | country2phone.put("FR", "+33"); 75 | country2phone.put("GA", "+241"); 76 | country2phone.put("GM", "+220"); 77 | country2phone.put("GE", "+995"); 78 | country2phone.put("DE", "+49"); 79 | country2phone.put("GH", "+233"); 80 | country2phone.put("GR", "+30"); 81 | country2phone.put("GD", "+1-473"); 82 | country2phone.put("GT", "+502"); 83 | country2phone.put("GN", "+224"); 84 | country2phone.put("GW", "+245"); 85 | country2phone.put("GY", "+592"); 86 | country2phone.put("HT", "+509"); 87 | country2phone.put("HN", "+504"); 88 | country2phone.put("HU", "+36"); 89 | country2phone.put("IS", "+354"); 90 | country2phone.put("IN", "+91"); 91 | country2phone.put("ID", "+62"); 92 | country2phone.put("IR", "+98"); 93 | country2phone.put("IQ", "+964"); 94 | country2phone.put("IE", "+353"); 95 | country2phone.put("IL", "+972"); 96 | country2phone.put("IT", "+39"); 97 | country2phone.put("JM", "+1-876"); 98 | country2phone.put("JP", "+81"); 99 | country2phone.put("JO", "+962"); 100 | country2phone.put("KZ", "+7"); 101 | country2phone.put("KE", "+254"); 102 | country2phone.put("KI", "+686"); 103 | country2phone.put("KP", "+850"); 104 | country2phone.put("KR", "+82"); 105 | country2phone.put("KW", "+965"); 106 | country2phone.put("KG", "+996"); 107 | country2phone.put("LA", "+856"); 108 | country2phone.put("LV", "+371"); 109 | country2phone.put("LB", "+961"); 110 | country2phone.put("LS", "+266"); 111 | country2phone.put("LR", "+231"); 112 | country2phone.put("LY", "+218"); 113 | country2phone.put("LI", "+423"); 114 | country2phone.put("LT", "+370"); 115 | country2phone.put("LU", "+352"); 116 | country2phone.put("MK", "+389"); 117 | country2phone.put("MG", "+261"); 118 | country2phone.put("MW", "+265"); 119 | country2phone.put("MY", "+60"); 120 | country2phone.put("MV", "+960"); 121 | country2phone.put("ML", "+223"); 122 | country2phone.put("MT", "+356"); 123 | country2phone.put("MH", "+692"); 124 | country2phone.put("MR", "+222"); 125 | country2phone.put("MU", "+230"); 126 | country2phone.put("MX", "+52"); 127 | country2phone.put("FM", "+691"); 128 | country2phone.put("MD", "+373"); 129 | country2phone.put("MC", "+377"); 130 | country2phone.put("MN", "+976"); 131 | country2phone.put("ME", "+382"); 132 | country2phone.put("MA", "+212"); 133 | country2phone.put("MZ", "+258"); 134 | country2phone.put("MM", "+95"); 135 | country2phone.put("NA", "+264"); 136 | country2phone.put("NR", "+674"); 137 | country2phone.put("NP", "+977"); 138 | country2phone.put("NL", "+31"); 139 | country2phone.put("NZ", "+64"); 140 | country2phone.put("NI", "+505"); 141 | country2phone.put("NE", "+227"); 142 | country2phone.put("NG", "+234"); 143 | country2phone.put("NO", "+47"); 144 | country2phone.put("OM", "+968"); 145 | country2phone.put("PK", "+92"); 146 | country2phone.put("PW", "+680"); 147 | country2phone.put("PA", "+507"); 148 | country2phone.put("PG", "+675"); 149 | country2phone.put("PY", "+595"); 150 | country2phone.put("PE", "+51"); 151 | country2phone.put("PH", "+63"); 152 | country2phone.put("PL", "+48"); 153 | country2phone.put("PT", "+351"); 154 | country2phone.put("QA", "+974"); 155 | country2phone.put("RO", "+40"); 156 | country2phone.put("RU", "+7"); 157 | country2phone.put("RW", "+250"); 158 | country2phone.put("KN", "+1-869"); 159 | country2phone.put("LC", "+1-758"); 160 | country2phone.put("VC", "+1-784"); 161 | country2phone.put("WS", "+685"); 162 | country2phone.put("SM", "+378"); 163 | country2phone.put("ST", "+239"); 164 | country2phone.put("SA", "+966"); 165 | country2phone.put("SN", "+221"); 166 | country2phone.put("RS", "+381"); 167 | country2phone.put("SC", "+248"); 168 | country2phone.put("SL", "+232"); 169 | country2phone.put("SG", "+65"); 170 | country2phone.put("SK", "+421"); 171 | country2phone.put("SI", "+386"); 172 | country2phone.put("SB", "+677"); 173 | country2phone.put("SO", "+252"); 174 | country2phone.put("ZA", "+27"); 175 | country2phone.put("ES", "+34"); 176 | country2phone.put("LK", "+94"); 177 | country2phone.put("SD", "+249"); 178 | country2phone.put("SR", "+597"); 179 | country2phone.put("SZ", "+268"); 180 | country2phone.put("SE", "+46"); 181 | country2phone.put("CH", "+41"); 182 | country2phone.put("SY", "+963"); 183 | country2phone.put("TJ", "+992"); 184 | country2phone.put("TZ", "+255"); 185 | country2phone.put("TH", "+66"); 186 | country2phone.put("TL", "+670"); 187 | country2phone.put("TG", "+228"); 188 | country2phone.put("TO", "+676"); 189 | country2phone.put("TT", "+1-868"); 190 | country2phone.put("TN", "+216"); 191 | country2phone.put("TR", "+90"); 192 | country2phone.put("TM", "+993"); 193 | country2phone.put("TV", "+688"); 194 | country2phone.put("UG", "+256"); 195 | country2phone.put("UA", "+380"); 196 | country2phone.put("AE", "+971"); 197 | country2phone.put("GB", "+44"); 198 | country2phone.put("US", "+1"); 199 | country2phone.put("UY", "+598"); 200 | country2phone.put("UZ", "+998"); 201 | country2phone.put("VU", "+678"); 202 | country2phone.put("VA", "+379"); 203 | country2phone.put("VE", "+58"); 204 | country2phone.put("VN", "+84"); 205 | country2phone.put("YE", "+967"); 206 | country2phone.put("ZM", "+260"); 207 | country2phone.put("ZW", "+263"); 208 | country2phone.put("GE", "+995"); 209 | country2phone.put("TW", "+886"); 210 | country2phone.put("AZ", "+374-97"); 211 | country2phone.put("CY", "+90-392"); 212 | country2phone.put("MD", "+373-533"); 213 | country2phone.put("SO", "+252"); 214 | country2phone.put("GE", "+995"); 215 | country2phone.put("CX", "+61"); 216 | country2phone.put("CC", "+61"); 217 | country2phone.put("NF", "+672"); 218 | country2phone.put("NC", "+687"); 219 | country2phone.put("PF", "+689"); 220 | country2phone.put("YT", "+262"); 221 | country2phone.put("GP", "+590"); 222 | country2phone.put("GP", "+590"); 223 | country2phone.put("PM", "+508"); 224 | country2phone.put("WF", "+681"); 225 | country2phone.put("CK", "+682"); 226 | country2phone.put("NU", "+683"); 227 | country2phone.put("TK", "+690"); 228 | country2phone.put("GG", "+44"); 229 | country2phone.put("IM", "+44"); 230 | country2phone.put("JE", "+44"); 231 | country2phone.put("AI", "+1-264"); 232 | country2phone.put("BM", "+1-441"); 233 | country2phone.put("IO", "+246"); 234 | country2phone.put("", "+357"); 235 | country2phone.put("VG", "+1-284"); 236 | country2phone.put("KY", "+1-345"); 237 | country2phone.put("FK", "+500"); 238 | country2phone.put("GI", "+350"); 239 | country2phone.put("MS", "+1-664"); 240 | country2phone.put("SH", "+290"); 241 | country2phone.put("TC", "+1-649"); 242 | country2phone.put("MP", "+1-670"); 243 | country2phone.put("PR", "+1-787and1-939"); 244 | country2phone.put("AS", "+1-684"); 245 | country2phone.put("GU", "+1-671"); 246 | country2phone.put("VI", "+1-340"); 247 | country2phone.put("HK", "+852"); 248 | country2phone.put("MO", "+853"); 249 | country2phone.put("FO", "+298"); 250 | country2phone.put("GL", "+299"); 251 | country2phone.put("GF", "+594"); 252 | country2phone.put("GP", "+590"); 253 | country2phone.put("MQ", "+596"); 254 | country2phone.put("RE", "+262"); 255 | country2phone.put("AX", "+358-18"); 256 | country2phone.put("AW", "+297"); 257 | country2phone.put("AN", "+599"); 258 | country2phone.put("SJ", "+47"); 259 | country2phone.put("AC", "+247"); 260 | country2phone.put("TA", "+290"); 261 | country2phone.put("CS", "+381"); 262 | country2phone.put("PS", "+970"); 263 | country2phone.put("EH", "+212"); 264 | } 265 | } -------------------------------------------------------------------------------- /app/src/main/java/com/simcoder/whatsappclone/Utils/SendNotification.java: -------------------------------------------------------------------------------- 1 | package com.simcoder.whatsappclone.Utils; 2 | 3 | import com.onesignal.OneSignal; 4 | 5 | import org.json.JSONException; 6 | import org.json.JSONObject; 7 | 8 | public class SendNotification { 9 | 10 | public SendNotification(String message, String heading, String notificationKey){ 11 | 12 | try { 13 | JSONObject notificationContent = new JSONObject( 14 | "{'contents':{'en':'" + message + "'},"+ 15 | "'include_player_ids':['" + notificationKey + "']," + 16 | "'headings':{'en': '" + heading + "'}}"); 17 | OneSignal.postNotification(notificationContent, null); 18 | } catch (JSONException e) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_chat.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 26 | 27 | 31 | 32 | 38 |