├── .circleci
└── config.yml
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── masscode
│ │ └── animesuta
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── emptybox.json
│ ├── java
│ │ └── com
│ │ │ └── masscode
│ │ │ └── animesuta
│ │ │ ├── MainActivity.kt
│ │ │ ├── MyApplication.kt
│ │ │ ├── binding
│ │ │ ├── ActivityBinding.kt
│ │ │ └── BindingAdapters.kt
│ │ │ ├── detail
│ │ │ ├── DetailAnimeActivity.kt
│ │ │ └── DetailAnimeViewModel.kt
│ │ │ ├── di
│ │ │ └── AppModule.kt
│ │ │ └── home
│ │ │ ├── HomeFragment.kt
│ │ │ └── HomeViewModel.kt
│ └── res
│ │ ├── drawable-v24
│ │ ├── ic_favorite_white.xml
│ │ ├── ic_launcher_foreground.xml
│ │ └── ic_not_favorite_white.xml
│ │ ├── drawable
│ │ ├── ic_arrow_back.xml
│ │ ├── ic_favorite_black.xml
│ │ ├── ic_home.xml
│ │ ├── ic_launcher_background.xml
│ │ └── ic_play_arrow.xml
│ │ ├── layout
│ │ ├── activity_detail_anime.xml
│ │ ├── activity_main.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_detail_anime.xml
│ │ ├── content_main.xml
│ │ ├── fragment_home.xml
│ │ ├── item_list_placeholder.xml
│ │ ├── nav_header_main.xml
│ │ ├── view_empty.xml
│ │ └── view_error.xml
│ │ ├── menu
│ │ └── drawer_menu.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── navigation
│ │ └── nav_graph.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── masscode
│ └── animesuta
│ └── ExampleUnitTest.kt
├── build.gradle
├── core
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── masscode
│ │ └── animesuta
│ │ └── core
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── masscode
│ │ │ └── animesuta
│ │ │ └── core
│ │ │ ├── binding
│ │ │ └── BindingAdapters.kt
│ │ │ ├── data
│ │ │ ├── AnimeRepository.kt
│ │ │ ├── NetworkBoundResource.kt
│ │ │ ├── Resource.kt
│ │ │ └── source
│ │ │ │ ├── local
│ │ │ │ ├── LocalDataSource.kt
│ │ │ │ ├── entity
│ │ │ │ │ └── AnimeEntity.kt
│ │ │ │ └── room
│ │ │ │ │ ├── AnimeDao.kt
│ │ │ │ │ └── AnimeDatabase.kt
│ │ │ │ └── remote
│ │ │ │ ├── RemoteDataSource.kt
│ │ │ │ ├── network
│ │ │ │ ├── ApiResponse.kt
│ │ │ │ └── ApiService.kt
│ │ │ │ └── response
│ │ │ │ ├── AnimeResponse.kt
│ │ │ │ ├── Attributes.kt
│ │ │ │ ├── CoverImage.kt
│ │ │ │ ├── ListAnimeResponse.kt
│ │ │ │ └── PosterImage.kt
│ │ │ ├── di
│ │ │ └── CoreModule.kt
│ │ │ ├── domain
│ │ │ ├── model
│ │ │ │ └── Anime.kt
│ │ │ ├── repository
│ │ │ │ └── IAnimeRepository.kt
│ │ │ └── usecase
│ │ │ │ ├── AnimeInteractor.kt
│ │ │ │ └── AnimeUseCase.kt
│ │ │ ├── ui
│ │ │ └── AnimeAdapter.kt
│ │ │ └── utils
│ │ │ ├── AppExecutors.kt
│ │ │ └── DataMapper.kt
│ └── res
│ │ ├── layout
│ │ └── item_list_anime.xml
│ │ └── values
│ │ └── string.xml
│ └── test
│ └── java
│ └── com
│ └── masscode
│ └── animesuta
│ └── core
│ └── ExampleUnitTest.kt
├── favorite
├── .gitignore
├── build.gradle
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── masscode
│ │ └── animesuta
│ │ └── favorite
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── masscode
│ │ │ └── animesuta
│ │ │ └── favorite
│ │ │ ├── FavoriteFragment.kt
│ │ │ ├── FavoriteModule.kt
│ │ │ └── FavoriteViewModel.kt
│ └── res
│ │ └── layout
│ │ └── fragment_favorite.xml
│ └── test
│ └── java
│ └── com
│ └── masscode
│ └── animesuta
│ └── favorite
│ └── ExampleUnitTest.kt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── images
├── android representation.jpeg
├── app module.PNG
├── clean arch layer.jpeg
├── core module.PNG
├── favorite module.PNG
└── test.md
├── settings.gradle
└── shared_dependencies.gradle
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 |
3 | orbs:
4 | android: circleci/android@0.2.1
5 |
6 | jobs:
7 | build:
8 | executor: android/android
9 | steps:
10 | - checkout
11 | - restore_cache:
12 | key: android-orb-v1-
13 | - run:
14 | name: Chmod permissions
15 | command: sudo chmod +x ./gradlew
16 | - run:
17 | name: Download Dependencies
18 | command: ./gradlew androidDependencies
19 | - save_cache:
20 | key: 'android-orb-v1-{{ epoch }}'
21 | paths:
22 | - ~/.android/build-cache
23 | - ~/.android/cache
24 | - run:
25 | name: Run Build
26 | command: ./gradlew build
27 | - store_artifacts:
28 | path: app/build/reports
29 | destination: reports
30 | - run:
31 | name: Run Tests
32 | command: ./gradlew lint test
33 | - store_test_results:
34 | path: app/build/test-results
35 | - store_artifacts:
36 | path: app/build/outputs/apk/debug/
37 | destination: artifact-file
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | xmlns:android
33 |
34 | ^$
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | xmlns:.*
44 |
45 | ^$
46 |
47 |
48 | BY_NAME
49 |
50 |
51 |
52 |
53 |
54 |
55 | .*:id
56 |
57 | http://schemas.android.com/apk/res/android
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | .*:name
67 |
68 | http://schemas.android.com/apk/res/android
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | name
78 |
79 | ^$
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | style
89 |
90 | ^$
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | .*
100 |
101 | ^$
102 |
103 |
104 | BY_NAME
105 |
106 |
107 |
108 |
109 |
110 |
111 | .*
112 |
113 | http://schemas.android.com/apk/res/android
114 |
115 |
116 | ANDROID_ATTRIBUTE_ORDER
117 |
118 |
119 |
120 |
121 |
122 |
123 | .*
124 |
125 | .*
126 |
127 |
128 | BY_NAME
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2020 Agus Tiyansyah Syam
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android Clean Architecture
2 | [](https://circleci.com/gh/agustiyann/Android-Clean-Architecture)
3 | 
4 | 
5 |
6 | ## What is Clean Architecture?
7 | Clean Architecture is a software engineering development architecture created by Uncle Bob (**Robert C. Martin**). The essence of this architecture is separation of concern. So that we can read the code in the project more easily.
8 |
9 | In addition, the main idea of using Clean Architecture is to produce a system that is **Independent of Framework**, **Testable**, **Independent of UI**, **Independent of Database**, and **Independent of External**.
10 | This is an overview to represent Clean Architecture suggested by Robert C. Martin:
11 |
12 |
13 | ## Use this pattern in an Android project
14 | In a typical android project it is divided into 3 layers like this:
15 |
16 |
17 | - **Presentation Layer** contains the UI and Presenter / ViewModel which will control the views. This UI will depend heavily on the Use Case.
18 | - **Domain Layer** contains Entities, Use Case, Repository Interface. This is the most core layer and is associated with business processes.
19 | - **Data Layer** contains Repository Implementation and DataSource which can be Local DataSource (database) and Remote DataSource (network).
20 |
21 | ## Modularization
22 | Modularization is a technique of breaking an Android project into sections called modules. With modularization we will get a lot of advantages over implementing the monolith (only one part) in our project.
23 |
24 |
25 |
26 |
27 |
28 |
29 | ## Tech stack & Open-source libraries
30 |
31 | - [Kotlin](https://kotlinlang.org/) based, [Coroutines](https://github.com/Kotlin/kotlinx.coroutines) + [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/) for asynchronous.
32 | - [Koin](https://insert-koin.io) for dependency injection.
33 | - Jetpack Libraries
34 | - [LiveData](https://developer.android.com/topic/libraries/architecture/livedata) - notify domain layer data to views.
35 | - [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) - UI related data holder, lifecycle aware.
36 | - [Room Persistence](https://developer.android.com/topic/libraries/architecture/room) - construct a database using the abstract layer.
37 | - Architecture
38 | - MVVM Architecture (View - DataBinding - ViewModel - Model)
39 | - Repository pattern
40 | - [Glide](https://github.com/bumptech/glide) - loading images.
41 | - [Retrofit2 & OkHttp3](https://github.com/square/retrofit) - construct the REST APIs and paging network data.
42 | - [Gson](https://github.com/google/gson) - JSON representation.
43 | - [Timber](https://github.com/JakeWharton/timber) - logging.
44 | - [Material-Components](https://github.com/material-components/material-components-android) - Material design components.
45 | - [Leak Canary](https://square.github.io/leakcanary/) - memory leak detection library for Android.
46 | - Security
47 | - [SQLCipher](https://www.zetetic.net/sqlcipher/) - protecting data.
48 | - ProGuard - disguise the code so that it is difficult to read by others after reverse engineering.
49 | - Certificate Pinning - secure connection from mobile to server.
50 | - [Lottie](https://lottiefiles.com/) - displays animation in JSON format.
51 | - [Shimmer](https://facebook.github.io/shimmer-android/) - create a shimmer effect on the application.
52 |
53 | ## License
54 | ```
55 | Copyright 2020 Agus Tiyansyah Syam
56 |
57 | Licensed under the Apache License, Version 2.0 (the "License");
58 | you may not use this file except in compliance with the License.
59 | You may obtain a copy of the License at
60 |
61 | http://www.apache.org/licenses/LICENSE-2.0
62 |
63 | Unless required by applicable law or agreed to in writing, software
64 | distributed under the License is distributed on an "AS IS" BASIS,
65 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66 | See the License for the specific language governing permissions and
67 | limitations under the License.
68 | ```
69 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: "kotlin-kapt"
5 | apply plugin: "androidx.navigation.safeargs.kotlin"
6 | apply from: '../shared_dependencies.gradle'
7 |
8 | android {
9 | compileSdkVersion 30
10 | buildToolsVersion "30.0.2"
11 |
12 | defaultConfig {
13 | applicationId "com.masscode.animesuta"
14 | multiDexEnabled true
15 | minSdkVersion 16
16 | targetSdkVersion 30
17 | versionCode 1
18 | versionName "1.0"
19 |
20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled true
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 | debug {
29 | minifyEnabled true
30 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 |
34 | dataBinding {
35 | enabled = true
36 | }
37 |
38 | compileOptions {
39 | sourceCompatibility JavaVersion.VERSION_1_8
40 | targetCompatibility JavaVersion.VERSION_1_8
41 | }
42 |
43 | kotlinOptions {
44 | jvmTarget = "1.8"
45 | }
46 | dynamicFeatures = [':favorite']
47 | }
48 |
49 | dependencies {
50 | implementation project(":core")
51 | implementation fileTree(dir: "libs", include: ["*.jar"])
52 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
53 | // navigation component
54 | api "androidx.navigation:navigation-fragment-ktx:$nav_version"
55 | api "androidx.navigation:navigation-ui-ktx:$nav_version"
56 | api "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
57 |
58 | // debugImplementation because LeakCanary should only run in debug builds.
59 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
60 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/masscode/animesuta/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.masscode.animesuta", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/assets/emptybox.json:
--------------------------------------------------------------------------------
1 | {"v":"5.4.2","fr":60,"ip":0,"op":90,"w":620,"h":690,"nm":"Pre-comp 2","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"bottom_right 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":15}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[211.343,208.143,0],"e":[211.343,428.143,0],"to":[0,36.6666679382324,0],"ti":[0,-30,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[211.343,428.143,0],"e":[211.343,388.143,0],"to":[0,30,0],"ti":[0,6.66666650772095,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[97.496,-65.355,0],"ix":1},"s":{"a":0,"k":[117.486,89.612,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[{"i":[[0.25,0.643],[9.638,27.694],[-0.545,1.799],[-2.253,0.087],[-49.028,-1.083],[-2.41,-2.312],[-1.521,-3.891],[-8.485,-26.666],[1.229,0.008],[53.092,-0.118]],"o":[[-10.659,-27.407],[-0.62,-1.781],[0.577,-1.904],[48.997,-1.881],[3.579,0.079],[3.17,3.04],[10.237,26.193],[0.329,1.034],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-14.216,-147.833],[-15.21,-153.348],[-11.12,-158.055],[136.006,-159.153],[145.395,-154.598],[152.084,-143.734],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.424,0.569],[15.558,22.754],[-0.549,0.524],[-1.831,0.039],[-48.815,-0.529],[-2.518,-1.52],[-1.695,-2.278],[-14.928,-21.952],[1.229,0.008],[53.092,-0.118]],"o":[[-16.558,-22.209],[-0.417,-0.61],[1.236,-1.18],[48.804,-1.038],[3.061,0.033],[2.559,1.544],[15.934,21.406],[0.628,0.923],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-32.223,-132.662],[-32.193,-134.793],[-27.451,-137.218],[119.002,-138.009],[127.738,-135.536],[133.603,-129.197],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":17,"s":[{"i":[[0.424,0.569],[15.558,22.754],[-0.549,0.524],[-1.831,0.039],[-48.815,-0.529],[-2.518,-1.52],[-1.695,-2.278],[-14.928,-21.952],[1.229,0.008],[53.092,-0.118]],"o":[[-16.558,-22.209],[-0.417,-0.61],[1.236,-1.18],[48.804,-1.038],[3.061,0.033],[2.559,1.544],[15.934,21.406],[0.628,0.923],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-32.223,-132.662],[-32.193,-134.793],[-27.451,-137.218],[119.002,-138.009],[127.738,-135.536],[133.603,-129.197],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.755,0.163],[22.491,4.893],[-0.583,-0.1],[-1.798,0.007],[-48.594,0.029],[-2.65,-0.445],[-1.767,-0.37],[-22.306,-4.387],[1.229,0.008],[53.092,-0.118]],"o":[[-22.5,-4.861],[-0.577,-0.125],[1.764,0.304],[48.593,-0.202],[2.699,-0.002],[1.785,0.3],[22.233,4.66],[1.199,0.236],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-51.645,-80.621],[-50.591,-79.366],[-45.198,-79.511],[100.583,-79.994],[108.666,-79.602],[113.707,-77.789],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[{"i":[[0.755,0.163],[22.491,4.893],[-0.583,-0.1],[-1.798,0.007],[-48.594,0.029],[-2.65,-0.445],[-1.767,-0.37],[-22.306,-4.387],[1.229,0.008],[53.092,-0.118]],"o":[[-22.5,-4.861],[-0.577,-0.125],[1.764,0.304],[48.593,-0.202],[2.699,-0.002],[1.785,0.3],[22.233,4.66],[1.199,0.236],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-51.645,-80.621],[-50.591,-79.366],[-45.198,-79.511],[100.583,-79.994],[108.666,-79.602],[113.707,-77.789],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.247,-0.644],[6.169,-21.714],[-1.621,-1.738],[-2.463,-0.053],[-48.247,0.874],[-2.012,1.421],[-0.72,1.893],[-6.492,22.149],[1.229,0.008],[53.092,-0.118]],"o":[[-8.129,21.216],[-0.618,2.176],[1.556,1.668],[48.242,1.039],[2.587,-0.047],[1.776,-1.254],[8.252,-21.697],[0.305,-1.04],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-7.072,-0.833],[-4.48,5.499],[1.889,8.776],[146.661,8.755],[153.766,6.024],[157.571,1.048],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":24,"s":[{"i":[[0.247,-0.644],[6.169,-21.714],[-1.621,-1.738],[-2.463,-0.053],[-48.247,0.874],[-2.012,1.421],[-0.72,1.893],[-6.492,22.149],[1.229,0.008],[53.092,-0.118]],"o":[[-8.129,21.216],[-0.618,2.176],[1.556,1.668],[48.242,1.039],[2.587,-0.047],[1.776,-1.254],[8.252,-21.697],[0.305,-1.04],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-7.072,-0.833],[-4.48,5.499],[1.889,8.776],[146.661,8.755],[153.766,6.024],[157.571,1.048],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.209,-0.654],[5.451,-24.026],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.734,2.328],[-5.933,24.38],[1.229,0.008],[53.092,-0.118]],"o":[[-7.558,23.588],[-0.59,2.598],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[7.579,-24.03],[0.256,-1.05],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-5.266,6.219],[-2.315,13.736],[4.282,17.811],[148.818,17.898],[155.694,14.438],[159.211,7.879],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":26,"s":[{"i":[[0.209,-0.654],[5.451,-24.026],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.734,2.328],[-5.933,24.38],[1.229,0.008],[53.092,-0.118]],"o":[[-7.558,23.588],[-0.59,2.598],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[7.579,-24.03],[0.256,-1.05],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-5.266,6.219],[-2.315,13.736],[4.282,17.811],[148.818,17.898],[155.694,14.438],[159.211,7.879],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[-0.148,-0.667],[-8.331,-32.489],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[0.45,2.382],[8.874,32.748],[1.229,0.008],[53.092,-0.118]],"o":[[7.251,32.686],[0.663,2.585],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[-6.275,-33.203],[-0.283,-1.045],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[39.561,32.675],[42.512,40.192],[49.109,44.267],[193.645,44.354],[200.521,40.894],[204.038,34.335],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"t":29}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.97565870098,0.623621323529,0.104366167854,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[13.186,-121.197],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[91.803,91.525],"ix":3},"r":{"a":0,"k":36.852,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"bottom_right 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":15}],"ix":11},"r":{"a":0,"k":149.892,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[239.343,81.393,0],"e":[239.343,301.393,0],"to":[0,36.6666679382324,0],"ti":[0,-30,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[239.343,301.393,0],"e":[239.343,261.393,0],"to":[0,30,0],"ti":[0,6.66666650772095,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[97.496,-65.355,0],"ix":1},"s":{"a":0,"k":[98.474,89.612,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[{"i":[[0.669,0.345],[13.132,7.662],[2.349,2.068],[-2.927,0.191],[-50.571,-0.547],[-6.093,-2.696],[-4.316,-2.999],[-10.975,-8.181],[1.229,0.008],[53.092,-0.118]],"o":[[-13.598,-7.014],[-2.773,-1.618],[-2.067,-1.82],[50.434,-3.288],[6.83,0.074],[4.92,2.177],[11.291,7.846],[0.935,0.697],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-24.326,-87.334],[-32.133,-92.799],[-37.475,-98.911],[114.198,-102.339],[133.777,-97.06],[146.651,-87.982],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.747,0.188],[12.353,3.718],[3.201,1.325],[-2.289,0.161],[-51.584,1.049],[-5.74,-1.85],[-5.003,-2.301],[-10.051,-5.077],[1.229,0.008],[53.092,-0.118]],"o":[[-12.557,-3.155],[-3.35,-1.008],[-2.075,-0.859],[51.43,-3.628],[6.117,-0.124],[5.305,1.71],[10.274,4.724],[1.064,0.537],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-21.74,-75.551],[-31.537,-79.151],[-37.545,-82.094],[117.008,-89.63],[134.773,-85.599],[149.964,-79.007],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":16,"s":[{"i":[[0.747,0.188],[12.353,3.718],[3.201,1.325],[-2.289,0.161],[-51.584,1.049],[-5.74,-1.85],[-5.003,-2.301],[-10.051,-5.077],[1.229,0.008],[53.092,-0.118]],"o":[[-12.557,-3.155],[-3.35,-1.008],[-2.075,-0.859],[51.43,-3.628],[6.117,-0.124],[5.305,1.71],[10.274,4.724],[1.064,0.537],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-21.74,-75.551],[-31.537,-79.151],[-37.545,-82.094],[117.008,-89.63],[134.773,-85.599],[149.964,-79.007],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.707,-0.283],[9.564,-3.731],[1.953,-1.212],[-3.397,-0.096],[-49.861,1.406],[-5.083,1.281],[-6.291,2.258],[-7.299,3.525],[1.229,0.008],[53.092,-0.118]],"o":[[-9.521,3.814],[-2.188,0.853],[-2.77,1.719],[49.86,1.408],[5.288,-0.149],[6.535,-1.647],[7.715,-2.769],[1.076,-0.519],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-12.916,-53.343],[-19.686,-51.237],[-26.711,-44.785],[122.922,-47.209],[138.586,-49.446],[157.584,-55.946],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":17,"s":[{"i":[[0.707,-0.283],[9.564,-3.731],[1.953,-1.212],[-3.397,-0.096],[-49.861,1.406],[-5.083,1.281],[-6.291,2.258],[-7.299,3.525],[1.229,0.008],[53.092,-0.118]],"o":[[-9.521,3.814],[-2.188,0.853],[-2.77,1.719],[49.86,1.408],[5.288,-0.149],[6.535,-1.647],[7.715,-2.769],[1.076,-0.519],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-12.916,-53.343],[-19.686,-51.237],[-26.711,-44.785],[122.922,-47.209],[138.586,-49.446],[157.584,-55.946],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.289,-0.63],[10.587,-24.925],[0.029,-1.947],[-2.074,-0.06],[-50.642,0.949],[-2.605,1.76],[-1.445,3.288],[-8.597,24.745],[1.229,0.008],[53.092,-0.118]],"o":[[-11.328,24.675],[-0.776,1.826],[-0.027,1.812],[50.625,1.473],[3.293,-0.062],[3.19,-2.155],[10.612,-24.141],[0.357,-1.027],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-16.787,9.609],[-18.533,15.249],[-16.949,20.506],[135.009,19.717],[144.552,17.48],[151.303,8.711],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":18,"s":[{"i":[[0.289,-0.63],[10.587,-24.925],[0.029,-1.947],[-2.074,-0.06],[-50.642,0.949],[-2.605,1.76],[-1.445,3.288],[-8.597,24.745],[1.229,0.008],[53.092,-0.118]],"o":[[-11.328,24.675],[-0.776,1.826],[-0.027,1.812],[50.625,1.473],[3.293,-0.062],[3.19,-2.155],[10.612,-24.141],[0.357,-1.027],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-16.787,9.609],[-18.533,15.249],[-16.949,20.506],[135.009,19.717],[144.552,17.48],[151.303,8.711],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.015,-0.679],[-0.933,-32.194],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.093,2.413],[1.011,32.595],[1.229,0.008],[53.092,-0.118]],"o":[[-0.71,32.199],[0.077,2.648],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[1.258,-32.589],[-0.033,-1.073],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[15.61,31.635],[18.561,39.152],[25.158,43.227],[169.694,43.314],[176.57,39.854],[180.087,33.295],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":22,"s":[{"i":[[0.015,-0.679],[-0.933,-32.194],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.093,2.413],[1.011,32.595],[1.229,0.008],[53.092,-0.118]],"o":[[-0.71,32.199],[0.077,2.648],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[1.258,-32.589],[-0.033,-1.073],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[15.61,31.635],[18.561,39.152],[25.158,43.227],[169.694,43.314],[176.57,39.854],[180.087,33.295],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[-0.367,-0.599],[-12.262,-18.403],[-2.375,-2.331],[-2.692,-0.074],[-48.163,1.073],[-1.429,1.944],[1.167,2.11],[12.725,18.474],[1.229,0.008],[53.092,-0.118]],"o":[[11.502,18.773],[1.797,2.697],[1.79,1.757],[48.155,1.326],[2.644,-0.059],[1.45,-1.972],[-10.733,-19.414],[-0.634,-0.92],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[52.062,-9.636],[57.718,-1.684],[64.315,2.39],[208.851,2.477],[215.727,-0.983],[216.538,-7.976],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":27,"s":[{"i":[[-0.367,-0.599],[-12.262,-18.403],[-2.375,-2.331],[-2.692,-0.074],[-48.163,1.073],[-1.429,1.944],[1.167,2.11],[12.725,18.474],[1.229,0.008],[53.092,-0.118]],"o":[[11.502,18.773],[1.797,2.697],[1.79,1.757],[48.155,1.326],[2.644,-0.059],[1.45,-1.972],[-10.733,-19.414],[-0.634,-0.92],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[52.062,-9.636],[57.718,-1.684],[64.315,2.39],[208.851,2.477],[215.727,-0.983],[216.538,-7.976],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[-0.773,-0.069],[-19.217,-1.218],[-4.041,-0.075],[-3.068,0.066],[-48.612,1.57],[-0.169,0.371],[0.533,-0.005],[20.288,-0.298],[1.229,0.008],[53.092,-0.118]],"o":[[19.169,1.705],[4.031,0.255],[3.068,0.057],[48.631,-1.041],[0.457,-0.015],[0.197,-0.433],[-20.29,0.171],[-1.229,0.018],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[73.139,-60.703],[85.264,-60.561],[94.465,-60.309],[240.345,-63.881],[240.721,-65.033],[241.436,-66.283],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":29,"s":[{"i":[[-0.773,-0.069],[-19.217,-1.218],[-4.041,-0.075],[-3.068,0.066],[-48.612,1.57],[-0.169,0.371],[0.533,-0.005],[20.288,-0.298],[1.229,0.008],[53.092,-0.118]],"o":[[19.169,1.705],[4.031,0.255],[3.068,0.057],[48.631,-1.041],[0.457,-0.015],[0.197,-0.433],[-20.29,0.171],[-1.229,0.018],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[73.139,-60.703],[85.264,-60.561],[94.465,-60.309],[240.345,-63.881],[240.721,-65.033],[241.436,-66.283],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[-0.777,-0.032],[-19.66,-0.5],[-4.041,-0.075],[-3.069,0.014],[-48.162,0.703],[-0.169,0.371],[0.533,-0.005],[20.288,-0.298],[1.229,0.008],[53.092,-0.118]],"o":[[19.646,0.801],[4.04,0.103],[3.068,0.057],[48.168,-0.223],[0.457,-0.007],[0.197,-0.433],[-20.29,0.171],[-1.229,0.018],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[74.516,-63.312],[86.641,-63.171],[95.842,-62.919],[240.345,-63.881],[240.721,-65.033],[241.436,-66.283],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"t":30}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.903937006932,0.576676013423,0.093966001623,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"bottom_right","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":15}],"ix":11},"r":{"a":0,"k":-210.358,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[380.355,161.774,0],"e":[380.355,381.774,0],"to":[0,36.6666679382324,0],"ti":[0,-30,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[380.355,381.774,0],"e":[380.355,341.774,0],"to":[0,30,0],"ti":[0,6.66666650772095,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[97.496,-65.355,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":15,"s":[98.088,89.612,100],"e":[98.088,-94.196,100]},{"t":29}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[{"i":[[-0.109,-0.76],[-5.613,-30.321],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[0.28,2.465],[6.015,30.617],[1.22,0.008],[53.092,-0.118]],"o":[[4.359,30.527],[0.49,2.647],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[-3.518,-31.003],[-0.235,-1.197],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[30.873,26.25],[33.824,33.768],[40.421,37.842],[184.957,37.929],[191.833,34.469],[195.35,27.91],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.518,-0.567],[23.77,-30.027],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[-1.623,1.876],[-24.922,29.639],[1.22,0.008],[53.092,-0.118]],"o":[[-25.845,28.261],[-1.671,2.111],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[25.334,-29.288],[0.785,-0.934],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[-61.106,20.603],[-58.155,28.121],[-51.559,32.196],[92.977,32.283],[99.854,28.823],[103.37,22.263],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[{"i":[[0.518,-0.567],[23.77,-30.027],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[-1.623,1.876],[-24.922,29.639],[1.22,0.008],[53.092,-0.118]],"o":[[-25.845,28.261],[-1.671,2.111],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[25.334,-29.288],[0.785,-0.934],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[-61.106,20.603],[-58.155,28.121],[-51.559,32.196],[92.977,32.283],[99.854,28.823],[103.37,22.263],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.277,-0.716],[14.523,-44.035],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[-0.882,2.319],[-15.196,44.277],[1.22,0.008],[53.092,-0.118]],"o":[[-16.715,43.25],[-0.843,2.556],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[16.636,-43.756],[0.396,-1.154],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[-32.893,65.419],[-29.942,72.936],[-23.345,77.011],[121.191,77.098],[128.067,73.638],[131.584,67.079],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":25,"s":[{"i":[[0.277,-0.716],[14.523,-44.035],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[-0.882,2.319],[-15.196,44.277],[1.22,0.008],[53.092,-0.118]],"o":[[-16.715,43.25],[-0.843,2.556],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[16.636,-43.756],[0.396,-1.154],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[-32.893,65.419],[-29.942,72.936],[-23.345,77.011],[121.191,77.098],[128.067,73.638],[131.584,67.079],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.037,-0.767],[-0.173,-31.248],[-1.711,-2.078],[-2.584,-0.071],[-48.167,1.073],[-1.847,1.781],[-0.158,2.476],[0.199,31.655],[1.22,0.008],[53.092,-0.118]],"o":[[-1.522,31.211],[0.015,2.692],[1.643,1.995],[48.16,1.326],[2.565,-0.057],[1.786,-1.722],[2.019,-31.591],[-0.008,-1.22],[-53.09,-0.359],[-0.768,0.002]],"v":[[15.543,-64.979],[13.154,28.735],[16.104,36.252],[22.701,40.327],[167.237,40.414],[174.113,36.954],[177.63,30.395],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"t":29}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.90588241278,0.576470588235,0.094117654539,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,-0.107],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"box","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":15}],"ix":11},"r":{"a":0,"k":-0.138,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[310,220,0],"e":[310,440,0],"to":[0,36.6666679382324,0],"ti":[0,-30,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[310,440,0],"e":[310,400,0],"to":[0,30,0],"ti":[0,6.66666650772095,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[114.5,111.5,0],"ix":1},"s":{"a":0,"k":[210,210,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.676,1.529],[0,0],[0,1.437],[0,0],[-2.676,-1.53],[0,0],[0,-1.436],[0,0]],"o":[[0,0],[-1.249,-0.714],[0,0],[0,-3.077],[0,0],[1.249,0.714],[0,0],[0,3.078]],"v":[[7.814,14.89],[-11.803,3.682],[-13.822,0.205],[-13.822,-11.413],[-7.814,-14.889],[11.802,-3.68],[13.822,-0.204],[13.822,11.413]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.995999983245,0.995999983245,0.995999983245,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[67.059,135.614],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.16,1.318],[0,0],[-0.504,0.292],[-4.258,2.805],[0.212,0.123],[12.284,6.925]],"o":[[0,0],[0.456,-0.01],[17.4,-10.058],[-0.172,-0.191],[-6.276,-3.627],[-2.13,-1.2]],"v":[[-33.579,-39.177],[-33.4,37.332],[-32.002,36.86],[33.4,-1.005],[32.879,-1.57],[-26.565,-35.369]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.769000004787,0.681999954523,0.607999973671,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[147.882,65.668],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":4,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.213,0.123],[6.288,3.607],[12.284,6.924],[0.894,0.379],[2.252,-1.314],[1.819,-1.791],[-17.273,-10.007],[-0.95,0.549],[-17.4,10.06],[-4.258,2.805]],"o":[[-6.275,-3.627],[-5.131,-2.943],[-2.494,-1.405],[-1.22,0.528],[-14.667,8.562],[4.538,2.653],[1.046,0.606],[17.401,-10.059],[4.408,-2.549],[-0.171,-0.191]],"v":[[66.278,-1.562],[47.435,-12.418],[6.835,-35.361],[-0.379,-39.182],[-8.488,-35.245],[-66.799,-0.937],[-1.311,36.948],[1.397,36.868],[53.62,6.732],[66.799,-0.997]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":4,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.917999985639,0.851000019148,0.764999988032,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[114.462,65.66],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":4,"cix":2,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-0.005,-24.322],[1.903,1.096],[2.616,1.472],[-0.03,5.005],[0.01,9.844]],"o":[[0,0],[-2.239,0.118],[-15.611,-8.992],[-4.347,-2.446],[0.059,-9.842],[4.384,2.492]],"v":[[33.613,-38.028],[33.609,37.91],[27.456,36.222],[-27.186,4.76],[-33.583,-6.359],[-33.594,-76.364]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.995999983245,0.8,0.313999998803,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[80.871,141.03],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":4,"cix":2,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-4.147,2.385],[-0.029,-4.102],[4.338,-2.47],[10.47,-6.046],[2.548,0.242]],"o":[[0,0],[0.031,5.777],[0.036,4.968],[-7.538,4.292],[-2.117,1.223],[-0.005,-24.322]],"v":[[-33.625,-38.09],[33.024,-76.375],[33.598,-6.383],[27.179,4.728],[-26.801,35.827],[-33.629,37.848]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.987999949736,0.736999990426,0.238999998803,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[148.109,141.092],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":4,"cix":2,"ix":5,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[114.5,111.5],"ix":2},"a":{"a":0,"k":[114.5,111.5],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"box","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"bottom_right 4","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":15}],"ix":11},"r":{"a":0,"k":-150.704,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[379.843,80.643,0],"e":[379.843,300.643,0],"to":[0,36.6666679382324,0],"ti":[0,-30,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[379.843,300.643,0],"e":[379.843,260.643,0],"to":[0,30,0],"ti":[0,6.66666650772095,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[97.496,-65.355,0],"ix":1},"s":{"a":0,"k":[97.228,95.215,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[{"i":[[-0.643,-0.382],[-18.864,-10.591],[-1.644,-0.89],[-2.802,-0.07],[-48.163,1.073],[-0.716,2.224],[2.199,1.39],[17.518,9.202],[1.065,0.003],[53.092,-0.118]],"o":[[18.548,11.008],[1.627,0.914],[2.383,1.289],[48.159,1.198],[2.644,-0.059],[0.735,-2.282],[-16.56,-10.467],[-0.912,-0.479],[-53.092,-0.136],[-0.777,0.002]],"v":[[15.543,-64.979],[72.21,-33.309],[77.014,-30.466],[84.284,-26.777],[228.82,-26.69],[235.696,-30.15],[231.972,-36.474],[180.221,-65.213],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.015,-0.679],[-0.933,-32.194],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.093,2.413],[1.011,32.595],[1.229,0.008],[53.092,-0.118]],"o":[[-0.71,32.199],[0.077,2.648],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[1.258,-32.589],[-0.033,-1.073],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[15.61,31.635],[18.561,39.152],[25.158,43.227],[169.694,43.314],[176.57,39.854],[180.087,33.295],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":21,"s":[{"i":[[0.015,-0.679],[-0.933,-32.194],[-1.771,-2.15],[-2.692,-0.074],[-48.163,1.073],[-1.776,1.712],[-0.093,2.413],[1.011,32.595],[1.229,0.008],[53.092,-0.118]],"o":[[-0.71,32.199],[0.077,2.648],[1.573,1.909],[48.155,1.326],[2.644,-0.059],[1.856,-1.789],[1.258,-32.589],[-0.033,-1.073],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[15.61,31.635],[18.561,39.152],[25.158,43.227],[169.694,43.314],[176.57,39.854],[180.087,33.295],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.355,-0.604],[9.063,-18.116],[-0.993,-3.498],[-2.692,-0.088],[-49.222,0.786],[-1.832,1.666],[-1.275,2.313],[-9.417,19.905],[1.229,0.008],[53.092,-0.118]],"o":[[-10.346,17.584],[-1.652,3.302],[0.648,2.283],[49.196,1.615],[2.645,-0.042],[2.036,-1.851],[10.697,-19.406],[0.469,-0.992],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-14.038,-11.592],[-16.469,-0.991],[-9.872,3.084],[137.815,4.075],[144.691,0.615],[149.006,-6.101],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":26,"s":[{"i":[[0.355,-0.604],[9.063,-18.116],[-0.993,-3.498],[-2.692,-0.088],[-49.222,0.786],[-1.832,1.666],[-1.275,2.313],[-9.417,19.905],[1.229,0.008],[53.092,-0.118]],"o":[[-10.346,17.584],[-1.652,3.302],[0.648,2.283],[49.196,1.615],[2.645,-0.042],[2.036,-1.851],[10.697,-19.406],[0.469,-0.992],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-14.038,-11.592],[-16.469,-0.991],[-9.872,3.084],[137.815,4.075],[144.691,0.615],[149.006,-6.101],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}],"e":[{"i":[[0.761,0.139],[18.699,4.066],[1.768,2.165],[-1.916,-0.085],[-46.459,-2.274],[-2.914,0.176],[-3.445,-0.368],[-21.965,-2.982],[1.229,0.008],[53.092,-0.118]],"o":[[-18.859,-3.457],[-2.954,-0.642],[-1.114,-1.364],[46.471,2.069],[2.917,0.143],[3.463,-0.21],[22.064,2.356],[1.215,0.165],[-53.09,-0.359],[-0.777,0.002]],"v":[[15.543,-64.979],[-40.778,-76.356],[-49.358,-79.092],[-43.68,-79.91],[95.666,-72.634],[104.429,-72.66],[114.762,-73.791],[180.598,-64.526],[177.029,-65.337],[17.754,-65.628]],"c":true}]},{"t":29}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.976470648074,0.623529411765,0.105882360421,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[99.101,-65.381],"ix":2},"a":{"a":0,"k":[99.101,-65.381],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"shadow","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":15,"s":[100],"e":[63]},{"t":21}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[287,509,0],"e":[287,449,0],"to":[0,-10,0],"ti":[0,4.66666650772095,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[287,449,0],"e":[287,481,0],"to":[0,-4.66666650772095,0],"ti":[0,-5.33333349227905,0]},{"t":21}],"ix":2},"a":{"a":0,"k":[119.5,119.5,0],"ix":1},"s":{"a":0,"k":[397.854,250.518,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[81.29,81.29],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":20,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,0,0,0,0.95,0,0,0,1,0,0,0,0.001,0.39,0.524,0.195,0.999,0],"ix":9}},"s":{"a":0,"k":[0.074,0.267],"ix":5},"e":{"a":0,"k":[-25.662,26.134],"ix":6},"t":2,"h":{"a":0,"k":0,"ix":7},"a":{"a":0,"k":0,"ix":8},"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[125.672,140.06],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[124.899,112.74],"ix":3},"r":{"a":0,"k":-47.351,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":0,"bm":0}],"markers":[]}
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.navigation.NavController
6 | import androidx.navigation.findNavController
7 | import androidx.navigation.ui.NavigationUI
8 | import kotlinx.android.synthetic.main.activity_main.*
9 | import kotlinx.android.synthetic.main.app_bar_main.*
10 |
11 | class MainActivity : AppCompatActivity() {
12 |
13 | private lateinit var navCtrl: NavController
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_main)
18 | setSupportActionBar(toolbar)
19 |
20 | navCtrl = this.findNavController(R.id.nav_host_fragment)
21 | NavigationUI.setupActionBarWithNavController(this, navCtrl, drawer_layout)
22 | NavigationUI.setupWithNavController(nav_view, navCtrl)
23 | }
24 |
25 | override fun onSupportNavigateUp(): Boolean {
26 | return NavigationUI.navigateUp(navCtrl, drawer_layout)
27 | }
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/MyApplication.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta
2 |
3 | import android.app.Application
4 | import com.masscode.animesuta.core.di.databaseModule
5 | import com.masscode.animesuta.core.di.networkModule
6 | import com.masscode.animesuta.core.di.repositoryModule
7 | import com.masscode.animesuta.di.useCaseModule
8 | import com.masscode.animesuta.di.viewModelModule
9 | import org.koin.android.ext.koin.androidContext
10 | import org.koin.android.ext.koin.androidLogger
11 | import org.koin.core.context.startKoin
12 | import org.koin.core.logger.Level
13 | import timber.log.Timber
14 |
15 | class MyApplication : Application() {
16 | override fun onCreate() {
17 | super.onCreate()
18 | startKoin {
19 | androidLogger(Level.ERROR)
20 | androidContext(this@MyApplication)
21 | modules(
22 | listOf(
23 | databaseModule,
24 | networkModule,
25 | repositoryModule,
26 | useCaseModule,
27 | viewModelModule
28 | )
29 | )
30 | }
31 | if (BuildConfig.DEBUG) {
32 | Timber.plant(Timber.DebugTree())
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/binding/ActivityBinding.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.binding
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import androidx.appcompat.widget.Toolbar
5 | import androidx.databinding.BindingAdapter
6 | import com.masscode.animesuta.R
7 |
8 | fun AppCompatActivity.simpleToolbarWithHome(toolbar: Toolbar, title_: String = "") {
9 | setSupportActionBar(toolbar)
10 | supportActionBar?.run {
11 | setDisplayHomeAsUpEnabled(true)
12 | setHomeAsUpIndicator(R.drawable.ic_arrow_back)
13 | title = title_
14 | }
15 | }
16 |
17 | @BindingAdapter("simpleToolbarWithHome", "simpleToolbarTitle")
18 | fun bindToolbarWithTitle(toolbar: Toolbar, activity: AppCompatActivity, title: String) {
19 | activity.simpleToolbarWithHome(toolbar, title)
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/binding/BindingAdapters.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.binding
2 |
3 | import android.annotation.SuppressLint
4 | import android.widget.ImageView
5 | import android.widget.RatingBar
6 | import android.widget.TextView
7 | import androidx.databinding.BindingAdapter
8 | import com.bumptech.glide.Glide
9 |
10 | @BindingAdapter("app:showImage")
11 | fun showImage(imgView: ImageView, url: String?) {
12 | Glide.with(imgView.context).load(url).into(imgView)
13 | }
14 |
15 | @SuppressLint("SetTextI18n")
16 | @BindingAdapter("app:startDate")
17 | fun startDate(textView: TextView, date: String) {
18 | textView.text = "Start date: $date"
19 | }
20 |
21 | @BindingAdapter("app:setRating")
22 | fun setRating(ratingBar: RatingBar, rating: Double) {
23 | val float = rating.toFloat()
24 | ratingBar.rating = float / 20
25 | }
26 |
27 | @SuppressLint("SetTextI18n")
28 | @BindingAdapter("app:setRatingText")
29 | fun setRatingText(text: TextView, rating: Double) {
30 | text.text = "Rating: $rating"
31 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/detail/DetailAnimeActivity.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.detail
2 |
3 | import android.content.ActivityNotFoundException
4 | import android.content.Intent
5 | import android.net.Uri
6 | import android.os.Bundle
7 | import androidx.appcompat.app.AppCompatActivity
8 | import androidx.core.content.ContextCompat
9 | import androidx.databinding.DataBindingUtil
10 | import com.masscode.animesuta.R
11 | import com.masscode.animesuta.core.domain.model.Anime
12 | import com.masscode.animesuta.databinding.ActivityDetailAnimeBinding
13 | import org.koin.android.viewmodel.ext.android.viewModel
14 |
15 | class DetailAnimeActivity : AppCompatActivity() {
16 |
17 | private lateinit var binding: ActivityDetailAnimeBinding
18 | private lateinit var mAnime: Anime
19 | private var statusFavorite: Boolean = false
20 |
21 | private val detailViewModel: DetailAnimeViewModel by viewModel()
22 |
23 | override fun onCreate(savedInstanceState: Bundle?) {
24 | super.onCreate(savedInstanceState)
25 | binding = DataBindingUtil.setContentView(this, R.layout.activity_detail_anime)
26 |
27 | mAnime = DetailAnimeActivityArgs.fromBundle(intent.extras!!).anime
28 | statusFavorite = mAnime.isFavorite
29 | setStatusFavorite(statusFavorite)
30 |
31 | with(binding) {
32 | activity = this@DetailAnimeActivity
33 | lifecycleOwner = this@DetailAnimeActivity
34 | anime = mAnime
35 | fab.setOnClickListener { fabListener() }
36 | }
37 | }
38 |
39 | fun playTrailer(id: String) {
40 | val appIntent = Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:$id"))
41 | val webIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=$id"))
42 |
43 | try {
44 | startActivity(appIntent)
45 | } catch (ex: ActivityNotFoundException) {
46 | startActivity(webIntent)
47 | }
48 | }
49 |
50 | private fun fabListener() {
51 | statusFavorite = !statusFavorite
52 | detailViewModel.setFavoriteAnime(mAnime, statusFavorite)
53 | setStatusFavorite(statusFavorite)
54 | }
55 |
56 | private fun setStatusFavorite(statusFavorite: Boolean) {
57 | if (statusFavorite) {
58 | binding.fab.setImageDrawable(
59 | ContextCompat.getDrawable(
60 | this,
61 | R.drawable.ic_favorite_white
62 | )
63 | )
64 | } else {
65 | binding.fab.setImageDrawable(
66 | ContextCompat.getDrawable(
67 | this,
68 | R.drawable.ic_not_favorite_white
69 | )
70 | )
71 | }
72 | }
73 |
74 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/detail/DetailAnimeViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.detail
2 |
3 | import androidx.lifecycle.ViewModel
4 | import com.masscode.animesuta.core.domain.model.Anime
5 | import com.masscode.animesuta.core.domain.usecase.AnimeUseCase
6 |
7 | class DetailAnimeViewModel(private val animeUseCase: AnimeUseCase) : ViewModel() {
8 |
9 | fun setFavoriteAnime(anime: Anime, newStatus: Boolean) =
10 | animeUseCase.setFavoriteAnime(anime, newStatus)
11 |
12 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/di/AppModule.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.di
2 |
3 | import com.masscode.animesuta.core.domain.usecase.AnimeInteractor
4 | import com.masscode.animesuta.core.domain.usecase.AnimeUseCase
5 | import com.masscode.animesuta.detail.DetailAnimeViewModel
6 | import com.masscode.animesuta.home.HomeViewModel
7 | import org.koin.android.viewmodel.dsl.viewModel
8 | import org.koin.dsl.module
9 |
10 | val useCaseModule = module {
11 | factory { AnimeInteractor(get()) }
12 | }
13 |
14 | val viewModelModule = module {
15 | viewModel { HomeViewModel(get()) }
16 | viewModel { DetailAnimeViewModel(get()) }
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/home/HomeFragment.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.home
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.navigation.fragment.findNavController
9 | import androidx.recyclerview.widget.GridLayoutManager
10 | import com.masscode.animesuta.R
11 | import com.masscode.animesuta.core.data.Resource
12 | import com.masscode.animesuta.core.domain.model.Anime
13 | import com.masscode.animesuta.core.ui.AnimeAdapter
14 | import kotlinx.android.synthetic.main.fragment_home.*
15 | import kotlinx.android.synthetic.main.view_error.*
16 | import org.koin.android.viewmodel.ext.android.viewModel
17 | import timber.log.Timber
18 |
19 | class HomeFragment : Fragment() {
20 |
21 | private val homeViewModel: HomeViewModel by viewModel()
22 |
23 | override fun onCreateView(
24 | inflater: LayoutInflater, container: ViewGroup?,
25 | savedInstanceState: Bundle?
26 | ): View? {
27 | // Inflate the layout for this fragment
28 | return inflater.inflate(R.layout.fragment_home, container, false)
29 | }
30 |
31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
32 | super.onViewCreated(view, savedInstanceState)
33 |
34 | if (activity != null) {
35 | val animeAdapter = AnimeAdapter { item -> showDetail(item) }
36 |
37 | homeViewModel.anime.observe(viewLifecycleOwner, { anime ->
38 | if (anime != null) {
39 | when (anime) {
40 | is Resource.Loading -> progress_bar.visibility = View.VISIBLE
41 | is Resource.Success -> {
42 | progress_bar.visibility = View.GONE
43 | animeAdapter.setData(anime.data)
44 | }
45 | is Resource.Error -> {
46 | progress_bar.visibility = View.GONE
47 | view_error.visibility = View.VISIBLE
48 | tv_error.text = anime.message ?: getString(R.string.something_wrong)
49 | }
50 | }
51 | }
52 | })
53 |
54 | with(rv_anime) {
55 | layoutManager = GridLayoutManager(requireContext(), 2)
56 | setHasFixedSize(true)
57 | adapter = animeAdapter
58 | }
59 | }
60 | }
61 |
62 | private fun showDetail(anime: Anime) {
63 | Timber.d("OnClick : ${anime.canonicalTitle}")
64 | this.findNavController()
65 | .navigate(HomeFragmentDirections.actionHomeFragmentToDetailAnimeActivity(anime))
66 | }
67 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/masscode/animesuta/home/HomeViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.home
2 |
3 | import androidx.lifecycle.ViewModel
4 | import androidx.lifecycle.asLiveData
5 | import com.masscode.animesuta.core.domain.usecase.AnimeUseCase
6 |
7 | class HomeViewModel(animeUseCase: AnimeUseCase) : ViewModel() {
8 |
9 | val anime = animeUseCase.getAllAnime().asLiveData()
10 |
11 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_favorite_white.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_not_favorite_white.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_back.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_favorite_black.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_play_arrow.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail_anime.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
18 |
23 |
24 |
30 |
31 |
38 |
39 |
46 |
47 |
52 |
53 |
61 |
62 |
63 |
64 |
65 |
69 |
70 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_detail_anime.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
18 |
23 |
24 |
28 |
29 |
40 |
41 |
56 |
57 |
70 |
71 |
85 |
86 |
97 |
98 |
110 |
111 |
125 |
126 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
26 |
27 |
30 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_list_placeholder.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
21 |
22 |
32 |
33 |
42 |
43 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
71 |
72 |
75 |
76 |
86 |
87 |
96 |
97 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/drawer_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/navigation/nav_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
16 |
17 |
23 |
26 |
27 |
32 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Animesutā
3 |
4 | Home
5 | Favorite
6 | Oops.. something went wrong
7 | Empty data
8 |
9 | Image
10 | Sample of title text
11 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae eaque iste nobis non quasi ratione veritatis. Accusantium assumenda, cum delectus deserunt dignissimos doloribus ea error esse et ex explicabo fuga ipsa ipsum omnis optio perferendis provident quaerat quam sequi unde? At deleniti dignissimos exercitationem iure officiis perspiciatis rerum tenetur, vitae?
12 | Watch Trailer
13 | Favorite
14 | アニメスター
15 | Details
16 | Synopsis
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/test/java/com/masscode/animesuta/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = "1.4.10"
4 | ext.appcompat_version = "1.2.0"
5 | ext.core_ktx_version = "1.3.1"
6 | ext.constraint_version = "2.0.1"
7 | ext.legacy_support_version = "1.0.0"
8 | ext.junit_version = "4.13"
9 | ext.androidx_junit_version = "1.1.2"
10 | ext.espresso_version = "3.3.0"
11 | ext.multidex_version = "2.0.1"
12 |
13 | ext.cardview_version = "1.0.0"
14 | ext.recyclerview_version = "1.1.0"
15 | ext.material_version = "1.3.0-alpha02"
16 | ext.glide_version = "4.11.0"
17 |
18 | ext.room_version = "2.2.5"
19 |
20 | ext.nav_version = "2.3.0"
21 |
22 | ext.retrofit_version = "2.9.0"
23 | ext.logging_interceptor_version = "4.8.0"
24 |
25 | ext.kotlin_coroutines_version = "1.3.6"
26 | ext.kotlin_coroutines_android_version = "1.3.9"
27 | ext.lifecycle_version = "2.2.0"
28 |
29 | ext.koin_version = "2.1.6"
30 |
31 | ext.sqlcipher_version = "4.4.0"
32 | ext.sqlite_version = "2.1.0"
33 |
34 | ext.timber_version = "4.7.1"
35 |
36 | ext.lottie_version = "3.4.2"
37 |
38 | ext.shimmer_version = "0.5.0"
39 |
40 | repositories {
41 | google()
42 | jcenter()
43 | }
44 | dependencies {
45 | classpath "com.android.tools.build:gradle:4.0.1"
46 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
47 |
48 | // NOTE: Do not place your application dependencies here; they belong
49 | // in the individual module build.gradle files
50 | def nav_version = "2.3.0"
51 | classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
52 | }
53 | }
54 |
55 | allprojects {
56 | repositories {
57 | google()
58 | jcenter()
59 | }
60 | }
61 |
62 | task clean(type: Delete) {
63 | delete rootProject.buildDir
64 | }
--------------------------------------------------------------------------------
/core/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/core/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: "kotlin-kapt"
5 | apply from: '../shared_dependencies.gradle'
6 |
7 | android {
8 | compileSdkVersion 30
9 | buildToolsVersion "30.0.2"
10 |
11 | defaultConfig {
12 | minSdkVersion 16
13 | targetSdkVersion 30
14 | versionCode 1
15 | versionName "1.0"
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | consumerProguardFiles "consumer-rules.pro"
19 | }
20 |
21 | buildTypes {
22 | release {
23 | minifyEnabled true
24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25 | }
26 | debug {
27 | minifyEnabled true
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 |
32 | dataBinding {
33 | enabled = true
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation fileTree(dir: "libs", include: ["*.jar"])
39 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
40 |
41 | implementation "androidx.room:room-runtime:$room_version"
42 | kapt "androidx.room:room-compiler:$room_version"
43 | androidTestImplementation "androidx.room:room-testing:$room_version"
44 | implementation "androidx.room:room-ktx:$room_version"
45 |
46 | // retrofit
47 | implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
48 | implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
49 | implementation "com.squareup.okhttp3:logging-interceptor:$logging_interceptor_version"
50 |
51 | // coroutine flow
52 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
53 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_android_version"
54 | api "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
55 |
56 | // database encryption
57 | implementation "net.zetetic:android-database-sqlcipher:$sqlcipher_version"
58 | implementation "androidx.sqlite:sqlite:$sqlite_version"
59 | }
--------------------------------------------------------------------------------
/core/consumer-rules.pro:
--------------------------------------------------------------------------------
1 | ##---------------Begin: proguard configuration for SQLCipher ----------
2 | -keep,includedescriptorclasses class net.sqlcipher.** { *; }
3 | -keep,includedescriptorclasses interface net.sqlcipher.** { *; }
4 |
5 |
6 | ##---------------Begin: proguard configuration for Gson ----------
7 | # Gson uses generic type information stored in a class file when working with fields. Proguard
8 | # removes such information by default, so configure it to keep all of it.
9 | -keepattributes Signature
10 |
11 | # For using GSON @Expose annotation
12 | -keepattributes *Annotation*
13 |
14 | # Gson specific classes
15 | -dontwarn sun.misc.**
16 | #-keep class com.google.gson.stream.** { *; }
17 |
18 | # Application classes that will be serialized/deserialized over Gson
19 | -keep class com.google.gson.examples.android.model.** { ; }
20 |
21 | # Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
22 | # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
23 | -keep class * extends com.google.gson.TypeAdapter
24 | -keep class * implements com.google.gson.TypeAdapterFactory
25 | -keep class * implements com.google.gson.JsonSerializer
26 | -keep class * implements com.google.gson.JsonDeserializer
27 |
28 | # Prevent R8 from leaving Data object members always null
29 | -keepclassmembers,allowobfuscation class * {
30 | @com.google.gson.annotations.SerializedName ;
31 | }
32 |
33 |
34 | ##---------------Begin: proguard configuration for Retrofit ----------
35 | # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
36 | # EnclosingMethod is required to use InnerClasses.
37 | -keepattributes Signature, InnerClasses, EnclosingMethod
38 |
39 | # Retrofit does reflection on method and parameter annotations.
40 | -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
41 |
42 | # Retain service method parameters when optimizing.
43 | -keepclassmembers,allowshrinking,allowobfuscation interface * {
44 | @retrofit2.http.* ;
45 | }
46 |
47 | # Ignore annotation used for build tooling.
48 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
49 |
50 | # Ignore JSR 305 annotations for embedding nullability information.
51 | -dontwarn javax.annotation.**
52 |
53 | # Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
54 | -dontwarn kotlin.Unit
55 |
56 | # Top-level functions that can only be used by Kotlin.
57 | -dontwarn retrofit2.KotlinExtensions
58 | -dontwarn retrofit2.KotlinExtensions$*
59 |
60 | # With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
61 | # and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
62 | -if interface * { @retrofit2.http.* ; }
63 | -keep,allowobfuscation interface <1>
64 |
65 | -dontwarn kotlinx.**
66 |
67 |
68 | ##---------------Begin: proguard configuration for Glide ----------
69 | -keep public class * implements com.bumptech.glide.module.GlideModule
70 | -keep class * extends com.bumptech.glide.module.AppGlideModule {
71 | (...);
72 | }
73 | -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
74 | **[] $VALUES;
75 | public *;
76 | }
77 | -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
78 | *** rewind();
79 | }
80 |
81 | # Uncomment for DexGuard only
82 | #-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
83 |
84 |
85 | ##---------------Begin: proguard configuration for RxJava ----------
86 | # Uncomment if you use RxJava
87 | #-dontwarn java.util.concurrent.Flow*
88 |
89 | ##---------------Begin: proguard configuration for fragment and pass data (Navigation Component) ----------
90 | -keep class * extends androidx.fragment.app.Fragment{}
91 | -keepnames class * extends android.os.Parcelable
92 | -keepnames class * extends java.io.Serializable
--------------------------------------------------------------------------------
/core/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/core/src/androidTest/java/com/masscode/animesuta/core/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.masscode.animesuta.core.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/core/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/binding/BindingAdapters.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.binding
2 |
3 | import android.widget.ImageView
4 | import androidx.databinding.BindingAdapter
5 | import com.bumptech.glide.Glide
6 |
7 | @BindingAdapter("app:showImage")
8 | fun showImage(imgView: ImageView, url: String?) {
9 | Glide.with(imgView.context).load(url).into(imgView)
10 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/AnimeRepository.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data
2 |
3 | import com.masscode.animesuta.core.data.source.local.LocalDataSource
4 | import com.masscode.animesuta.core.data.source.remote.RemoteDataSource
5 | import com.masscode.animesuta.core.data.source.remote.network.ApiResponse
6 | import com.masscode.animesuta.core.data.source.remote.response.AnimeResponse
7 | import com.masscode.animesuta.core.domain.model.Anime
8 | import com.masscode.animesuta.core.domain.repository.IAnimeRepository
9 | import com.masscode.animesuta.core.utils.AppExecutors
10 | import com.masscode.animesuta.core.utils.DataMapper
11 | import kotlinx.coroutines.flow.Flow
12 | import kotlinx.coroutines.flow.map
13 |
14 | class AnimeRepository(
15 | private val remoteDataSource: RemoteDataSource,
16 | private val localDataSource: LocalDataSource,
17 | private val appExecutors: AppExecutors
18 | ) : IAnimeRepository {
19 |
20 | override fun getAllAnime(): Flow>> =
21 | object : NetworkBoundResource, List>() {
22 | override fun loadFromDB(): Flow> {
23 | return localDataSource.getAllAnime().map { DataMapper.mapEntitiesToDomain(it) }
24 | }
25 |
26 | override fun shouldFetch(data: List?): Boolean {
27 | return true// data == null || data.isEmpty()
28 | }
29 |
30 | override suspend fun createCall(): Flow>> {
31 | return remoteDataSource.getAllAnime()
32 | }
33 |
34 | override suspend fun saveCallResult(data: List) {
35 | val animeList = DataMapper.mapResponsesToEntities(data)
36 | localDataSource.insertAnime(animeList)
37 | }
38 | }.asFlow()
39 |
40 | override fun getFavoriteAnime(): Flow> {
41 | return localDataSource.getFavoriteAnime().map { DataMapper.mapEntitiesToDomain(it) }
42 | }
43 |
44 | override fun setFavoriteAnime(anime: Anime, state: Boolean) {
45 | val animeEntity = DataMapper.mapDomainToEntity(anime)
46 | appExecutors.diskIO().execute {
47 | localDataSource.setFavoriteAnime(animeEntity, state)
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/NetworkBoundResource.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data
2 |
3 | import com.masscode.animesuta.core.data.source.remote.network.ApiResponse
4 | import kotlinx.coroutines.flow.*
5 |
6 | abstract class NetworkBoundResource {
7 |
8 | private var result: Flow> = flow {
9 | emit(Resource.Loading())
10 | val dbSource = loadFromDB().first()
11 | if (shouldFetch(dbSource)) {
12 | emit(Resource.Loading())
13 | when (val apiResponse = createCall().first()) {
14 | is ApiResponse.Success -> {
15 | saveCallResult(apiResponse.data)
16 | emitAll(loadFromDB().map { Resource.Success(it) })
17 | }
18 | is ApiResponse.Empty -> {
19 | emitAll(loadFromDB().map { Resource.Success(it) })
20 | }
21 | is ApiResponse.Error -> {
22 | onFetchFailed()
23 | emit(Resource.Error(apiResponse.errorMessage, null))
24 | }
25 | }
26 | } else {
27 | emitAll(loadFromDB().map { Resource.Success(it) })
28 | }
29 | }
30 |
31 | protected open fun onFetchFailed() {}
32 |
33 | protected abstract fun loadFromDB(): Flow
34 |
35 | protected abstract fun shouldFetch(data: ResultType?): Boolean
36 |
37 | protected abstract suspend fun createCall(): Flow>
38 |
39 | protected abstract suspend fun saveCallResult(data: RequestType)
40 |
41 | fun asFlow(): Flow> = result
42 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/Resource.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data
2 |
3 | sealed class Resource(val data: T? = null, val message: String? = null) {
4 | class Success(data: T) : Resource(data)
5 | class Loading(data: T? = null) : Resource(data)
6 | class Error(message: String, data: T? = null) : Resource(data, message)
7 | }
8 |
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/local/LocalDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.local
2 |
3 | import com.masscode.animesuta.core.data.source.local.entity.AnimeEntity
4 | import com.masscode.animesuta.core.data.source.local.room.AnimeDao
5 | import kotlinx.coroutines.flow.Flow
6 |
7 | class LocalDataSource(private val animeDao: AnimeDao) {
8 |
9 | fun getAllAnime(): Flow> = animeDao.getAllAnime()
10 |
11 | fun getFavoriteAnime(): Flow> = animeDao.getFavoriteAnime()
12 |
13 | suspend fun insertAnime(animeList: List) = animeDao.insertAnime(animeList)
14 |
15 | fun setFavoriteAnime(anime: AnimeEntity, newState: Boolean) {
16 | anime.isFavorite = newState
17 | animeDao.updateFavoriteAnime(anime)
18 | }
19 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/local/entity/AnimeEntity.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.local.entity
2 |
3 | import android.os.Parcelable
4 | import androidx.room.ColumnInfo
5 | import androidx.room.Entity
6 | import androidx.room.PrimaryKey
7 | import kotlinx.android.parcel.Parcelize
8 | import org.jetbrains.annotations.NotNull
9 |
10 | @Parcelize
11 | @Entity(tableName = "anime")
12 | data class AnimeEntity(
13 | @PrimaryKey
14 | @NotNull
15 | @ColumnInfo(name = "id")
16 | var id: Int,
17 |
18 | @ColumnInfo(name = "title")
19 | var canonicalTitle: String,
20 |
21 | @ColumnInfo(name = "startDate")
22 | var startDate: String,
23 |
24 | @ColumnInfo(name = "rating")
25 | var averageRating: Double,
26 |
27 | @ColumnInfo(name = "synopsis")
28 | var synopsis: String,
29 |
30 | @ColumnInfo(name = "posterImage")
31 | var posterImage: String,
32 |
33 | @ColumnInfo(name = "coverImage")
34 | var coverImage: String,
35 |
36 | @ColumnInfo(name = "youtubeVideoId")
37 | var youtubeVideoId: String,
38 |
39 | @ColumnInfo(name = "isFavorite")
40 | var isFavorite: Boolean = false
41 | ) : Parcelable
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/local/room/AnimeDao.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.local.room
2 |
3 | import androidx.room.*
4 | import com.masscode.animesuta.core.data.source.local.entity.AnimeEntity
5 | import kotlinx.coroutines.flow.Flow
6 |
7 | @Dao
8 | interface AnimeDao {
9 |
10 | @Query("SELECT * FROM anime")
11 | fun getAllAnime(): Flow>
12 |
13 | @Query("SELECT * FROM anime where isFavorite = 1")
14 | fun getFavoriteAnime(): Flow>
15 |
16 | @Insert(onConflict = OnConflictStrategy.IGNORE)
17 | suspend fun insertAnime(anime: List)
18 |
19 | @Update
20 | fun updateFavoriteAnime(anime: AnimeEntity)
21 |
22 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/local/room/AnimeDatabase.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.local.room
2 |
3 | import androidx.room.Database
4 | import androidx.room.RoomDatabase
5 | import com.masscode.animesuta.core.data.source.local.entity.AnimeEntity
6 |
7 | @Database(entities = [AnimeEntity::class], version = 1, exportSchema = false)
8 | abstract class AnimeDatabase : RoomDatabase() {
9 |
10 | abstract fun animeDao(): AnimeDao
11 |
12 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/RemoteDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote
2 |
3 | import com.masscode.animesuta.core.data.source.remote.network.ApiResponse
4 | import com.masscode.animesuta.core.data.source.remote.network.ApiService
5 | import com.masscode.animesuta.core.data.source.remote.response.AnimeResponse
6 | import kotlinx.coroutines.Dispatchers
7 | import kotlinx.coroutines.flow.Flow
8 | import kotlinx.coroutines.flow.flow
9 | import kotlinx.coroutines.flow.flowOn
10 | import timber.log.Timber
11 |
12 | class RemoteDataSource(private val apiService: ApiService) {
13 |
14 | fun getAllAnime(): Flow>> {
15 | return flow {
16 | try {
17 | val response = apiService.getAnimeList()
18 | val dataArray = response.animeList
19 | if (dataArray.isNotEmpty()) {
20 | emit(ApiResponse.Success(response.animeList))
21 | } else {
22 | emit(ApiResponse.Empty)
23 | }
24 | } catch (e: Exception) {
25 | emit(ApiResponse.Error(e.toString()))
26 | Timber.e(e.toString())
27 | }
28 | }.flowOn(Dispatchers.IO)
29 | }
30 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/network/ApiResponse.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.network
2 |
3 | sealed class ApiResponse {
4 | data class Success(val data: T) : ApiResponse()
5 | data class Error(val errorMessage: String) : ApiResponse()
6 | object Empty : ApiResponse()
7 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/network/ApiService.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.network
2 |
3 | import com.masscode.animesuta.core.data.source.remote.response.ListAnimeResponse
4 | import retrofit2.http.GET
5 |
6 | interface ApiService {
7 | @GET("trending/anime")
8 | suspend fun getAnimeList(): ListAnimeResponse
9 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/response/AnimeResponse.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class AnimeResponse(
6 | @SerializedName("id")
7 | val id : Int,
8 | @SerializedName("attributes")
9 | val attributes : Attributes
10 | )
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/response/Attributes.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class Attributes(
6 | @SerializedName("canonicalTitle")
7 | val canonicalTitle : String,
8 |
9 | @SerializedName("startDate")
10 | val startDate : String,
11 |
12 | @SerializedName("averageRating")
13 | val averageRating : Double,
14 |
15 | @SerializedName("synopsis")
16 | val synopsis : String,
17 |
18 | @SerializedName("posterImage")
19 | val posterImage : PosterImage,
20 |
21 | @SerializedName("coverImage")
22 | val coverImage : CoverImage,
23 |
24 | @SerializedName("youtubeVideoId")
25 | val youtubeVideoId : String
26 | )
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/response/CoverImage.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class CoverImage(
6 | @SerializedName("small")
7 | val small : String,
8 | @SerializedName("large")
9 | val large : String
10 | )
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/response/ListAnimeResponse.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class ListAnimeResponse(
6 | @SerializedName("data") val animeList: List
7 | )
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/data/source/remote/response/PosterImage.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.data.source.remote.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class PosterImage(
6 | @SerializedName("medium")
7 | val medium : String,
8 | @SerializedName("large")
9 | val large : String
10 | )
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/di/CoreModule.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.di
2 |
3 | import androidx.room.Room
4 | import com.masscode.animesuta.core.data.AnimeRepository
5 | import com.masscode.animesuta.core.data.source.local.LocalDataSource
6 | import com.masscode.animesuta.core.data.source.local.room.AnimeDatabase
7 | import com.masscode.animesuta.core.data.source.remote.RemoteDataSource
8 | import com.masscode.animesuta.core.data.source.remote.network.ApiService
9 | import com.masscode.animesuta.core.domain.repository.IAnimeRepository
10 | import com.masscode.animesuta.core.utils.AppExecutors
11 | import net.sqlcipher.database.SQLiteDatabase
12 | import net.sqlcipher.database.SupportFactory
13 | import okhttp3.CertificatePinner
14 | import okhttp3.OkHttpClient
15 | import okhttp3.logging.HttpLoggingInterceptor
16 | import org.koin.android.ext.koin.androidContext
17 | import org.koin.dsl.module
18 | import retrofit2.Retrofit
19 | import retrofit2.converter.gson.GsonConverterFactory
20 | import java.util.concurrent.TimeUnit
21 |
22 | val databaseModule = module {
23 | factory { get().animeDao() }
24 | single {
25 | val passphrase: ByteArray = SQLiteDatabase.getBytes("masscode".toCharArray())
26 | val factory = SupportFactory(passphrase)
27 |
28 | Room.databaseBuilder(
29 | androidContext(),
30 | AnimeDatabase::class.java, "Anime.db"
31 | ).fallbackToDestructiveMigration()
32 | .openHelperFactory(factory)
33 | .build()
34 | }
35 | }
36 |
37 | val networkModule = module {
38 | single {
39 | val hostname = "kitsu.io"
40 | val certificatePinner = CertificatePinner.Builder()
41 | .add(hostname, "sha256/mRjXIIcEJSE3kJl4YNqqfOS+COj4KG3VJPSJo6ymApk=")
42 | .add(hostname, "sha256/FEzVOUp4dF3gI0ZVPRJhFbSJVXR+uQmMH65xhs1glH4=")
43 | .add(hostname, "sha256/Y9mvm0exBk1JoQ57f9Vm28jKo5lFm/woKcVxrYxu80o=")
44 | .build()
45 | OkHttpClient.Builder()
46 | .addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
47 | .connectTimeout(120, TimeUnit.SECONDS)
48 | .readTimeout(120, TimeUnit.SECONDS)
49 | .certificatePinner(certificatePinner)
50 | .build()
51 | }
52 | single {
53 | val retrofit = Retrofit.Builder()
54 | .baseUrl("https://kitsu.io/api/edge/")
55 | .addConverterFactory(GsonConverterFactory.create())
56 | .client(get())
57 | .build()
58 | retrofit.create(ApiService::class.java)
59 | }
60 | }
61 |
62 | val repositoryModule = module {
63 | single { LocalDataSource(get()) }
64 | single { RemoteDataSource(get()) }
65 | factory { AppExecutors() }
66 | single {
67 | AnimeRepository(
68 | get(),
69 | get(),
70 | get()
71 | )
72 | }
73 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/domain/model/Anime.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.domain.model
2 |
3 | import android.os.Parcelable
4 | import kotlinx.android.parcel.Parcelize
5 |
6 | @Parcelize
7 | data class Anime(
8 | var id: Int,
9 | var canonicalTitle: String,
10 | var startDate: String,
11 | var averageRating: Double,
12 | var synopsis: String,
13 | var posterImage: String,
14 | var coverImage: String,
15 | var youtubeVideoId: String,
16 | var isFavorite: Boolean = false
17 | ) : Parcelable
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/domain/repository/IAnimeRepository.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.domain.repository
2 |
3 | import com.masscode.animesuta.core.data.Resource
4 | import com.masscode.animesuta.core.domain.model.Anime
5 | import kotlinx.coroutines.flow.Flow
6 |
7 | interface IAnimeRepository {
8 |
9 | fun getAllAnime(): Flow>>
10 |
11 | fun getFavoriteAnime(): Flow>
12 |
13 | fun setFavoriteAnime(anime: Anime, state: Boolean)
14 |
15 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/domain/usecase/AnimeInteractor.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.domain.usecase
2 |
3 | import com.masscode.animesuta.core.data.Resource
4 | import com.masscode.animesuta.core.domain.model.Anime
5 | import com.masscode.animesuta.core.domain.repository.IAnimeRepository
6 | import kotlinx.coroutines.flow.Flow
7 |
8 | class AnimeInteractor(private val animeRepository: IAnimeRepository): AnimeUseCase {
9 | override fun getAllAnime(): Flow>> {
10 | return animeRepository.getAllAnime()
11 | }
12 |
13 | override fun getFavoriteAnime(): Flow> {
14 | return animeRepository.getFavoriteAnime()
15 | }
16 |
17 | override fun setFavoriteAnime(anime: Anime, state: Boolean) {
18 | return animeRepository.setFavoriteAnime(anime, state)
19 | }
20 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/domain/usecase/AnimeUseCase.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.domain.usecase
2 |
3 | import com.masscode.animesuta.core.data.Resource
4 | import com.masscode.animesuta.core.domain.model.Anime
5 | import kotlinx.coroutines.flow.Flow
6 |
7 | interface AnimeUseCase {
8 | fun getAllAnime(): Flow>>
9 | fun getFavoriteAnime(): Flow>
10 | fun setFavoriteAnime(anime: Anime, state: Boolean)
11 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/ui/AnimeAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.ui
2 |
3 | import android.view.LayoutInflater
4 | import android.view.ViewGroup
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.masscode.animesuta.core.databinding.ItemListAnimeBinding
7 | import com.masscode.animesuta.core.domain.model.Anime
8 |
9 | class AnimeAdapter(private val showDetail: (Anime) -> Unit) :
10 | RecyclerView.Adapter() {
11 |
12 | private var listData = ArrayList()
13 |
14 | fun setData(newListData: List?) {
15 | if (newListData == null) return
16 | listData.clear()
17 | listData.addAll(newListData)
18 | notifyDataSetChanged()
19 | }
20 |
21 | override fun onCreateViewHolder(
22 | parent: ViewGroup,
23 | viewType: Int
24 | ): AnimeAdapter.AnimeViewHolder {
25 | return AnimeViewHolder(
26 | ItemListAnimeBinding.inflate(
27 | LayoutInflater.from(parent.context),
28 | parent,
29 | false
30 | )
31 | )
32 | }
33 |
34 | override fun onBindViewHolder(holder: AnimeAdapter.AnimeViewHolder, position: Int) {
35 | val item = listData[position]
36 | holder.bind(item)
37 | }
38 |
39 | override fun getItemCount(): Int = listData.size
40 |
41 | inner class AnimeViewHolder(private var binding: ItemListAnimeBinding) :
42 | RecyclerView.ViewHolder(binding.root) {
43 | fun bind(anime: Anime?) {
44 | binding.anime = anime
45 |
46 | with(binding.root) {
47 | setOnClickListener { showDetail(anime!!) }
48 | }
49 |
50 | binding.executePendingBindings()
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/utils/AppExecutors.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.utils
2 |
3 | import androidx.annotation.VisibleForTesting
4 | import java.util.concurrent.Executor
5 | import java.util.concurrent.Executors
6 |
7 | class AppExecutors @VisibleForTesting constructor(
8 | private val diskIO: Executor
9 | ) {
10 |
11 | constructor() : this(
12 | Executors.newSingleThreadExecutor()
13 | )
14 |
15 | fun diskIO(): Executor = diskIO
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/core/src/main/java/com/masscode/animesuta/core/utils/DataMapper.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core.utils
2 |
3 | import com.masscode.animesuta.core.data.source.local.entity.AnimeEntity
4 | import com.masscode.animesuta.core.data.source.remote.response.AnimeResponse
5 | import com.masscode.animesuta.core.domain.model.Anime
6 |
7 | object DataMapper {
8 |
9 | fun mapResponsesToEntities(input: List): List {
10 | val animeList = ArrayList()
11 | input.map {
12 | val anime = AnimeEntity(
13 | id = it.id,
14 | canonicalTitle = it.attributes.canonicalTitle,
15 | startDate = it.attributes.startDate,
16 | averageRating = it.attributes.averageRating,
17 | synopsis = it.attributes.synopsis,
18 | posterImage = it.attributes.posterImage.medium,
19 | coverImage = it.attributes.coverImage.large,
20 | youtubeVideoId = it.attributes.youtubeVideoId,
21 | isFavorite = false
22 | )
23 | animeList.add(anime)
24 | }
25 | return animeList
26 | }
27 |
28 | fun mapEntitiesToDomain(input: List): List =
29 | input.map {
30 | Anime(
31 | id = it.id,
32 | canonicalTitle = it.canonicalTitle,
33 | startDate = it.startDate,
34 | averageRating = it.averageRating,
35 | synopsis = it.synopsis,
36 | posterImage = it.posterImage,
37 | coverImage = it.coverImage,
38 | youtubeVideoId = it.youtubeVideoId,
39 | isFavorite = it.isFavorite
40 | )
41 | }
42 |
43 | fun mapDomainToEntity(input: Anime) = AnimeEntity(
44 | id = input.id,
45 | canonicalTitle = input.canonicalTitle,
46 | startDate = input.startDate,
47 | averageRating = input.averageRating,
48 | synopsis = input.synopsis,
49 | posterImage = input.posterImage,
50 | coverImage = input.coverImage,
51 | youtubeVideoId = input.youtubeVideoId,
52 | isFavorite = input.isFavorite
53 | )
54 | }
--------------------------------------------------------------------------------
/core/src/main/res/layout/item_list_anime.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
20 |
21 |
24 |
25 |
36 |
37 |
46 |
47 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/core/src/main/res/values/string.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Image
4 | Sample of title text
5 |
--------------------------------------------------------------------------------
/core/src/test/java/com/masscode/animesuta/core/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.core
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/favorite/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/favorite/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.dynamic-feature"
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: "kotlin-kapt"
5 | apply from: '../shared_dependencies.gradle'
6 |
7 | android {
8 | compileSdkVersion 30
9 | buildToolsVersion "30.0.2"
10 |
11 | defaultConfig {
12 | minSdkVersion 16
13 | targetSdkVersion 30
14 | versionCode 1
15 | versionName "1.0"
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 |
20 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_8
22 | targetCompatibility JavaVersion.VERSION_1_8
23 | }
24 |
25 | kotlinOptions {
26 | jvmTarget = "1.8"
27 | }
28 |
29 | }
30 |
31 | dependencies {
32 | implementation project(":core")
33 | implementation fileTree(dir: "libs", include: ["*.jar"])
34 | implementation project(":app")
35 | implementation 'androidx.core:core-ktx:1.3.1'
36 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
37 | }
--------------------------------------------------------------------------------
/favorite/src/androidTest/java/com/masscode/animesuta/favorite/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.favorite
2 |
3 | import androidx.test.ext.junit.runners.AndroidJUnit4
4 | import org.junit.Test
5 | import org.junit.runner.RunWith
6 |
7 | /**
8 | * Instrumented test, which will execute on an Android device.
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | @RunWith(AndroidJUnit4::class)
13 | class ExampleInstrumentedTest {
14 | @Test
15 | fun useAppContext() {
16 | }
17 | }
--------------------------------------------------------------------------------
/favorite/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/favorite/src/main/java/com/masscode/animesuta/favorite/FavoriteFragment.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.favorite
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.navigation.fragment.findNavController
9 | import androidx.recyclerview.widget.GridLayoutManager
10 | import com.masscode.animesuta.core.domain.model.Anime
11 | import com.masscode.animesuta.core.ui.AnimeAdapter
12 | import kotlinx.android.synthetic.main.fragment_favorite.*
13 | import org.koin.android.viewmodel.ext.android.viewModel
14 | import org.koin.core.context.loadKoinModules
15 | import timber.log.Timber
16 |
17 | class FavoriteFragment : Fragment() {
18 |
19 | private val favoriteViewModel: FavoriteViewModel by viewModel()
20 |
21 | override fun onCreateView(
22 | inflater: LayoutInflater, container: ViewGroup?,
23 | savedInstanceState: Bundle?
24 | ): View? {
25 | // Inflate the layout for this fragment
26 | val view = inflater.inflate(R.layout.fragment_favorite, container, false)
27 | loadKoinModules(favoriteModule)
28 |
29 | return view
30 | }
31 |
32 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
33 | super.onViewCreated(view, savedInstanceState)
34 |
35 | if (activity != null) {
36 | val animeAdapter = AnimeAdapter { item -> showDetail(item) }
37 |
38 | favoriteViewModel.favoriteAnime.observe(viewLifecycleOwner, { anime ->
39 | animeAdapter.setData(anime)
40 | view_empty.visibility = if (anime.isNotEmpty()) View.GONE else View.VISIBLE
41 | })
42 |
43 | with(rv_anime) {
44 | layoutManager = GridLayoutManager(requireContext(), 2)
45 | setHasFixedSize(true)
46 | adapter = animeAdapter
47 | }
48 | }
49 | }
50 |
51 | private fun showDetail(anime: Anime) {
52 | Timber.d("OnClick : ${anime.canonicalTitle}")
53 | findNavController().navigate(
54 | FavoriteFragmentDirections.actionFavoriteFragmentToDetailAnimeActivity(
55 | anime
56 | )
57 | )
58 | }
59 | }
--------------------------------------------------------------------------------
/favorite/src/main/java/com/masscode/animesuta/favorite/FavoriteModule.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.favorite
2 |
3 | import org.koin.android.viewmodel.dsl.viewModel
4 | import org.koin.dsl.module
5 |
6 | val favoriteModule = module {
7 | viewModel { FavoriteViewModel(get()) }
8 | }
--------------------------------------------------------------------------------
/favorite/src/main/java/com/masscode/animesuta/favorite/FavoriteViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.favorite
2 |
3 | import androidx.lifecycle.ViewModel
4 | import androidx.lifecycle.asLiveData
5 | import com.masscode.animesuta.core.domain.usecase.AnimeUseCase
6 |
7 | class FavoriteViewModel(animeUseCase: AnimeUseCase) : ViewModel() {
8 |
9 | val favoriteAnime = animeUseCase.getFavoriteAnime().asLiveData()
10 |
11 | }
--------------------------------------------------------------------------------
/favorite/src/main/res/layout/fragment_favorite.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/favorite/src/test/java/com/masscode/animesuta/favorite/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.masscode.animesuta.favorite
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Sep 24 19:20:43 ICT 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/images/android representation.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/images/android representation.jpeg
--------------------------------------------------------------------------------
/images/app module.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/images/app module.PNG
--------------------------------------------------------------------------------
/images/clean arch layer.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/images/clean arch layer.jpeg
--------------------------------------------------------------------------------
/images/core module.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/images/core module.PNG
--------------------------------------------------------------------------------
/images/favorite module.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agustiyann/Android-Clean-Architecture/0a51677ddcd69eb9f8c2f9c8da62518c894d06ce/images/favorite module.PNG
--------------------------------------------------------------------------------
/images/test.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':favorite'
2 | include ':core'
3 | include ':app'
4 | rootProject.name = "Animesuta"
--------------------------------------------------------------------------------
/shared_dependencies.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation "androidx.appcompat:appcompat:$appcompat_version"
3 | implementation "androidx.core:core-ktx:$core_ktx_version"
4 | implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
5 | implementation "androidx.legacy:legacy-support-v4:$legacy_support_version"
6 | testImplementation "junit:junit:$junit_version"
7 | androidTestImplementation "androidx.test.ext:junit:$androidx_junit_version"
8 | androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
9 | implementation "androidx.multidex:multidex:$multidex_version"
10 |
11 | implementation "androidx.cardview:cardview:$cardview_version"
12 | implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
13 | implementation "com.google.android.material:material:$material_version"
14 | implementation "com.github.bumptech.glide:glide:$glide_version"
15 |
16 | //koin
17 | implementation "org.koin:koin-core:$koin_version"
18 | implementation "org.koin:koin-android:$koin_version"
19 | implementation "org.koin:koin-android-viewmodel:$koin_version"
20 |
21 | // timber
22 | implementation "com.jakewharton.timber:timber:$timber_version"
23 |
24 | // Lottie
25 | implementation "com.airbnb.android:lottie:$lottie_version"
26 |
27 | // shimmer
28 | implementation "com.facebook.shimmer:shimmer:$shimmer_version"
29 | }
--------------------------------------------------------------------------------