Skip to content

Commit

Permalink
Merge pull request #70 from kl3jvi/feature/implementing_epoxy
Browse files Browse the repository at this point in the history
Feature/implementing epoxy
  • Loading branch information
kl3jvi authored Mar 28, 2022
2 parents 92246a2 + 5465cca commit e16dfb8
Show file tree
Hide file tree
Showing 81 changed files with 1,308 additions and 1,327 deletions.
13 changes: 8 additions & 5 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 23 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ android {

buildTypes {
release {
// minifyEnabled true
// shrinkResources true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable true
debuggable false
signingConfig signingConfigs.release
}
}
Expand All @@ -58,6 +58,7 @@ android {
dataBinding true
}


packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
Expand All @@ -70,7 +71,10 @@ android {
universalApk true
}
}


}
kapt {
correctErrorTypes = true
}

apollo {
Expand Down Expand Up @@ -99,11 +103,11 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"

def livedataVersion = "2.4.1"
def viewModelVersion = "2.5.0-alpha02"
def viewModelVersion = "2.5.0-alpha05"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$livedataVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$viewModelVersion"

def navigationComponentVersion = "2.5.0-alpha02"
def navigationComponentVersion = "2.5.0-alpha03"
implementation "androidx.navigation:navigation-runtime-ktx:$navigationComponentVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationComponentVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationComponentVersion"
Expand All @@ -114,13 +118,13 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"

// Coroutine Lifecycle Scopes
def lifecycle_version = "2.5.0-alpha02"
def lifecycle_version = "2.5.0-alpha05"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"

def analyticsVersion = "20.0.2"
def analyticsVersion = "20.1.2"
implementation "com.google.firebase:firebase-analytics-ktx:$analyticsVersion"

def crashlyticsVersion = "18.2.7"
def crashlyticsVersion = "18.2.9"
implementation "com.google.firebase:firebase-crashlytics-ktx:$crashlyticsVersion"

// Hilt DI
Expand All @@ -131,7 +135,7 @@ dependencies {

// Retrofit
def retrofitVersion = "2.9.0"
def interceptor_version = "5.0.0-alpha.2"
def interceptor_version = "5.0.0-alpha.4"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$interceptor_version"
Expand All @@ -141,12 +145,12 @@ dependencies {
implementation "org.jsoup:jsoup:$jsoupVersion"

//Room Library
def room_version = "2.4.1"
def room_version = "2.4.2"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"

//Video Player
def exoplayerVersion = "2.16.1"
def exoplayerVersion = "2.17.1"
implementation "com.google.android.exoplayer:exoplayer:$exoplayerVersion"
implementation "com.google.android.exoplayer:extension-cast:$exoplayerVersion"
implementation "com.google.android.exoplayer:extension-mediasession:$exoplayerVersion"
Expand All @@ -169,7 +173,7 @@ dependencies {
kapt "com.github.bumptech.glide:compiler:$glideVersion"

//splash screen
def splashVersion = "1.0.0-beta01"
def splashVersion = "1.0.0-beta02"
implementation "androidx.core:core-splashscreen:$splashVersion"

def onesignalVersion = "4.6.2"
Expand All @@ -179,7 +183,7 @@ dependencies {
implementation "org.apache.commons:commons-text:$textUtilsVersion"

// paging 3
def paginationVersion = "3.1.0"
def paginationVersion = "3.1.1"
implementation "androidx.paging:paging-runtime-ktx:$paginationVersion"

// browser
Expand All @@ -200,7 +204,11 @@ dependencies {
// def brainTree = "6.0.2"
// implementation "com.braintreepayments.api:drop-in:$brainTree"

implementation "androidx.metrics:metrics-performance:1.0.0-alpha01"
def epoxyVersion = "5.0.0-beta03"
implementation "com.airbnb.android:epoxy:$epoxyVersion"
implementation "com.airbnb.android:epoxy-databinding:$epoxyVersion"
implementation "com.airbnb.android:epoxy-paging3:$epoxyVersion"
kapt "com.airbnb.android:epoxy-processor:$epoxyVersion"


}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MySplash">
android:theme="@style/Theme.MySplash"
android:usesCleartextTraffic="true">
<activity
android:name=".ui.activities.login.LoginActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.kl3jvi.animity.application

import android.app.Application
import android.os.StrictMode
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
Expand All @@ -11,9 +10,7 @@ import dagger.hilt.android.HiltAndroidApp
class AnimityApplication : Application() {

private lateinit var firebaseAnalytics: FirebaseAnalytics

override fun onCreate() {
turnOnStrictMode()
super.onCreate()
firebaseAnalytics = Firebase.analytics
apply {
Expand All @@ -23,18 +20,5 @@ class AnimityApplication : Application() {
}
}

private fun turnOnStrictMode() {
StrictMode.setThreadPolicy(
StrictMode.ThreadPolicy.Builder().detectAll()
.penaltyLog()

.penaltyFlashScreen().build()
)
StrictMode.setVmPolicy(
StrictMode.VmPolicy.Builder().detectAll()
.penaltyLog().build()
)
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package com.kl3jvi.animity.bindings
import android.graphics.drawable.Drawable
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import coil.load
import coil.transform.CircleCropTransformation
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.kl3jvi.animity.R
import com.kl3jvi.animity.data.model.ui_models.GenreModel
import com.kl3jvi.animity.di.GlideApp
import com.kl3jvi.animity.utils.hide
import com.kl3jvi.animity.utils.show
Expand All @@ -25,6 +26,12 @@ object ViewBindings {
}
}

@JvmStatic
@BindingAdapter("list_to_string")
fun joinList(textView: TextView, list: List<GenreModel>) {
textView.text = list.joinToString { it.genreName }
}

@JvmStatic
@BindingAdapter(value = ["imageUrl", "placeholder", "error"], requireAll = false)
fun loadImage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.kl3jvi.animity.ui.adapters.homeAdapter.HomeRecyclerViewItem
import kotlinx.parcelize.Parcelize

@Parcelize
Expand All @@ -23,19 +22,7 @@ data class AnimeMetaModel(
@ColumnInfo var releasedDate: String? = null,
) : Parcelable

fun AnimeMetaModel.toAnime(): HomeRecyclerViewItem.Anime {
return HomeRecyclerViewItem.Anime(
id,
typeValue,
imageUrl,
categoryUrl,
episodeUrl,
title,
episodeNumber,
timestamp,
insertionOrder
)
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.kl3jvi.animity.data.model.ui_models
import android.os.Parcelable
import kotlinx.parcelize.Parcelize


@Parcelize
data class EpisodeInfo(
var vidCdnUrl: String? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.kl3jvi.animity.data.model.ui_models.test

import com.google.gson.annotations.SerializedName


data class DetailedAnimeInfo(
@SerializedName("Pages")
val pages: Pages,
)

data class Pages(
@SerializedName("Gogoanime")
val data: Map<String, SubInfo>
)

data class SubInfo(
@SerializedName("active")
val active: Boolean,
@SerializedName("actor")
val actor: Any,
@SerializedName("aniId")
val aniId: Int,
@SerializedName("createdAt")
val createdAt: String,
@SerializedName("deletedAt")
val deletedAt: Any,
@SerializedName("hentai")
val hentai: Boolean,
@SerializedName("identifier")
val identifier: String,
@SerializedName("image")
val image: String,
@SerializedName("malId")
val malId: Int,
@SerializedName("page")
val page: String,
@SerializedName("sticky")
val sticky: Boolean,
@SerializedName("title")
val title: String,
@SerializedName("type")
val type: String,
@SerializedName("updatedAt")
val updatedAt: String,
@SerializedName("url")
val url: String
)


Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ class AnimeApiClient @Inject constructor(

suspend fun fetchM3u8PreProcessor(header: Map<String, String>, url: String) =
animeService.fetchM3u8PreProcessor(header, url)
}

suspend fun getGogoUrlFromAniListId(id: Int) = animeService.getGogoUrlFromAniListId(id)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.kl3jvi.animity.data.network.anime_service

import com.kl3jvi.animity.utils.Constants
import com.kl3jvi.animity.data.model.ui_models.test.DetailedAnimeInfo
import com.kl3jvi.animity.utils.Constants.Companion.ANIME_SCHEDULE
import com.kl3jvi.animity.utils.Constants.Companion.EPISODE_LOAD_URL
import com.kl3jvi.animity.utils.Constants.Companion.SEARCH_URL
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*

/**
Expand Down Expand Up @@ -84,6 +85,10 @@ interface AnimeService {
@Path("episodeUrl") episodeUrl: String
): ResponseBody

@GET("https://raw.githubusercontent.com/MALSync/MAL-Sync-Backup/master/data/anilist/anime/{id}.json")
suspend fun getGogoUrlFromAniListId(
@Path("id") id: Int = 1
): Response<DetailedAnimeInfo>

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.kl3jvi.animity.data.repository.fragment_repositories

import com.kl3jvi.animity.data.model.ui_models.test.DetailedAnimeInfo
import com.kl3jvi.animity.data.network.anime_service.AnimeApiClient
import com.kl3jvi.animity.domain.repositories.fragment_repositories.FavoriteRepository
import com.kl3jvi.animity.domain.repositories.network_repositories.NetworkBoundRepository
import com.kl3jvi.animity.utils.NetworkResource
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.withContext
import retrofit2.Response
import javax.inject.Inject

@ExperimentalCoroutinesApi
class FavoriteRepositoryImpl @Inject constructor(
private val apiClient: AnimeApiClient,
private val ioDispatcher: CoroutineDispatcher
) : FavoriteRepository {
override fun getGogoUrlFromAniListId(id: Int): Flow<NetworkResource<DetailedAnimeInfo>> {
return object : NetworkBoundRepository<DetailedAnimeInfo>() {
override suspend fun fetchFromRemote(): Response<DetailedAnimeInfo> {
return withContext(ioDispatcher) {
apiClient.getGogoUrlFromAniListId(id) }
}
}.asFlow()
}

//
//
// withContext(ioDispatcher)
// { apiClient.getGogoUrlFromAniListId(id) }
}
Loading

0 comments on commit e16dfb8

Please sign in to comment.