Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

# Built application files
*.apk
Expand All @@ -38,6 +25,7 @@ build/

# Local configuration file (sdk path, etc)
local.properties
gradle.properties

# Proguard folder generated by Eclipse
proguard/
Expand Down Expand Up @@ -103,19 +91,3 @@ lint/tmp/
*.hprof

.idea/


*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: android
dist: trusty
jdk: oraclejdk8

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache

before_install:
- yes | sdkmanager "platforms;android-29"
- yes | sdkmanager "emulator" "tools" "platform-tools"
- yes | sdkmanager --licenses
- yes | sdkmanager "build-tools;30.0.1"


android:
components:
- build-tools-30.0.1
- android-30
- sys-img-x86-android-30
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'

script:
- "./gradlew spotlessCheck"
- "./gradlew test"
- "./gradlew :app:clean :app:build"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# MovieBrowser

[![Build Status](https://travis-ci.com/harmittaa/MovieBrowser.svg?branch=main)](https://travis-ci.com/harmittaa/MovieBrowser)

Simple browser, displays movies of different categories from the [TMDB](https://www.themoviedb.org/).


## Setting up

Clone and set your TMDB API key in the `gradle.properties`.
101 changes: 95 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,70 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'koin'
apply plugin: 'kotlin-kapt'
apply from: "$project.rootDir/spotless.gradle"



android {
compileSdkVersion 29
compileSdkVersion 30
buildToolsVersion "30.0.1"

defaultConfig {
applicationId "com.github.harmittaa.moviebrowser"
minSdkVersion 24
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
debug {
try {
minifyEnabled false
buildConfigField "String", "TMDB_URL", "\"https://api.themoviedb.org/3/\""
buildConfigField "String", "TMDB_KEY", tmdb_api_key
debuggable true
} catch (e) {
// add gradle.properties file with the following property:
// tmdb_api_key = "YOUR_API_KEY"
throw e
}

}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "TMDB_URL", "\"https://api.themoviedb.org/3/\""
buildConfigField "String", "TMDB_KEY", tmdb_api_key
}
}

buildFeatures {
dataBinding = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility 1.8
targetCompatibility 1.8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
freeCompilerArgs += ["-Xopt-in=org.mylibrary.OptInAnnotation", "-Xopt-in=kotlin.RequiresOptIn"]
}

configurations.all {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.7.1"
resolutionStrategy.force "org.antlr:antlr4-tool:4.7.1"
}
}

kapt {
correctErrorTypes = true
}

dependencies {
Expand Down Expand Up @@ -55,7 +93,7 @@ dependencies {

def glide_version = "4.11.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"

def timber_version = "4.7.1"
implementation "com.jakewharton.timber:timber:$timber_version"
Expand All @@ -70,13 +108,64 @@ dependencies {
// Koin AndroidX Fragment features
implementation "org.koin:koin-androidx-fragment:$koin_version"

def room_version ="2.2.5"
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"

// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"

def recycler_view_version = "1.2.0-alpha05"
implementation "androidx.recyclerview:recyclerview:$recycler_view_version"

def retrofit_version = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"

def moshi_version = "1.9.3"
implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"

def okhttp_version = "4.8.1"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"

implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

def store_version = "4.0.0-alpha07"
implementation "com.dropbox.mobile.store:store4:$store_version"

def coroutines_version = "1.3.9"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"

def progressbar_version = "1.1.0"
implementation "com.github.castorflex.smoothprogressbar:library:$progressbar_version"

// testing
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
def mockito_version = "3.4.0"
testImplementation "org.mockito:mockito-core:$mockito_version"
testImplementation "org.mockito:mockito-inline:$mockito_version"

def mockito_kotlin_version = "2.2.0"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin_version"
testImplementation "android.arch.core:core-testing:$arch_version"

def epoxy_version = "4.0.0-beta6"
implementation "com.airbnb.android:epoxy:$epoxy_version"
implementation "com.airbnb.android:epoxy-databinding:$epoxy_version"
kapt "com.airbnb.android:epoxy-processor:$epoxy_version"

def viewpager_version = "1.0.0"
implementation "androidx.viewpager2:viewpager2:$viewpager_version"

def material_version = "1.3.0-alpha02"
implementation "com.google.android.material:material:$material_version"

def gravity_snap_helper_version = "2.2.1"
implementation "com.github.rubensousa:gravitysnaphelper:$gravity_snap_helper_version"

implementation 'com.wajahatkarim3:roomexplorer:0.0.2'

}
14 changes: 9 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.harmittaa.moviebrowser">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".application.MovieBrowserApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@drawable/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.github.harmittaa.moviebrowser.MainActivity">
android:theme="@style/AppTheme"
android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name="com.github.harmittaa.moviebrowser.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,54 @@ package com.github.harmittaa.moviebrowser

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.harmittaa.moviebrowser.db.MovieDatabase
import com.github.harmittaa.moviebrowser.domain.GenreLocal
import kotlin.coroutines.EmptyCoroutineContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.java.KoinJavaComponent.inject

class MainActivity : AppCompatActivity() {
private val db: MovieDatabase by inject(MovieDatabase::class.java)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportActionBar?.hide()
setContentView(R.layout.activity_main)
prepopulateDb()
}

private fun prepopulateDb() {
val genresList = mutableListOf<GenreLocal>()
defaultGenreList.forEach { (id, name) ->
genresList.add(GenreLocal(id, name))
}

CoroutineScope(EmptyCoroutineContext).launch(Dispatchers.IO) {
db.genreDao().insertGenres(*genresList.toTypedArray())
}
}

private val defaultGenreList = mapOf(
28 to "Action",
12 to "Adventure",
16 to "Animation",
35 to "Comedy",
80 to "Crime",
99 to "Documentary",
18 to "Drama",
1075 to "Family",
14 to "Fantasy",
36 to "History",
27 to "Horror",
10402 to "Music",
9648 to "Mystery",
10749 to "Romance",
878 to "Science Fiction",
10770 to "TV Movie",
53 to "Thriller",
19752 to "War",
37 to "Western"
)
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
package com.github.harmittaa.moviebrowser.application

import android.app.Application
import com.github.harmittaa.moviebrowser.browse.di.viewModelModule
import com.github.harmittaa.moviebrowser.data.di.storeRepositoryModule
import com.github.harmittaa.moviebrowser.data.di.useCaseModule
import com.github.harmittaa.moviebrowser.db.di.databaseModule
import com.github.harmittaa.moviebrowser.epoxy.di.epoxyModule
import com.github.harmittaa.moviebrowser.network.networkModule
import kotlin.time.ExperimentalTime
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import timber.log.Timber

@OptIn(
FlowPreview::class,
ExperimentalCoroutinesApi::class,
ExperimentalTime::class,
ExperimentalStdlibApi::class
)
class MovieBrowserApplication : Application() {

override fun onCreate() {
super.onCreate()
Timber.plant(Timber.DebugTree())
startKoin {
androidContext(this@MovieBrowserApplication)
modules(
listOf(
networkModule,
viewModelModule,
storeRepositoryModule,
useCaseModule,
databaseModule,
epoxyModule
)
)
}
}
}
Loading