├── README.md
├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── themes.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ ├── drawable
│ │ │ │ ├── shape_circle_white.xml
│ │ │ │ ├── shape_corner_all_24.xml
│ │ │ │ ├── shape_corner_all_59.xml
│ │ │ │ ├── shape_corner_all_6.xml
│ │ │ │ ├── shape_corner_all_white_6.xml
│ │ │ │ ├── shape_corner_all_white_24.xml
│ │ │ │ ├── ic_home_blue_24.xml
│ │ │ │ ├── ic_home_gray_24.xml
│ │ │ │ ├── ic_arrow_up_24.xml
│ │ │ │ ├── ic_filter_on_24.xml
│ │ │ │ ├── ic_arrow_back_24.xml
│ │ │ │ ├── ic_arrow_down_blue_24.xml
│ │ │ │ ├── ic_filter_off_24.xml
│ │ │ │ ├── ic_wifi_24.xml
│ │ │ │ ├── ic_search_black.xml
│ │ │ │ ├── ic_star_yellow_16.xml
│ │ │ │ ├── ic_dinner_dining_24.xml
│ │ │ │ ├── ic_smoking_rooms_24.xml
│ │ │ │ ├── ic_smoke_free_24.xml
│ │ │ │ ├── ic_bathtub_24.xml
│ │ │ │ ├── ic_heart_pink_filled_24.xml
│ │ │ │ ├── ic_heart_gray_outline_24.xml
│ │ │ │ ├── ic_launcher_foreground.xml
│ │ │ │ ├── ic_pool_24.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── xml
│ │ │ │ ├── backup_rules.xml
│ │ │ │ └── data_extraction_rules.xml
│ │ │ └── layout
│ │ │ │ ├── activity_detail_catalog_content_facility_holder.xml
│ │ │ │ ├── activity_detail_catalog.xml
│ │ │ │ ├── activity_detail_catalog_content_facility_item.xml
│ │ │ │ ├── activity_main_category_holder.xml
│ │ │ │ ├── activity_main_category_popular_item.xml
│ │ │ │ ├── activity_main_category_recommend_item.xml
│ │ │ │ ├── activity_detail_catalog_content_item.xml
│ │ │ │ ├── activity_favorite.xml
│ │ │ │ └── activity_home.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── dizcoding
│ │ │ │ └── aspen
│ │ │ │ ├── main
│ │ │ │ ├── view
│ │ │ │ │ ├── detail
│ │ │ │ │ │ ├── content
│ │ │ │ │ │ │ ├── facility
│ │ │ │ │ │ │ │ ├── Facility.kt
│ │ │ │ │ │ │ │ ├── FacilityHolder.kt
│ │ │ │ │ │ │ │ ├── FacilityAdapter.kt
│ │ │ │ │ │ │ │ └── FacilityHolderAdapter.kt
│ │ │ │ │ │ │ └── detail
│ │ │ │ │ │ │ │ ├── Detail.kt
│ │ │ │ │ │ │ │ └── DetailAdapter.kt
│ │ │ │ │ │ ├── DetailCatalogActivity.kt
│ │ │ │ │ │ └── DetailCatalogActivityViewModel.kt
│ │ │ │ │ ├── home
│ │ │ │ │ │ ├── content
│ │ │ │ │ │ │ ├── popular
│ │ │ │ │ │ │ │ ├── MainPopularHolder.kt
│ │ │ │ │ │ │ │ ├── mainPopularHolderAdapter.kt
│ │ │ │ │ │ │ │ └── MainPopularAdapter.kt
│ │ │ │ │ │ │ ├── recommended
│ │ │ │ │ │ │ │ ├── MainRecommendHolder.kt
│ │ │ │ │ │ │ │ ├── mainRecommendHolderAdapter.kt
│ │ │ │ │ │ │ │ └── MainRecommendAdapter.kt
│ │ │ │ │ │ │ └── MainContent.kt
│ │ │ │ │ │ ├── HomeActivity.kt
│ │ │ │ │ │ └── HomeActivityViewModel.kt
│ │ │ │ │ ├── util
│ │ │ │ │ │ ├── FavoriteCatalogHandler.kt
│ │ │ │ │ │ └── FavoriteCatalogHandlerImpl.kt
│ │ │ │ │ ├── ViewModule.kt
│ │ │ │ │ └── favorite
│ │ │ │ │ │ ├── FavoriteActivityViewModel.kt
│ │ │ │ │ │ └── FavoriteActivity.kt
│ │ │ │ ├── utility
│ │ │ │ │ ├── noactionbarpadding
│ │ │ │ │ │ ├── NoActionBarPadding.kt
│ │ │ │ │ │ └── NoActionBarPaddingImpl.kt
│ │ │ │ │ ├── viewbindinginflater
│ │ │ │ │ │ ├── ViewBindingInflater.kt
│ │ │ │ │ │ └── ViewBindingInflaterImpl.kt
│ │ │ │ │ └── extension
│ │ │ │ │ │ ├── TextViewExtension.kt
│ │ │ │ │ │ └── ImageViewExtensions.kt
│ │ │ │ ├── domain
│ │ │ │ │ ├── DomainModule.kt
│ │ │ │ │ └── CatalogRepository.kt
│ │ │ │ └── data
│ │ │ │ │ ├── catalog
│ │ │ │ │ ├── CatalogDetailEntity.kt
│ │ │ │ │ ├── CatalogEntity.kt
│ │ │ │ │ ├── CatalogDao.kt
│ │ │ │ │ └── CatalogRepositoryImpl.kt
│ │ │ │ │ ├── facility
│ │ │ │ │ └── FacilityEntity.kt
│ │ │ │ │ ├── DataModule.kt
│ │ │ │ │ └── Database.kt
│ │ │ │ └── App.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── dizcoding
│ │ │ └── aspen
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── dizcoding
│ │ └── aspen
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle.kts
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── .gitignore
├── settings.gradle.kts
├── gradle.properties
├── gradlew.bat
└── gradlew
/README.md:
--------------------------------------------------------------------------------
1 | # aspen
2 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Aspen
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 24dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gandhi-wibowo/aspen/main/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/facility/Facility.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.facility
2 |
3 | class Facility(
4 | var name : String,
5 | var icon : Int
6 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/facility/FacilityHolder.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.facility
2 |
3 | class FacilityHolder(
4 | var facilities : List
5 | )
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_circle_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/noactionbarpadding/NoActionBarPadding.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.noactionbarpadding
2 |
3 | import android.view.View
4 |
5 | interface NoActionBarPadding {
6 | fun handleNoActionBarPaddingBy(view: View)
7 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_all_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_all_59.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_all_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_all_white_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 05 20:40:16 WIB 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_all_white_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/popular/MainPopularHolder.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.popular
2 |
3 | import com.dizcoding.aspen.main.view.home.content.MainContent
4 |
5 | class MainPopularHolder(
6 | var popularContents: List?
7 | )
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /.idea
4 | /local.properties
5 | /.idea/caches
6 | /.idea/libraries
7 | /.idea/modules.xml
8 | /.idea/workspace.xml
9 | /.idea/navEditor.xml
10 | /.idea/assetWizardSettings.xml
11 | .DS_Store
12 | /build
13 | /captures
14 | .externalNativeBuild
15 | .cxx
16 | local.properties
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/domain/DomainModule.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.domain
2 |
3 | import com.dizcoding.aspen.main.data.catalog.CatalogRepositoryImpl
4 | import org.koin.dsl.module
5 |
6 | val domainModule = module {
7 | single { CatalogRepositoryImpl(get()) }
8 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/recommended/MainRecommendHolder.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.recommended
2 |
3 | import com.dizcoding.aspen.main.view.home.content.MainContent
4 |
5 | class MainRecommendHolder(
6 | var recommendContents: List?
7 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/util/FavoriteCatalogHandler.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.util
2 |
3 | import com.dizcoding.aspen.main.domain.CatalogRepository
4 |
5 | interface FavoriteCatalogHandler {
6 | suspend fun updateFavorite(repo: CatalogRepository, id: Int, isLiked: Boolean)
7 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/MainContent.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content
2 |
3 | class MainContent(
4 | var catalogId: Int,
5 | var catalogName: String,
6 | var catalogImage: String,
7 | var catalogRate: String,
8 | var isCatalogFavorite: Boolean
9 | )
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_blue_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_gray_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_up_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_filter_on_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_back_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_down_blue_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/detail/Detail.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.detail
2 |
3 | class Detail(
4 | var catalogId: Int,
5 | var catalogName: String,
6 | var catalogImage: String,
7 | var catalogIsLoved: Boolean,
8 | var catalogRate: String,
9 | var catalogRatedBy: String,
10 | var catalogShortDescription: String,
11 | var catalogDescription: String
12 | )
--------------------------------------------------------------------------------
/app/src/test/java/com/dizcoding/aspen/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen
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 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/viewbindinginflater/ViewBindingInflater.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.viewbindinginflater
2 |
3 | import android.view.LayoutInflater
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.viewbinding.ViewBinding
6 |
7 | interface ViewBindingInflater {
8 | val binding: VB
9 | fun setViewBindingInflater(activity: AppCompatActivity, layout: (LayoutInflater) -> VB)
10 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/util/FavoriteCatalogHandlerImpl.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.util
2 |
3 | import com.dizcoding.aspen.main.domain.CatalogRepository
4 |
5 | class FavoriteCatalogHandlerImpl : FavoriteCatalogHandler {
6 |
7 | override suspend fun updateFavorite(
8 | repo: CatalogRepository,
9 | id: Int,
10 | isLiked: Boolean
11 | ) {
12 | repo.updateFavorite(id, isLiked)
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/catalog/CatalogDetailEntity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data.catalog
2 |
3 | import androidx.room.Embedded
4 | import androidx.room.Relation
5 | import com.dizcoding.aspen.main.data.facility.FacilityEntity
6 |
7 | class CatalogDetailEntity(
8 | @Embedded val catalog: CatalogEntity,
9 | @Relation(
10 | parentColumn = "id",
11 | entityColumn = "catalog_id"
12 | )
13 | val facilityEntity: List
14 | )
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_filter_off_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_wifi_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/facility/FacilityEntity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data.facility
2 |
3 | import androidx.room.ColumnInfo
4 | import androidx.room.Entity
5 | import androidx.room.PrimaryKey
6 |
7 | @Entity(tableName = "facility")
8 | data class FacilityEntity(
9 | @PrimaryKey(autoGenerate = true)
10 | @ColumnInfo(name = "id") val id: Int = 0,
11 | @ColumnInfo(name = "catalog_id") val catalogId: Int,
12 | @ColumnInfo(name = "name") val name: String,
13 | )
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/DataModule.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data
2 |
3 | import androidx.room.Room
4 | import org.koin.android.ext.koin.androidContext
5 | import org.koin.dsl.module
6 |
7 | val dataModule = module {
8 | single {
9 | Room
10 | .databaseBuilder(
11 | androidContext(),
12 | Database::class.java,
13 | "hotels.db"
14 | )
15 | .fallbackToDestructiveMigration()
16 | .build()
17 | }
18 |
19 | single { get().catalogDao() }
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/ViewModule.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view
2 |
3 | import com.dizcoding.aspen.main.view.detail.DetailCatalogActivityViewModel
4 | import com.dizcoding.aspen.main.view.favorite.FavoriteActivityViewModel
5 | import com.dizcoding.aspen.main.view.home.HomeActivityViewModel
6 | import org.koin.androidx.viewmodel.dsl.viewModelOf
7 | import org.koin.dsl.module
8 |
9 |
10 | val viewModule = module {
11 | viewModelOf(::HomeActivityViewModel)
12 | viewModelOf(::DetailCatalogActivityViewModel)
13 | viewModelOf(::FavoriteActivityViewModel)
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/Database.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data
2 |
3 | import androidx.room.Database
4 | import androidx.room.RoomDatabase
5 | import com.dizcoding.aspen.main.data.catalog.CatalogDao
6 | import com.dizcoding.aspen.main.data.catalog.CatalogEntity
7 | import com.dizcoding.aspen.main.data.facility.FacilityEntity
8 |
9 | @Database(
10 | version = 2,
11 | entities = [
12 | CatalogEntity::class,
13 | FacilityEntity::class
14 | ]
15 | )
16 | abstract class Database : RoomDatabase() {
17 | abstract fun catalogDao(): CatalogDao
18 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_star_yellow_16.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/extension/TextViewExtension.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.extension
2 |
3 | import android.widget.TextView
4 | import androidx.core.content.ContextCompat
5 |
6 | fun TextView.setDrawableLeft(id: Int) {
7 | val drawable = ContextCompat.getDrawable(this.context, id)
8 | this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
9 | }
10 |
11 |
12 | fun TextView.setDrawableRight(id: Int) {
13 | val drawable = ContextCompat.getDrawable(this.context, id)
14 | this.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null)
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/domain/CatalogRepository.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.domain
2 |
3 | import com.dizcoding.aspen.main.data.catalog.CatalogDetailEntity
4 | import com.dizcoding.aspen.main.data.catalog.CatalogEntity
5 | import kotlinx.coroutines.flow.Flow
6 |
7 | interface CatalogRepository {
8 | suspend fun create(data: List)
9 | suspend fun getBy(id: Int): CatalogDetailEntity
10 | suspend fun deleteAll()
11 | suspend fun updateFavorite(id: Int, isLiked: Boolean)
12 | fun getAll(keyword: String): Flow>
13 | fun getFavorite(keyword: String): Flow>
14 |
15 | }
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | maven("https://jitpack.io")
20 | }
21 | }
22 |
23 | rootProject.name = "Aspen"
24 | include(":app")
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/noactionbarpadding/NoActionBarPaddingImpl.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.noactionbarpadding
2 |
3 | import android.view.View
4 | import androidx.core.view.ViewCompat
5 | import androidx.core.view.WindowInsetsCompat
6 |
7 | class NoActionBarPaddingImpl : NoActionBarPadding {
8 | override fun handleNoActionBarPaddingBy(view: View) {
9 | ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
10 | val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
11 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
12 | insets
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dinner_dining_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/facility/FacilityAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.facility
2 |
3 | import com.dizcoding.adapterdelegate.bind
4 | import com.dizcoding.adapterdelegate.itemDelegate
5 | import com.dizcoding.aspen.R
6 | import com.dizcoding.aspen.databinding.ActivityDetailCatalogContentFacilityItemBinding
7 |
8 | fun facilityAdapter() =
9 | itemDelegate(R.layout.activity_detail_catalog_content_facility_item)
10 | .bind {
11 | val binding = ActivityDetailCatalogContentFacilityItemBinding.bind(containerView)
12 | binding.textViewFacilityName.text = it.name
13 | binding.imageViewIcon.setImageResource(it.icon)
14 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_smoking_rooms_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_smoke_free_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/dizcoding/aspen/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen
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.dizcoding.ucoffee", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/viewbindinginflater/ViewBindingInflaterImpl.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.viewbindinginflater
2 |
3 | import android.view.LayoutInflater
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.viewbinding.ViewBinding
6 |
7 | @Suppress("UNCHECKED_CAST")
8 | class ViewBindingInflaterImpl : ViewBindingInflater {
9 | private var _binding: ViewBinding? = null
10 |
11 | override val binding: VB
12 | get() = _binding as VB
13 |
14 | override fun setViewBindingInflater(
15 | activity: AppCompatActivity,
16 | layout: (LayoutInflater) -> VB
17 | ) {
18 | _binding = layout.invoke(activity.layoutInflater)
19 | activity.setContentView(requireNotNull(binding).root)
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/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/main/java/com/dizcoding/aspen/main/data/catalog/CatalogEntity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data.catalog
2 |
3 | import androidx.room.ColumnInfo
4 | import androidx.room.Entity
5 | import androidx.room.PrimaryKey
6 |
7 | @Entity(tableName = "catalog")
8 | data class CatalogEntity(
9 | @PrimaryKey(autoGenerate = true)
10 | @ColumnInfo(name = "id") val id: Int = 0,
11 | @ColumnInfo(name = "category") val category: String,
12 | @ColumnInfo(name = "name") val name: String,
13 | @ColumnInfo(name = "short_desc") val shortDescription: String,
14 | @ColumnInfo(name = "description") val description: String,
15 | @ColumnInfo(name = "rate") val rate: Double,
16 | @ColumnInfo(name = "rated_by") val ratedBy: Int,
17 | @ColumnInfo(name = "image_url") val imageUrl: String,
18 | @ColumnInfo(name = "is_favorite") val isFavorite: Boolean
19 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/App.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen
2 |
3 | import android.app.Application
4 | import com.dizcoding.aspen.main.data.dataModule
5 | import com.dizcoding.aspen.main.domain.domainModule
6 | import com.dizcoding.aspen.main.view.viewModule
7 | import org.koin.android.ext.koin.androidContext
8 | import org.koin.android.ext.koin.androidLogger
9 | import org.koin.core.context.startKoin
10 | import org.koin.core.logger.Level
11 |
12 | class App : Application() {
13 |
14 | override fun onCreate() {
15 | super.onCreate()
16 | startKoin {
17 | androidLogger(Level.NONE)
18 | androidContext(this@App)
19 | modules(
20 | listOf(
21 | dataModule,
22 | domainModule,
23 | viewModule
24 | )
25 | )
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_bathtub_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/facility/FacilityHolderAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.facility
2 |
3 | import androidx.recyclerview.widget.GridLayoutManager
4 | import com.dizcoding.adapterdelegate.DelegatesAdapter
5 | import com.dizcoding.adapterdelegate.bind
6 | import com.dizcoding.adapterdelegate.itemDelegate
7 | import com.dizcoding.aspen.R
8 | import com.dizcoding.aspen.databinding.ActivityDetailCatalogContentFacilityHolderBinding
9 |
10 | fun facilityHolderAdapter() =
11 | itemDelegate(R.layout.activity_detail_catalog_content_facility_holder)
12 | .bind {
13 | val binding = ActivityDetailCatalogContentFacilityHolderBinding.bind(containerView)
14 | binding.textViewFacility.text = "Facilities"
15 | binding.recyclerViewCatalogFacility.layoutManager =
16 | GridLayoutManager(containerView.context, 4)
17 |
18 | val adapter = DelegatesAdapter(
19 | facilityAdapter()
20 | )
21 | binding.recyclerViewCatalogFacility.adapter = adapter
22 | adapter.submitList(it.facilities)
23 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail_catalog_content_facility_holder.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail_catalog.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
15 |
16 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/catalog/CatalogDao.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data.catalog
2 |
3 | import androidx.room.Dao
4 | import androidx.room.Insert
5 | import androidx.room.OnConflictStrategy
6 | import androidx.room.Query
7 | import kotlinx.coroutines.flow.Flow
8 |
9 | @Dao
10 | interface CatalogDao {
11 | @Insert(onConflict = OnConflictStrategy.IGNORE)
12 | suspend fun create(data: List)
13 |
14 | @Query("SELECT * FROM catalog")
15 | fun getAll(): Flow>
16 |
17 | @Query("SELECT * FROM catalog WHERE name LIKE :keyword")
18 | fun getAll(keyword: String): Flow>
19 |
20 | @Query("SELECT * FROM catalog WHERE is_favorite = 1")
21 | fun getFavorite(): Flow>
22 |
23 | @Query("SELECT * FROM catalog WHERE is_favorite = 1 AND name LIKE :keyword")
24 | fun getFavorite(keyword: String): Flow>
25 |
26 | @Query("SELECT * FROM catalog WHERE id =:id")
27 | suspend fun getBy(id: Int): CatalogDetailEntity
28 |
29 | @Query("DELETE FROM catalog")
30 | suspend fun deleteAll()
31 |
32 | @Query("UPDATE catalog SET is_favorite = :isLiked WHERE id = :id")
33 | suspend fun updateFavorite(id: Int, isLiked: Boolean)
34 |
35 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_heart_pink_filled_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/data/catalog/CatalogRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.data.catalog
2 |
3 | import com.dizcoding.aspen.main.domain.CatalogRepository
4 | import kotlinx.coroutines.flow.Flow
5 |
6 | class CatalogRepositoryImpl(
7 | private val catalogDao: CatalogDao
8 | ) : CatalogRepository {
9 | override suspend fun create(data: List) {
10 | return catalogDao.create(data)
11 | }
12 |
13 | override suspend fun getBy(id: Int): CatalogDetailEntity {
14 | return catalogDao.getBy(id)
15 | }
16 |
17 | override suspend fun deleteAll() {
18 | return catalogDao.deleteAll()
19 | }
20 |
21 | override suspend fun updateFavorite(id: Int, isLiked: Boolean) {
22 | return catalogDao.updateFavorite(id, isLiked)
23 | }
24 |
25 | override fun getAll(keyword: String): Flow> {
26 | if (keyword != "") {
27 | return catalogDao.getAll("%$keyword%")
28 | } else {
29 | return catalogDao.getAll()
30 | }
31 | }
32 |
33 | override fun getFavorite(keyword: String): Flow> {
34 | if (keyword != "") {
35 | return catalogDao.getFavorite("%$keyword%")
36 | } else {
37 | return catalogDao.getFavorite()
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail_catalog_content_facility_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
29 |
--------------------------------------------------------------------------------
/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 -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-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 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
18 |
21 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/recommended/mainRecommendHolderAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.recommended
2 |
3 | import androidx.recyclerview.widget.LinearLayoutManager
4 | import com.dizcoding.adapterdelegate.DelegatesAdapter
5 | import com.dizcoding.adapterdelegate.bind
6 | import com.dizcoding.adapterdelegate.itemDelegate
7 | import com.dizcoding.aspen.R
8 | import com.dizcoding.aspen.databinding.ActivityMainCategoryHolderBinding
9 | import com.dizcoding.aspen.main.view.home.content.MainContent
10 |
11 | fun mainRecommendHolderAdapter(
12 | seeAllClicked: () -> Unit,
13 | itemClick: (MainContent) -> Unit,
14 | isLiked: (MainContent) -> Unit
15 | ) =
16 | itemDelegate(R.layout.activity_main_category_holder)
17 | .bind {
18 | val binding = ActivityMainCategoryHolderBinding.bind(containerView)
19 | binding.textViewCategory.text = "Recommend"
20 | val adapter = DelegatesAdapter(
21 | mainRecommendAdapter(itemClick, isLiked)
22 | )
23 | binding.recyclerViewCatalogPopular.layoutManager = LinearLayoutManager(containerView.context)
24 | binding.recyclerViewCatalogPopular.adapter = adapter
25 |
26 | if (!it.recommendContents.isNullOrEmpty()) adapter.submitList(it.recommendContents!!)
27 |
28 | binding.textViewAll.setOnClickListener {
29 | seeAllClicked.invoke()
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/popular/mainPopularHolderAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.popular
2 |
3 | import androidx.recyclerview.widget.LinearLayoutManager
4 | import com.dizcoding.adapterdelegate.DelegatesAdapter
5 | import com.dizcoding.adapterdelegate.bind
6 | import com.dizcoding.adapterdelegate.itemDelegate
7 | import com.dizcoding.aspen.R
8 | import com.dizcoding.aspen.databinding.ActivityMainCategoryHolderBinding
9 | import com.dizcoding.aspen.main.view.home.content.MainContent
10 |
11 | fun mainPopularHolderAdapter(
12 | seeAllClicked: () -> Unit,
13 | itemClick: (MainContent) -> Unit,
14 | isLiked: (MainContent) -> Unit
15 | ) =
16 | itemDelegate(R.layout.activity_main_category_holder)
17 | .bind {
18 | val binding = ActivityMainCategoryHolderBinding.bind(containerView)
19 | binding.textViewCategory.text = "Popular"
20 | val adapter = DelegatesAdapter(
21 | mainPopularAdapter(itemClick, isLiked)
22 | )
23 | binding.recyclerViewCatalogPopular.layoutManager =
24 | LinearLayoutManager(containerView.context, LinearLayoutManager.HORIZONTAL, false)
25 | binding.recyclerViewCatalogPopular.adapter = adapter
26 |
27 | if (!it.popularContents.isNullOrEmpty()) adapter.submitList(it.popularContents!!)
28 |
29 | binding.textViewAll.setOnClickListener {
30 | seeAllClicked.invoke()
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_heart_gray_outline_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_category_holder.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/popular/MainPopularAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.popular
2 |
3 | import com.dizcoding.adapterdelegate.bind
4 | import com.dizcoding.adapterdelegate.click
5 | import com.dizcoding.adapterdelegate.itemDelegate
6 | import com.dizcoding.aspen.R
7 | import com.dizcoding.aspen.databinding.ActivityMainCategoryPopularItemBinding
8 | import com.dizcoding.aspen.main.view.home.content.MainContent
9 | import com.dizcoding.aspen.main.utility.extension.loadImage
10 |
11 | fun mainPopularAdapter(itemClick: (MainContent) -> Unit, isLiked: (MainContent) -> Unit) =
12 | itemDelegate(R.layout.activity_main_category_popular_item)
13 | .click(itemClick)
14 | .bind {
15 | val binding = ActivityMainCategoryPopularItemBinding.bind(containerView)
16 | binding.textViewCatalogName.text = it.catalogName
17 | binding.textViewCatalogRate.text = it.catalogRate
18 | binding.imageViewCatalog.loadImage(it.catalogImage, R.dimen.rad_24)
19 | if (it.isCatalogFavorite) {
20 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_pink_filled_24)
21 | } else {
22 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_gray_outline_24)
23 | }
24 |
25 | binding.imageViewCatalogLike.setOnClickListener { c ->
26 | it.isCatalogFavorite = !it.isCatalogFavorite
27 | if (it.isCatalogFavorite) {
28 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_pink_filled_24)
29 | } else {
30 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_gray_outline_24)
31 | }
32 | isLiked.invoke(it)
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/content/recommended/MainRecommendAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home.content.recommended
2 |
3 | import com.dizcoding.adapterdelegate.bind
4 | import com.dizcoding.adapterdelegate.click
5 | import com.dizcoding.adapterdelegate.itemDelegate
6 | import com.dizcoding.aspen.R
7 | import com.dizcoding.aspen.databinding.ActivityMainCategoryRecommendItemBinding
8 | import com.dizcoding.aspen.main.view.home.content.MainContent
9 | import com.dizcoding.aspen.main.utility.extension.loadImage
10 |
11 | fun mainRecommendAdapter(itemClick: (MainContent) -> Unit, isLiked: (MainContent) -> Unit) =
12 | itemDelegate(R.layout.activity_main_category_recommend_item)
13 | .click(itemClick)
14 | .bind {
15 | val binding = ActivityMainCategoryRecommendItemBinding.bind(containerView)
16 | binding.textViewCatalogName.text = it.catalogName
17 | binding.textViewCatalogRate.text = it.catalogRate
18 |
19 | binding.imageViewCatalog.loadImage(it.catalogImage, R.dimen.rad_24)
20 |
21 | if (it.isCatalogFavorite) {
22 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_pink_filled_24)
23 | } else {
24 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_gray_outline_24)
25 | }
26 |
27 |
28 | binding.imageViewCatalogLike.setOnClickListener { c ->
29 | it.isCatalogFavorite = !it.isCatalogFavorite
30 | if (it.isCatalogFavorite) {
31 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_pink_filled_24)
32 | } else {
33 | binding.imageViewCatalogLike.setImageResource(R.drawable.ic_heart_gray_outline_24)
34 | }
35 | isLiked.invoke(it)
36 | }
37 | }
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android.application)
3 | alias(libs.plugins.jetbrains.kotlin.android)
4 | alias(libs.plugins.ksp)
5 | }
6 |
7 | android {
8 | namespace = "com.dizcoding.aspen"
9 | compileSdk = 34
10 |
11 | defaultConfig {
12 | applicationId = "com.dizcoding.aspen"
13 | minSdk = 24
14 | targetSdk = 34
15 | versionCode = 1
16 | versionName = "1.0"
17 |
18 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19 | }
20 |
21 | buildTypes {
22 | release {
23 | isMinifyEnabled = false
24 | proguardFiles(
25 | getDefaultProguardFile("proguard-android-optimize.txt"),
26 | "proguard-rules.pro"
27 | )
28 | }
29 | }
30 | buildFeatures{
31 | viewBinding = true
32 | }
33 | compileOptions {
34 | sourceCompatibility = JavaVersion.VERSION_17
35 | targetCompatibility = JavaVersion.VERSION_17
36 | }
37 | kotlinOptions {
38 | jvmTarget = "17"
39 | }
40 | }
41 |
42 | dependencies {
43 |
44 | implementation(libs.androidx.core.ktx)
45 | implementation(libs.androidx.appcompat)
46 | implementation(libs.material)
47 | implementation(libs.androidx.activity)
48 | implementation(libs.androidx.constraintlayout)
49 | testImplementation(libs.junit)
50 | androidTestImplementation(libs.androidx.junit)
51 | androidTestImplementation(libs.androidx.espresso.core)
52 |
53 | implementation(libs.recyclerview.delegate)
54 | implementation(libs.di.koin)
55 | implementation(libs.lifecycle.livedata)
56 | implementation(libs.lifecycle.common.java8)
57 | implementation(libs.lifecycle.viewmodel.ktx)
58 | implementation(libs.glide)
59 | implementation(libs.glide.compiler)
60 | implementation(libs.room.runtime)
61 | ksp(libs.room.compiler)
62 | implementation(libs.room.ktx)
63 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/favorite/FavoriteActivityViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.favorite
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MediatorLiveData
5 | import androidx.lifecycle.MutableLiveData
6 | import androidx.lifecycle.ViewModel
7 | import androidx.lifecycle.viewModelScope
8 | import com.dizcoding.aspen.main.domain.CatalogRepository
9 | import com.dizcoding.aspen.main.view.home.content.MainContent
10 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandler
11 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandlerImpl
12 | import kotlinx.coroutines.launch
13 |
14 | class FavoriteActivityViewModel(
15 | private val catalogRepository: CatalogRepository
16 | ) : ViewModel(),
17 | FavoriteCatalogHandler by FavoriteCatalogHandlerImpl() {
18 |
19 | private val _searchQuery = MutableLiveData()
20 | private val _contents = MediatorLiveData>()
21 |
22 | val contents: LiveData> get() = _contents
23 |
24 | fun searchBy(keyword: String?) {
25 | _searchQuery.value = keyword ?: ""
26 | }
27 |
28 | init {
29 | _contents.addSource(_searchQuery) { query ->
30 | viewModelScope.launch {
31 | catalogRepository.getFavorite(query).collect {
32 | val allCatalogContents: List = it.map {
33 | MainContent(
34 | catalogId = it.id,
35 | catalogName = it.name,
36 | catalogImage = it.imageUrl,
37 | catalogRate = it.rate.toString(),
38 | isCatalogFavorite = it.isFavorite
39 | )
40 | }
41 | _contents.value = allCatalogContents.toMutableList()
42 | }
43 |
44 |
45 | }
46 |
47 | }
48 | }
49 |
50 | fun updateFavorite(id: Int, isLiked: Boolean) {
51 | viewModelScope.launch {
52 | updateFavorite(catalogRepository, id, isLiked)
53 | }
54 | }
55 |
56 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_pool_24.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/DetailCatalogActivity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import androidx.recyclerview.widget.LinearLayoutManager
6 | import com.dizcoding.adapterdelegate.DelegatesAdapter
7 | import com.dizcoding.aspen.databinding.ActivityDetailCatalogBinding
8 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPadding
9 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPaddingImpl
10 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflater
11 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflaterImpl
12 | import com.dizcoding.aspen.main.view.detail.content.detail.detailAdapter
13 | import com.dizcoding.aspen.main.view.detail.content.facility.facilityHolderAdapter
14 | import org.koin.androidx.viewmodel.ext.android.viewModel
15 |
16 | class DetailCatalogActivity : AppCompatActivity(),
17 | NoActionBarPadding by NoActionBarPaddingImpl(),
18 | ViewBindingInflater by ViewBindingInflaterImpl() {
19 |
20 | private val viewModel: DetailCatalogActivityViewModel by viewModel()
21 | private val adapter = DelegatesAdapter(
22 | detailAdapter { item ->
23 | viewModel.updateFavorite(item.catalogId,item.catalogIsLoved)
24 | },
25 | facilityHolderAdapter()
26 | )
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 | setViewBindingInflater(this) { ActivityDetailCatalogBinding.inflate(layoutInflater) }
31 | handleNoActionBarPaddingBy(requireNotNull(binding.root))
32 |
33 | binding.recyclerViewCatalogDetail.layoutManager = LinearLayoutManager(this)
34 | binding.recyclerViewCatalogDetail.adapter = adapter
35 |
36 | viewModel.contents().observe(this) {
37 | adapter.submitList(it)
38 | }
39 |
40 | val catalogId = intent.getIntExtra("id",0)
41 | viewModel.fetchContents(catalogId)
42 |
43 |
44 | binding.imageViewArrowBack.setOnClickListener {
45 | finish()
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.5.0"
3 | kotlin = "1.9.0"
4 | coreKtx = "1.13.1"
5 | junit = "4.13.2"
6 | junitVersion = "1.2.1"
7 | espressoCore = "3.6.1"
8 | appcompat = "1.7.0"
9 | material = "1.12.0"
10 | activity = "1.9.0"
11 | constraintlayout = "2.1.4"
12 | ksp = "1.9.0-1.0.13"
13 |
14 | [libraries]
15 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
16 | junit = { group = "junit", name = "junit", version.ref = "junit" }
17 | androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
18 | androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
19 | androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
20 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
21 | androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
22 | androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
23 | recyclerview-delegate = { group = "com.github.gandhi-wibowo", name = "AdapterDelegate", version = "v0.0.1" }
24 | di-koin = { group = "io.insert-koin", name = "koin-android", version = "3.4.3" }
25 | lifecycle-livedata = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version = "2.8.3" }
26 | lifecycle-common-java8 = { group = "androidx.lifecycle", name = "lifecycle-common-java8", version = "2.8.3" }
27 | lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version = "2.8.3" }
28 | glide = { group = "com.github.bumptech.glide", name = "glide", version = "4.12.0" }
29 | glide-compiler = { group = "com.github.bumptech.glide", name = "compiler", version = "4.12.0" }
30 | room-runtime = { group = "androidx.room", name = "room-runtime", version = "2.6.1" }
31 | room-compiler = { group = "androidx.room", name = "room-compiler", version = "2.6.1" }
32 | room-ktx = { group = "androidx.room", name = "room-ktx", version = "2.6.1" }
33 |
34 | [plugins]
35 | android-application = { id = "com.android.application", version.ref = "agp" }
36 | jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
37 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/content/detail/DetailAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail.content.detail
2 |
3 | import com.dizcoding.adapterdelegate.bind
4 | import com.dizcoding.adapterdelegate.itemDelegate
5 | import com.dizcoding.aspen.R
6 | import com.dizcoding.aspen.databinding.ActivityDetailCatalogContentItemBinding
7 | import com.dizcoding.aspen.main.utility.extension.loadImage
8 | import com.dizcoding.aspen.main.utility.extension.setDrawableRight
9 |
10 |
11 | fun detailAdapter(isFavorite: (Detail) -> Unit) =
12 | itemDelegate(R.layout.activity_detail_catalog_content_item)
13 | .bind {
14 | val binding = ActivityDetailCatalogContentItemBinding.bind(containerView)
15 | // image
16 | binding.imageViewCatalog.loadImage(it.catalogImage, R.dimen.rad_24)
17 | // like
18 | if (it.catalogIsLoved) binding.imageViewCatalogIsFavorite.loadImage(R.drawable.ic_heart_pink_filled_24)
19 | else binding.imageViewCatalogIsFavorite.loadImage(R.drawable.ic_heart_gray_outline_24)
20 | binding.textViewCatalogName.text = it.catalogName
21 | binding.textViewCatalogRate.text = it.catalogRate + it.catalogRatedBy
22 | binding.textViewCatalogDescription.text = it.catalogShortDescription
23 | var readMoreIsExpanded = false
24 | binding.textViewReadMore.setOnClickListener { _ ->
25 | readMoreIsExpanded = !readMoreIsExpanded
26 | if (readMoreIsExpanded) {
27 | binding.textViewCatalogDescription.text = it.catalogDescription
28 | binding.textViewReadMore.apply {
29 | text = "Read Less"
30 | setDrawableRight(R.drawable.ic_arrow_up_24)
31 | }
32 | // read less
33 | } else {
34 | // read more
35 | binding.textViewCatalogDescription.text = it.catalogShortDescription
36 | binding.textViewReadMore.apply {
37 | text = "Read More"
38 | setDrawableRight(R.drawable.ic_arrow_down_blue_24)
39 | }
40 | }
41 | }
42 | binding.imageViewCatalogIsFavorite.setOnClickListener { _ ->
43 | it.catalogIsLoved = !it.catalogIsLoved
44 | if (it.catalogIsLoved) binding.imageViewCatalogIsFavorite.loadImage(R.drawable.ic_heart_pink_filled_24)
45 | else binding.imageViewCatalogIsFavorite.loadImage(R.drawable.ic_heart_gray_outline_24)
46 | isFavorite.invoke(it)
47 | }
48 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_category_popular_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
32 |
33 |
47 |
48 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_category_recommend_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
33 |
34 |
48 |
49 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/utility/extension/ImageViewExtensions.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.utility.extension
2 |
3 | import android.graphics.drawable.Drawable
4 | import android.widget.ImageView
5 | import androidx.annotation.DimenRes
6 | import com.bumptech.glide.Glide
7 | import com.bumptech.glide.load.DataSource
8 | import com.bumptech.glide.load.engine.GlideException
9 | import com.bumptech.glide.load.resource.bitmap.RoundedCorners
10 | import com.bumptech.glide.request.RequestListener
11 | import com.bumptech.glide.request.target.Target
12 |
13 | fun ImageView.loadImage(source: Any) {
14 | loadImage(source) {}
15 | }
16 |
17 | fun ImageView.loadImage(source: Any, onLoadError: (Boolean) -> Unit) {
18 | Glide
19 | .with(this)
20 | .load(source)
21 | .listener(object : RequestListener {
22 | override fun onLoadFailed(
23 | e: GlideException?,
24 | model: Any?,
25 | target: Target?,
26 | isFirstResource: Boolean
27 | ): Boolean {
28 | onLoadError.invoke(true)
29 | return false
30 | }
31 |
32 | override fun onResourceReady(
33 | resource: Drawable?,
34 | model: Any?,
35 | target: Target?,
36 | dataSource: DataSource?,
37 | isFirstResource: Boolean
38 | ): Boolean {
39 | onLoadError.invoke(false)
40 | return false
41 | }
42 |
43 | })
44 | .into(this)
45 | }
46 |
47 | fun ImageView.loadImage(
48 | source: Any,
49 | @DimenRes rad: Int
50 | ) {
51 | loadImage(source, rad) {}
52 | }
53 |
54 | fun ImageView.loadImage(
55 | source: Any,
56 | @DimenRes rad: Int,
57 | onLoadError: (Boolean) -> Unit
58 | ) {
59 | val radius = context.resources.getDimensionPixelSize(rad)
60 | Glide
61 | .with(this)
62 | .load(source)
63 | .transform(RoundedCorners(radius))
64 | .listener(object : RequestListener {
65 | override fun onLoadFailed(
66 | e: GlideException?,
67 | model: Any?,
68 | target: Target?,
69 | isFirstResource: Boolean
70 | ): Boolean {
71 | onLoadError.invoke(true)
72 | return false
73 | }
74 |
75 | override fun onResourceReady(
76 | resource: Drawable?,
77 | model: Any?,
78 | target: Target?,
79 | dataSource: DataSource?,
80 | isFirstResource: Boolean
81 | ): Boolean {
82 | onLoadError.invoke(false)
83 | return false
84 | }
85 |
86 | })
87 | .into(this)
88 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/detail/DetailCatalogActivityViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.detail
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MutableLiveData
5 | import androidx.lifecycle.ViewModel
6 | import androidx.lifecycle.viewModelScope
7 | import com.dizcoding.aspen.R
8 | import com.dizcoding.aspen.main.domain.CatalogRepository
9 | import com.dizcoding.aspen.main.view.detail.content.detail.Detail
10 | import com.dizcoding.aspen.main.view.detail.content.facility.Facility
11 | import com.dizcoding.aspen.main.view.detail.content.facility.FacilityHolder
12 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandler
13 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandlerImpl
14 | import kotlinx.coroutines.launch
15 |
16 | class DetailCatalogActivityViewModel(
17 | private val catalogRepository: CatalogRepository
18 | ) : ViewModel(),
19 | FavoriteCatalogHandler by FavoriteCatalogHandlerImpl() {
20 |
21 | fun updateFavorite(id: Int, isLiked: Boolean) {
22 | viewModelScope.launch {
23 | updateFavorite(catalogRepository, id, isLiked)
24 | }
25 | }
26 |
27 | private val _contents: MutableLiveData> = MutableLiveData()
28 | fun contents(): LiveData> = _contents
29 | fun fetchContents(id: Int) {
30 | viewModelScope.launch {
31 | val catalog = catalogRepository.getBy(id)
32 | _contents.value = mutableListOf(
33 | Detail(
34 | catalogId = catalog.catalog.id,
35 | catalogName = catalog.catalog.name,
36 | catalogImage = catalog.catalog.imageUrl,
37 | catalogIsLoved = catalog.catalog.isFavorite,
38 | catalogRate = catalog.catalog.rate.toString(),
39 | catalogRatedBy = " (${catalog.catalog.ratedBy} Reviews)",
40 | catalogShortDescription = catalog.catalog.shortDescription,
41 | catalogDescription = catalog.catalog.description
42 | ),
43 | FacilityHolder(
44 | facilities = listOf(
45 | Facility(
46 | name = "Dinner",
47 | icon = R.drawable.ic_dinner_dining_24
48 | ),
49 | Facility(
50 | name = "Tub",
51 | icon = R.drawable.ic_bathtub_24
52 | ),
53 | Facility(
54 | name = "Pool",
55 | icon = R.drawable.ic_pool_24
56 | ),
57 | Facility(
58 | name = "No Smoking",
59 | icon = R.drawable.ic_smoke_free_24
60 | ),
61 | Facility(
62 | name = "Internet",
63 | icon = R.drawable.ic_wifi_24
64 | )
65 | )
66 | )
67 | )
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/favorite/FavoriteActivity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.favorite
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import androidx.appcompat.app.AppCompatActivity
6 | import androidx.appcompat.widget.SearchView
7 | import androidx.recyclerview.widget.LinearLayoutManager
8 | import com.dizcoding.adapterdelegate.DelegatesAdapter
9 | import com.dizcoding.aspen.databinding.ActivityFavoriteBinding
10 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPadding
11 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPaddingImpl
12 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflater
13 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflaterImpl
14 | import com.dizcoding.aspen.main.view.detail.DetailCatalogActivity
15 | import com.dizcoding.aspen.main.view.home.HomeActivity
16 | import com.dizcoding.aspen.main.view.home.content.recommended.mainRecommendAdapter
17 | import org.koin.androidx.viewmodel.ext.android.viewModel
18 |
19 |
20 | class FavoriteActivity : AppCompatActivity(),
21 | NoActionBarPadding by NoActionBarPaddingImpl(),
22 | ViewBindingInflater by ViewBindingInflaterImpl() {
23 |
24 | private val viewModel: FavoriteActivityViewModel by viewModel()
25 |
26 | private val adapter = DelegatesAdapter(
27 | mainRecommendAdapter({ itemClick ->
28 | startActivity(
29 | Intent(this, DetailCatalogActivity::class.java).putExtra(
30 | "id",
31 | itemClick.catalogId
32 | )
33 | )
34 | }, { onLikeClicked ->
35 | viewModel.updateFavorite(onLikeClicked.catalogId, onLikeClicked.isCatalogFavorite)
36 | })
37 | )
38 |
39 | override fun onCreate(savedInstanceState: Bundle?) {
40 | super.onCreate(savedInstanceState)
41 | setViewBindingInflater(this) { ActivityFavoriteBinding.inflate(layoutInflater) }
42 | handleNoActionBarPaddingBy(requireNotNull(binding.root))
43 |
44 | viewModel.searchBy("")
45 |
46 | binding.constraintLayoutBottomMenu.setOnClickListener { }
47 | binding.imageViewHome.setOnClickListener {
48 | startActivity(Intent(this, HomeActivity::class.java))
49 | }
50 | binding.imageViewArrowBack.setOnClickListener { finish() }
51 |
52 | binding.recyclerViewCatalogDetail.layoutManager = LinearLayoutManager(this)
53 | binding.recyclerViewCatalogDetail.adapter = adapter
54 |
55 | viewModel.contents.observe(this) {
56 | adapter.submitList(it)
57 | }
58 |
59 | binding.searchViewCatalog.setOnQueryTextListener(object : SearchView.OnQueryTextListener{
60 | override fun onQueryTextSubmit(query: String?): Boolean {
61 | viewModel.searchBy(query)
62 | return true
63 | }
64 |
65 | override fun onQueryTextChange(newText: String?): Boolean {
66 | viewModel.searchBy(newText)
67 | return true
68 | }
69 |
70 | })
71 | }
72 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail_catalog_content_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
30 |
31 |
39 |
40 |
50 |
51 |
59 |
60 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/HomeActivity.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import androidx.appcompat.app.AppCompatActivity
6 | import androidx.appcompat.widget.SearchView
7 | import androidx.recyclerview.widget.LinearLayoutManager
8 | import com.dizcoding.adapterdelegate.DelegatesAdapter
9 | import com.dizcoding.aspen.databinding.ActivityHomeBinding
10 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPadding
11 | import com.dizcoding.aspen.main.utility.noactionbarpadding.NoActionBarPaddingImpl
12 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflater
13 | import com.dizcoding.aspen.main.utility.viewbindinginflater.ViewBindingInflaterImpl
14 | import com.dizcoding.aspen.main.view.detail.DetailCatalogActivity
15 | import com.dizcoding.aspen.main.view.favorite.FavoriteActivity
16 | import com.dizcoding.aspen.main.view.home.content.popular.mainPopularHolderAdapter
17 | import com.dizcoding.aspen.main.view.home.content.recommended.mainRecommendHolderAdapter
18 | import org.koin.androidx.viewmodel.ext.android.viewModel
19 |
20 | class HomeActivity : AppCompatActivity(),
21 | NoActionBarPadding by NoActionBarPaddingImpl(),
22 | ViewBindingInflater by ViewBindingInflaterImpl() {
23 |
24 | private val viewModel: HomeActivityViewModel by viewModel()
25 |
26 | private val adapter = DelegatesAdapter(
27 | mainPopularHolderAdapter({
28 | }, { itemClick ->
29 | startActivity(
30 | Intent(this, DetailCatalogActivity::class.java).putExtra(
31 | "id",
32 | itemClick.catalogId
33 | )
34 | )
35 | }, { onLikeClicked ->
36 | viewModel.updateFavorite(onLikeClicked.catalogId,onLikeClicked.isCatalogFavorite)
37 | }),
38 | mainRecommendHolderAdapter({
39 | }, { itemClick ->
40 | startActivity(
41 | Intent(this, DetailCatalogActivity::class.java).putExtra(
42 | "id",
43 | itemClick.catalogId
44 | )
45 | )
46 | }, { onLikeClicked ->
47 | viewModel.updateFavorite(onLikeClicked.catalogId,onLikeClicked.isCatalogFavorite)
48 | }),
49 | )
50 |
51 | override fun onCreate(savedInstanceState: Bundle?) {
52 | super.onCreate(savedInstanceState)
53 | setViewBindingInflater(this) { ActivityHomeBinding.inflate(layoutInflater) }
54 | handleNoActionBarPaddingBy(requireNotNull(binding.root))
55 |
56 | viewModel.searchBy("")
57 | viewModel.initContent()
58 |
59 | binding.constraintLayoutBottomMenu.setOnClickListener { }
60 | binding.imageViewFavorite.setOnClickListener {
61 | startActivity(Intent(this, FavoriteActivity::class.java))
62 | }
63 |
64 | binding.recyclerViewCatalog.layoutManager = LinearLayoutManager(this)
65 | binding.recyclerViewCatalog.adapter = adapter
66 |
67 | binding.searchViewCatalog.setOnQueryTextListener(object : SearchView.OnQueryTextListener{
68 | override fun onQueryTextSubmit(query: String?): Boolean {
69 | viewModel.searchBy(query)
70 | return true
71 | }
72 |
73 | override fun onQueryTextChange(newText: String?): Boolean {
74 | viewModel.searchBy(newText)
75 | return true
76 | }
77 | })
78 |
79 | viewModel.contents.observe(this){
80 | adapter.submitList(it)
81 | }
82 |
83 | }
84 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_favorite.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
32 |
33 |
42 |
43 |
44 |
45 |
52 |
53 |
64 |
65 |
75 |
76 |
77 |
78 |
79 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
28 |
29 |
37 |
38 |
47 |
48 |
49 |
50 |
57 |
58 |
69 |
70 |
80 |
81 |
82 |
83 |
91 |
92 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dizcoding/aspen/main/view/home/HomeActivityViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.dizcoding.aspen.main.view.home
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.lifecycle.MediatorLiveData
5 | import androidx.lifecycle.MutableLiveData
6 | import androidx.lifecycle.ViewModel
7 | import androidx.lifecycle.viewModelScope
8 | import com.dizcoding.aspen.main.data.catalog.CatalogEntity
9 | import com.dizcoding.aspen.main.domain.CatalogRepository
10 | import com.dizcoding.aspen.main.view.home.content.MainContent
11 | import com.dizcoding.aspen.main.view.home.content.popular.MainPopularHolder
12 | import com.dizcoding.aspen.main.view.home.content.recommended.MainRecommendHolder
13 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandler
14 | import com.dizcoding.aspen.main.view.util.FavoriteCatalogHandlerImpl
15 | import kotlinx.coroutines.launch
16 |
17 | class HomeActivityViewModel(
18 | private val catalogRepository: CatalogRepository
19 | ) : ViewModel(),
20 | FavoriteCatalogHandler by FavoriteCatalogHandlerImpl() {
21 |
22 | private val _searchQuery = MutableLiveData()
23 | private val _contents = MediatorLiveData>()
24 |
25 | val contents: LiveData> get() = _contents
26 |
27 | fun searchBy(keyword: String?) {
28 | _searchQuery.value = keyword ?: ""
29 | }
30 |
31 | init {
32 | _contents.addSource(_searchQuery) { query ->
33 | viewModelScope.launch {
34 | catalogRepository.getAll(query).collect {
35 | val allCatalogContents: List = it.map {
36 | MainContent(
37 | catalogId = it.id,
38 | catalogName = it.name,
39 | catalogImage = it.imageUrl,
40 | catalogRate = it.rate.toString(),
41 | isCatalogFavorite = it.isFavorite
42 | )
43 | }
44 | val catalogContent: List =
45 | it.filter { it.category == "popular" }.map {
46 | MainContent(
47 | catalogId = it.id,
48 | catalogName = it.name,
49 | catalogImage = it.imageUrl,
50 | catalogRate = it.rate.toString(),
51 | isCatalogFavorite = it.isFavorite
52 | )
53 | }
54 |
55 |
56 | if (catalogContent.isEmpty() && allCatalogContents.isEmpty()) _contents.value =
57 | mutableListOf()
58 | else if (catalogContent.isNotEmpty() && allCatalogContents.isEmpty()) _contents.value =
59 | mutableListOf(MainRecommendHolder(recommendContents = allCatalogContents))
60 | else if (catalogContent.isEmpty() && !allCatalogContents.isEmpty()) _contents.value =
61 | mutableListOf(
62 | MainPopularHolder(popularContents = catalogContent)
63 | )
64 | else _contents.value = mutableListOf(
65 | MainPopularHolder(popularContents = catalogContent),
66 | MainRecommendHolder(recommendContents = allCatalogContents)
67 | )
68 | }
69 |
70 |
71 | }
72 |
73 | }
74 | }
75 |
76 | fun updateFavorite(id: Int, isLiked: Boolean) {
77 | viewModelScope.launch {
78 | updateFavorite(catalogRepository, id, isLiked)
79 | }
80 | }
81 |
82 | fun initContent() {
83 | viewModelScope.launch {
84 | catalogRepository.getAll("").collect {
85 | if (it.isEmpty()) {
86 | catalogRepository.deleteAll()
87 | catalogRepository.create(
88 | listOf(
89 | CatalogEntity(
90 | category = "popular",
91 | name = "Kamar sederhana",
92 | shortDescription = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda....",
93 | description = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda dari lelahnya menghadapi kerasnya kota. Kamar sederhana ini menyediakan beberapa fasilitas",
94 | rate = 3.2,
95 | ratedBy = 1254,
96 | imageUrl = "https://ak-d.tripcdn.com/images/0225612000ddh5qriE0CE_Z_1080_808_R5_D.jpg",
97 | isFavorite = false
98 | ),
99 | CatalogEntity(
100 | category = "kamar-anak",
101 | name = "Kamar bahagia",
102 | shortDescription = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda, bersama balita....",
103 | description = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda bersama sang balita dari lelahnya menghadapi kerasnya kota. Kamar sederhana ini menyediakan beberapa fasilitas ",
104 | rate = 3.4,
105 | ratedBy = 154,
106 | imageUrl = "https://ak-d.tripcdn.com/images/0580y12000dyxrl2222BC_R_600_400_R5.webp",
107 | isFavorite = false
108 | ),
109 | CatalogEntity(
110 | category = "popular",
111 | name = "Kamar Mewah",
112 | shortDescription = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda, bersama balita....",
113 | description = "Kamar nyaman, dan aman untuk mengistirahatkan tubuh anda bersama sang balita dari lelahnya menghadapi kerasnya kota. Kamar sederhana ini menyediakan beberapa fasilitas ",
114 | rate = 3.1,
115 | ratedBy = 1545,
116 | imageUrl = "https://ak-d.tripcdn.com/images/0585v12000dyxrtx01E81_R_600_400_R5.webp",
117 | isFavorite = false
118 | ),
119 | CatalogEntity(
120 | category = "kamar-mewah",
121 | name = "Kamar Mewah",
122 | shortDescription = "Nikmati kopi anda di balkon kamar anda....",
123 | description = "Nikmati kopi anda di balkon kamar anda, dan rasakan sensasi indahnya menikmati sunset dan sunrise sembari menikmati keindahan kota",
124 | rate = 3.8,
125 | ratedBy = 1345,
126 | imageUrl = "https://ak-d.tripcdn.com/images/0582d12000ddi33lv00A2_R_600_400_R5.webp",
127 | isFavorite = false
128 | ),
129 | CatalogEntity(
130 | category = "kamar-murah",
131 | name = "Kamar Murah",
132 | shortDescription = "Kecil, sederhana, namun tetap mempertahankan kebersihan dan kenyamanan.....",
133 | description = "Kecil, sederhana, namun tetap mempertahankan kebersihan dan kenyamanan. Sehingga akan tetap membuat anda betah untuk menginap di kamar kami ini.",
134 | rate = 4.0,
135 | ratedBy = 1385,
136 | imageUrl = "https://ak-d.tripcdn.com/images/0225212000ddh5qx7E332_R_600_400_R5.webp",
137 | isFavorite = false
138 | ),
139 | CatalogEntity(
140 | category = "popular",
141 | name = "Kamar Keluarga",
142 | shortDescription = "Anda memiliki banyak anggota keluarga ?, Tenang jangan khawatir....",
143 | description = "Anda memiliki banyak anggota keluarga ?, Tenang jangan khawatir. Dengan adanya kamar ini, anda akan tetap merasakan nyamannya menginap sembari bercanda bersama seluruh keluarga anda",
144 | rate = 4.0,
145 | ratedBy = 1385,
146 | imageUrl = "https://ak-d.tripcdn.com/images/0222i12000ddh5qrc815E_R_600_400_R5.webp",
147 | isFavorite = false
148 | ),
149 | CatalogEntity(
150 | category = "popular",
151 | name = "Kamar Favorite",
152 | shortDescription = "Ini adalah kamar kami yang paling laris. Tentu anda akan banyak mendapatkan ....",
153 | description = "Ini adalah kamar kami yang paling laris. Tentu anda akan banyak mendapatkan fasilitas-fasilitas yang juga sangan menarik, banyak pelanggan kami yang sangat bahagia setelah menginap di kamar ini dengan pasangannya. Jadikan anda adalah pelanggan kami yang selanjutnya",
154 | rate = 4.0,
155 | ratedBy = 1385,
156 | imageUrl = "https://ak-d.tripcdn.com/images/0227212000ddh5jwv9DBE_R_600_400_R5.webp",
157 | isFavorite = false
158 | )
159 | )
160 | )
161 | }
162 | }
163 |
164 | }
165 | }
166 | }
--------------------------------------------------------------------------------