Skip to content

Commit

Permalink
Merge pull request #19 from Kaede-No-Ki/0.1.3-alpha
Browse files Browse the repository at this point in the history
0.1.3 alpha
  • Loading branch information
derysudrajat authored Oct 10, 2020
2 parents 6498926 + 8039a92 commit 23d465e
Show file tree
Hide file tree
Showing 23 changed files with 705 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .idea/codeStyles/Project.xml

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

11 changes: 9 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'

Expand All @@ -80,7 +80,6 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

// ktx artifact
implementation "androidx.core:core-ktx:1.3.1"
implementation "androidx.activity:activity-ktx:1.1.0"
implementation "androidx.fragment:fragment-ktx:1.2.5"

Expand All @@ -94,6 +93,14 @@ dependencies {
// skeleton layout
implementation 'com.faltenreich:skeletonlayout:2.1.0'

// exo-player
implementation 'com.google.android.exoplayer:exoplayer:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.4'

testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.activity.detail.DetailActivity"
android:theme="@style/AppTheme.BottomSheet.Themed"/>
<activity
android:name=".ui.activity.episode.AnimeEpisodeActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".ui.activity.detail.DetailActivity"
android:theme="@style/AppTheme.BottomSheet.Themed" />
<activity android:name=".ui.activity.choosemode.ChooseModeActivity" />
<activity android:name=".ui.activity.splashscreen.Splashscreen">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.kaedenoki.moviecorner.data.anime.response

import com.google.gson.annotations.SerializedName

data class AnimeEpisodeResponse(

@field:SerializedName("link_stream")
val linkStream: String? = null,

@field:SerializedName("baseUrl")
val baseUrl: String? = null,

@field:SerializedName("id")
val id: String? = null,

@field:SerializedName("title")
val title: String? = null,

@field:SerializedName("quality")
val quality: Quality? = null
)

data class HighQuality(

@field:SerializedName("download_links")
val downloadLinks: List<DownloadLinksItem?>? = null,

@field:SerializedName("size")
val size: String? = null,

@field:SerializedName("quality")
val quality: String? = null
)

data class Quality(

@field:SerializedName("high_quality")
val highQuality: HighQuality? = null,

@field:SerializedName("medium_quality")
val mediumQuality: MediumQuality? = null,

@field:SerializedName("low_quality")
val lowQuality: LowQuality? = null
)

data class DownloadLinksItem(

@field:SerializedName("host")
val host: String? = null,

@field:SerializedName("link")
val link: String? = null
)

data class LowQuality(

@field:SerializedName("download_links")
val downloadLinks: List<DownloadLinksItem?>? = null,

@field:SerializedName("size")
val size: String? = null,

@field:SerializedName("quality")
val quality: String? = null
)

data class MediumQuality(

@field:SerializedName("download_links")
val downloadLinks: List<DownloadLinksItem?>? = null,

@field:SerializedName("size")
val size: String? = null,

@field:SerializedName("quality")
val quality: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ data class ResponseDetailAnime(
@field:SerializedName("title")
val title: String? = null,

@field:SerializedName("synopsis")
val synopsis: String? = null,

@field:SerializedName("type")
val type: String? = null,

Expand Down
20 changes: 18 additions & 2 deletions app/src/main/java/com/kaedenoki/moviecorner/helper/Helpers.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.kaedenoki.moviecorner.helper

import android.view.View
import com.kaedenoki.moviecorner.helper.Helpers.getTitleEpisode

object Helpers {
fun View.hideView(){
fun View.hideView() {
this.visibility = View.GONE
}

fun View.showView(){
fun View.showView() {
this.visibility = View.VISIBLE
}

Expand Down Expand Up @@ -39,4 +40,19 @@ object Helpers {
val episode = data[1].split(" ")
return episode[0]
}

val imgMode = listOf(
"https://images2.alphacoders.com/742/thumb-1920-742320.png",
"https://assets.st-note.com/production/uploads/images/25980292/picture_pc_1d466b6781c87b2fd537736dc38775f4.jpg"
)

fun String.getTitleEpisode(): String {
val data = this.split(" Episode ")
return data[0]
}

fun String.getTextEpisode(): String {
val data = this.split(" Episode ")
return "Episode ${data[1].split(" ")[0]}"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kaedenoki.moviecorner.repository.network.anime

import com.kaedenoki.moviecorner.data.anime.response.AnimeEpisodeResponse
import com.kaedenoki.moviecorner.data.anime.response.BaseAnimeResponse
import com.kaedenoki.moviecorner.data.anime.response.HomeAnimeResponse
import com.kaedenoki.moviecorner.data.anime.response.ResponseDetailAnime
Expand All @@ -22,4 +23,10 @@ interface AnimeContract {
@Path("id")
id: String?
): Call<ResponseDetailAnime>

@GET("eps/{id}")
fun getEpisodeAnime(
@Path("id")
id: String?
): Call<AnimeEpisodeResponse>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kaedenoki.moviecorner.repository.network.anime

import android.util.Log
import com.kaedenoki.moviecorner.data.anime.response.AnimeEpisodeResponse
import com.kaedenoki.moviecorner.data.anime.response.BaseAnimeResponse
import com.kaedenoki.moviecorner.data.anime.response.HomeAnimeResponse
import com.kaedenoki.moviecorner.data.anime.response.ResponseDetailAnime
Expand Down Expand Up @@ -65,4 +66,21 @@ class AnimeServices {
)
}

fun getEpisodeAnime(id: String?, callback: (AnimeEpisodeResponse) -> Unit){
RetrofitInstance.getAnimeClient().getEpisodeAnime(id).enqueue(
object : Callback<AnimeEpisodeResponse> {
override fun onResponse(
call: Call<AnimeEpisodeResponse>,
response: Response<AnimeEpisodeResponse>
) {
callback(response.body()!!)
}

override fun onFailure(call: Call<AnimeEpisodeResponse>, t: Throwable) {
Log.d("TAG", "onFailure: ${t.message}")
}
}
)
}

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.kaedenoki.moviecorner.ui.activity.choosemode

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import coil.load
import com.kaedenoki.moviecorner.databinding.ActivityChooseModeBinding
import com.kaedenoki.moviecorner.helper.Const.MODE_ANIME
import com.kaedenoki.moviecorner.helper.Const.MODE_SERIES
import com.kaedenoki.moviecorner.helper.Helpers
import com.kaedenoki.moviecorner.repository.local.HawkStore
import com.kaedenoki.moviecorner.ui.activity.main.MainActivity

Expand All @@ -18,8 +19,8 @@ class ChooseModeActivity : AppCompatActivity() {
setContentView(binding.root)

binding.apply {
ivAnime.load("https://images2.alphacoders.com/742/thumb-1920-742320.png")
ivSeries.load("https://assets.st-note.com/production/uploads/images/25980292/picture_pc_1d466b6781c87b2fd537736dc38775f4.jpg")
ivAnime.load(Helpers.imgMode[0])
ivSeries.load(Helpers.imgMode[1])
cardAnime.setOnClickListener {
HawkStore.saveMode(this@ChooseModeActivity, MODE_ANIME)
val intent = Intent(this@ChooseModeActivity, MainActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class DetailActivity : AppCompatActivity() {
tvTotalEps.text =
buildString { append("Total Episode: ").append(it.totalEpisode ?: "-") }

tvSinopsis.text = it.synopsis

episodeAdapter = AnimeEpisodeAdapter(this@DetailActivity, it.episodeList)
}
}
Expand Down
Loading

0 comments on commit 23d465e

Please sign in to comment.