Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Mar 24, 2020
1 parent 9eff896 commit d013b7e
Show file tree
Hide file tree
Showing 74 changed files with 2,596 additions and 34 deletions.
39 changes: 5 additions & 34 deletions .gitignore
@@ -1,8 +1,6 @@
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex
Expand All @@ -14,10 +12,9 @@
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
/.idea
.gradle/
build/

Expand All @@ -36,50 +33,24 @@ proguard/
# Android Studio captures folder
captures/

# IntelliJ
# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
freeline_project_description.json
1 change: 1 addition & 0 deletions app/.gitignore
@@ -0,0 +1 @@
/build
79 changes: 79 additions & 0 deletions app/build.gradle
@@ -0,0 +1,79 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: '../dependencies.gradle'

android {
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.skydoves.marvelheroes"
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.versionCode
versionName versions.versionName
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
dataBinding {
enabled = true
}
androidExtensions {
experimental = true
}
}

dependencies {
// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"

// android supports
implementation "com.google.android.material:material:$versions.materialVersion"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintVersion"

// architecture components
implementation "androidx.lifecycle:lifecycle-extensions:$versions.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$versions.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycleVersion"
implementation "androidx.room:room-runtime:$versions.roomVersion"
kapt "androidx.room:room-compiler:$versions.roomVersion"
testImplementation "androidx.arch.core:core-testing:$versions.archCompomentVersion"

// koin
implementation "org.koin:koin-android:$versions.koinVersion"
implementation "org.koin:koin-android-scope:$versions.koinVersion"
implementation "org.koin:koin-android-viewmodel:$versions.koinVersion"

// network
implementation "com.squareup.retrofit2:retrofit:$versions.retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$versions.okhttpVersion"
implementation "com.squareup.retrofit2:converter-gson:$versions.retrofitVersion"

// coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$versions.coroutinesVersion"

// glide
implementation "com.github.bumptech.glide:glide:$versions.glideVersion"
kapt "com.github.bumptech.glide:compiler:$versions.glideVersion"

// transformation
implementation "com.github.skydoves:transformationlayout:$versions.transformationLayout"

// whatIf
implementation "com.github.skydoves:whatif:$versions.whatIfVersion"

// discrete scrollview
implementation "com.yarolegovich:discrete-scrollview:$versions.discreteScrollview"

// debugging
implementation "com.jakewharton.timber:timber:$versions.timberVersion"
}

apply from: '../spotless.gradle'
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
@@ -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
27 changes: 27 additions & 0 deletions app/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.skydoves.marvelheroes">

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

<application
android:name=".MarvelHeroesApplication"
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"
tools:ignore="AllowBackup">
<activity android:name=".view.ui.details.DetailActivity"></activity>
<activity android:name=".view.ui.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
@@ -0,0 +1,47 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress("unused")

package com.skydoves.marvelheroes

import android.app.Application
import com.skydoves.marvelheroes.di.networkModule
import com.skydoves.marvelheroes.di.persistenceModule
import com.skydoves.marvelheroes.di.repositoryModule
import com.skydoves.marvelheroes.di.viewModelModule
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import timber.log.Timber

class MarvelHeroesApplication : Application() {

override fun onCreate() {
super.onCreate()

startKoin {
androidContext(this@MarvelHeroesApplication)
modules(networkModule)
modules(persistenceModule)
modules(repositoryModule)
modules(viewModelModule)
}

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
}
@@ -0,0 +1,35 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.skydoves.marvelheroes.base

import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
* DatabindingActivity is an abstract class for providing [DataBindingUtil].
* provides implementations of only [ViewDataBinding] from an abstract information.
* Do not modify this class. This is a first-level abstraction class.
* If you want to add more specifications, make another class which extends [DatabindingActivity].
*/
abstract class DatabindingActivity : AppCompatActivity() {

protected inline fun <reified T : ViewDataBinding> binding(
@LayoutRes resId: Int
): Lazy<T> = lazy { DataBindingUtil.setContentView<T>(this, resId) }
}
@@ -0,0 +1,39 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.skydoves.marvelheroes.base

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment

/**
* DatabindingFragment is an abstract class for providing [DataBindingUtil].
* provides implementations of only [ViewDataBinding] from an abstract information.
* Do not modify this class. This is a first-level abstraction class.
* If you want to add more specifications, make another class which extends [DatabindingFragment].
*/
abstract class DatabindingFragment : Fragment() {

protected inline fun <reified T : ViewDataBinding> binding(
inflater: LayoutInflater,
@LayoutRes resId: Int,
container: ViewGroup?
): T = DataBindingUtil.inflate(inflater, resId, container, false)
}
@@ -0,0 +1,32 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.skydoves.marvelheroes.base

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers

abstract class LiveCoroutinesViewModel : ViewModel() {

inline fun <T> launchOnViewModelScope(crossinline block: suspend () -> LiveData<T>): LiveData<T> {
return liveData(viewModelScope.coroutineContext + Dispatchers.IO) {
emitSource(block())
}
}
}

0 comments on commit d013b7e

Please sign in to comment.