Skip to content

Commit

Permalink
update: build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
amirisback committed Apr 2, 2024
1 parent 8ebbaf4 commit cadac38
Show file tree
Hide file tree
Showing 21 changed files with 330 additions and 223 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ dependencies {
implementation(DependencyGradle.FROGO_SDK)
implementation(DependencyGradle.FROGO_UI)
implementation(DependencyGradle.FROGO_RECYCLER_VIEW)

implementation(Koin.core)
implementation(Koin.android)
implementation(Koin.androidCompat)
implementation(Koin.androidxWorkManager)
}
5 changes: 3 additions & 2 deletions app/src/main/java/com/frogobox/appapi/ConsumeApp.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.frogobox.appapi

import com.frogobox.appapi.core.FrogoKoinApplication
import com.frogobox.appapi.di.consumeApiModule
import com.frogobox.appapi.di.repositoryModule
import com.frogobox.appapi.di.viewModelModule
import com.frogobox.sdk.FrogoKoinApplication
import org.koin.core.KoinApplication

/*
/**
* Created by faisalamir on 28/07/21
* Consumable
* -----------------------------------------
Expand All @@ -18,6 +18,7 @@ import org.koin.core.KoinApplication
* All rights reserved
*
*/

class ConsumeApp : FrogoKoinApplication() {

override fun setupKoinModule(koinApplication: KoinApplication) {
Expand Down
43 changes: 43 additions & 0 deletions app/src/main/java/com/frogobox/appapi/core/FrogoKoinApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.frogobox.appapi.core

import com.frogobox.sdk.FrogoApplication
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.KoinApplication
import org.koin.core.context.startKoin
import org.koin.core.logger.Level


/**
* Created by faisalamir on 26/07/21
* FrogoSDK
* -----------------------------------------
* Name : Muhammad Faisal Amir
* E-mail : faisalamircs@gmail.com
* Github : github.com/amirisback
* -----------------------------------------
* Copyright (C) 2021 FrogoBox Inc.
* All rights reserved
*
*/

abstract class FrogoKoinApplication : FrogoApplication() {

open fun setupKoinModule(koinApplication: KoinApplication) {}

override fun onCreateExt() {
super.onCreateExt()
startKoin {
androidContext(this@FrogoKoinApplication)
androidLogger(
if (isDebugMode()) {
Level.DEBUG
} else {
Level.ERROR
}
)
setupKoinModule(this)
}
}

}
12 changes: 6 additions & 6 deletions app/src/main/java/com/frogobox/appapi/mvvm/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class MainActivity : FrogoBindActivity<ActivityMainBinding>() {
setupIntentActivity(data.code, data)
}

override fun onItemLongClicked(
binding: ItemMainBinding,
data: MainModel,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<MainModel>
) {
override fun areItemsTheSame(oldItem: MainModel, newItem: MainModel): Boolean {
return oldItem.code == newItem.code
}

override fun areContentsTheSame(oldItem: MainModel, newItem: MainModel): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ItemMainBinding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class MealActivity : FrogoBindActivity<ActivityMealBinding>() {
private fun setupRv(data: List<Meal>) {

val adapterCallback = object : IFrogoBindingAdapter<Meal, ItemGridImageBinding> {
override fun areContentsTheSame(oldItem: Meal, newItem: Meal): Boolean {
return oldItem == newItem
}

override fun areItemsTheSame(oldItem: Meal, newItem: Meal): Boolean {
return oldItem.idMeal == newItem.idMeal
}

override fun setViewBinding(parent: ViewGroup): ItemGridImageBinding {
return ItemGridImageBinding.inflate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import androidx.fragment.app.Fragment
import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.appapi.mvvm.main.MainModel
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -64,12 +66,15 @@ class MovieDayFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.poster_path}")
}

override fun onItemLongClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingMovie,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingMovie>
) {
override fun areItemsTheSame(oldItem: TrendingMovie, newItem: TrendingMovie): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(
oldItem: TrendingMovie,
newItem: TrendingMovie
): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -53,24 +54,27 @@ class MovieWeekFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
override fun onViewCreatedExt(view: View, savedInstanceState: Bundle?) {
}

private fun setupRV(data: List<com.frogobox.coreutil.movie.model.TrendingMovie>) {
private fun setupRV(data: List<TrendingMovie>) {

val adapterCallback = object : IFrogoBindingAdapter<com.frogobox.coreutil.movie.model.TrendingMovie, ContentItemBinding> {
val adapterCallback = object : IFrogoBindingAdapter<TrendingMovie, ContentItemBinding> {
override fun onItemClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingMovie,
data: TrendingMovie,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingMovie>
notifyListener: FrogoRecyclerNotifyListener<TrendingMovie>
) {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.poster_path}")
}

override fun onItemLongClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingMovie,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingMovie>
) {
override fun areItemsTheSame(oldItem: TrendingMovie, newItem: TrendingMovie): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(
oldItem: TrendingMovie,
newItem: TrendingMovie
): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
Expand All @@ -83,9 +87,9 @@ class MovieWeekFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {

override fun setupInitComponent(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingMovie,
data: TrendingMovie,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingMovie>
notifyListener: FrogoRecyclerNotifyListener<TrendingMovie>
) {
binding.apply {
tvTitle.text = data.title
Expand All @@ -97,7 +101,7 @@ class MovieWeekFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
}
}

binding.frogoRecyclerView.injectorBinding<com.frogobox.coreutil.movie.model.TrendingMovie, ContentItemBinding>()
binding.frogoRecyclerView.injectorBinding<TrendingMovie, ContentItemBinding>()
.addData(data)
.addCallback(adapterCallback)
.createLayoutGrid(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.coreutil.movie.model.TrendingPerson
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -64,12 +66,18 @@ class PersonDayFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.profile_path}")
}

override fun onItemLongClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingPerson,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingPerson>
) {
override fun areItemsTheSame(
oldItem: TrendingPerson,
newItem: TrendingPerson
): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(
oldItem: TrendingPerson,
newItem: TrendingPerson
): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.coreutil.movie.model.TrendingPerson
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -68,6 +70,20 @@ class PersonWeekFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.profile_path}")
}

override fun areItemsTheSame(
oldItem: TrendingPerson,
newItem: TrendingPerson
): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(
oldItem: TrendingPerson,
newItem: TrendingPerson
): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
return ContentItemBinding.inflate(
LayoutInflater.from(parent.context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.coreutil.movie.model.TrendingTv
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -61,12 +63,12 @@ class TvDayFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.poster_path}")
}

override fun onItemLongClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingTv,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingTv>
) {
override fun areItemsTheSame(oldItem: TrendingTv, newItem: TrendingTv): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(oldItem: TrendingTv, newItem: TrendingTv): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import com.bumptech.glide.Glide
import com.frogobox.appapi.databinding.ContentItemBinding
import com.frogobox.appapi.databinding.FragmentTrendingChildBinding
import com.frogobox.coreutil.movie.MovieUrl
import com.frogobox.coreutil.movie.model.TrendingMovie
import com.frogobox.coreutil.movie.model.TrendingTv
import com.frogobox.recycler.core.FrogoRecyclerNotifyListener
import com.frogobox.recycler.core.IFrogoBindingAdapter
import com.frogobox.sdk.ext.openDetailImageUri
Expand Down Expand Up @@ -66,12 +68,12 @@ class TvWeekFragment : FrogoBindFragment<FragmentTrendingChildBinding>() {
requireActivity().openDetailImageUri("${MovieUrl.BASE_URL_IMAGE_ORIGNAL}${data.poster_path}")
}

override fun onItemLongClicked(
binding: ContentItemBinding,
data: com.frogobox.coreutil.movie.model.TrendingTv,
position: Int,
notifyListener: FrogoRecyclerNotifyListener<com.frogobox.coreutil.movie.model.TrendingTv>
) {
override fun areItemsTheSame(oldItem: TrendingTv, newItem: TrendingTv): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(oldItem: TrendingTv, newItem: TrendingTv): Boolean {
return oldItem == newItem
}

override fun setViewBinding(parent: ViewGroup): ContentItemBinding {
Expand Down
Loading

0 comments on commit cadac38

Please sign in to comment.