├── .github └── FUNDING.yml ├── .gradle ├── 4.10.1 │ ├── fileChanges │ │ └── last-build.bin │ ├── fileContent │ │ └── fileContent.lock │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── gc.properties │ ├── javaCompile │ │ ├── classAnalysis.bin │ │ ├── javaCompile.lock │ │ └── taskHistory.bin │ └── taskHistory │ │ ├── taskHistory.bin │ │ └── taskHistory.lock └── buildOutputCleanup │ ├── buildOutputCleanup.lock │ ├── cache.properties │ └── outputFiles.bin ├── .idea ├── assetWizardSettings.xml ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── libraries │ ├── Gradle__android_arch_core_common_1_1_1_jar.xml │ ├── Gradle__android_arch_core_runtime_1_1_1_aar.xml │ ├── Gradle__android_arch_lifecycle_common_1_1_1_jar.xml │ ├── Gradle__android_arch_lifecycle_livedata_1_1_1_aar.xml │ ├── Gradle__android_arch_lifecycle_livedata_core_1_1_1_aar.xml │ ├── Gradle__android_arch_lifecycle_runtime_1_1_1_aar.xml │ ├── Gradle__android_arch_lifecycle_viewmodel_1_1_1_aar.xml │ ├── Gradle__com_android_support_animated_vector_drawable_28_0_0_aar.xml │ ├── Gradle__com_android_support_appcompat_v7_28_0_0_aar.xml │ ├── Gradle__com_android_support_asynclayoutinflater_28_0_0_aar.xml │ ├── Gradle__com_android_support_cardview_v7_28_0_0_aar.xml │ ├── Gradle__com_android_support_collections_28_0_0_jar.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_1_1_3_aar.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_solver_1_1_3_jar.xml │ ├── Gradle__com_android_support_coordinatorlayout_28_0_0_aar.xml │ ├── Gradle__com_android_support_cursoradapter_28_0_0_aar.xml │ ├── Gradle__com_android_support_customview_28_0_0_aar.xml │ ├── Gradle__com_android_support_design_28_0_0_aar.xml │ ├── Gradle__com_android_support_documentfile_28_0_0_aar.xml │ ├── Gradle__com_android_support_drawerlayout_28_0_0_aar.xml │ ├── Gradle__com_android_support_interpolator_28_0_0_aar.xml │ ├── Gradle__com_android_support_loader_28_0_0_aar.xml │ ├── Gradle__com_android_support_localbroadcastmanager_28_0_0_aar.xml │ ├── Gradle__com_android_support_print_28_0_0_aar.xml │ ├── Gradle__com_android_support_recyclerview_v7_28_0_0_aar.xml │ ├── Gradle__com_android_support_slidingpanelayout_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_annotations_28_0_0_jar.xml │ ├── Gradle__com_android_support_support_compat_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_core_ui_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_core_utils_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_fragment_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_media_compat_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_v4_28_0_0_aar.xml │ ├── Gradle__com_android_support_support_vector_drawable_28_0_0_aar.xml │ ├── Gradle__com_android_support_swiperefreshlayout_28_0_0_aar.xml │ ├── Gradle__com_android_support_test_espresso_espresso_core_3_0_2_aar.xml │ ├── Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2_aar.xml │ ├── Gradle__com_android_support_test_monitor_1_0_2_aar.xml │ ├── Gradle__com_android_support_test_runner_1_0_2_aar.xml │ ├── Gradle__com_android_support_transition_28_0_0_aar.xml │ ├── Gradle__com_android_support_versionedparcelable_28_0_0_aar.xml │ ├── Gradle__com_android_support_viewpager_28_0_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_ads_identifier_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_base_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_basement_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_clearcut_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_flags_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_measurement_base_16_0_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_phenotype_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_stats_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_tasks_15_0_1_aar.xml │ ├── Gradle__com_google_android_gms_play_services_vision_15_0_2_aar.xml │ ├── Gradle__com_google_android_gms_play_services_vision_common_15_0_2_aar.xml │ ├── Gradle__com_google_android_gms_play_services_vision_image_label_15_0_0_aar.xml │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml │ ├── Gradle__com_google_code_gson_gson_2_7_jar.xml │ ├── Gradle__com_google_firebase_firebase_analytics_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_analytics_impl_16_1_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_auth_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_auth_interop_16_0_0_aar.xml │ ├── Gradle__com_google_firebase_firebase_common_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_core_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_database_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_database_collection_15_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_database_connection_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_iid_17_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_iid_interop_16_0_0_aar.xml │ ├── Gradle__com_google_firebase_firebase_measurement_connector_16_0_0_aar.xml │ ├── Gradle__com_google_firebase_firebase_measurement_connector_impl_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_messaging_17_3_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_ml_common_16_0_0_aar.xml │ ├── Gradle__com_google_firebase_firebase_ml_vision_16_0_0_aar.xml │ ├── Gradle__com_google_firebase_firebase_storage_16_0_1_aar.xml │ ├── Gradle__com_google_firebase_firebase_storage_common_16_0_1_aar.xml │ ├── Gradle__com_nineoldandroids_library_2_4_0_jar.xml │ ├── Gradle__com_rengwuxian_materialedittext_library_2_1_4_aar.xml │ ├── Gradle__com_squareup_javawriter_2_1_1_jar.xml │ ├── Gradle__com_squareup_okhttp3_okhttp_3_8_0_jar.xml │ ├── Gradle__com_squareup_okio_okio_1_13_0_jar.xml │ ├── Gradle__com_squareup_retrofit2_converter_gson_2_3_0_jar.xml │ ├── Gradle__com_squareup_retrofit2_retrofit_2_3_0_jar.xml │ ├── Gradle__de_hdodenhof_circleimageview_2_2_0_aar.xml │ ├── Gradle__javax_inject_javax_inject_1_jar.xml │ ├── Gradle__junit_junit_4_12_jar.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 ├── LICENSE ├── README.md ├── Textchat.iml ├── app ├── build.gradle ├── google-services.json └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── example │ │ └── mohaiminur │ │ └── com │ │ └── textchat │ │ ├── Adapter │ │ ├── MessageAdapter.java │ │ └── UserAdapter.java │ │ ├── CountryToPhonePrefix.java │ │ ├── Fragments │ │ ├── APIService.java │ │ ├── ChatsFragment.java │ │ ├── ProfileFragment.java │ │ └── UsersFragment.java │ │ ├── LoginActivity.java │ │ ├── MainActivity.java │ │ ├── MessageActivity.java │ │ ├── Model │ │ ├── Chat.java │ │ ├── Chatlist.java │ │ ├── User.java │ │ └── UserObject.java │ │ ├── Notifications │ │ ├── Client.java │ │ ├── Data.java │ │ ├── MyFirebaseIdService.java │ │ ├── MyFirebaseMessaging.java │ │ ├── MyResponse.java │ │ ├── OreoNotification.java │ │ ├── Sender.java │ │ └── Token.java │ │ └── StartActivity.java │ └── res │ ├── drawable-anydpi │ └── ic_action_name.xml │ ├── drawable-hdpi │ ├── camera.png │ ├── galleryy.png │ ├── ic_action_name.png │ └── onee.png │ ├── drawable-mdpi │ └── ic_action_name.png │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable-xhdpi │ └── ic_action_name.png │ ├── drawable-xxhdpi │ └── ic_action_name.png │ ├── drawable │ ├── background_left.xml │ ├── ic_launcher_background.xml │ └── one.png │ ├── layout │ ├── activity_login.xml │ ├── activity_main.xml │ ├── activity_message.xml │ ├── activity_start.xml │ ├── chat_item_left.xml │ ├── chat_item_right.xml │ ├── fragment_chats.xml │ ├── fragment_profile.xml │ ├── fragment_users.xml │ └── user_item.xml │ ├── menu │ └── menu.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── build └── intermediates │ └── lint-cache │ ├── maven.google │ ├── com │ │ ├── android │ │ │ └── support │ │ │ │ ├── constraint │ │ │ │ └── group-index.xml │ │ │ │ ├── group-index.xml │ │ │ │ └── test │ │ │ │ ├── espresso │ │ │ │ └── group-index.xml │ │ │ │ └── group-index.xml │ │ └── google │ │ │ └── firebase │ │ │ └── group-index.xml │ └── master-index.xml │ └── sdk-registry.xml │ └── sdk-registry.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.gradle/4.10.1/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/4.10.1/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/gc.properties -------------------------------------------------------------------------------- /.gradle/4.10.1/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/4.10.1/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Sat Mar 16 02:33:52 BDT 2019 2 | gradle.version=4.10.1 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.idea/assetWizardSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 134 | 135 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/.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_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_core_runtime_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_common_1_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_livedata_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_livedata_core_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_viewmodel_1_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_animated_vector_drawable_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_appcompat_v7_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_asynclayoutinflater_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_cardview_v7_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_collections_28_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_1_1_3_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_solver_1_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_coordinatorlayout_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_cursoradapter_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_customview_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_design_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_documentfile_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_drawerlayout_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_interpolator_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_loader_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_localbroadcastmanager_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_print_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_recyclerview_v7_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_slidingpanelayout_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_annotations_28_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_compat_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_ui_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_utils_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_fragment_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_media_compat_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_v4_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_vector_drawable_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_swiperefreshlayout_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_3_0_2_aar.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_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_monitor_1_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_runner_1_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_transition_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_versionedparcelable_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_viewpager_28_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_ads_identifier_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_base_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_basement_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_clearcut_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_flags_15_0_1_aar.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_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_phenotype_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_stats_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_tasks_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_vision_15_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_vision_common_15_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_vision_image_label_15_0_0_aar.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_code_gson_gson_2_7_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_analytics_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_analytics_impl_16_1_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_auth_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_auth_interop_16_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_common_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_core_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_collection_15_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_database_connection_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_iid_17_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_iid_interop_16_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_measurement_connector_16_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_measurement_connector_impl_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_messaging_17_3_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_ml_common_16_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_ml_vision_16_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_storage_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_firebase_firebase_storage_common_16_0_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_rengwuxian_materialedittext_library_2_1_4_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.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__com_squareup_okhttp3_okhttp_3_8_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__de_hdodenhof_circleimageview_2_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.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__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 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Md. Moahiminur Rahaman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Textchat.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.example.mohaiminur.com.textchat" 7 | minSdkVersion 17 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | 20 | allprojects { 21 | gradle.projectsEvaluated { 22 | tasks.withType(JavaCompile) { 23 | options.compilerArgs << "-Xlint:deprecation" 24 | } 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | //noinspection GradleCompatible 32 | implementation 'com.android.support:appcompat-v7:28.0.0' 33 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 34 | implementation 'com.android.support:support-v4:28.0.0' 35 | implementation 'com.android.support:design:28.0.0' 36 | implementation 'com.google.firebase:firebase-auth:16.0.1' 37 | implementation 'com.google.firebase:firebase-database:16.0.1' 38 | implementation 'com.google.firebase:firebase-storage:16.0.1' 39 | implementation 'com.google.firebase:firebase-core:16.0.1' 40 | implementation 'com.google.firebase:firebase-ml-vision:16.0.0' 41 | 42 | 43 | implementation 'com.android.support:cardview-v7:28.0.0' 44 | implementation 'com.rengwuxian.materialedittext:library:2.1.4' 45 | //add this library and this 46 | implementation 'de.hdodenhof:circleimageview:2.2.0' 47 | implementation 'com.github.bumptech.glide:glide:4.8.0' 48 | 49 | //add these libraries 50 | implementation 'com.squareup.retrofit2:retrofit:2.3.0' 51 | implementation 'com.squareup.retrofit2:converter-gson:2.3.0' 52 | implementation 'com.google.firebase:firebase-messaging:17.3.1' 53 | 54 | testImplementation 'junit:junit:4.12' 55 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 57 | 58 | } 59 | apply plugin: 'com.google.gms.google-services' 60 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "814710260366", 4 | "firebase_url": "https://textchat-95daa.firebaseio.com", 5 | "project_id": "textchat-95daa", 6 | "storage_bucket": "textchat-95daa.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:814710260366:android:71f0958877aa40de", 12 | "android_client_info": { 13 | "package_name": "com.example.mohaiminur.com.textchat" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "814710260366-ov17jbg3l692rrd1j0u8vpskv67ca78o.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.example.mohaiminur.com.textchat", 22 | "certificate_hash": "28978fb2916124273b63c3f6252e2ef5f630171f" 23 | } 24 | }, 25 | { 26 | "client_id": "814710260366-on0b2drmbodjljhqhebusdb8t8m74clj.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyBFvN3WiVq0yCl1RbZq4JYojckh6W_fwck" 33 | } 34 | ], 35 | "services": { 36 | "analytics_service": { 37 | "status": 1 38 | }, 39 | "appinvite_service": { 40 | "status": 2, 41 | "other_platform_oauth_client": [ 42 | { 43 | "client_id": "814710260366-on0b2drmbodjljhqhebusdb8t8m74clj.apps.googleusercontent.com", 44 | "client_type": 3 45 | } 46 | ] 47 | }, 48 | "ads_service": { 49 | "status": 2 50 | } 51 | } 52 | } 53 | ], 54 | "configuration_version": "1" 55 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Adapter/MessageAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Adapter; 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.ImageView; 10 | import android.widget.TextView; 11 | import com.bumptech.glide.Glide; 12 | import com.google.firebase.auth.FirebaseAuth; 13 | import com.google.firebase.auth.FirebaseUser; 14 | import com.example.mohaiminur.com.textchat.Model.Chat; 15 | import com.example.mohaiminur.com.textchat.R; 16 | 17 | import java.util.List; 18 | 19 | public class MessageAdapter extends RecyclerView.Adapter { 20 | 21 | public static final int MSG_TYPE_LEFT = 0; 22 | public static final int MSG_TYPE_RIGHT = 1; 23 | 24 | private Context mContext; 25 | private List mChat; 26 | private String imageurl; 27 | 28 | FirebaseUser fuser; 29 | 30 | public MessageAdapter(Context mContext, List mChat, String imageurl){ 31 | this.mChat = mChat; 32 | this.mContext = mContext; 33 | this.imageurl = imageurl; 34 | } 35 | 36 | @NonNull 37 | @Override 38 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 39 | if (viewType == MSG_TYPE_RIGHT) { 40 | View view = LayoutInflater.from(mContext).inflate(R.layout.chat_item_right, parent, false); 41 | return new ViewHolder(view); 42 | } else { 43 | View view = LayoutInflater.from(mContext).inflate(R.layout.chat_item_left, parent, false); 44 | return new ViewHolder(view); 45 | } 46 | } 47 | 48 | @Override 49 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) { 50 | 51 | Chat chat = mChat.get(position); 52 | 53 | holder.show_message.setText(chat.getMessage()); 54 | 55 | if (imageurl.equals("default")){ 56 | holder.profile_image.setImageResource(R.mipmap.ic_launcher); 57 | } else { 58 | Glide.with(mContext).load(imageurl).into(holder.profile_image); 59 | } 60 | 61 | if (position == mChat.size()-1){ 62 | if (chat.isIsseen()){ 63 | holder.txt_seen.setText("Seen"); 64 | } else { 65 | holder.txt_seen.setText("Delivered"); 66 | } 67 | } else { 68 | holder.txt_seen.setVisibility(View.GONE); 69 | } 70 | 71 | } 72 | 73 | @Override 74 | public int getItemCount() { 75 | return mChat.size(); 76 | } 77 | 78 | public class ViewHolder extends RecyclerView.ViewHolder{ 79 | 80 | public TextView show_message; 81 | public ImageView profile_image; 82 | public TextView txt_seen; 83 | 84 | public ViewHolder(View itemView) { 85 | super(itemView); 86 | 87 | show_message = itemView.findViewById(R.id.show_message); 88 | profile_image = itemView.findViewById(R.id.profile_image); 89 | txt_seen = itemView.findViewById(R.id.txt_seen); 90 | } 91 | } 92 | 93 | @Override 94 | public int getItemViewType(int position) { 95 | fuser = FirebaseAuth.getInstance().getCurrentUser(); 96 | if (mChat.get(position).getSender().equals(fuser.getUid())){ 97 | return MSG_TYPE_RIGHT; 98 | } else { 99 | return MSG_TYPE_LEFT; 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Adapter/UserAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 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 | import android.widget.TextView; 12 | 13 | import com.bumptech.glide.Glide; 14 | import com.google.firebase.auth.FirebaseAuth; 15 | import com.google.firebase.auth.FirebaseUser; 16 | import com.google.firebase.database.DataSnapshot; 17 | import com.google.firebase.database.DatabaseError; 18 | import com.google.firebase.database.DatabaseReference; 19 | import com.google.firebase.database.FirebaseDatabase; 20 | import com.google.firebase.database.ValueEventListener; 21 | import com.example.mohaiminur.com.textchat.MessageActivity; 22 | import com.example.mohaiminur.com.textchat.Model.Chat; 23 | import com.example.mohaiminur.com.textchat.Model.User; 24 | import com.example.mohaiminur.com.textchat.R; 25 | 26 | import java.util.List; 27 | 28 | public class UserAdapter extends RecyclerView.Adapter { 29 | 30 | private Context mContext; 31 | private List mUsers; 32 | private boolean ischat; 33 | 34 | String theLastMessage; 35 | 36 | public UserAdapter(Context mContext, List mUsers, boolean ischat){ 37 | this.mUsers = mUsers; 38 | this.mContext = mContext; 39 | this.ischat = ischat; 40 | } 41 | 42 | @NonNull 43 | @Override 44 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 45 | View view = LayoutInflater.from(mContext).inflate(R.layout.user_item, parent, false); 46 | return new ViewHolder(view); 47 | } 48 | 49 | @Override 50 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) { 51 | 52 | final User user = mUsers.get(position); 53 | holder.username.setText(user.getUsername()); 54 | if (user.getImageURL().equals("default")){ 55 | holder.profile_image.setImageResource(R.mipmap.ic_launcher); 56 | } else { 57 | Glide.with(mContext).load(user.getImageURL()).into(holder.profile_image); 58 | } 59 | 60 | if (ischat){ 61 | lastMessage(user.getId(), holder.last_msg); 62 | } else { 63 | holder.last_msg.setVisibility(View.GONE); 64 | } 65 | 66 | if (ischat){ 67 | if (user.getStatus().equals("online")){ 68 | holder.img_on.setVisibility(View.VISIBLE); 69 | holder.img_off.setVisibility(View.GONE); 70 | } else { 71 | holder.img_on.setVisibility(View.GONE); 72 | holder.img_off.setVisibility(View.VISIBLE); 73 | } 74 | } else { 75 | holder.img_on.setVisibility(View.GONE); 76 | holder.img_off.setVisibility(View.GONE); 77 | } 78 | 79 | holder.itemView.setOnClickListener(new View.OnClickListener() { 80 | @Override 81 | public void onClick(View view) { 82 | Intent intent = new Intent(mContext, MessageActivity.class); 83 | intent.putExtra("userid", user.getId()); 84 | mContext.startActivity(intent); 85 | } 86 | }); 87 | } 88 | 89 | @Override 90 | public int getItemCount() { 91 | return mUsers.size(); 92 | } 93 | 94 | public class ViewHolder extends RecyclerView.ViewHolder{ 95 | 96 | public TextView username; 97 | public ImageView profile_image; 98 | private ImageView img_on; 99 | private ImageView img_off; 100 | private TextView last_msg; 101 | 102 | public ViewHolder(View itemView) { 103 | super(itemView); 104 | 105 | username = itemView.findViewById(R.id.username); 106 | profile_image = itemView.findViewById(R.id.profile_image); 107 | img_on = itemView.findViewById(R.id.img_on); 108 | img_off = itemView.findViewById(R.id.img_off); 109 | last_msg = itemView.findViewById(R.id.last_msg); 110 | } 111 | } 112 | 113 | //check for last message 114 | private void lastMessage(final String userid, final TextView last_msg){ 115 | theLastMessage = "default"; 116 | final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 117 | DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Chats"); 118 | 119 | reference.addValueEventListener(new ValueEventListener() { 120 | @Override 121 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 122 | for (DataSnapshot snapshot : dataSnapshot.getChildren()){ 123 | Chat chat = snapshot.getValue(Chat.class); 124 | if (firebaseUser != null && chat != null) { 125 | if (chat.getReceiver().equals(firebaseUser.getUid()) && chat.getSender().equals(userid) || 126 | chat.getReceiver().equals(userid) && chat.getSender().equals(firebaseUser.getUid())) { 127 | theLastMessage = chat.getMessage(); 128 | } 129 | } 130 | } 131 | 132 | switch (theLastMessage){ 133 | case "default": 134 | last_msg.setText("No Message"); 135 | break; 136 | 137 | default: 138 | last_msg.setText(theLastMessage); 139 | break; 140 | } 141 | 142 | theLastMessage = "default"; 143 | } 144 | 145 | @Override 146 | public void onCancelled(@NonNull DatabaseError databaseError) { 147 | 148 | } 149 | }); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/CountryToPhonePrefix.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat; 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("AR", "+54"); 21 | country2phone.put("AM", "+374"); 22 | country2phone.put("AU", "+61"); 23 | country2phone.put("AT", "+43"); 24 | country2phone.put("AZ", "+994"); 25 | country2phone.put("BH", "+973"); 26 | country2phone.put("BD", "+880"); 27 | country2phone.put("BY", "+375"); 28 | country2phone.put("BE", "+32"); 29 | country2phone.put("BZ", "+501"); 30 | country2phone.put("BJ", "+229"); 31 | country2phone.put("BT", "+975"); 32 | country2phone.put("BO", "+591"); 33 | country2phone.put("BA", "+387"); 34 | country2phone.put("BW", "+267"); 35 | country2phone.put("BR", "+55"); 36 | country2phone.put("BN", "+673"); 37 | country2phone.put("BG", "+359"); 38 | country2phone.put("BF", "+226"); 39 | country2phone.put("BI", "+257"); 40 | country2phone.put("KH", "+855"); 41 | country2phone.put("CM", "+237"); 42 | country2phone.put("CA", "+1"); 43 | country2phone.put("CV", "+238"); 44 | country2phone.put("CF", "+236"); 45 | country2phone.put("TD", "+235"); 46 | country2phone.put("CL", "+56"); 47 | country2phone.put("CN", "+86"); 48 | country2phone.put("CO", "+57"); 49 | country2phone.put("KM", "+269"); 50 | country2phone.put("CD", "+243"); 51 | country2phone.put("CG", "+242"); 52 | country2phone.put("CR", "+506"); 53 | country2phone.put("CI", "+225"); 54 | country2phone.put("HR", "+385"); 55 | country2phone.put("CU", "+53"); 56 | country2phone.put("CY", "+357"); 57 | country2phone.put("CZ", "+420"); 58 | country2phone.put("DK", "+45"); 59 | country2phone.put("DJ", "+253"); 60 | country2phone.put("EC", "+593"); 61 | country2phone.put("EG", "+20"); 62 | country2phone.put("SV", "+503"); 63 | country2phone.put("GQ", "+240"); 64 | country2phone.put("ER", "+291"); 65 | country2phone.put("EE", "+372"); 66 | country2phone.put("ET", "+251"); 67 | country2phone.put("FJ", "+679"); 68 | country2phone.put("FI", "+358"); 69 | country2phone.put("FR", "+33"); 70 | country2phone.put("GA", "+241"); 71 | country2phone.put("GM", "+220"); 72 | country2phone.put("GE", "+995"); 73 | country2phone.put("DE", "+49"); 74 | country2phone.put("GH", "+233"); 75 | country2phone.put("GR", "+30"); 76 | country2phone.put("GT", "+502"); 77 | country2phone.put("GN", "+224"); 78 | country2phone.put("GW", "+245"); 79 | country2phone.put("GY", "+592"); 80 | country2phone.put("HT", "+509"); 81 | country2phone.put("HN", "+504"); 82 | country2phone.put("HU", "+36"); 83 | country2phone.put("IS", "+354"); 84 | country2phone.put("IN", "+91"); 85 | country2phone.put("ID", "+62"); 86 | country2phone.put("IR", "+98"); 87 | country2phone.put("IQ", "+964"); 88 | country2phone.put("IE", "+353"); 89 | country2phone.put("IL", "+972"); 90 | country2phone.put("IT", "+39"); 91 | country2phone.put("JP", "+81"); 92 | country2phone.put("JO", "+962"); 93 | country2phone.put("KZ", "+7"); 94 | country2phone.put("KE", "+254"); 95 | country2phone.put("KI", "+686"); 96 | country2phone.put("KP", "+850"); 97 | country2phone.put("KR", "+82"); 98 | country2phone.put("KW", "+965"); 99 | country2phone.put("KG", "+996"); 100 | country2phone.put("LA", "+856"); 101 | country2phone.put("LV", "+371"); 102 | country2phone.put("LB", "+961"); 103 | country2phone.put("LS", "+266"); 104 | country2phone.put("LR", "+231"); 105 | country2phone.put("LY", "+218"); 106 | country2phone.put("LI", "+423"); 107 | country2phone.put("LT", "+370"); 108 | country2phone.put("LU", "+352"); 109 | country2phone.put("MK", "+389"); 110 | country2phone.put("MG", "+261"); 111 | country2phone.put("MW", "+265"); 112 | country2phone.put("MY", "+60"); 113 | country2phone.put("MV", "+960"); 114 | country2phone.put("ML", "+223"); 115 | country2phone.put("MT", "+356"); 116 | country2phone.put("MH", "+692"); 117 | 118 | 119 | 120 | } 121 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Fragments/APIService.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Fragments; 2 | 3 | import com.example.mohaiminur.com.textchat.Notifications.MyResponse; 4 | import com.example.mohaiminur.com.textchat.Notifications.Sender; 5 | 6 | import retrofit2.Call; 7 | import retrofit2.http.Body; 8 | import retrofit2.http.Headers; 9 | import retrofit2.http.POST; 10 | 11 | public interface APIService { 12 | @Headers( 13 | { 14 | "Content-Type:application/json", 15 | "Authorization:key=AAAAvbCEAo4:APA91bHjxeZAeBT4-hUzVqcYz0cAzYjYb49GGgHlOeOlAUzbxYlTXZDZePKbpKQfUjM1QSDZdiLIs_nNUJcXwZREAELb3RcS97YGXLNDVREFa8IItZp7A9hcdfdDloVqM3VrLfY1FHdG" 16 | } 17 | ) 18 | 19 | @POST("fcm/send") 20 | Call sendNotification(@Body Sender body); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Fragments/ChatsFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.google.firebase.auth.FirebaseAuth; 13 | import com.google.firebase.auth.FirebaseUser; 14 | import com.google.firebase.database.DataSnapshot; 15 | import com.google.firebase.database.DatabaseError; 16 | import com.google.firebase.database.DatabaseReference; 17 | import com.google.firebase.database.FirebaseDatabase; 18 | import com.google.firebase.database.ValueEventListener; 19 | import com.google.firebase.iid.FirebaseInstanceId; 20 | import com.example.mohaiminur.com.textchat.Adapter.UserAdapter; 21 | import com.example.mohaiminur.com.textchat.Model.Chatlist; 22 | import com.example.mohaiminur.com.textchat.Model.User; 23 | import com.example.mohaiminur.com.textchat.Notifications.Token; 24 | import com.example.mohaiminur.com.textchat.R; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | 30 | public class ChatsFragment extends Fragment { 31 | 32 | private RecyclerView recyclerView; 33 | 34 | private UserAdapter userAdapter; 35 | private List mUsers; 36 | 37 | FirebaseUser fuser; 38 | DatabaseReference reference; 39 | 40 | private List usersList; 41 | 42 | @Override 43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 44 | Bundle savedInstanceState) { 45 | View view = inflater.inflate(R.layout.fragment_chats, container, false); 46 | 47 | recyclerView = view.findViewById(R.id.recycler_view); 48 | recyclerView.setHasFixedSize(true); 49 | recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 50 | 51 | fuser = FirebaseAuth.getInstance().getCurrentUser(); 52 | 53 | usersList = new ArrayList<>(); 54 | 55 | reference = FirebaseDatabase.getInstance().getReference("Chatlist").child(fuser.getUid()); 56 | reference.addValueEventListener(new ValueEventListener() { 57 | @Override 58 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 59 | usersList.clear(); 60 | for (DataSnapshot snapshot : dataSnapshot.getChildren()){ 61 | Chatlist chatlist = snapshot.getValue(Chatlist.class); 62 | usersList.add(chatlist); 63 | } 64 | 65 | chatList(); 66 | } 67 | 68 | @Override 69 | public void onCancelled(@NonNull DatabaseError databaseError) { 70 | 71 | } 72 | }); 73 | 74 | updateToken(FirebaseInstanceId.getInstance().getToken()); 75 | 76 | 77 | return view; 78 | } 79 | 80 | private void updateToken(String token){ 81 | DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens"); 82 | Token token1 = new Token(token); 83 | reference.child(fuser.getUid()).setValue(token1); 84 | } 85 | 86 | private void chatList() { 87 | mUsers = new ArrayList<>(); 88 | reference = FirebaseDatabase.getInstance().getReference("Users"); 89 | reference.addValueEventListener(new ValueEventListener() { 90 | @Override 91 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 92 | mUsers.clear(); 93 | for (DataSnapshot snapshot : dataSnapshot.getChildren()){ 94 | User user = snapshot.getValue(User.class); 95 | for (Chatlist chatlist : usersList){ 96 | if (user.getId().equals(chatlist.getId())){ 97 | mUsers.add(user); 98 | } 99 | } 100 | } 101 | userAdapter = new UserAdapter(getContext(), mUsers, true); 102 | recyclerView.setAdapter(userAdapter); 103 | } 104 | 105 | @Override 106 | public void onCancelled(@NonNull DatabaseError databaseError) { 107 | 108 | } 109 | }); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Fragments/ProfileFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Fragments; 2 | 3 | import android.app.Activity; 4 | import android.app.ProgressDialog; 5 | import android.content.ContentResolver; 6 | import android.content.Intent; 7 | import android.net.Uri; 8 | import android.os.Bundle; 9 | import android.support.annotation.NonNull; 10 | import android.support.v4.app.Fragment; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.webkit.MimeTypeMap; 15 | import android.widget.TextView; 16 | import android.widget.Toast; 17 | 18 | import com.bumptech.glide.Glide; 19 | import com.google.android.gms.tasks.Continuation; 20 | import com.google.android.gms.tasks.OnCompleteListener; 21 | import com.google.android.gms.tasks.OnFailureListener; 22 | import com.google.android.gms.tasks.Task; 23 | import com.google.firebase.auth.FirebaseAuth; 24 | import com.google.firebase.auth.FirebaseUser; 25 | import com.google.firebase.database.DataSnapshot; 26 | import com.google.firebase.database.DatabaseError; 27 | import com.google.firebase.database.DatabaseReference; 28 | import com.google.firebase.database.FirebaseDatabase; 29 | import com.google.firebase.database.ValueEventListener; 30 | import com.google.firebase.storage.FirebaseStorage; 31 | import com.google.firebase.storage.StorageReference; 32 | import com.google.firebase.storage.StorageTask; 33 | import com.google.firebase.storage.UploadTask; 34 | import com.example.mohaiminur.com.textchat.Model.User; 35 | import com.example.mohaiminur.com.textchat.R; 36 | 37 | import java.util.HashMap; 38 | 39 | import de.hdodenhof.circleimageview.CircleImageView; 40 | 41 | import static android.app.Activity.RESULT_OK; 42 | 43 | 44 | public class ProfileFragment extends Fragment { 45 | 46 | CircleImageView image_profile; 47 | TextView username; 48 | 49 | DatabaseReference reference; 50 | FirebaseUser fuser; 51 | 52 | StorageReference storageReference; 53 | private static final int IMAGE_REQUEST = 1; 54 | private Uri imageUri; 55 | private StorageTask uploadTask; 56 | 57 | 58 | @Override 59 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 60 | Bundle savedInstanceState) { 61 | // Inflate the layout for this fragment 62 | View view = inflater.inflate(R.layout.fragment_profile, container, false); 63 | 64 | image_profile = view.findViewById(R.id.profile_image); 65 | username = view.findViewById(R.id.username); 66 | 67 | 68 | 69 | storageReference = FirebaseStorage.getInstance().getReference("uploads"); 70 | 71 | fuser = FirebaseAuth.getInstance().getCurrentUser(); 72 | reference = FirebaseDatabase.getInstance().getReference("Users").child(fuser.getUid()); 73 | 74 | reference.addValueEventListener(new ValueEventListener() { 75 | @Override 76 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 77 | User user = dataSnapshot.getValue(User.class); 78 | username.setText(user.getUsername()); 79 | if (user.getImageURL().equals("default")){ 80 | image_profile.setImageResource(R.mipmap.ic_launcher); 81 | } else { 82 | 83 | if (getActivity() == null) { 84 | return; 85 | } 86 | Glide.with(getContext()).load(user.getImageURL()).into(image_profile); 87 | } 88 | } 89 | 90 | @Override 91 | public void onCancelled(@NonNull DatabaseError databaseError) { 92 | 93 | } 94 | }); 95 | 96 | image_profile.setOnClickListener(new View.OnClickListener() { 97 | @Override 98 | public void onClick(View view) { 99 | openImage(); 100 | } 101 | }); 102 | 103 | return view; 104 | } 105 | 106 | private void openImage() { 107 | Intent intent = new Intent(); 108 | intent.setType("image/*"); 109 | intent.setAction(Intent.ACTION_GET_CONTENT); 110 | startActivityForResult(intent, IMAGE_REQUEST); 111 | } 112 | 113 | private String getFileExtension(Uri uri){ 114 | ContentResolver contentResolver = getContext().getContentResolver(); 115 | MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); 116 | return mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(uri)); 117 | } 118 | 119 | private void uploadImage(){ 120 | final ProgressDialog pd = new ProgressDialog(getContext()); 121 | pd.setMessage("Uploading"); 122 | pd.show(); 123 | 124 | if (imageUri != null){ 125 | final StorageReference fileReference = storageReference.child(System.currentTimeMillis() 126 | +"."+getFileExtension(imageUri)); 127 | 128 | uploadTask = fileReference.putFile(imageUri); 129 | uploadTask.continueWithTask(new Continuation>() { 130 | @Override 131 | public Task then(@NonNull Task task) throws Exception { 132 | if (!task.isSuccessful()){ 133 | throw task.getException(); 134 | } 135 | 136 | return fileReference.getDownloadUrl(); 137 | } 138 | }).addOnCompleteListener(new OnCompleteListener() { 139 | @Override 140 | public void onComplete(@NonNull Task task) { 141 | if (task.isSuccessful()){ 142 | Uri downloadUri = task.getResult(); 143 | String mUri = downloadUri.toString(); 144 | 145 | reference = FirebaseDatabase.getInstance().getReference("Users").child(fuser.getUid()); 146 | HashMap map = new HashMap<>(); 147 | map.put("imageURL", ""+mUri); 148 | reference.updateChildren(map); 149 | 150 | pd.dismiss(); 151 | } else { 152 | Toast.makeText(getContext(), "Failed!", Toast.LENGTH_SHORT).show(); 153 | pd.dismiss(); 154 | } 155 | } 156 | }).addOnFailureListener(new OnFailureListener() { 157 | @Override 158 | public void onFailure(@NonNull Exception e) { 159 | Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); 160 | pd.dismiss(); 161 | } 162 | }); 163 | } else { 164 | Toast.makeText(getContext(), "No image selected", Toast.LENGTH_SHORT).show(); 165 | } 166 | } 167 | 168 | @Override 169 | public void onActivityResult(int requestCode, int resultCode, Intent data) { 170 | super.onActivityResult(requestCode, resultCode, data); 171 | 172 | if (requestCode == IMAGE_REQUEST && resultCode == RESULT_OK 173 | && data != null && data.getData() != null){ 174 | imageUri = data.getData(); 175 | 176 | if (uploadTask != null && uploadTask.isInProgress()){ 177 | Toast.makeText(getContext(), "Upload in preogress", Toast.LENGTH_SHORT).show(); 178 | } else { 179 | uploadImage(); 180 | } 181 | } 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Fragments/UsersFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Fragments; 2 | 3 | import android.database.Cursor; 4 | import android.os.Bundle; 5 | import android.provider.ContactsContract; 6 | import android.support.annotation.NonNull; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import com.example.mohaiminur.com.textchat.Model.UserObject; 14 | import com.google.firebase.auth.FirebaseAuth; 15 | import com.google.firebase.auth.FirebaseUser; 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.example.mohaiminur.com.textchat.Adapter.UserAdapter; 23 | import com.example.mohaiminur.com.textchat.Model.User; 24 | import com.example.mohaiminur.com.textchat.R; 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | 29 | public class UsersFragment extends Fragment { 30 | 31 | private RecyclerView recyclerView; 32 | 33 | private UserAdapter userAdapter; 34 | private List mUsers; 35 | Cursor cursor; 36 | String phone; 37 | 38 | ArrayList userList, contactList; 39 | 40 | @Override 41 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 42 | Bundle savedInstanceState) { 43 | 44 | View view = inflater.inflate(R.layout.fragment_users, container, false); 45 | 46 | recyclerView = view.findViewById(R.id.recycler_view); 47 | recyclerView.setHasFixedSize(true); 48 | recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 49 | 50 | mUsers = new ArrayList<>(); 51 | 52 | contactList= new ArrayList<>(); 53 | userList= new ArrayList<>(); 54 | 55 | 56 | readUsers(); 57 | 58 | return view; 59 | } 60 | 61 | 62 | public void readUsers() { 63 | 64 | cursor = getActivity().getApplicationContext().getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); 65 | 66 | while (cursor.moveToNext()) { 67 | String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); 68 | 69 | phone = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); 70 | 71 | 72 | if (phone.length() <= 10) { 73 | continue; 74 | } 75 | 76 | if (!String.valueOf(phone.charAt(0)).equals("+")) { 77 | phone = "+88" + phone; 78 | } 79 | phone = phone.replace(" ", ""); 80 | phone = phone.replace("-", ""); 81 | phone = phone.replace("(", ""); 82 | phone = phone.replace(")", ""); 83 | 84 | final UserObject mContact = new UserObject("", name, phone); 85 | contactList.add(mContact); 86 | 87 | 88 | final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 89 | final DatabaseReference mUserDB = FirebaseDatabase.getInstance().getReference().child("Users"); 90 | Query query = mUserDB.orderByChild("phone").equalTo(mContact.getPhone()); 91 | query.addListenerForSingleValueEvent(new ValueEventListener() { 92 | @Override 93 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 94 | // mUsers.clear(); 95 | 96 | if (dataSnapshot.exists()) { 97 | 98 | for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) { 99 | User user = childSnapshot.getValue( User.class ); 100 | if (!user.getId().equals( firebaseUser.getUid() )) { 101 | mUsers.add(user); 102 | } 103 | 104 | } 105 | userAdapter = new UserAdapter( getContext(), mUsers, false ); 106 | recyclerView.setAdapter( userAdapter ); 107 | 108 | 109 | } 110 | } 111 | 112 | 113 | @Override 114 | public void onCancelled(@NonNull DatabaseError databaseError) { 115 | 116 | } 117 | }); 118 | 119 | } 120 | 121 | cursor.close(); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat; 2 | import android.content.Context; 3 | import android.content.Intent; 4 | import android.content.SharedPreferences; 5 | import android.support.annotation.NonNull; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.telephony.TelephonyManager; 9 | import android.view.View; 10 | import android.widget.Button; 11 | import android.widget.EditText; 12 | 13 | import com.google.android.gms.tasks.OnCompleteListener; 14 | import com.google.android.gms.tasks.Task; 15 | import com.google.firebase.FirebaseApp; 16 | import com.google.firebase.FirebaseException; 17 | import com.google.firebase.auth.AuthResult; 18 | import com.google.firebase.auth.FirebaseAuth; 19 | import com.google.firebase.auth.FirebaseUser; 20 | import com.google.firebase.auth.PhoneAuthCredential; 21 | import com.google.firebase.auth.PhoneAuthProvider; 22 | import com.google.firebase.database.DataSnapshot; 23 | import com.google.firebase.database.DatabaseError; 24 | import com.google.firebase.database.DatabaseReference; 25 | import com.google.firebase.database.FirebaseDatabase; 26 | import com.google.firebase.database.ValueEventListener; 27 | 28 | import java.util.HashMap; 29 | import java.util.Map; 30 | import java.util.concurrent.TimeUnit; 31 | 32 | 33 | public class LoginActivity extends AppCompatActivity { 34 | 35 | private EditText name,mPhoneNumber, mCode; 36 | private Button mSend; 37 | public static final String fstring="com.example.mohaiminur.com.textchat.UserFragment"; 38 | public static final String fcode="codee"; 39 | 40 | private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks; 41 | 42 | String mVerificationId; 43 | 44 | @Override 45 | protected void onCreate(Bundle savedInstanceState) { 46 | super.onCreate(savedInstanceState); 47 | setContentView(R.layout.activity_login); 48 | 49 | FirebaseApp.initializeApp(this); 50 | getCountryISO(); 51 | 52 | userIsLoggedIn(); 53 | 54 | String ISOPrefix = getCountryISO(); 55 | String Ccode=ISOPrefix; 56 | 57 | 58 | SharedPreferences sp= getSharedPreferences( fstring, Context.MODE_PRIVATE ); 59 | sp.edit().putString( fcode,Ccode ).commit(); 60 | 61 | name=findViewById(R.id.name_id); 62 | mPhoneNumber = findViewById(R.id.phoneNumber); 63 | mPhoneNumber.setText( Ccode ); 64 | mCode = findViewById(R.id.code); 65 | 66 | mSend = findViewById(R.id.send); 67 | 68 | mSend.setOnClickListener(new View.OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | if(mVerificationId != null) 72 | verifyPhoneNumberWithCode(); 73 | else 74 | startPhoneNumberVerification(); 75 | } 76 | }); 77 | 78 | 79 | mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { 80 | @Override 81 | public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) { 82 | signInWithPhoneAuthCredential(phoneAuthCredential); 83 | } 84 | 85 | @Override 86 | public void onVerificationFailed(FirebaseException e) { 87 | } 88 | 89 | 90 | @Override 91 | public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) { 92 | super.onCodeSent(verificationId, forceResendingToken); 93 | 94 | mVerificationId = verificationId; 95 | mPhoneNumber.setVisibility( View.INVISIBLE ); 96 | name.setVisibility( View.INVISIBLE ); 97 | mCode.setVisibility( View.VISIBLE ); 98 | mSend.setText("Verify Code"); 99 | } 100 | }; 101 | 102 | } 103 | 104 | private String getCountryISO() { 105 | 106 | String iso = null; 107 | 108 | TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE); 109 | if(telephonyManager.getNetworkCountryIso()!=null) 110 | if (!telephonyManager.getNetworkCountryIso().toString().equals("")) 111 | iso = telephonyManager.getNetworkCountryIso().toString(); 112 | 113 | return CountryToPhonePrefix.getPhone( iso ); 114 | } 115 | 116 | private void verifyPhoneNumberWithCode(){ 117 | PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, mCode.getText().toString()); 118 | signInWithPhoneAuthCredential(credential); 119 | } 120 | 121 | private void signInWithPhoneAuthCredential(PhoneAuthCredential phoneAuthCredential) { 122 | FirebaseAuth.getInstance().signInWithCredential(phoneAuthCredential).addOnCompleteListener(this, new OnCompleteListener() { 123 | @Override 124 | public void onComplete(@NonNull Task task) { 125 | if(task.isSuccessful()){ 126 | final String txt_username = name.getText().toString(); 127 | final FirebaseUser userid = FirebaseAuth.getInstance().getCurrentUser(); 128 | 129 | if(userid != null){ 130 | final DatabaseReference mUserDB = FirebaseDatabase.getInstance().getReference().child("Users").child(userid.getUid()); 131 | mUserDB.addListenerForSingleValueEvent(new ValueEventListener() { 132 | @Override 133 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 134 | if(!dataSnapshot.exists()){ 135 | Map userMap = new HashMap<>(); 136 | userMap.put("phone", userid.getPhoneNumber()); 137 | userMap.put("username", txt_username); 138 | /* userMap.replace( "username", txt_username ); */ 139 | userMap.put("id", userid.getUid()); 140 | userMap.put("imageURL", "default"); 141 | userMap.put("status", "offline"); 142 | mUserDB.updateChildren(userMap); 143 | 144 | 145 | } 146 | userIsLoggedIn(); 147 | } 148 | 149 | @Override 150 | public void onCancelled(@NonNull DatabaseError databaseError) { 151 | 152 | } 153 | }); 154 | } 155 | 156 | } 157 | 158 | } 159 | }); 160 | } 161 | 162 | private void userIsLoggedIn() { 163 | FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); 164 | if(user != null){ 165 | startActivity(new Intent(getApplicationContext(), MainActivity.class)); 166 | finish(); 167 | return; 168 | } 169 | } 170 | 171 | private void startPhoneNumberVerification() { 172 | PhoneAuthProvider.getInstance().verifyPhoneNumber( 173 | mPhoneNumber.getText().toString(), 174 | 60, 175 | TimeUnit.SECONDS, 176 | this, 177 | mCallbacks); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.support.design.widget.TabLayout; 8 | import android.support.v4.app.Fragment; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.app.FragmentPagerAdapter; 11 | import android.support.v4.view.ViewPager; 12 | import android.support.v7.app.AppCompatActivity; 13 | import android.support.v7.widget.Toolbar; 14 | import android.view.Menu; 15 | import android.view.MenuItem; 16 | import android.widget.TextView; 17 | 18 | import com.bumptech.glide.Glide; 19 | import com.google.firebase.auth.FirebaseAuth; 20 | import com.google.firebase.auth.FirebaseUser; 21 | import com.google.firebase.database.DataSnapshot; 22 | import com.google.firebase.database.DatabaseError; 23 | import com.google.firebase.database.DatabaseReference; 24 | import com.google.firebase.database.FirebaseDatabase; 25 | import com.google.firebase.database.ValueEventListener; 26 | import com.example.mohaiminur.com.textchat.Fragments.ChatsFragment; 27 | import com.example.mohaiminur.com.textchat.Fragments.ProfileFragment; 28 | import com.example.mohaiminur.com.textchat.Fragments.UsersFragment; 29 | import com.example.mohaiminur.com.textchat.Model.Chat; 30 | import com.example.mohaiminur.com.textchat.Model.User; 31 | 32 | import java.util.ArrayList; 33 | import java.util.HashMap; 34 | 35 | import de.hdodenhof.circleimageview.CircleImageView; 36 | 37 | public class MainActivity extends AppCompatActivity { 38 | 39 | CircleImageView profile_image; 40 | TextView username; 41 | 42 | FirebaseUser firebaseUser; 43 | DatabaseReference reference; 44 | 45 | @Override 46 | protected void onCreate(Bundle savedInstanceState) { 47 | super.onCreate( savedInstanceState ); 48 | setContentView( R.layout.activity_main ); 49 | 50 | Toolbar toolbar = findViewById( R.id.toolbar ); 51 | setSupportActionBar( toolbar ); 52 | getSupportActionBar().setTitle( "" ); 53 | 54 | profile_image = findViewById( R.id.profile_image ); 55 | username = findViewById( R.id.username ); 56 | 57 | firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 58 | reference = FirebaseDatabase.getInstance().getReference( "Users" ).child( firebaseUser.getUid() ); 59 | 60 | reference.addValueEventListener( new ValueEventListener() { 61 | @Override 62 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 63 | User user = dataSnapshot.getValue( User.class ); 64 | username.setText( user.getUsername() ); 65 | if (user.getImageURL().equals( "default" )) { 66 | profile_image.setImageResource( R.mipmap.ic_launcher ); 67 | } else { 68 | 69 | //change this 70 | Glide.with( getApplicationContext() ).load( user.getImageURL() ).into( profile_image ); 71 | } 72 | } 73 | 74 | @Override 75 | public void onCancelled(@NonNull DatabaseError databaseError) { 76 | 77 | } 78 | } ); 79 | 80 | final TabLayout tabLayout = findViewById( R.id.tab_layout ); 81 | final ViewPager viewPager = findViewById( R.id.view_pager ); 82 | 83 | 84 | reference = FirebaseDatabase.getInstance().getReference( "Chats" ); 85 | reference.addValueEventListener( new ValueEventListener() { 86 | @Override 87 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 88 | ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter( getSupportFragmentManager() ); 89 | int unread = 0; 90 | for (DataSnapshot snapshot : dataSnapshot.getChildren()) { 91 | Chat chat = snapshot.getValue( Chat.class ); 92 | if (chat.getReceiver().equals( firebaseUser.getUid() ) && !chat.isIsseen()) { 93 | unread++; 94 | } 95 | } 96 | 97 | if (unread == 0) { 98 | viewPagerAdapter.addFragment( new ChatsFragment(), "Chats" ); 99 | } else { 100 | viewPagerAdapter.addFragment( new ChatsFragment(), "(" + unread + ") Chats" ); 101 | } 102 | 103 | viewPagerAdapter.addFragment( new UsersFragment(), "Users" ); 104 | viewPagerAdapter.addFragment( new ProfileFragment(), "Profile" ); 105 | 106 | viewPager.setAdapter( viewPagerAdapter ); 107 | 108 | tabLayout.setupWithViewPager( viewPager ); 109 | 110 | } 111 | 112 | @Override 113 | public void onCancelled(@NonNull DatabaseError databaseError) { 114 | 115 | } 116 | } ); 117 | 118 | 119 | } 120 | 121 | @Override 122 | public boolean onCreateOptionsMenu(Menu menu) { 123 | getMenuInflater().inflate( R.menu.menu, menu ); 124 | return true; 125 | } 126 | 127 | @Override 128 | public boolean onOptionsItemSelected(MenuItem item) { 129 | switch (item.getItemId()) { 130 | 131 | case R.id.logout: 132 | FirebaseAuth.getInstance().signOut(); 133 | // change this code beacuse your app will crash 134 | startActivity( new Intent( MainActivity.this, LoginActivity.class ).setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP ) ); 135 | finish(); 136 | return true; 137 | } 138 | 139 | return false; 140 | } 141 | 142 | private void status(String status) { 143 | reference = FirebaseDatabase.getInstance().getReference( "Users" ).child( firebaseUser.getUid() ); 144 | 145 | HashMap hashMap = new HashMap<>(); 146 | hashMap.put( "status", status ); 147 | 148 | reference.updateChildren( hashMap ); 149 | } 150 | 151 | @Override 152 | protected void onResume() { 153 | super.onResume(); 154 | status( "online" ); 155 | } 156 | 157 | @Override 158 | protected void onPause() { 159 | super.onPause(); 160 | status( "offline" ); 161 | } 162 | 163 | class ViewPagerAdapter extends FragmentPagerAdapter { 164 | 165 | private ArrayList fragments; 166 | private ArrayList titles; 167 | 168 | ViewPagerAdapter(FragmentManager fm) { 169 | super( fm ); 170 | this.fragments = new ArrayList<>(); 171 | this.titles = new ArrayList<>(); 172 | } 173 | 174 | @Override 175 | public Fragment getItem(int position) { 176 | return fragments.get( position ); 177 | } 178 | 179 | @Override 180 | public int getCount() { 181 | return fragments.size(); 182 | } 183 | 184 | public void addFragment(Fragment fragment, String title) { 185 | fragments.add( fragment ); 186 | titles.add( title ); 187 | } 188 | 189 | // Ctrl + O 190 | 191 | @Nullable 192 | @Override 193 | public CharSequence getPageTitle(int position) { 194 | return titles.get( position ); 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Model/Chat.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Model; 2 | 3 | public class Chat { 4 | 5 | private String sender; 6 | private String receiver; 7 | private String message; 8 | private boolean isseen; 9 | 10 | public Chat(String sender, String receiver, String message, boolean isseen) { 11 | this.sender = sender; 12 | this.receiver = receiver; 13 | this.message = message; 14 | this.isseen = isseen; 15 | } 16 | 17 | public Chat() { 18 | } 19 | 20 | public String getSender() { 21 | return sender; 22 | } 23 | 24 | public void setSender(String sender) { 25 | this.sender = sender; 26 | } 27 | 28 | public String getReceiver() { 29 | return receiver; 30 | } 31 | 32 | public void setReceiver(String receiver) { 33 | this.receiver = receiver; 34 | } 35 | 36 | public String getMessage() { 37 | return message; 38 | } 39 | 40 | public void setMessage(String message) { 41 | this.message = message; 42 | } 43 | 44 | public boolean isIsseen() { 45 | return isseen; 46 | } 47 | 48 | public void setIsseen(boolean isseen) { 49 | this.isseen = isseen; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Model/Chatlist.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Model; 2 | 3 | public class Chatlist { 4 | public String id; 5 | 6 | public Chatlist(String id) { 7 | this.id = id; 8 | } 9 | 10 | public Chatlist() { 11 | } 12 | 13 | public String getId() { 14 | return id; 15 | } 16 | 17 | public void setId(String id) { 18 | this.id = id; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Model/User.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Model; 2 | 3 | public class User { 4 | 5 | private String id; 6 | private String username; 7 | private String imageURL; 8 | private String status; 9 | 10 | 11 | public User(String id, String username, String imageURL, String status) { 12 | this.id = id; 13 | this.username = username; 14 | this.imageURL = imageURL; 15 | this.status = status; 16 | } 17 | 18 | public User() { 19 | 20 | } 21 | 22 | public String getId() { 23 | return id; 24 | } 25 | 26 | public void setId(String id) { 27 | this.id = id; 28 | } 29 | 30 | public String getUsername() { 31 | return username; 32 | } 33 | 34 | public void setUsername(String username) { 35 | this.username = username; 36 | } 37 | 38 | public String getImageURL() { 39 | return imageURL; 40 | } 41 | 42 | public void setImageURL(String imageURL) { 43 | this.imageURL = imageURL; 44 | } 45 | 46 | public String getStatus() { 47 | return status; 48 | } 49 | 50 | public void setStatus(String status) { 51 | this.status = status; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Model/UserObject.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Model; 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/example/mohaiminur/com/textchat/Notifications/Client.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | import retrofit2.Retrofit; 4 | import retrofit2.converter.gson.GsonConverterFactory; 5 | 6 | public class Client { 7 | 8 | private static Retrofit retrofit = null; 9 | 10 | public static Retrofit getClient(String url){ 11 | if (retrofit == null){ 12 | retrofit = new Retrofit.Builder() 13 | .baseUrl(url) 14 | .addConverterFactory(GsonConverterFactory.create()) 15 | .build(); 16 | } 17 | return retrofit; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/Data.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | public class Data { 4 | private String user; 5 | private int icon; 6 | private String body; 7 | private String title; 8 | private String sented; 9 | 10 | public Data(String user, int icon, String body, String title, String sented) { 11 | this.user = user; 12 | this.icon = icon; 13 | this.body = body; 14 | this.title = title; 15 | this.sented = sented; 16 | } 17 | 18 | public Data() { 19 | } 20 | 21 | public String getUser() { 22 | return user; 23 | } 24 | 25 | public void setUser(String user) { 26 | this.user = user; 27 | } 28 | 29 | public int getIcon() { 30 | return icon; 31 | } 32 | 33 | public void setIcon(int icon) { 34 | this.icon = icon; 35 | } 36 | 37 | public String getBody() { 38 | return body; 39 | } 40 | 41 | public void setBody(String body) { 42 | this.body = body; 43 | } 44 | 45 | public String getTitle() { 46 | return title; 47 | } 48 | 49 | public void setTitle(String title) { 50 | this.title = title; 51 | } 52 | 53 | public String getSented() { 54 | return sented; 55 | } 56 | 57 | public void setSented(String sented) { 58 | this.sented = sented; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/MyFirebaseIdService.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | import com.google.firebase.auth.FirebaseAuth; 4 | import com.google.firebase.auth.FirebaseUser; 5 | import com.google.firebase.database.DatabaseReference; 6 | import com.google.firebase.database.FirebaseDatabase; 7 | import com.google.firebase.iid.FirebaseInstanceId; 8 | import com.google.firebase.iid.FirebaseInstanceIdService; 9 | 10 | public class MyFirebaseIdService extends FirebaseInstanceIdService { 11 | 12 | @Override 13 | public void onTokenRefresh() { 14 | super.onTokenRefresh(); 15 | FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 16 | 17 | String refreshToken = FirebaseInstanceId.getInstance().getToken(); 18 | if (firebaseUser != null){ 19 | updateToken(refreshToken); 20 | } 21 | } 22 | 23 | private void updateToken(String refreshToken) { 24 | FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 25 | 26 | DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens"); 27 | Token token = new Token(refreshToken); 28 | reference.child(firebaseUser.getUid()).setValue(token); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/MyFirebaseMessaging.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | import android.app.Notification; 4 | import android.app.NotificationManager; 5 | import android.app.PendingIntent; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.content.SharedPreferences; 9 | import android.media.RingtoneManager; 10 | import android.net.Uri; 11 | import android.os.Build; 12 | import android.os.Bundle; 13 | import android.support.v4.app.NotificationCompat; 14 | 15 | import com.google.firebase.auth.FirebaseAuth; 16 | import com.google.firebase.auth.FirebaseUser; 17 | import com.google.firebase.messaging.FirebaseMessagingService; 18 | import com.google.firebase.messaging.RemoteMessage; 19 | import com.example.mohaiminur.com.textchat.MessageActivity; 20 | 21 | public class MyFirebaseMessaging extends FirebaseMessagingService { 22 | 23 | @Override 24 | public void onMessageReceived(RemoteMessage remoteMessage) { 25 | super.onMessageReceived(remoteMessage); 26 | 27 | String sented = remoteMessage.getData().get("sented"); 28 | String user = remoteMessage.getData().get("user"); 29 | 30 | SharedPreferences preferences = getSharedPreferences("PREFS", MODE_PRIVATE); 31 | String currentUser = preferences.getString("currentuser", "none"); 32 | 33 | FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 34 | 35 | if (firebaseUser != null && sented.equals(firebaseUser.getUid())){ 36 | if (!currentUser.equals(user)) { 37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 38 | sendOreoNotification(remoteMessage); 39 | } else { 40 | sendNotification(remoteMessage); 41 | } 42 | } 43 | } 44 | } 45 | 46 | private void sendOreoNotification(RemoteMessage remoteMessage){ 47 | String user = remoteMessage.getData().get("user"); 48 | String icon = remoteMessage.getData().get("icon"); 49 | String title = remoteMessage.getData().get("title"); 50 | String body = remoteMessage.getData().get("body"); 51 | 52 | RemoteMessage.Notification notification = remoteMessage.getNotification(); 53 | int j = Integer.parseInt(user.replaceAll("[\\D]", "")); 54 | Intent intent = new Intent(this, MessageActivity.class); 55 | Bundle bundle = new Bundle(); 56 | bundle.putString("userid", user); 57 | intent.putExtras(bundle); 58 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 59 | PendingIntent pendingIntent = PendingIntent.getActivity(this, j, intent, PendingIntent.FLAG_ONE_SHOT); 60 | Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 61 | 62 | OreoNotification oreoNotification = new OreoNotification(this); 63 | Notification.Builder builder = oreoNotification.getOreoNotification(title, body, pendingIntent, 64 | defaultSound, icon); 65 | 66 | int i = 0; 67 | if (j > 0){ 68 | i = j; 69 | } 70 | 71 | oreoNotification.getManager().notify(i, builder.build()); 72 | 73 | } 74 | 75 | private void sendNotification(RemoteMessage remoteMessage) { 76 | 77 | String user = remoteMessage.getData().get("user"); 78 | String icon = remoteMessage.getData().get("icon"); 79 | String title = remoteMessage.getData().get("title"); 80 | String body = remoteMessage.getData().get("body"); 81 | 82 | RemoteMessage.Notification notification = remoteMessage.getNotification(); 83 | int j = Integer.parseInt(user.replaceAll("[\\D]", "")); 84 | Intent intent = new Intent(this, MessageActivity.class); 85 | Bundle bundle = new Bundle(); 86 | bundle.putString("userid", user); 87 | intent.putExtras(bundle); 88 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 89 | PendingIntent pendingIntent = PendingIntent.getActivity(this, j, intent, PendingIntent.FLAG_ONE_SHOT); 90 | 91 | Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 92 | NotificationCompat.Builder builder = new NotificationCompat.Builder(this) 93 | .setSmallIcon(Integer.parseInt(icon)) 94 | .setContentTitle(title) 95 | .setContentText(body) 96 | .setAutoCancel(true) 97 | .setSound(defaultSound) 98 | .setContentIntent(pendingIntent); 99 | NotificationManager noti = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); 100 | 101 | int i = 0; 102 | if (j > 0){ 103 | i = j; 104 | } 105 | 106 | noti.notify(i, builder.build()); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/MyResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | public class MyResponse { 4 | 5 | public int success; 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/OreoNotification.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | import android.annotation.TargetApi; 4 | import android.app.Notification; 5 | import android.app.NotificationChannel; 6 | import android.app.NotificationManager; 7 | import android.app.PendingIntent; 8 | import android.content.Context; 9 | import android.content.ContextWrapper; 10 | import android.net.Uri; 11 | import android.os.Build; 12 | 13 | public class OreoNotification extends ContextWrapper { 14 | 15 | private static final String CHANNEL_ID = "com.example.mohaiminur.com.textchat"; 16 | private static final String CHANNEL_NAME = "textchat"; 17 | 18 | private NotificationManager notificationManager; 19 | 20 | public OreoNotification(Context base) { 21 | super(base); 22 | 23 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ 24 | createChannel(); 25 | } 26 | } 27 | 28 | @TargetApi(Build.VERSION_CODES.O) 29 | private void createChannel() { 30 | 31 | NotificationChannel channel = new NotificationChannel(CHANNEL_ID, 32 | CHANNEL_NAME, 33 | NotificationManager.IMPORTANCE_DEFAULT); 34 | channel.enableLights(false); 35 | channel.enableVibration(true); 36 | channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); 37 | 38 | getManager().createNotificationChannel(channel); 39 | } 40 | 41 | public NotificationManager getManager(){ 42 | if (notificationManager == null){ 43 | notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); 44 | } 45 | 46 | return notificationManager; 47 | } 48 | 49 | @TargetApi(Build.VERSION_CODES.O) 50 | public Notification.Builder getOreoNotification(String title, String body, 51 | PendingIntent pendingIntent, Uri soundUri, String icon){ 52 | return new Notification.Builder(getApplicationContext(), CHANNEL_ID) 53 | .setContentIntent(pendingIntent) 54 | .setContentTitle(title) 55 | .setContentText(body) 56 | .setSmallIcon(Integer.parseInt(icon)) 57 | .setSound(soundUri) 58 | .setAutoCancel(true); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/Sender.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | public class Sender { 4 | public Data data; 5 | public String to; 6 | 7 | public Sender(Data data, String to) { 8 | this.data = data; 9 | this.to = to; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/Notifications/Token.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat.Notifications; 2 | 3 | public class Token { 4 | private String token; 5 | 6 | public Token(String token) { 7 | this.token = token; 8 | } 9 | 10 | public Token() { 11 | } 12 | 13 | public String getToken() { 14 | return token; 15 | } 16 | 17 | public void setToken(String token) { 18 | this.token = token; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/mohaiminur/com/textchat/StartActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.mohaiminur.com.textchat; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | 8 | import com.google.firebase.auth.FirebaseAuth; 9 | import com.google.firebase.auth.FirebaseUser; 10 | 11 | public class StartActivity extends AppCompatActivity { 12 | 13 | FirebaseUser firebaseUser; 14 | 15 | @Override 16 | protected void onStart() { 17 | super.onStart(); 18 | 19 | firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); 20 | 21 | //check if user is null 22 | if (firebaseUser != null){ 23 | Intent intent = new Intent(StartActivity.this, MainActivity.class); 24 | startActivity(intent); 25 | finish(); 26 | } 27 | } 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_start); 33 | 34 | 35 | Thread thread=new Thread() 36 | { 37 | @Override 38 | public void run() { 39 | try 40 | { 41 | sleep(2500); 42 | } 43 | catch(Exception e) 44 | { 45 | e.printStackTrace(); 46 | } 47 | finally { 48 | Intent mainIntent=new Intent(StartActivity.this,LoginActivity.class); 49 | startActivity(mainIntent); 50 | } 51 | } 52 | }; 53 | thread.start(); 54 | 55 | } 56 | 57 | @Override 58 | protected void onPause() { 59 | super.onPause(); 60 | finish(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-anydpi/ic_action_name.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-hdpi/camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/galleryy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-hdpi/galleryy.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-hdpi/ic_action_name.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/onee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-hdpi/onee.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-mdpi/ic_action_name.png -------------------------------------------------------------------------------- /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-xhdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-xhdpi/ic_action_name.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable-xxhdpi/ic_action_name.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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/drawable/one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohaiminur/Textchat/c07b17348972915b0cda677fdbf2f1034ed7a1f7/app/src/main/res/drawable/one.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 17 | 18 | 27 | 28 | 29 | 40 | 41 | 42 | 57 | 58 | 72 | 73 |