├── CONTRIBUTING.md ├── .gradle ├── 5.4.1 │ ├── gc.properties │ ├── fileChanges │ │ └── last-build.bin │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── javaCompile │ │ ├── jarAnalysis.bin │ │ ├── taskHistory.bin │ │ ├── classAnalysis.bin │ │ └── javaCompile.lock │ ├── fileContent │ │ └── fileContent.lock │ └── executionHistory │ │ ├── executionHistory.bin │ │ └── executionHistory.lock ├── vcs-1 │ └── gc.properties └── buildOutputCleanup │ ├── cache.properties │ ├── outputFiles.bin │ └── buildOutputCleanup.lock ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── google_maps_api.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── navigation │ │ │ │ └── nav_graph.xml │ │ │ ├── color │ │ │ │ └── menu_item_foreground.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── home_icon.xml │ │ │ │ ├── gradient_color.xml │ │ │ │ ├── search_icon.xml │ │ │ │ └── dice_icon.xml │ │ │ ├── menu │ │ │ │ ├── menu_main.xml │ │ │ │ └── bottom_tab_bar_items.xml │ │ │ ├── layout │ │ │ │ ├── activity_country__details.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── fragment_search_frag.xml │ │ │ │ ├── all_countries_frag.xml │ │ │ │ ├── item_card.xml │ │ │ │ └── activity_sign_in.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── ic_launcher-web.png │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── firozhasan │ │ │ │ └── retrofitkotlinexample │ │ │ │ ├── model │ │ │ │ ├── modelClass │ │ │ │ │ ├── QuotesResponse.kt │ │ │ │ │ ├── Quote.kt │ │ │ │ │ ├── User.kt │ │ │ │ │ ├── CurrenciesItem.kt │ │ │ │ │ ├── LanguagesItem.kt │ │ │ │ │ ├── RegionalBlocsItem.kt │ │ │ │ │ ├── UserX.kt │ │ │ │ │ ├── Translations.kt │ │ │ │ │ └── Country.kt │ │ │ │ ├── repos │ │ │ │ │ ├── LoginRepository.kt │ │ │ │ │ ├── AllCountriesRepository.kt │ │ │ │ │ ├── FindCountryRepository.kt │ │ │ │ │ └── CountryDetailsRepository.kt │ │ │ │ └── api │ │ │ │ │ ├── CountryAPI.kt │ │ │ │ │ ├── JobServices.kt │ │ │ │ │ ├── LoginAPI.kt │ │ │ │ │ ├── SafeApiRequest.kt │ │ │ │ │ ├── CountriesAPI.kt │ │ │ │ │ └── NetworkConnectionInterceptor.kt │ │ │ │ ├── listener │ │ │ │ ├── MainListener.kt │ │ │ │ ├── AuthListener.kt │ │ │ │ └── Constant.kt │ │ │ │ ├── util │ │ │ │ ├── Exceptions.kt │ │ │ │ ├── Status.kt │ │ │ │ ├── Delegates.kt │ │ │ │ ├── ViewUtils.kt │ │ │ │ └── Coroutines.kt │ │ │ │ ├── viewModel │ │ │ │ ├── AuthViewModelFactory.kt │ │ │ │ ├── CountryDetailsViewModelFactory.kt │ │ │ │ ├── FindCountryViewModelFactory.kt │ │ │ │ ├── AllCountriesViewModelFactory.kt │ │ │ │ ├── FindCountryViewModel.kt │ │ │ │ ├── AllCountriesViewModel.kt │ │ │ │ ├── AuthViewModel.kt │ │ │ │ └── CountryDetailsViewModel.kt │ │ │ │ ├── view │ │ │ │ ├── activities │ │ │ │ │ ├── CountryDetails.kt │ │ │ │ │ ├── SignInActivity.kt │ │ │ │ │ └── MainActivity.kt │ │ │ │ ├── adapters │ │ │ │ │ ├── gMapBindingAdapter.kt │ │ │ │ │ ├── CountryListBindingAdapter.kt │ │ │ │ │ └── CountriesAdapter.kt │ │ │ │ └── fragments │ │ │ │ │ ├── SearchFrag.kt │ │ │ │ │ ├── AllCountriesFrag.kt │ │ │ │ │ └── CountriesDetailsFrag.kt │ │ │ │ └── MVVMapplicaiton.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── firozhasan │ │ │ └── retrofitkotlinexample │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── firozhasan │ │ └── retrofitkotlinexample │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── PULL_REQUEST_TEMPLATE.md ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── vcs.xml ├── libraries │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml │ ├── Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml │ ├── Gradle__com_github_2coffees1team_GlideToVectorYou_v1_2_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_base_10_2_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_maps_10_2_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_tasks_10_2_0_aar.xml │ ├── Gradle__com_google_android_gms_play_services_basement_10_2_0_aar.xml │ ├── Gradle__androidx_arch_core_core_common_2_1_0_jar.xml │ ├── Gradle__androidx_collection_collection_1_1_0_jar.xml │ ├── Gradle__androidx_collection_collection_ktx_1_1_0_jar.xml │ ├── Gradle__org_kodein_di_kodein_di_core_jvm_6_2_1_jar.xml │ ├── Gradle__org_kodein_di_kodein_di_generic_jvm_6_2_1_jar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_common_2_2_0_rc01_jar.xml │ ├── Gradle__androidx_loader_loader_1_0_0_aar.xml │ ├── Gradle__androidx_core_core_ktx_1_1_0_aar.xml │ ├── Gradle__androidx_cardview_cardview_1_0_0_aar.xml │ ├── Gradle__junit_junit_4_12_jar.xml │ ├── Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml │ ├── Gradle__androidx_customview_customview_1_0_0_aar.xml │ ├── Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml │ ├── Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml │ ├── Gradle__androidx_activity_activity_1_1_0_rc01_aar.xml │ ├── Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml │ ├── Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml │ ├── Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml │ ├── Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml │ ├── Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml │ ├── Gradle__androidx_activity_activity_ktx_1_1_0_rc01_aar.xml │ ├── Gradle__androidx_fragment_fragment_ktx_1_2_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_process_2_1_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_service_2_1_0_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_2_1_0_aar.xml │ ├── Gradle__com_squareup_okio_okio_1_15_0_jar.xml │ ├── Gradle__javax_inject_javax_inject_1_jar.xml │ ├── Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml │ ├── Gradle__androidx_databinding_databinding_runtime_3_5_3_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_extensions_2_1_0_aar.xml │ ├── Gradle__com_google_code_gson_gson_2_8_5_jar.xml │ ├── Gradle__androidx_databinding_databinding_adapters_3_5_3_aar.xml │ ├── Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml │ ├── Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml │ ├── Gradle__com_squareup_javawriter_2_1_1_jar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_navigation_navigation_ui_2_2_0_rc01_aar.xml │ ├── Gradle__org_jetbrains_annotations_13_0_jar.xml │ ├── Gradle__androidx_navigation_navigation_common_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_navigation_navigation_ui_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml │ ├── Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml │ ├── Gradle__androidx_navigation_navigation_runtime_2_2_0_rc01_aar.xml │ ├── Gradle__com_squareup_okhttp3_okhttp_3_12_0_jar.xml │ ├── Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_navigation_navigation_fragment_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml │ ├── Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml │ ├── Gradle__androidx_annotation_annotation_1_1_0_jar.xml │ ├── Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml │ ├── Gradle__androidx_navigation_navigation_common_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__com_squareup_retrofit2_retrofit_2_6_0_jar.xml │ ├── Gradle__org_kodein_di_kodein_di_framework_android_x_6_2_1_aar.xml │ ├── Gradle__androidx_navigation_navigation_runtime_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__androidx_navigation_navigation_fragment_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__org_kodein_di_kodein_di_framework_android_core_6_2_1_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_rc01_aar.xml │ ├── Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml │ ├── Gradle__androidx_core_core_1_1_0_aar.xml │ ├── Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_50_jar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_1_0_0_rc01_aar.xml │ ├── Gradle__androidx_media_media_1_0_0_aar.xml │ ├── Gradle__androidx_print_print_1_0_0_aar.xml │ ├── Gradle__com_squareup_retrofit2_converter_gson_2_6_0_jar.xml │ ├── Gradle__androidx_test_runner_1_1_0_aar.xml │ ├── Gradle__androidx_test_monitor_1_1_0_aar.xml │ ├── Gradle__androidx_databinding_databinding_common_3_5_3_jar.xml │ ├── Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_30_jar.xml │ ├── Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_3_10_jar.xml │ ├── Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml │ ├── Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_50_jar.xml │ ├── Gradle__androidx_transition_transition_1_2_0_aar.xml │ ├── Gradle__androidx_fragment_fragment_1_2_0_rc01_aar.xml │ ├── Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_0_jar.xml │ ├── Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml │ ├── Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_0_jar.xml │ ├── Gradle__androidx_test_espresso_espresso_core_3_1_0_aar.xml │ ├── Gradle__androidx_viewpager2_viewpager2_1_0_0_beta05_aar.xml │ ├── Gradle__com_google_android_material_material_1_2_0_alpha01_aar.xml │ ├── Gradle__androidx_recyclerview_recyclerview_1_1_0_beta05_aar.xml │ ├── Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml │ ├── Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_beta01_aar.xml │ └── Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_aar.xml ├── runConfigurations.xml ├── gradle.xml ├── modules.xml ├── assetWizardSettings.xml └── misc.xml ├── MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml ├── local.properties ├── gradle.properties ├── bbb-MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml ├── AndroidStudioProjects-MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml ├── gradlew.bat └── CODE_OF_CONDUCT.md /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gradle/5.4.1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.gradle/5.4.1/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 14 04:36:44 BDT 2019 2 | gradle.version=5.4.1 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2E4BA6 4 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gradle/5.4.1/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.gradle/5.4.1/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/5.4.1/javaCompile/jarAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/javaCompile/jarAnalysis.bin -------------------------------------------------------------------------------- /.gradle/5.4.1/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/5.4.1/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/5.4.1/javaCompile/classAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/javaCompile/classAnalysis.bin -------------------------------------------------------------------------------- /.gradle/5.4.1/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/5.4.1/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/5.4.1/executionHistory/executionHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/executionHistory/executionHistory.bin -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gradle/5.4.1/executionHistory/executionHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/.gradle/5.4.1/executionHistory/executionHistory.lock -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firoz-Hasan/MVVM-DataBinding-LIveData-Retrofit-Coroutines-DependencyInjection-Kotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4dp 4 | 8dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/navigation/nav_graph.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/QuotesResponse.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | data class QuotesResponse ( 5 | val isSuccessful: Boolean, 6 | val quotes: List 7 | ) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 06 20:46:29 BDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/listener/MainListener.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.listener 2 | 3 | /* 4 | interface MainListener { 5 | fun gotoDetailsFragment(alpha2Code : String) 6 | fun gotoDetailsActivity(alpha2Code : String) 7 | }*/ 8 | -------------------------------------------------------------------------------- /MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/util/Exceptions.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.util 2 | 3 | import java.io.IOException 4 | 5 | class ApiException(message: String) : IOException(message) 6 | class NoInternetException(message: String) : IOException(message) -------------------------------------------------------------------------------- /app/src/main/res/color/menu_item_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/util/Status.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.util 2 | 3 | //An enum is a special "class" that 4 | // represents a group of constants (unchangeable variables, 5 | // like final variables). 6 | enum class Status { 7 | LOADING, ERROR, DONE 8 | } -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #FFFFFF 8 | #000000 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RetrofitKotlinExample 3 | Countries 4 | Hello blank fragment 5 | MVVM Architecture 6 | SIGN IN 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/Quote.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | 5 | data class Quote( 6 | val id: Int, 7 | val quote: String, 8 | val author: String, 9 | val thumbnail: String, 10 | val created_at: String, 11 | val updated_at: String 12 | ) -------------------------------------------------------------------------------- /app/src/main/res/drawable/home_icon.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Sun Jan 19 14:07:12 BDT 2020 8 | sdk.dir=C\:\\Users\\41532\\AppData\\Local\\Android\\Sdk 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/listener/AuthListener.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.listener 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.UserX 4 | 5 | interface AuthListener{ 6 | fun onStarted() 7 | fun onSuccess(user: UserX?) 8 | fun onFailure(message: String) 9 | fun gotoMainActivity() 10 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/util/Delegates.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.util 2 | 3 | import kotlinx.coroutines.* 4 | 5 | fun lazyDeferred(block: suspend CoroutineScope.() -> T): Lazy>{ 6 | return lazy { 7 | GlobalScope.async(start = CoroutineStart.LAZY) { 8 | block.invoke(this) 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/User.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | data class User( 7 | @SerializedName("isSuccessful") 8 | var isSuccessful: Boolean = false, 9 | @SerializedName("message") 10 | var message: String = "", 11 | @SerializedName("user") 12 | var user: UserX = UserX() 13 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/CurrenciesItem.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | 7 | data class CurrenciesItem( 8 | 9 | @field:SerializedName("symbol") 10 | val symbol: String? = null, 11 | 12 | @field:SerializedName("code") 13 | val code: String? = null, 14 | 15 | @field:SerializedName("name") 16 | val name: String? = null 17 | ) -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/listener/Constant.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.listener 2 | 3 | interface Constant { 4 | companion object { 5 | const val BASE_URL = "https://restcountries.eu/" 6 | const val ALL_COUNTIRES = "rest/v2/all" 7 | const val CAPITAL = "/rest/v2/capital/{capital}" 8 | const val BASE_URL_LOGIN = "https://api.simplifiedcoding.in/course-apis/mvvm/" 9 | const val LOGIN = "login" 10 | } 11 | } -------------------------------------------------------------------------------- /app/src/test/java/com/example/firozhasan/retrofitkotlinexample/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/LanguagesItem.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | import com.google.gson.annotations.SerializedName 4 | 5 | 6 | data class LanguagesItem( 7 | 8 | @field:SerializedName("nativeName") 9 | val nativeName: String? = null, 10 | 11 | @field:SerializedName("iso639_2") 12 | val iso6392: String? = null, 13 | 14 | @field:SerializedName("name") 15 | val name: String? = null, 16 | 17 | @field:SerializedName("iso639_1") 18 | val iso6391: String? = null 19 | ) -------------------------------------------------------------------------------- /app/src/main/res/drawable/search_icon.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_2coffees1team_GlideToVectorYou_v1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/RegionalBlocsItem.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | 7 | data class RegionalBlocsItem( 8 | 9 | @field:SerializedName("otherNames") 10 | val otherNames: List? = null, 11 | 12 | @field:SerializedName("acronym") 13 | val acronym: String? = null, 14 | 15 | @field:SerializedName("name") 16 | val name: String? = null, 17 | 18 | @field:SerializedName("otherAcronyms") 19 | val otherAcronyms: List? = null 20 | ) -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_base_10_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_maps_10_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_tasks_10_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/repos/LoginRepository.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.repos 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.model.api.LoginAPI 4 | import com.example.firozhasan.retrofitkotlinexample.model.api.SafeApiRequest 5 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.User 6 | 7 | class LoginRepository(private val loginAPI: LoginAPI) : SafeApiRequest(){ 8 | suspend fun userLogin(email: String, password: String): User { 9 | return apiRequest { loginAPI.userLogin(email, password) } 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/AuthViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import androidx.lifecycle.ViewModel 4 | import androidx.lifecycle.ViewModelProvider 5 | import com.example.firozhasan.retrofitkotlinexample.model.repos.LoginRepository 6 | 7 | @Suppress("UNCHECKED_CAST") 8 | class AuthViewModelFactory( 9 | private val repository: LoginRepository 10 | ) : ViewModelProvider.NewInstanceFactory() { 11 | override fun create(modelClass: Class): T { 12 | return AuthViewModel(repository) as T 13 | } 14 | } -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_gms_play_services_basement_10_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dice_icon.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_collection_collection_1_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/CountryDetailsViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import androidx.lifecycle.ViewModel 4 | import androidx.lifecycle.ViewModelProvider 5 | import com.example.firozhasan.retrofitkotlinexample.model.repos.CountryDetailsRepository 6 | 7 | class CountryDetailsViewModelFactory 8 | (private val repository: CountryDetailsRepository): 9 | ViewModelProvider.NewInstanceFactory() { 10 | override fun create(modelClass: Class): T { 11 | return CountryDetailsViewModel(repository) as T 12 | } 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/FindCountryViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import androidx.lifecycle.ViewModel 4 | import androidx.lifecycle.ViewModelProvider 5 | import com.example.firozhasan.retrofitkotlinexample.model.repos.FindCountryRepository 6 | 7 | @Suppress("UNCHECKED_CAST") 8 | class FindCountryViewModelFactory( 9 | private val repository: FindCountryRepository 10 | ) : ViewModelProvider.NewInstanceFactory() { 11 | override fun create(modelClass: Class): T { 12 | return FindCountryViewModel(repository) as T 13 | } 14 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/UserX.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | data class UserX( 7 | @SerializedName("created_at") 8 | var createdAt: String = "", 9 | @SerializedName("email") 10 | var email: String = "", 11 | @SerializedName("email_verified_at") 12 | var emailVerifiedAt: Any = Any(), 13 | @SerializedName("id") 14 | var id: Int = 0, 15 | @SerializedName("name") 16 | var name: String = "", 17 | @SerializedName("updated_at") 18 | var updatedAt: String = "" 19 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/AllCountriesViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import androidx.lifecycle.ViewModel 4 | import androidx.lifecycle.ViewModelProvider 5 | import com.example.firozhasan.retrofitkotlinexample.model.repos.AllCountriesRepository 6 | 7 | @Suppress("UNCHECKED_CAST") 8 | class AllCountriesViewModelFactory( 9 | private val repository: AllCountriesRepository 10 | ) : ViewModelProvider.NewInstanceFactory() { 11 | override fun create(modelClass: Class): T { 12 | return AllCountriesViewModel(repository) as T 13 | } 14 | } -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_collection_collection_ktx_1_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_kodein_di_kodein_di_core_jvm_6_2_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_kodein_di_kodein_di_generic_jvm_6_2_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_rc01_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_core_core_ktx_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_12_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/repos/AllCountriesRepository.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.repos 2 | 3 | import android.util.Log 4 | import androidx.lifecycle.MutableLiveData 5 | import com.example.firozhasan.retrofitkotlinexample.model.api.CountriesAPI 6 | import com.example.firozhasan.retrofitkotlinexample.model.api.SafeApiRequest 7 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.Country 8 | 9 | class AllCountriesRepository(private val countriesApi: CountriesAPI) : SafeApiRequest() { 10 | suspend fun fetchAllCountries(): List { 11 | val response = apiRequest { countriesApi.getAllCountries() } 12 | return response 13 | } 14 | } -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bottom_tab_bar_items.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_activity_activity_1_1_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_activity_activity_ktx_1_1_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_fragment_fragment_ktx_1_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_okio_okio_1_15_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_country__details.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_databinding_databinding_runtime_3_5_3_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_databinding_databinding_adapters_3_5_3_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_ui_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_annotations_13_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_common_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_ui_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_runtime_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_12_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/util/ViewUtils.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.util 2 | 3 | import android.content.Context 4 | import com.google.android.material.snackbar.Snackbar 5 | import android.view.View 6 | import android.widget.ProgressBar 7 | import android.widget.Toast 8 | 9 | fun Context.toast(message: String){ 10 | Toast.makeText(this, message, Toast.LENGTH_LONG ).show() 11 | } 12 | 13 | fun ProgressBar.show(){ 14 | visibility = View.VISIBLE 15 | } 16 | 17 | fun ProgressBar.hide(){ 18 | visibility = View.GONE 19 | } 20 | 21 | fun View.snackbar(message: String){ 22 | Snackbar.make(this, message, Snackbar.LENGTH_LONG).also { snackbar -> 23 | snackbar.setAction("Ok") { 24 | snackbar.dismiss() 25 | } 26 | }.show() 27 | } 28 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_fragment_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | android.enableJetifier=true 10 | android.useAndroidX=true 11 | org.gradle.jvmargs=-Xmx1536m 12 | # When configured, Gradle will run in incubating parallel mode. 13 | # This option should only be used with decoupled projects. More details, visit 14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 15 | # org.gradle.parallel=true 16 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_common_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_6_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_x_6_2_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_runtime_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_navigation_navigation_fragment_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/CountryAPI.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.listener.Constant 4 | import retrofit2.Retrofit 5 | import retrofit2.converter.gson.GsonConverterFactory 6 | 7 | class CountryAPI { 8 | 9 | companion object { 10 | 11 | private var retrofit: Retrofit? = null 12 | 13 | val client: Retrofit 14 | get() { 15 | if (retrofit == null) { 16 | retrofit = Retrofit.Builder() 17 | .addConverterFactory(GsonConverterFactory.create()) 18 | .baseUrl(Constant.BASE_URL) 19 | .build() 20 | } 21 | return retrofit!! 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_core_6_2_1_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/firozhasan/retrofitkotlinexample/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.example.firozhasan.retrofitkotlinexample", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_50_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_1_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_6_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_runner_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_monitor_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_databinding_databinding_common_3_5_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_30_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_3_10_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/JobServices.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.listener.Constant 4 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.Country 5 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.User 6 | import retrofit2.Call 7 | import retrofit2.Response 8 | import retrofit2.http.* 9 | 10 | interface JobServices { 11 | 12 | @GET(Constant.CAPITAL) 13 | fun getKountry(@Path("capital") capitalOfCountry: String): Call> 14 | 15 | @GET(Constant.ALL_COUNTIRES) 16 | fun getAllCountries() : Call> 17 | 18 | @FormUrlEncoded 19 | @POST(Constant.LOGIN) 20 | suspend fun userLogin( 21 | @Field("email") email: String, 22 | @Field("password") password: String 23 | 24 | ) : Response 25 | } -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_50_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/modelClass/Translations.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.modelClass 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | 7 | data class Translations( 8 | 9 | @field:SerializedName("br") 10 | val br: String? = null, 11 | 12 | @field:SerializedName("de") 13 | val de: String? = null, 14 | 15 | @field:SerializedName("pt") 16 | val pt: String? = null, 17 | 18 | @field:SerializedName("ja") 19 | val ja: String? = null, 20 | 21 | @field:SerializedName("hr") 22 | val hr: String? = null, 23 | 24 | @field:SerializedName("it") 25 | val it: String? = null, 26 | 27 | @field:SerializedName("fa") 28 | val fa: String? = null, 29 | 30 | @field:SerializedName("fr") 31 | val fr: String? = null, 32 | 33 | @field:SerializedName("es") 34 | val es: String? = null, 35 | 36 | @field:SerializedName("nl") 37 | val nl: String? = null 38 | ) -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_fragment_fragment_1_2_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_beta05_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_material_material_1_2_0_alpha01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_beta05_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /bbb-MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AndroidStudioProjects-MVVM-DataBinding-LIveData-Retrofit-Kotlin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_beta01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | AIzaSyAbucZwXbnmzrwnsX9Q_WE-MRI13fezhQM 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/util/Coroutines.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.util 2 | 3 | import kotlinx.coroutines.CoroutineScope 4 | import kotlinx.coroutines.Dispatchers 5 | import kotlinx.coroutines.launch 6 | import kotlinx.coroutines.withContext 7 | 8 | object Coroutines { 9 | fun main(work : suspend (() -> Unit)){ 10 | CoroutineScope(Dispatchers.Main).launch { 11 | work() 12 | //when we say launch this will fire up a new coroutine 13 | } 14 | } 15 | 16 | fun io(work : suspend (() -> Unit)){ 17 | CoroutineScope(Dispatchers.IO).launch { 18 | work() 19 | } 20 | } 21 | 22 | suspend fun withContextMain(work : suspend (() -> Unit)){ 23 | withContext(Dispatchers.Main) { 24 | work() 25 | // when we say withcontext that means we are using already existed 26 | // coroutine not firing any new coroutine. 27 | } 28 | } 29 | 30 | suspend fun withContextIO(work : suspend (() -> Unit)){ 31 | withContext(Dispatchers.IO) { 32 | work() 33 | } 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/FindCountryViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import android.util.Log 4 | import android.view.View 5 | import androidx.lifecycle.LiveData 6 | import androidx.lifecycle.MutableLiveData 7 | import androidx.lifecycle.ViewModel 8 | import com.example.firozhasan.retrofitkotlinexample.model.repos.FindCountryRepository 9 | import com.example.firozhasan.retrofitkotlinexample.util.Coroutines 10 | 11 | class FindCountryViewModel(private val repository : FindCountryRepository) 12 | : ViewModel() { 13 | 14 | //val countryFullInfo: LiveData> get() = repository.findCountryFullInfo 15 | val country: LiveData 16 | get() = repository.findCountryName 17 | val editTextCountryName = MutableLiveData() 18 | 19 | fun onChangeFindCountryClick(view: View) { 20 | Log.d("hellohello", "find er view model e asche outside ") 21 | Coroutines.io { 22 | Log.d("hellohello", "find er view model e asche inside ") 23 | repository.findCountryByCapital(editTextCountryName.value.toString()) 24 | } 25 | } 26 | 27 | 28 | 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/view/activities/CountryDetails.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.view.activities 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import com.example.firozhasan.retrofitkotlinexample.R 6 | import com.example.firozhasan.retrofitkotlinexample.view.fragments.CountriesDetailsFrag 7 | 8 | 9 | class CountryDetails : AppCompatActivity() { 10 | 11 | var countriesDetails: CountriesDetailsFrag? = null 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_country__details) 15 | countriesDetails = CountriesDetailsFrag() 16 | val getAlphaCode = intent.getStringExtra("alpha") 17 | val bundle = Bundle() 18 | bundle.putString("message", getAlphaCode) 19 | countriesDetails!!.setArguments(bundle) 20 | supportFragmentManager 21 | .beginTransaction() 22 | .setCustomAnimations(R.anim.abc_fade_in, R.anim.abc_fade_out) 23 | .add(R.id.cntryDetails, countriesDetails!!) 24 | .show(countriesDetails!!) 25 | .commit() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | 24 | 25 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/repos/FindCountryRepository.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.repos 2 | 3 | import android.util.Log 4 | import androidx.lifecycle.MutableLiveData 5 | import com.example.firozhasan.retrofitkotlinexample.model.api.CountriesAPI 6 | import com.example.firozhasan.retrofitkotlinexample.model.api.SafeApiRequest 7 | import com.example.firozhasan.retrofitkotlinexample.util.Coroutines 8 | 9 | class FindCountryRepository(private val countriesAPI: CountriesAPI) : SafeApiRequest(){ 10 | val findCountryName = MutableLiveData() 11 | suspend fun findCountryByCapital(capital: String) { 12 | return Coroutines.withContextIO { 13 | fetchACountry(capital) 14 | } 15 | } 16 | private suspend fun fetchACountry(capital: String) { 17 | Log.d("hellohello","fetchAllCountries2 outside fetch ") 18 | try { 19 | val response = apiRequest { countriesAPI.getCountry(capital) } 20 | Log.d("hellohello","fetchAllCountries2inside fetch try+${response} ") 21 | findCountryName.postValue(response[0].name) 22 | } catch (e: Exception) { 23 | e.printStackTrace() 24 | Log.d("hellohello","fetchAllCountries2inside fetch catch+${e.toString()} ") 25 | 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /.idea/assetWizardSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/LoginAPI.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.User 4 | import okhttp3.OkHttpClient 5 | import retrofit2.Response 6 | import retrofit2.Retrofit 7 | import retrofit2.converter.gson.GsonConverterFactory 8 | import retrofit2.http.Field 9 | import retrofit2.http.FormUrlEncoded 10 | import retrofit2.http.POST 11 | 12 | interface LoginAPI { 13 | 14 | @FormUrlEncoded 15 | @POST("login") 16 | suspend fun userLogin( 17 | @Field("email") email: String, 18 | @Field("password") password: String 19 | ): Response 20 | 21 | companion object { 22 | operator fun invoke( 23 | networkConnectionInterceptor: NetworkConnectionInterceptor 24 | ): LoginAPI { 25 | 26 | val okHttpClient = OkHttpClient.Builder() 27 | .addInterceptor(networkConnectionInterceptor) 28 | .build() 29 | 30 | return Retrofit.Builder() 31 | .client(okHttpClient) 32 | .baseUrl("https://api.simplifiedcoding.in/course-apis/mvvm/") 33 | .addConverterFactory(GsonConverterFactory.create()) 34 | .build() 35 | .create(LoginAPI::class.java) 36 | } 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/SafeApiRequest.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import android.util.Log 4 | import com.example.firozhasan.retrofitkotlinexample.util.ApiException 5 | import com.google.gson.JsonObject 6 | import org.json.JSONException 7 | import org.json.JSONObject 8 | import retrofit2.Response 9 | import java.lang.StringBuilder 10 | 11 | abstract class SafeApiRequest { 12 | suspend fun apiRequest(call: suspend () -> Response): T { 13 | 14 | val response = call.invoke() 15 | val message = StringBuilder() 16 | 17 | if (response?.isSuccessful) { 18 | Log.d("hellohello","safeapireqsucc+${response.body()} ") 19 | 20 | return response?.body()!! 21 | 22 | } 23 | else { 24 | val error = response?.errorBody()?.string() 25 | error?.let { 26 | try { 27 | message.append(JSONObject(it).getString("message")) 28 | // Log.d("hellohello","safeapireqfail 00000+${response.code()} ") 29 | 30 | } catch (e: JSONException) { 31 | message.append("\n") 32 | } 33 | 34 | } 35 | message.append("\nError code ${response.code()}") 36 | Log.d("hellohello","safeapireqfail 00000+${response.code()} ") 37 | throw ApiException(message.toString()) 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/CountriesAPI.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import com.example.firozhasan.retrofitkotlinexample.listener.Constant 4 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.Country 5 | import okhttp3.OkHttpClient 6 | import retrofit2.Response 7 | import retrofit2.Retrofit 8 | import retrofit2.converter.gson.GsonConverterFactory 9 | import retrofit2.http.GET 10 | import retrofit2.http.Path 11 | 12 | interface CountriesAPI { 13 | 14 | @GET(Constant.ALL_COUNTIRES) 15 | suspend fun getAllCountries() : Response> 16 | 17 | @GET(Constant.CAPITAL) 18 | suspend fun getCountry(@Path("capital") capitalOfCountry: String): Response> 19 | 20 | @GET("rest/v2/alpha/{code}") 21 | suspend fun getCountryDetails(@Path("code") alpha2Code: String): Response 22 | 23 | companion object { 24 | operator fun invoke( 25 | networkConnectionInterceptor: NetworkConnectionInterceptor 26 | ): CountriesAPI { 27 | 28 | val okHttpClient = OkHttpClient.Builder() 29 | .addInterceptor(networkConnectionInterceptor) 30 | .build() 31 | 32 | return Retrofit.Builder() 33 | .client(okHttpClient) 34 | .baseUrl(Constant.BASE_URL) 35 | .addConverterFactory(GsonConverterFactory.create()) 36 | .build() 37 | .create(CountriesAPI::class.java) 38 | } 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/viewModel/AllCountriesViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.viewModel 2 | 3 | import android.util.Log 4 | import androidx.lifecycle.LiveData 5 | import androidx.lifecycle.MutableLiveData 6 | import androidx.lifecycle.ViewModel 7 | import androidx.lifecycle.viewModelScope 8 | import com.example.firozhasan.retrofitkotlinexample.model.modelClass.Country 9 | import com.example.firozhasan.retrofitkotlinexample.model.repos.AllCountriesRepository 10 | import com.example.firozhasan.retrofitkotlinexample.util.Status 11 | import kotlinx.coroutines.launch 12 | 13 | class AllCountriesViewModel(private val repository : AllCountriesRepository) 14 | : ViewModel() { 15 | private var countryList: List? = null 16 | private val _countries = MutableLiveData>() 17 | val countries: LiveData>? 18 | get() = _countries 19 | private val _status = MutableLiveData() 20 | val status : LiveData 21 | get() = _status 22 | init { 23 | getCountry() 24 | } 25 | private fun getCountry() { 26 | viewModelScope.launch { 27 | try { 28 | countryList = repository.fetchAllCountries() 29 | _status.value = Status.LOADING 30 | _countries.value = countryList 31 | _status.value = Status.DONE 32 | Log.d("pakapaki","fetchAllCountries2inside fetch try+${_countries?.value} ") 33 | } catch (e: Exception) { 34 | _status.value = Status.ERROR 35 | e.printStackTrace() 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/firozhasan/retrofitkotlinexample/model/api/NetworkConnectionInterceptor.kt: -------------------------------------------------------------------------------- 1 | package com.example.firozhasan.retrofitkotlinexample.model.api 2 | 3 | import android.content.Context 4 | import android.net.ConnectivityManager 5 | import android.net.NetworkCapabilities 6 | import android.os.Build 7 | import androidx.annotation.RequiresApi 8 | import com.example.firozhasan.retrofitkotlinexample.util.NoInternetException 9 | import okhttp3.Interceptor 10 | import okhttp3.Response 11 | 12 | class NetworkConnectionInterceptor( 13 | context: Context 14 | ) : Interceptor { 15 | 16 | private val applicationContext = context.applicationContext 17 | 18 | @RequiresApi(Build.VERSION_CODES.M) 19 | override fun intercept(chain: Interceptor.Chain): Response { 20 | if (!isInternetAvailable()) 21 | throw NoInternetException("Make sure you have an active data connection") 22 | return chain.proceed(chain.request()) 23 | } 24 | 25 | @RequiresApi(Build.VERSION_CODES.M) 26 | private fun isInternetAvailable(): Boolean { 27 | var result = false 28 | val connectivityManager = 29 | applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager? 30 | connectivityManager?.let { 31 | it.getNetworkCapabilities(connectivityManager.activeNetwork)?.apply { 32 | result = when { 33 | hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true 34 | hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true 35 | else -> false 36 | } 37 | } 38 | } 39 | return result 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_search_frag.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 19 | 20 | 29 |