Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
azisramdhan committed May 22, 2022
0 parents commit b8bf0de
Show file tree
Hide file tree
Showing 108 changed files with 3,871 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
72 changes: 72 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "alfatih.me.moviecatalogue"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true // This line here
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

// Hawk
implementation "com.orhanobut:hawk:2.0.1"

// Timber
implementation 'com.jakewharton.timber:timber:4.7.1'

//Retrofit2
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit2_version"
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2"

// Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'

// RecyclerView
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'

// View Model
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "android.arch.lifecycle:viewmodel:1.1.1"

// Spink Kit Indicator
implementation 'com.github.ybq:Android-SpinKit:1.4.0'

// Koin AndroidX Scope features
implementation "org.koin:koin-androidx-scope:$koin_version"
// Koin AndroidX ViewModel features
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
// Koin AndroidX Experimental features
implementation "org.koin:koin-androidx-ext:$koin_version"

}

androidExtensions {
experimental = true
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package alfatih.me.moviecatalogue

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("alfatih.me.moviecatalogue", appContext.packageName)
}
}
77 changes: 77 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
package="alfatih.me.moviecatalogue">

<!-- https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />

<permission
android:name="alfatih.me.moviecatalogue.READ_DATABASE"
android:protectionLevel="normal" />
<permission
android:name="alfatih.me.moviecatalogue.WRITE_DATABASE"
android:protectionLevel="normal" />

<dist:module dist:instant="true" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<provider
android:name=".data.source.local.movie.MovieProvider"
android:authorities="alfatih.me.moviecatalogue"
android:enabled="true"
android:exported="true" />

<receiver
android:name=".feature.reminder.AlarmReceiver"
android:enabled="true"
android:exported="true" />

<activity
android:name=".feature.reminder.ReminderActivity"
android:parentActivityName=".feature.list.ListActivity" />

<receiver android:name=".widget.FavoriteMovieWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/favorite_movie_widget_info" />
</receiver>

<activity android:name=".feature.favorite.FavoriteActivity" />
<activity
android:name=".feature.detail.movie.DetailMovieActivity"
android:parentActivityName=".feature.list.ListActivity" />
<activity
android:name=".feature.detail.tv.DetailTVShowActivity"
android:parentActivityName=".feature.list.ListActivity" />
<activity android:name=".feature.list.ListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service
android:name=".widget.StackWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
</application>

</manifest>
41 changes: 41 additions & 0 deletions app/src/main/java/alfatih/me/moviecatalogue/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package alfatih.me.moviecatalogue

import alfatih.me.moviecatalogue.feature.detail.movie.module.DetailMovieModule
import alfatih.me.moviecatalogue.feature.detail.tv.module.DetailTVShowModule
import alfatih.me.moviecatalogue.feature.list.module.ListModule
import android.app.Application
import com.orhanobut.hawk.Hawk
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import timber.log.Timber
import timber.log.Timber.DebugTree

class App : Application() {

override fun onCreate() {
super.onCreate()
setupTimber()
setupKoin()
setupHawk()
}

private fun setupHawk() {
Hawk.init(this).build()
}

private fun setupKoin() {
startKoin {
androidContext(this@App)
ListModule.module
DetailMovieModule.module
DetailTVShowModule.module
}
}

private fun setupTimber(){
if (BuildConfig.DEBUG) {
Timber.plant(DebugTree())
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package alfatih.me.moviecatalogue.data.model.movie

import android.os.Parcel
import android.os.Parcelable

data class MovieItem(
val adult: Boolean? = false,
val backdrop_path: String? = "",
val genre_ids: List<Int?>? = listOf(),
val id: Int? = 0,
val original_language: String? = "",
val original_title: String? = "",
val overview: String? = "",
val popularity: Double? = 0.0,
val poster_path: String? = "",
val release_date: String? = "",
val title: String? = "",
val video: Boolean? = false,
val vote_average: Double? = 0.0,
val vote_count: Int? = 0,
val base64_image: String? = ""
) : Parcelable {
constructor(source: Parcel) : this(
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
ArrayList<Int?>().apply { source.readList(this as List<*>, Int::class.java.classLoader) },
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readString(),
source.readValue(Double::class.java.classLoader) as Double?,
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readValue(Double::class.java.classLoader) as Double?,
source.readValue(Int::class.java.classLoader) as Int?,
source.readString()
)

override fun describeContents() = 0

override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeValue(adult)
writeString(backdrop_path)
writeList(genre_ids)
writeValue(id)
writeString(original_language)
writeString(original_title)
writeString(overview)
writeValue(popularity)
writeString(poster_path)
writeString(release_date)
writeString(title)
writeValue(video)
writeValue(vote_average)
writeValue(vote_count)
writeValue(base64_image)
}

companion object {
@JvmField
val CREATOR: Parcelable.Creator<MovieItem> = object : Parcelable.Creator<MovieItem> {
override fun createFromParcel(source: Parcel): MovieItem = MovieItem(source)
override fun newArray(size: Int): Array<MovieItem?> = arrayOfNulls(size)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package alfatih.me.moviecatalogue.data.model.movie

data class MovieResponse(
val page: Int? = 0,
val results: List<MovieItem> = listOf(),
val total_pages: Int? = 0,
val total_results: Int? = 0
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package alfatih.me.moviecatalogue.data.model.movie.detail

data class DetailResponse(
val original_language: String? = null,
val imdb_id: String? = null,
val video: Boolean? = null,
val title: String? = null,
val backdrop_path: String? = null,
val revenue: Int? = null,
val genres: List<GenresItem?>? = null,
val popularity: Double? = null,
val production_countries: List<ProductionCountriesItem?>? = null,
val id: Int? = null,
val vote_count: Int? = null,
val budget: Int? = null,
val overview: String? = null,
val original_title: String? = null,
val runtime: Int? = null,
val poster_path: String? = null,
val spoken_languages: List<SpokenLanguagesItem?>? = null,
val production_companies: List<ProductionCompaniesItem?>? = null,
val release_date: String? = null,
val vote_average: Double? = null,
val belongs_to_collection: Any? = null,
val tagline: String? = null,
val adult: Boolean? = null,
val homepage: String? = null,
val status: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package alfatih.me.moviecatalogue.data.model.movie.detail

data class GenresItem(
val name: String? = null,
val id: Int? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package alfatih.me.moviecatalogue.data.model.movie.detail

data class ProductionCompaniesItem(
val logo_path: String? = null,
val name: String? = null,
val id: Int? = null,
val origin_country: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package alfatih.me.moviecatalogue.data.model.movie.detail

data class ProductionCountriesItem(
val iso_3166_1: String? = null,
val name: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package alfatih.me.moviecatalogue.data.model.movie.detail

data class SpokenLanguagesItem(
val name: String? = null,
val iso_639_1: String? = null
)
Loading

0 comments on commit b8bf0de

Please sign in to comment.