commit e32750639ff0fbc174d3d714bf948f11564a3a28 Author: hmalik144 Date: Sat Jul 18 21:49:10 2020 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7bec898 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Project exclude paths +/.gradle/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..d168721 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Candy Space \ No newline at end of file diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000..2dd4328 Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..88ea3aa --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,122 @@ + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+ + +
+
\ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/dictionaries/h_mal.xml b/.idea/dictionaries/h_mal.xml new file mode 100644 index 0000000..f32ad56 --- /dev/null +++ b/.idea/dictionaries/h_mal.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..5cd135a --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_activity_activity_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_activity_activity_1_1_0_aar.xml new file mode 100644 index 0000000..eb1044c --- /dev/null +++ b/.idea/libraries/Gradle__androidx_activity_activity_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_activity_activity_ktx_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_activity_activity_ktx_1_1_0_aar.xml new file mode 100644 index 0000000..4609cbe --- /dev/null +++ b/.idea/libraries/Gradle__androidx_activity_activity_ktx_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_jar.xml b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_jar.xml new file mode 100644 index 0000000..5b17db6 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml new file mode 100644 index 0000000..6fc4952 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml new file mode 100644 index 0000000..3379a21 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_jar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_jar.xml new file mode 100644 index 0000000..a7f501b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml new file mode 100644 index 0000000..113ab6b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml new file mode 100644 index 0000000..d1f3672 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml new file mode 100644 index 0000000..5f5831a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml new file mode 100644 index 0000000..82efb76 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_jar.xml b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_jar.xml new file mode 100644 index 0000000..ecb16c3 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_collection_collection_ktx_1_1_0_jar.xml b/.idea/libraries/Gradle__androidx_collection_collection_ktx_1_1_0_jar.xml new file mode 100644 index 0000000..f2bc234 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_collection_collection_ktx_1_1_0_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml new file mode 100644 index 0000000..4300c06 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_1_1_3_aar.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml new file mode 100644 index 0000000..f92fb42 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_1_1_3_jar.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml new file mode 100644 index 0000000..b41e047 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_core_core_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_core_core_1_2_0_aar.xml new file mode 100644 index 0000000..5573d2f --- /dev/null +++ b/.idea/libraries/Gradle__androidx_core_core_1_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml new file mode 100644 index 0000000..ff6d861 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_core_core_ktx_1_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml new file mode 100644 index 0000000..ed20500 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml new file mode 100644 index 0000000..b113f0a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml new file mode 100644 index 0000000..05835c6 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml new file mode 100644 index 0000000..66fc38b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_0_0_aar.xml new file mode 100644 index 0000000..29fb232 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_fragment_fragment_1_2_5_aar.xml b/.idea/libraries/Gradle__androidx_fragment_fragment_1_2_5_aar.xml new file mode 100644 index 0000000..78fda73 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_fragment_fragment_1_2_5_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_fragment_fragment_ktx_1_2_5_aar.xml b/.idea/libraries/Gradle__androidx_fragment_fragment_ktx_1_2_5_aar.xml new file mode 100644 index 0000000..da48e3a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_fragment_fragment_ktx_1_2_5_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml new file mode 100644 index 0000000..6ac939e --- /dev/null +++ b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml new file mode 100644 index 0000000..7197f67 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml new file mode 100644 index 0000000..7dc4117 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml new file mode 100644 index 0000000..9601140 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_jar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_jar.xml new file mode 100644 index 0000000..26073f8 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_2_0_aar.xml new file mode 100644 index 0000000..7999368 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_2_0_aar.xml new file mode 100644 index 0000000..b06a47f --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_aar.xml new file mode 100644 index 0000000..105c0a9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_aar.xml new file mode 100644 index 0000000..2aa0543 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_2_0_aar.xml new file mode 100644 index 0000000..73dacfd --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_aar.xml new file mode 100644 index 0000000..70d2cd9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_aar.xml new file mode 100644 index 0000000..539339e --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_2_0_aar.xml new file mode 100644 index 0000000..d8dac7c --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_aar.xml new file mode 100644 index 0000000..171612a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_aar.xml new file mode 100644 index 0000000..61d8267 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_2_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_2_0_aar.xml new file mode 100644 index 0000000..7935322 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml new file mode 100644 index 0000000..de968ab --- /dev/null +++ b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml new file mode 100644 index 0000000..75566d3 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml new file mode 100644 index 0000000..2522404 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_media_media_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_common_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_common_2_2_2_aar.xml new file mode 100644 index 0000000..e772951 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_common_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_common_ktx_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_common_ktx_2_2_2_aar.xml new file mode 100644 index 0000000..56b19a9 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_common_ktx_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_2_2_2_aar.xml new file mode 100644 index 0000000..d3f3e81 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_ktx_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_ktx_2_2_2_aar.xml new file mode 100644 index 0000000..e63fbb3 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_fragment_ktx_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_2_2_2_aar.xml new file mode 100644 index 0000000..fd3f4ed --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_ktx_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_ktx_2_2_2_aar.xml new file mode 100644 index 0000000..31d684d --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_runtime_ktx_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_ui_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_ui_2_2_2_aar.xml new file mode 100644 index 0000000..c9e3244 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_ui_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_navigation_navigation_ui_ktx_2_2_2_aar.xml b/.idea/libraries/Gradle__androidx_navigation_navigation_ui_ktx_2_2_2_aar.xml new file mode 100644 index 0000000..1c27f15 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_navigation_navigation_ui_ktx_2_2_2_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_preference_preference_1_1_1_aar.xml b/.idea/libraries/Gradle__androidx_preference_preference_1_1_1_aar.xml new file mode 100644 index 0000000..1a61bbc --- /dev/null +++ b/.idea/libraries/Gradle__androidx_preference_preference_1_1_1_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_preference_preference_ktx_1_1_1_aar.xml b/.idea/libraries/Gradle__androidx_preference_preference_ktx_1_1_1_aar.xml new file mode 100644 index 0000000..7673ce0 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_preference_preference_ktx_1_1_1_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml new file mode 100644 index 0000000..c8c508b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml new file mode 100644 index 0000000..45bf78a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_room_room_common_2_3_0_alpha01_jar.xml b/.idea/libraries/Gradle__androidx_room_room_common_2_3_0_alpha01_jar.xml new file mode 100644 index 0000000..30f0f5a --- /dev/null +++ b/.idea/libraries/Gradle__androidx_room_room_common_2_3_0_alpha01_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_room_room_ktx_2_3_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_room_room_ktx_2_3_0_alpha01_aar.xml new file mode 100644 index 0000000..56b88fe --- /dev/null +++ b/.idea/libraries/Gradle__androidx_room_room_ktx_2_3_0_alpha01_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_room_room_runtime_2_3_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_room_room_runtime_2_3_0_alpha01_aar.xml new file mode 100644 index 0000000..dd86fe8 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_room_room_runtime_2_3_0_alpha01_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml new file mode 100644 index 0000000..07dd331 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml new file mode 100644 index 0000000..131743f --- /dev/null +++ b/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_sqlite_sqlite_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_sqlite_sqlite_2_1_0_aar.xml new file mode 100644 index 0000000..3f65263 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_sqlite_sqlite_2_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_sqlite_sqlite_framework_2_1_0_aar.xml b/.idea/libraries/Gradle__androidx_sqlite_sqlite_framework_2_1_0_aar.xml new file mode 100644 index 0000000..388ee4b --- /dev/null +++ b/.idea/libraries/Gradle__androidx_sqlite_sqlite_framework_2_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml new file mode 100644 index 0000000..c4acbb6 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml new file mode 100644 index 0000000..1aa84ea --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml new file mode 100644 index 0000000..97329fa --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml new file mode 100644 index 0000000..a765ea7 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml b/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml new file mode 100644 index 0000000..f64d008 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml new file mode 100644 index 0000000..3386608 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_rules_1_3_0_rc01_aar.xml b/.idea/libraries/Gradle__androidx_test_rules_1_3_0_rc01_aar.xml new file mode 100644 index 0000000..b0d9cbb --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_rules_1_3_0_rc01_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml new file mode 100644 index 0000000..1ed44ec --- /dev/null +++ b/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml b/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml new file mode 100644 index 0000000..48dd308 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml new file mode 100644 index 0000000..4450e18 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml new file mode 100644 index 0000000..49c13f2 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml new file mode 100644 index 0000000..95ae090 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml new file mode 100644 index 0000000..f75ae65 --- /dev/null +++ b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml new file mode 100644 index 0000000..18f75fb --- /dev/null +++ b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml new file mode 100644 index 0000000..a7dcb9a --- /dev/null +++ b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_aar.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml new file mode 100644 index 0000000..947e251 --- /dev/null +++ b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5_jar.xml b/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5_jar.xml new file mode 100644 index 0000000..0013c70 --- /dev/null +++ b/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_mikhaellopez_circularimageview_4_2_0_aar.xml b/.idea/libraries/Gradle__com_mikhaellopez_circularimageview_4_2_0_aar.xml new file mode 100644 index 0000000..b36c5ac --- /dev/null +++ b/.idea/libraries/Gradle__com_mikhaellopez_circularimageview_4_2_0_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_2_0_jar.xml b/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_2_0_jar.xml new file mode 100644 index 0000000..784a037 --- /dev/null +++ b/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_2_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml b/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml new file mode 100644 index 0000000..f97c138 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_okhttp3_mockwebserver_4_6_0_jar.xml b/.idea/libraries/Gradle__com_squareup_okhttp3_mockwebserver_4_6_0_jar.xml new file mode 100644 index 0000000..402cc5b --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_okhttp3_mockwebserver_4_6_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_14_7_jar.xml b/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_14_7_jar.xml new file mode 100644 index 0000000..f1fd499 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_14_7_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_6_0_jar.xml b/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_6_0_jar.xml new file mode 100644 index 0000000..8860498 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_6_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_okio_okio_1_17_2_jar.xml b/.idea/libraries/Gradle__com_squareup_okio_okio_1_17_2_jar.xml new file mode 100644 index 0000000..ca61454 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_okio_okio_1_17_2_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_okio_okio_2_6_0_jar.xml b/.idea/libraries/Gradle__com_squareup_okio_okio_2_6_0_jar.xml new file mode 100644 index 0000000..3ad288a --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_okio_okio_2_6_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_picasso_picasso_2_71828_aar.xml b/.idea/libraries/Gradle__com_squareup_picasso_picasso_2_71828_aar.xml new file mode 100644 index 0000000..9a92fd8 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_picasso_picasso_2_71828_aar.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_8_1_jar.xml b/.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_8_1_jar.xml new file mode 100644 index 0000000..a1e411e --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_8_1_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_8_1_jar.xml b/.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_8_1_jar.xml new file mode 100644 index 0000000..dab5123 --- /dev/null +++ b/.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_8_1_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml b/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml new file mode 100644 index 0000000..5ac7d7b --- /dev/null +++ b/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_12_jar.xml b/.idea/libraries/Gradle__junit_junit_4_12_jar.xml new file mode 100644 index 0000000..24e5b72 --- /dev/null +++ b/.idea/libraries/Gradle__junit_junit_4_12_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_13_jar.xml b/.idea/libraries/Gradle__junit_junit_4_13_jar.xml new file mode 100644 index 0000000..bf50f62 --- /dev/null +++ b/.idea/libraries/Gradle__junit_junit_4_13_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml new file mode 100644 index 0000000..8cda706 --- /dev/null +++ b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml new file mode 100644 index 0000000..996e0f8 --- /dev/null +++ b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml new file mode 100644 index 0000000..ddd2635 --- /dev/null +++ b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml new file mode 100644 index 0000000..6b1e2e7 --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml new file mode 100644 index 0000000..a8015c9 --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml new file mode 100644 index 0000000..00bb125 --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0_jar.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0_jar.xml new file mode 100644 index 0000000..56b3542 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_android_extensions_runtime_1_3_61_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_android_extensions_runtime_1_3_61_jar.xml new file mode 100644 index 0000000..6b05dd3 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_android_extensions_runtime_1_3_61_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_71_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_71_jar.xml new file mode 100644 index 0000000..8da9249 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_71_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_71_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_71_jar.xml new file mode 100644 index 0000000..7668e04 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_71_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_61_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_61_jar.xml new file mode 100644 index 0000000..de466a1 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_3_61_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_3_71_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_3_71_jar.xml new file mode 100644 index 0000000..94d35f4 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_3_71_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_annotations_common_1_3_61_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_annotations_common_1_3_61_jar.xml new file mode 100644 index 0000000..cf6e55a --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_annotations_common_1_3_61_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_common_1_3_71_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_common_1_3_71_jar.xml new file mode 100644 index 0000000..5e91bcd --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_common_1_3_71_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_3_61_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_3_61_jar.xml new file mode 100644 index 0000000..8a0411d --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_3_61_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_4_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_4_jar.xml new file mode 100644 index 0000000..8195aac --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_4_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_4_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_4_jar.xml new file mode 100644 index 0000000..33903d3 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_4_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_kodein_di_kodein_di_core_jvm_6_2_1_jar.xml b/.idea/libraries/Gradle__org_kodein_di_kodein_di_core_jvm_6_2_1_jar.xml new file mode 100644 index 0000000..b48875a --- /dev/null +++ b/.idea/libraries/Gradle__org_kodein_di_kodein_di_core_jvm_6_2_1_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_core_6_2_1_aar.xml b/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_core_6_2_1_aar.xml new file mode 100644 index 0000000..7c376e1 --- /dev/null +++ b/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_core_6_2_1_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_x_6_2_1_aar.xml b/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_x_6_2_1_aar.xml new file mode 100644 index 0000000..499f14f --- /dev/null +++ b/.idea/libraries/Gradle__org_kodein_di_kodein_di_framework_android_x_6_2_1_aar.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_kodein_di_kodein_di_generic_jvm_6_2_1_jar.xml b/.idea/libraries/Gradle__org_kodein_di_kodein_di_generic_jvm_6_2_1_jar.xml new file mode 100644 index 0000000..4a86016 --- /dev/null +++ b/.idea/libraries/Gradle__org_kodein_di_kodein_di_generic_jvm_6_2_1_jar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mockito_mockito_core_2_19_0_jar.xml b/.idea/libraries/Gradle__org_mockito_mockito_core_2_19_0_jar.xml new file mode 100644 index 0000000..339fea7 --- /dev/null +++ b/.idea/libraries/Gradle__org_mockito_mockito_core_2_19_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml b/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml new file mode 100644 index 0000000..fd3b4eb --- /dev/null +++ b/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mockito_mockito_inline_2_13_0_jar.xml b/.idea/libraries/Gradle__org_mockito_mockito_inline_2_13_0_jar.xml new file mode 100644 index 0000000..72b2d46 --- /dev/null +++ b/.idea/libraries/Gradle__org_mockito_mockito_inline_2_13_0_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml b/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml new file mode 100644 index 0000000..699ee35 --- /dev/null +++ b/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4ed797b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4bf4bb5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/Candy_Space.iml b/.idea/modules/Candy_Space.iml new file mode 100644 index 0000000..6cb3926 --- /dev/null +++ b/.idea/modules/Candy_Space.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/app/app.iml b/.idea/modules/app/app.iml new file mode 100644 index 0000000..f7aef8a --- /dev/null +++ b/.idea/modules/app/app.iml @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/navEditor.xml b/.idea/navEditor.xml new file mode 100644 index 0000000..1c753e1 --- /dev/null +++ b/.idea/navEditor.xml @@ -0,0 +1,43 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7316063 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Stack Exchange Users + +## Requirements + + - Minimum android version 24 + - Permissions : Internet, Network state + +## Installation +Clone this repository and import into **Android Studio** + +## Features + + - SOLID coding principles applied to keep code clean and easy to read + - Android navigation library + - Livedata, with lifecycle aware results + - Data persistence with room + - Picasso for image caching + - Recycler view for easy user list display + +## Architectural Pattern + +MVVM - Model View Viewmodel +SOLID coding principle + +## Jetpack + +* [AndroidX](https://developer.android.com/jetpack/androidx) + +## UI test + - AppUITest.kt + +### Unit test + - RepositoryTest.kt + - MainViewModelText.ky + +## Built With + +* [Kodein](https://github.com/Kodein-Framework/Kodein-DI) - Painless Kotlin Dependency Injection +* [Retrofit](https://github.com/square/retrofit) - Type-safe HTTP client for Android and Java by Square, Inc +* [Picasso](https://square.github.io/picasso/) - A powerful image downloading and caching library for Android +* [Circular Image View](https://github.com/lopspower/CircularImageView) - Create circular ImageView in Android in the simplest way possible +* [Room Persistence Library](https://developer.android.com/topic/libraries/architecture/room) - The Room persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite. +* [Mockito](https://github.com/mockito/mockito) - Most popular Mocking framework for unit tests written in Java + +## Authors + +* **Haider Malik** - *Android Developer* diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..9584e7f --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,99 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-kapt' + +apply plugin: "androidx.navigation.safeargs" + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + + defaultConfig { + applicationId "com.example.h_mal.candyspace" + minSdkVersion 24 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + // To inline the bytecode built with JVM target 1.8 into + // bytecode that is being built with JVM target 1.6. (e.g. navArgs) + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } + + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.annotation:annotation:1.1.0' + implementation "androidx.fragment:fragment-ktx:1.2.5" + implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2' + implementation 'androidx.navigation:navigation-ui-ktx:2.2.2' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.preference:preference:1.1.1' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:rules:1.2.0' + testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-test:1.3.71" + + // android unit testing and espresso + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + implementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + //mock websever for testing retrofit responses + testImplementation "com.squareup.okhttp3:mockwebserver:4.6.0" + testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" + + //mockito and livedata testing + testImplementation 'org.mockito:mockito-inline:2.13.0' + implementation 'android.arch.core:core-testing' + androidTestImplementation 'androidx.test:rules:1.3.0-rc01' + + //Retrofit and GSON + implementation 'com.squareup.retrofit2:retrofit:2.8.1' + implementation 'com.squareup.retrofit2:converter-gson:2.8.1' + + //Kotlin Coroutines + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4" + + //Kodein Dependency Injection + implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1" + implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1" + + // Shared prefs + implementation "androidx.preference:preference-ktx:1.1.1" + + // Picasso image display + implementation 'com.squareup.picasso:picasso:2.71828' + + //Android Room + implementation "androidx.room:room-runtime:2.3.0-alpha01" + implementation "androidx.room:room-ktx:2.3.0-alpha01" + kapt "androidx.room:room-compiler:2.3.0-alpha01" + + // Circle Image View + implementation 'com.mikhaellopez:circularimageview:4.2.0' + +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..a74f85a --- /dev/null +++ b/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.example.h_mal.stackexchangeusers + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.h_mal.candyspace", appContext.packageName) + } +} diff --git a/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ui/main/AppUITest.kt b/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ui/main/AppUITest.kt new file mode 100644 index 0000000..f137944 --- /dev/null +++ b/app/src/androidTest/java/com/example/h_mal/stackexchangeusers/ui/main/AppUITest.kt @@ -0,0 +1,121 @@ +package com.example.h_mal.stackexchangeusers.ui.main + + +import android.view.View +import android.view.ViewGroup +import androidx.test.InstrumentationRegistry.getTargetContext +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.UiController +import androidx.test.espresso.ViewAction +import androidx.test.espresso.action.ViewActions.* +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.idling.CountingIdlingResource +import androidx.test.espresso.matcher.ViewMatchers.* +import androidx.test.filters.LargeTest +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.rule.ActivityTestRule +import androidx.test.runner.AndroidJUnit4 +import com.example.h_mal.stackexchangeusers.R +import com.example.h_mal.stackexchangeusers.application.AppClass.Companion.idlingResources +import com.example.h_mal.stackexchangeusers.data.preferences.PreferenceProvider +import com.example.h_mal.stackexchangeusers.data.room.AppDatabase +import kotlinx.coroutines.runBlocking +import org.hamcrest.Description +import org.hamcrest.Matcher +import org.hamcrest.Matchers.allOf +import org.hamcrest.TypeSafeMatcher +import org.junit.After +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@LargeTest +@RunWith(AndroidJUnit4::class) +class AppUITest { + + @Rule + @JvmField + var mActivityTestRule = ActivityTestRule(MainActivity::class.java) + + val users = setOf("kenny", "adam", "gary", "user") + + lateinit var currentUser: String + + @Before + fun setUp() = runBlocking{ + deletePreviousEntries() + } + + private suspend fun deletePreviousEntries(){ + idlingResources.increment() + AppDatabase.invoke(InstrumentationRegistry.getInstrumentation().context).getUsersDao().deleteEntries() + idlingResources.decrement() + } + + @Test + fun mainActivityTest() { + val user = users.random() + + onView(allOf( + withId(R.id.search_button), withContentDescription("Search"), + isDisplayed() + ) + ).perform(click()) + + onView(allOf(withId(R.id.search_src_text), isDisplayed())) + .perform(replaceText(user), closeSoftKeyboard()) + + onView( + allOf( + withId(R.id.search_src_text), withText(user), + isDisplayed() + ) + ).perform(pressImeActionButton()) + + val viewGroup = onView( + allOf(childAtPosition(allOf( + withId(R.id.recycler_view), + childAtPosition(withId(R.id.main), 1) + ), 0), + isDisplayed() + ) + ) + onView(isRoot()).perform(waitFor(2000)) + viewGroup.check(matches(isDisplayed())) + } + + private fun waitFor(delay: Long): ViewAction? { + return object : ViewAction { + override fun getConstraints(): Matcher { + return isRoot() + } + + override fun getDescription(): String { + return "wait for " + delay + "milliseconds" + } + + override fun perform(uiController: UiController, view: View?) { + uiController.loopMainThreadForAtLeast(delay) + } + } + } + + private fun childAtPosition( + parentMatcher: Matcher, position: Int + ): Matcher { + + return object : TypeSafeMatcher() { + override fun describeTo(description: Description) { + description.appendText("Child at position $position in parent ") + parentMatcher.describeTo(description) + } + + public override fun matchesSafely(view: View): Boolean { + val parent = view.parent + return parent is ViewGroup && parentMatcher.matches(parent) + && view == parent.getChildAt(position) + } + } + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..84411c7 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/application/AppClass.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/application/AppClass.kt new file mode 100644 index 0000000..47fd275 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/application/AppClass.kt @@ -0,0 +1,41 @@ +package com.example.h_mal.stackexchangeusers.application + +import android.app.Application +import androidx.test.espresso.idling.CountingIdlingResource +import com.example.h_mal.stackexchangeusers.data.network.api.ApiClass +import com.example.h_mal.stackexchangeusers.data.network.api.interceptors.NetworkConnectionInterceptor +import com.example.h_mal.stackexchangeusers.data.network.api.interceptors.QueryParamsInterceptor +import com.example.h_mal.stackexchangeusers.data.preferences.PreferenceProvider +import com.example.h_mal.stackexchangeusers.data.repositories.RepositoryImpl +import com.example.h_mal.stackexchangeusers.data.room.AppDatabase +import com.example.h_mal.stackexchangeusers.ui.MainViewModelFactory +import org.kodein.di.Kodein +import org.kodein.di.KodeinAware +import org.kodein.di.android.x.androidXModule +import org.kodein.di.generic.bind +import org.kodein.di.generic.instance +import org.kodein.di.generic.provider +import org.kodein.di.generic.singleton + +class AppClass : Application(), KodeinAware{ + + companion object{ + // idling resource to be used for espresso testing + // when we need to wait for async operations to complete + val idlingResources = CountingIdlingResource("Data_loader") + } + + // Kodein creation of modules to be retrieve within the app + override val kodein = Kodein.lazy { + import(androidXModule(this@AppClass)) + + bind() from singleton { NetworkConnectionInterceptor(instance()) } + bind() from singleton { QueryParamsInterceptor() } + bind() from singleton { ApiClass(instance(), instance())} + bind() from singleton { AppDatabase(instance()) } + bind() from singleton { PreferenceProvider(instance()) } + bind() from singleton { RepositoryImpl(instance(), instance(), instance()) } + bind() from provider { MainViewModelFactory(instance()) } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/ApiClass.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/ApiClass.kt new file mode 100644 index 0000000..4834df6 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/ApiClass.kt @@ -0,0 +1,42 @@ +package com.example.h_mal.stackexchangeusers.data.network.api + +import com.example.h_mal.stackexchangeusers.data.network.api.interceptors.NetworkConnectionInterceptor +import com.example.h_mal.stackexchangeusers.data.network.api.interceptors.QueryParamsInterceptor +import com.example.h_mal.stackexchangeusers.data.network.model.ApiResponse +import okhttp3.OkHttpClient +import retrofit2.Response +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory +import retrofit2.http.GET +import retrofit2.http.Query + + +interface ApiClass { + + @GET("users?") + suspend fun getUsersFromApi(@Query("inname") inname: String): Response + + // invoke method creating an invocation of the api call + companion object{ + operator fun invoke( + // injected @params + networkConnectionInterceptor: NetworkConnectionInterceptor, + queryParamsInterceptor: QueryParamsInterceptor + ) : ApiClass { + + // okHttpClient with interceptors + val okkHttpclient = OkHttpClient.Builder() + .addNetworkInterceptor(networkConnectionInterceptor) + .addInterceptor(queryParamsInterceptor) + .build() + + // creation of retrofit class + return Retrofit.Builder() + .client(okkHttpclient) + .baseUrl("https://api.stackexchange.com/2.2/") + .addConverterFactory(GsonConverterFactory.create()) + .build() + .create(ApiClass::class.java) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/NetworkConnectionInterceptor.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/NetworkConnectionInterceptor.kt new file mode 100644 index 0000000..0b1d88c --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/NetworkConnectionInterceptor.kt @@ -0,0 +1,43 @@ +package com.example.h_mal.stackexchangeusers.data.network.api.interceptors + +import android.content.Context +import android.net.ConnectivityManager +import android.net.NetworkCapabilities +import okhttp3.Interceptor +import okhttp3.Response +import java.io.IOException + +/** +* interceptor used to determine if we have a valid network to make network calls +* +*/ +class NetworkConnectionInterceptor( + context: Context +) : Interceptor { + + private val applicationContext = context.applicationContext + + override fun intercept(chain: Interceptor.Chain): Response { + if (!isInternetAvailable()){ + throw IOException("Make sure you have an active data connection") + } + return chain.proceed(chain.request()) + } + + private fun isInternetAvailable(): Boolean { + var result = false + val connectivityManager = + applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager? + connectivityManager?.let { + it.getNetworkCapabilities(connectivityManager.activeNetwork)?.apply { + result = when { + hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true + hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true + else -> false + } + } + } + return result + } + +} diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/QueryParamsInterceptor.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/QueryParamsInterceptor.kt new file mode 100644 index 0000000..9effab6 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/api/interceptors/QueryParamsInterceptor.kt @@ -0,0 +1,31 @@ +package com.example.h_mal.stackexchangeusers.data.network.api.interceptors + +import okhttp3.Interceptor +import okhttp3.Request +import okhttp3.Response + +/** + * Interceptor used to add default query parameters to api calls + */ +class QueryParamsInterceptor : Interceptor{ + + override fun intercept(chain: Interceptor.Chain): Response { + val original = chain.request() + val originalHttpUrl = original.url() + + val url = originalHttpUrl.newBuilder() + .addQueryParameter("site", "stackoverflow") + .addQueryParameter("pagesize","20") + .addQueryParameter("order","desc") + .addQueryParameter("sort","reputation") + .build() + + // Request customization: add request headers + // Request customization: add request headers + val requestBuilder: Request.Builder = original.newBuilder() + .url(url) + + val request: Request = requestBuilder.build() + return chain.proceed(request) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/ApiResponse.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/ApiResponse.kt new file mode 100644 index 0000000..6d4c6b9 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/ApiResponse.kt @@ -0,0 +1,8 @@ +package com.example.h_mal.stackexchangeusers.data.network.model + +data class ApiResponse( + val items : List?, + val has_more : Boolean?, + val quota_max : Int?, + val quota_Remaining: Int? +) \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/BadgeCounts.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/BadgeCounts.kt new file mode 100644 index 0000000..d615025 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/BadgeCounts.kt @@ -0,0 +1,16 @@ +package com.example.h_mal.stackexchangeusers.data.network.model + +import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName + +class BadgeCounts { + @SerializedName("bronze") + @Expose + var bronze: Int? = null + @SerializedName("silver") + @Expose + var silver: Int? = null + @SerializedName("gold") + @Expose + var gold: Int? = null +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/User.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/User.kt new file mode 100644 index 0000000..4fc791c --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/model/User.kt @@ -0,0 +1,41 @@ +package com.example.h_mal.stackexchangeusers.data.network.model + +import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName + + +class User { + @SerializedName("badge_counts") + @Expose + var badgeCounts: BadgeCounts? = null + @SerializedName("last_modified_date") + @Expose + var lastModifiedDate: Int? = null + @SerializedName("reputation") + @Expose + var reputation: Int? = null + @SerializedName("creation_date") + @Expose + var creationDate: Int? = null + @SerializedName("user_type") + @Expose + var userType: String? = null + @SerializedName("user_id") + @Expose + var userId: Int? = null + @SerializedName("location") + @Expose + var location: String? = null + @SerializedName("website_url") + @Expose + var websiteUrl: String? = null + @SerializedName("link") + @Expose + var link: String? = null + @SerializedName("profile_image") + @Expose + var profileImage: String? = null + @SerializedName("display_name") + @Expose + var displayName: String? = null +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/networkUtils/ResponseUnwrap.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/networkUtils/ResponseUnwrap.kt new file mode 100644 index 0000000..e525633 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/network/networkUtils/ResponseUnwrap.kt @@ -0,0 +1,33 @@ +package com.example.h_mal.stackexchangeusers.data.network.networkUtils + +import org.json.JSONException +import org.json.JSONObject +import retrofit2.Response +import java.io.IOException + +abstract class ResponseUnwrap { + + @Suppress("BlockingMethodInNonBlockingContext") + suspend fun responseUnwrap( + call: suspend () -> Response + ): T { + + val response = call.invoke() + if (response.isSuccessful) { + return response.body()!! + } else { + val error = response.errorBody()?.string() + + val errorMessage = error?.let { + try { + JSONObject(it).getString("error_message") + } catch (e: JSONException) { + e.printStackTrace() + null + } + } ?: "Error Code: ${response.code()}" + + throw IOException(errorMessage) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/preferences/PreferencesProvider.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/preferences/PreferencesProvider.kt new file mode 100644 index 0000000..3955120 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/preferences/PreferencesProvider.kt @@ -0,0 +1,38 @@ +package com.example.h_mal.stackexchangeusers.data.preferences + +import android.content.Context +import android.content.SharedPreferences +import androidx.preference.PreferenceManager + +private const val LAST_SAVED = "late_saved" +private const val USER_SAVED = "user_saved" +class PreferenceProvider( + context: Context +) { + + private val appContext = context.applicationContext + + private val preference: SharedPreferences + get() = PreferenceManager.getDefaultSharedPreferences(appContext) + + + fun saveLastSavedAt(user: String, savedAt: Long) { + preference.edit().putString( + USER_SAVED, + user + ).putLong( + LAST_SAVED, + savedAt + ).apply() + } + + fun getLastSavedAt(user: String): Long? { + val savedUser = preference.getString(USER_SAVED, null) + + if (savedUser == user){ + return preference.getLong(LAST_SAVED, 1595076034403) + } + return null + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/Repository.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/Repository.kt new file mode 100644 index 0000000..18bb49a --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/Repository.kt @@ -0,0 +1,16 @@ +package com.example.h_mal.stackexchangeusers.data.repositories + +import androidx.lifecycle.LiveData +import com.example.h_mal.stackexchangeusers.data.network.model.ApiResponse +import com.example.h_mal.stackexchangeusers.data.network.model.User +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem + +interface Repository { + + fun getUsersFromDatabase(): LiveData> + fun getSingleUserFromDatabase(id: Int): LiveData + suspend fun saveUsersToDatabase(users: List) + suspend fun getUsersFromApi(username: String): ApiResponse? + fun saveCurrentSearchToPrefs(username: String) + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryImpl.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryImpl.kt new file mode 100644 index 0000000..d5069fe --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryImpl.kt @@ -0,0 +1,73 @@ +package com.example.h_mal.stackexchangeusers.data.repositories + +import com.example.h_mal.stackexchangeusers.data.network.api.ApiClass +import com.example.h_mal.stackexchangeusers.data.network.model.ApiResponse +import com.example.h_mal.stackexchangeusers.data.network.model.User +import com.example.h_mal.stackexchangeusers.data.network.networkUtils.ResponseUnwrap +import com.example.h_mal.stackexchangeusers.data.preferences.PreferenceProvider +import com.example.h_mal.stackexchangeusers.data.room.AppDatabase +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem + +const val MILLISECONDS_ONE_MIN = 60000 +class RepositoryImpl( + private val api: ApiClass, + private val database: AppDatabase, + private val preference: PreferenceProvider +) : ResponseUnwrap(), Repository { + + // Current list of users in the database + override fun getUsersFromDatabase() = database.getUsersDao().getAllUsers() + + // retrieving a single user from an ID + override fun getSingleUserFromDatabase(id: Int) = database.getUsersDao().getUser(id) + + // save a list of users to the room database + override suspend fun saveUsersToDatabase(users: List){ + val userList= getUserList(users) + database.getUsersDao().upsertNewUsers(userList) + } + + // fetch users from an api call + override suspend fun getUsersFromApi(username: String): ApiResponse? { + return when (isSearchValid(username)) { + true -> responseUnwrap { api.getUsersFromApi(username) } + else -> { null } + } + } + + // save current time and current search input into shared prefs + override fun saveCurrentSearchToPrefs(username: String){ + val time = System.currentTimeMillis() + preference.saveLastSavedAt(username, time) + } + + // boolean response of validity of search + // if the same search is taking place again with a minute return false + private fun isSearchValid(username: String): Boolean { + val time = preference.getLastSavedAt(username) ?: return true + val currentTime = System.currentTimeMillis() + val difference = currentTime - time + + return difference > MILLISECONDS_ONE_MIN + } + + // map user from api response to userItem entity for database + private fun getUserList(users: List): List { + return users.map { + it.mapToUserItem() + } + } + + private fun User.mapToUserItem(): UserItem { + return UserItem( + userId, + displayName, + badgeCounts?.bronze, + badgeCounts?.silver, + badgeCounts?.gold, + reputation, + creationDate, + profileImage + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/AppDatabase.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/AppDatabase.kt new file mode 100644 index 0000000..9f50354 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/AppDatabase.kt @@ -0,0 +1,37 @@ +package com.example.h_mal.stackexchangeusers.data.room + +import android.content.Context +import androidx.room.Database +import androidx.room.Room +import androidx.room.RoomDatabase +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem + +@Database( + entities = [UserItem::class], + version = 1 +) +abstract class AppDatabase : RoomDatabase() { + + abstract fun getUsersDao(): UsersDao + + companion object { + + @Volatile + private var instance: AppDatabase? = null + private val LOCK = Any() + + // create an instance of room database or use previously created instance + operator fun invoke(context: Context) = instance ?: synchronized(LOCK) { + instance ?: buildDatabase(context).also { + instance = it + } + } + + private fun buildDatabase(context: Context) = + Room.databaseBuilder( + context.applicationContext, + AppDatabase::class.java, + "MyDatabase.db" + ).build() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/UsersDao.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/UsersDao.kt new file mode 100644 index 0000000..108821e --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/UsersDao.kt @@ -0,0 +1,28 @@ +package com.example.h_mal.stackexchangeusers.data.room + +import androidx.lifecycle.LiveData +import androidx.room.* +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem + +@Dao +interface UsersDao { + + @Insert(onConflict = OnConflictStrategy.REPLACE) + fun saveAllUsers(users : List) + + @Query("SELECT * FROM UserItem") + fun getAllUsers() : LiveData> + + // clear database and add new entries + @Transaction + suspend fun upsertNewUsers(users : List){ + deleteEntries() + saveAllUsers(users) + } + + @Query("DELETE FROM UserItem") + suspend fun deleteEntries() + + @Query("SELECT * FROM UserItem WHERE userId = :id") + fun getUser(id: Int) : LiveData +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/entities/UserItem.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/entities/UserItem.kt new file mode 100644 index 0000000..f85b549 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/data/room/entities/UserItem.kt @@ -0,0 +1,17 @@ +package com.example.h_mal.stackexchangeusers.data.room.entities + +import androidx.room.Entity +import androidx.room.PrimaryKey + +@Entity +data class UserItem( + @PrimaryKey(autoGenerate = false) + val userId: Int?, + val displayName: String?, + val bronze: Int?, + val silver: Int?, + val gold: Int?, + val reputation: Int?, + val creationDate: Int?, + val profileImage: String? +) \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModel.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModel.kt new file mode 100644 index 0000000..8639096 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModel.kt @@ -0,0 +1,54 @@ +package com.example.h_mal.stackexchangeusers.ui + +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import com.example.h_mal.stackexchangeusers.application.AppClass.Companion.idlingResources +import com.example.h_mal.stackexchangeusers.data.repositories.Repository +import com.example.h_mal.stackexchangeusers.utils.Event +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.io.IOException + +class MainViewModel( + private val repository: Repository +) : ViewModel() { + + // livedata for user items in room database + val usersLiveData = repository.getUsersFromDatabase() + + val operationState = MutableLiveData>() + val operationError = MutableLiveData>() + + + fun getUsers(username: String?){ + // validate that search term is not empty + if (username.isNullOrBlank()){ + operationError.postValue(Event("Enter a valid username")) + return + } + // open a coroutine on the IO thread for async operations + CoroutineScope(Dispatchers.IO).launch { + operationState.postValue(Event(true)) + try { + // get users from api + val response = repository.getUsersFromApi(username) + // null check response exists and contains list of users + response?.items?.let { + // save users to database + repository.saveUsersToDatabase(it) + // save current search entry to preferences + repository.saveCurrentSearchToPrefs(username) + } + }catch (e: IOException){ + operationError.postValue(Event(e.message!!)) + }finally { + operationState.postValue(Event(false)) + } + } + } + + fun getSingleUser(id: Int) = repository.getSingleUserFromDatabase(id) + +} diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModelFactory.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModelFactory.kt new file mode 100644 index 0000000..b4fbb74 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/MainViewModelFactory.kt @@ -0,0 +1,22 @@ +package com.example.h_mal.stackexchangeusers.ui + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.example.h_mal.stackexchangeusers.data.repositories.Repository + +/** + * Viewmodel factory for [MainViewModel] + * @repository injected into MainViewModel + */ +class MainViewModelFactory( + private val repository: Repository +) : ViewModelProvider.Factory{ + + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T { + if (modelClass.isAssignableFrom(MainViewModel::class.java)) { + return (MainViewModel(repository)) as T + } + throw IllegalArgumentException("Unknown ViewModel class") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/MainActivity.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/MainActivity.kt new file mode 100644 index 0000000..ba47178 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/MainActivity.kt @@ -0,0 +1,85 @@ +package com.example.h_mal.stackexchangeusers.ui.main + +import android.os.Bundle +import android.view.MenuItem +import androidx.activity.viewModels +import androidx.appcompat.app.AppCompatActivity +import androidx.lifecycle.Observer +import com.example.h_mal.stackexchangeusers.R +import com.example.h_mal.stackexchangeusers.application.AppClass +import com.example.h_mal.stackexchangeusers.application.AppClass.Companion.idlingResources +import com.example.h_mal.stackexchangeusers.ui.MainViewModel +import com.example.h_mal.stackexchangeusers.ui.MainViewModelFactory +import com.example.h_mal.stackexchangeusers.utils.Event +import com.example.h_mal.stackexchangeusers.utils.displayToast +import com.example.h_mal.stackexchangeusers.utils.hide +import com.example.h_mal.stackexchangeusers.utils.show +import kotlinx.android.synthetic.main.main_activity.* +import org.kodein.di.KodeinAware +import org.kodein.di.android.kodein +import org.kodein.di.generic.instance + + +/** + * [MainActivity] hosting the fragments and controlling a lot of the UI + */ +class MainActivity : AppCompatActivity(), KodeinAware { + + //retrieve the viewmodel factory from the kodein dependency injection + override val kodein by kodein() + private val factory by instance() + // Kotlin lazy instantiation of viewmodel + val viewmodel by viewModels { factory } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.main_activity) + + // setup home button for back navigation + supportActionBar?.apply { + setDisplayHomeAsUpEnabled(true) + setDisplayShowHomeEnabled(true) + } + + // setup observers for operation live data + viewmodel.operationState.observe(this, stateObserver) + viewmodel.operationError.observe(this, errorObserver) + } + + override fun onDestroy() { + super.onDestroy() + // remove observers on activity destroy + viewmodel.operationState.removeObserver(stateObserver) + viewmodel.operationError.removeObserver(errorObserver) + } + + // toggle visibility of progress spinner while async operations are taking place + private val stateObserver = Observer> { + when(it.getContentIfNotHandled()){ + true -> { + progress_circular.show() + idlingResources.increment() + } + false -> { + progress_circular.hide() + idlingResources.decrement() + } + } + } + + // display a toast when operation fails + private val errorObserver = Observer> { + it.getContentIfNotHandled()?.let { message -> + displayToast(message) + } + } + + //When home button in toolbar is pressed + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + android.R.id.home -> onBackPressed() + } + return super.onOptionsItemSelected(item) + } + +} diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/MainFragment.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/MainFragment.kt new file mode 100644 index 0000000..d2f5bc4 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/MainFragment.kt @@ -0,0 +1,72 @@ +package com.example.h_mal.stackexchangeusers.ui.main.pages.home + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.lifecycle.Observer +import androidx.recyclerview.widget.LinearLayoutManager +import com.example.h_mal.stackexchangeusers.R +import com.example.h_mal.stackexchangeusers.application.AppClass.Companion.idlingResources +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem +import com.example.h_mal.stackexchangeusers.ui.MainViewModel +import com.example.h_mal.stackexchangeusers.utils.onSubmitListener +import kotlinx.android.synthetic.main.main_fragment.* + + +/** + * UI for the screen holding the list, search box + * Results for users will be displayed here + */ +class MainFragment : Fragment() { + /** + * get [MainViewModel] from [MainActivity] (the calling activity) + */ + val viewModel: MainViewModel by activityViewModels() + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + return inflater.inflate(R.layout.main_fragment, container, false) + } + + override fun onActivityCreated(savedInstanceState: Bundle?) { + super.onActivityCreated(savedInstanceState) + + search_bar.apply { + // use submit listener just to retrieve input upon submission of search view + onSubmitListener { + viewModel.getUsers(query.toString().trim()) + } + } + } + + override fun onStart() { + super.onStart() + viewModel.usersLiveData.observe(viewLifecycleOwner, usersObserver) + } + + override fun onStop() { + super.onStop() + viewModel.usersLiveData.removeObserver(usersObserver) + } + + private val usersObserver = Observer> { + // create adapter the recycler view + val mAdapter = UserRecyclerViewAdapter( + requireView(), + it + ) + + // setup the recyclerview + recycler_view.apply { + layoutManager = LinearLayoutManager(context) + setHasFixedSize(true) + adapter = mAdapter + } + } + +} diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/UserRecyclerViewAdapter.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/UserRecyclerViewAdapter.kt new file mode 100644 index 0000000..ee9de6a --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/home/UserRecyclerViewAdapter.kt @@ -0,0 +1,64 @@ +package com.example.h_mal.stackexchangeusers.ui.main.pages.home + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.h_mal.stackexchangeusers.R +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem +import com.example.h_mal.stackexchangeusers.utils.loadImage +import com.example.h_mal.stackexchangeusers.utils.navigateTo +import kotlinx.android.extensions.LayoutContainer +import kotlinx.android.synthetic.main.simple_item.view.* + +/** + * Create a Recyclerview adapter used to display [UserItem] + * @param parentView is used for context and navigation + * @param items is the list of users parsed from the database + */ +class UserRecyclerViewAdapter ( + val parentView: View, + val items: List +): RecyclerView.Adapter(){ + + // create a viewholder with [R.layout.simple_item] + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + val view = LayoutInflater + .from(parentView.context) + .inflate(R.layout.simple_item, parent, false) + + return ItemOne(view) + } + + override fun getItemCount(): Int { + return items.size + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + val view = holder as ItemOne + + items[position].let { + view.bindUser(it) + } + } + + // bind userItem fields to the views in the layout + internal inner class ItemOne( + override val containerView: View + ) : RecyclerView.ViewHolder(containerView), LayoutContainer { + + fun bindUser(userItem: UserItem){ + itemView.profile_img.loadImage(userItem.profileImage, 48, 48) + itemView.text1.text = userItem.displayName + itemView.text2.text = userItem.reputation.toString() + + itemView.setOnClickListener { + val action = + MainFragmentDirections.toUserProfileFragment(items[position].userId!!) + parentView.navigateTo(action) + } + } + } + +} + diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/user/UserProfileFragment.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/user/UserProfileFragment.kt new file mode 100644 index 0000000..3d47700 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/ui/main/pages/user/UserProfileFragment.kt @@ -0,0 +1,57 @@ +package com.example.h_mal.stackexchangeusers.ui.main.pages.user + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.lifecycle.Observer +import com.example.h_mal.stackexchangeusers.R +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem +import com.example.h_mal.stackexchangeusers.ui.MainViewModel +import com.example.h_mal.stackexchangeusers.utils.epochToData +import com.example.h_mal.stackexchangeusers.utils.loadImage +import kotlinx.android.synthetic.main.fragment_user_profile.* + +/** + * A simple [Fragment] subclass. + * Use the [UserProfileFragment.newInstance] factory method to + * create an instance of this fragment. + */ +class UserProfileFragment : Fragment() { + val viewModel: MainViewModel by activityViewModels() + + var userId: Int = 0 + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.fragment_user_profile, container, false) + } + + //Update the data for viewbinding onResume as data would have changed when selecting a new user + override fun onResume() { + super.onResume() + userId = UserProfileFragmentArgs.fromBundle(requireArguments()).userId + viewModel.getSingleUser(userId).observe(viewLifecycleOwner, singleUserObserver) + } + + override fun onPause() { + super.onPause() + viewModel.getSingleUser(id).removeObserver(singleUserObserver) + } + + private val singleUserObserver = Observer { + username.text = it.displayName + reputation.text = it.reputation.toString() + gold_score.text = it.gold.toString() + silver_score.text = it.silver.toString() + bronze_score.text = it.bronze.toString() + date_joined.text = epochToData(it.creationDate) + + imageView.loadImage(it.profileImage) + } + +} diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ConverterUtil.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ConverterUtil.kt new file mode 100644 index 0000000..9d0b7a8 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ConverterUtil.kt @@ -0,0 +1,17 @@ +package com.example.h_mal.stackexchangeusers.utils + +import java.text.SimpleDateFormat +import java.util.* + + +fun epochToData(number: Int?): String { + number ?: return "" + return try { + val sdf = SimpleDateFormat("dd/MM/yyyy") + val netDate = Date(number.toLong() * 1000) + sdf.format(netDate) + } catch (e: Exception) { + "" + } +} + diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/Event.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/Event.kt new file mode 100644 index 0000000..582646b --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/Event.kt @@ -0,0 +1,24 @@ +package com.example.h_mal.stackexchangeusers.utils + +/** + * Used with livedata to make observation lifecycle aware + * Display livedata response only once + */ +open class Event(private val content: T) { + + var hasBeenHandled = false + private set // Allow external read but not write + + /** + * Returns the content and prevents its use again. + */ + fun getContentIfNotHandled(): T? { + return if (hasBeenHandled) { + null + } else { + hasBeenHandled = true + content + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ViewUtils.kt b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ViewUtils.kt new file mode 100644 index 0000000..2ea2aba --- /dev/null +++ b/app/src/main/java/com/example/h_mal/stackexchangeusers/utils/ViewUtils.kt @@ -0,0 +1,57 @@ +package com.example.h_mal.stackexchangeusers.utils + +import android.content.Context +import android.view.View +import android.widget.ImageView +import android.widget.Toast +import androidx.appcompat.widget.SearchView +import androidx.navigation.NavDirections +import androidx.navigation.Navigation +import com.example.h_mal.stackexchangeusers.R +import com.squareup.picasso.Picasso + +fun View.show() { + this.visibility = View.VISIBLE +} + +fun View.hide() { + this.visibility = View.GONE +} + +fun Context.displayToast(message: String) { + Toast.makeText(this, message, Toast.LENGTH_LONG).show() +} + +fun View.navigateTo(navDirections: NavDirections) { + Navigation.findNavController(this).navigate(navDirections) +} + +fun ImageView.loadImage(url: String?){ + Picasso.get() + .load(url) + .placeholder(R.mipmap.ic_launcher) + .into(this) +} + +fun ImageView.loadImage(url: String?, height: Int, width: Int){ + Picasso.get() + .load(url) + .resize(width, height) + .centerCrop() + .placeholder(R.mipmap.ic_launcher) + .into(this) +} + +fun SearchView.onSubmitListener(searchSubmit: (String) -> Unit) { + this.setOnQueryTextListener(object : + SearchView.OnQueryTextListener { + override fun onQueryTextSubmit(s: String): Boolean { + searchSubmit.invoke(s) + return true + } + + override fun onQueryTextChange(s: String): Boolean { + return true + } + }) +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_user_profile.xml b/app/src/main/res/layout/fragment_user_profile.xml new file mode 100644 index 0000000..2de1867 --- /dev/null +++ b/app/src/main/res/layout/fragment_user_profile.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/list_item_layout.xml b/app/src/main/res/layout/list_item_layout.xml new file mode 100644 index 0000000..d25ba32 --- /dev/null +++ b/app/src/main/res/layout/list_item_layout.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml new file mode 100644 index 0000000..5c9b54a --- /dev/null +++ b/app/src/main/res/layout/main_activity.xml @@ -0,0 +1,34 @@ + + + + + + + diff --git a/app/src/main/res/layout/main_fragment.xml b/app/src/main/res/layout/main_fragment.xml new file mode 100644 index 0000000..cfbe5f1 --- /dev/null +++ b/app/src/main/res/layout/main_fragment.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/app/src/main/res/layout/simple_item.xml b/app/src/main/res/layout/simple_item.xml new file mode 100644 index 0000000..a24e68b --- /dev/null +++ b/app/src/main/res/layout/simple_item.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/navigation/app_navigation.xml b/app/src/main/res/navigation/app_navigation.xml new file mode 100644 index 0000000..697c671 --- /dev/null +++ b/app/src/main/res/navigation/app_navigation.xml @@ -0,0 +1,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..030098f --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #6200EE + #3700B3 + #03DAC5 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..71d15fe --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..1f1eb2d --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + Stack Exchange Users + + + Hello blank fragment + + Enter a valid username + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/test/java/com/example/h_mal/stackexchangeusers/ExampleUnitTest.kt b/app/src/test/java/com/example/h_mal/stackexchangeusers/ExampleUnitTest.kt new file mode 100644 index 0000000..2a5e126 --- /dev/null +++ b/app/src/test/java/com/example/h_mal/stackexchangeusers/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.example.h_mal.stackexchangeusers + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/app/src/test/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryTest.kt b/app/src/test/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryTest.kt new file mode 100644 index 0000000..7891324 --- /dev/null +++ b/app/src/test/java/com/example/h_mal/stackexchangeusers/data/repositories/RepositoryTest.kt @@ -0,0 +1,93 @@ +package com.example.h_mal.stackexchangeusers.data.repositories + +import com.example.h_mal.stackexchangeusers.data.network.api.ApiClass +import com.example.h_mal.stackexchangeusers.data.network.model.ApiResponse +import com.example.h_mal.stackexchangeusers.data.preferences.PreferenceProvider +import com.example.h_mal.stackexchangeusers.data.room.AppDatabase +import kotlinx.coroutines.runBlocking +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Before +import org.junit.Test +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.Mockito.mock +import org.mockito.MockitoAnnotations +import retrofit2.Response +import okhttp3.ResponseBody +import okio.IOException +import kotlin.test.assertFailsWith + +class RepositoryTest { + + lateinit var repository: Repository + + @Mock + lateinit var api: ApiClass + @Mock + lateinit var db: AppDatabase + @Mock + lateinit var prefs: PreferenceProvider + + @Before + fun setUp() { + MockitoAnnotations.initMocks(this) + repository = RepositoryImpl(api, db, prefs) + } + + @Test + fun fetchUserFromApi_positiveResponse() = runBlocking { + // GIVEN + val input = "12345" + val mockApiResponse = mock(ApiResponse::class.java) + val mockResponse = Response.success(mockApiResponse) + + // WHEN + Mockito.`when`(api.getUsersFromApi(input)).thenReturn( + mockResponse + ) + Mockito.`when`(prefs.getLastSavedAt(input)).thenReturn(null) + + // THEN + val getUser = repository.getUsersFromApi(input) + assertNotNull(getUser) + assertEquals(mockApiResponse, getUser) + } + + @Test + fun fetchUserFromApi_negativeResponse() = runBlocking { + //GIVEN + //mock retrofit error response + val mockBody = mock(ResponseBody::class.java) + val mockRaw = mock(okhttp3.Response::class.java) + val re = Response.error(mockBody, mockRaw) + + //WHEN + Mockito.`when`(api.getUsersFromApi("12345")).then { re } + + //THEN - assert exception is not null + val ioExceptionReturned = assertFailsWith { + repository.getUsersFromApi("12345") + } + assertNotNull(ioExceptionReturned) + assertNotNull(ioExceptionReturned.message) + } + + @Test + fun fetchUserFromApi_alreadySearched() = runBlocking { + // GIVEN + val mockApiResponse = mock(ApiResponse::class.java) + val mockResponse = Response.success(mockApiResponse) + + //WHEN + Mockito.`when`(api.getUsersFromApi("12345")).thenReturn( + mockResponse + ) + Mockito.`when`(prefs.getLastSavedAt("12345")).thenReturn(System.currentTimeMillis()) + + // THEN + val getUser = repository.getUsersFromApi("12345") + assertEquals(getUser, null) + } + +} \ No newline at end of file diff --git a/app/src/test/java/com/example/h_mal/stackexchangeusers/ui/main/MainViewModelTest.kt b/app/src/test/java/com/example/h_mal/stackexchangeusers/ui/main/MainViewModelTest.kt new file mode 100644 index 0000000..e43127e --- /dev/null +++ b/app/src/test/java/com/example/h_mal/stackexchangeusers/ui/main/MainViewModelTest.kt @@ -0,0 +1,75 @@ +package com.example.h_mal.stackexchangeusers.ui.main + +import androidx.arch.core.executor.testing.InstantTaskExecutorRule +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.Observer +import com.example.h_mal.stackexchangeusers.data.network.model.ApiResponse +import com.example.h_mal.stackexchangeusers.data.network.model.User +import com.example.h_mal.stackexchangeusers.data.repositories.Repository +import com.example.h_mal.stackexchangeusers.data.repositories.RepositoryImpl +import com.example.h_mal.stackexchangeusers.data.room.entities.UserItem +import com.example.h_mal.stackexchangeusers.ui.MainViewModel +import kotlinx.coroutines.runBlocking +import org.junit.Assert.assertEquals +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TestRule +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.Mockito.mock +import org.mockito.MockitoAnnotations +import java.io.IOException +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +class MainViewModelTest { + + @get:Rule + var rule: TestRule = InstantTaskExecutorRule() + + lateinit var viewModel: MainViewModel + + @Mock + lateinit var repository: Repository + + @Before + fun setUp() { + MockitoAnnotations.initMocks(this) + viewModel = MainViewModel(repository) + + } + + @Test + fun getApiFromRepository_SuccessfulReturn() = runBlocking{ + //GIVEN + val mockApiResponse = mock(ApiResponse::class.java) + + //WHEN + Mockito.`when`(repository.getUsersFromApi("12345")).thenReturn(mockApiResponse) + + //THEN + viewModel.getUsers("12345") + viewModel.operationState.observeForever{ + it.getContentIfNotHandled()?.let {result -> + assertFalse { result } + } + } + } + + @Test + fun getApiFromRepository_unsuccessfulReturn() = runBlocking{ + // WHEN + Mockito.`when`(repository.getUsersFromApi("12345")).thenAnswer{ throw IOException("throwed") } + + // THEN + viewModel.getUsers("fsdfsdf") + viewModel.operationError.observeForever{ + it.getContentIfNotHandled()?.let {result -> + assertEquals(result, "throwed") + } + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..c4cf0bf --- /dev/null +++ b/build.gradle @@ -0,0 +1,32 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + ext.kotlin_version = '1.3.61' + repositories { + google() + jcenter() + + } + dependencies { + classpath 'com.android.tools.build:gradle:4.0.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + + //Android Navigation Safe Args Classpath + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0" + } +} + +allprojects { + repositories { + google() + jcenter() + + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..23339e0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1e4767d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 15 20:57:53 BST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..f602b33 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Fri Jul 17 15:27:39 BST 2020 +sdk.dir=C\:\\Users\\h_mal\\AppData\\Local\\Android\\Sdk diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..7b4d379 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name='Candy Space' +include ':app'