Skip to content

Commit

Permalink
Merge pull request #34 from stanwood/feature/master_merge
Browse files Browse the repository at this point in the history
Feature/master merge
  • Loading branch information
aclassen authored Oct 11, 2019
2 parents 320b31e + 5a73c89 commit 9a606b7
Show file tree
Hide file tree
Showing 32 changed files with 194 additions and 169 deletions.
9 changes: 0 additions & 9 deletions .idea/codeStyles/Project.xml

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class ArmorsFragment : Fragment(), HasSupportFragmentInjector {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) =
FragmentArmorBinding.inflate(inflater, container, false, dataBindingComponent)
DataBindingUtil.inflate<FragmentArmorBinding>(inflater, R.layout.fragment_armor, container, false, dataBindingComponent)
.apply {
binding = this
retryCallback = View.OnClickListener { viewModel?.retry() }
Expand Down
32 changes: 16 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ buildscript {
jcenter()
}
dependencies {
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-rc02'
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "io.stanwood.mhwdb"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -55,26 +55,26 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.github.stanwood.framework-core-android:ui:0.3'
implementation 'com.github.stanwood.framework-core-android:databinding:0.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.1'
implementation 'com.github.stanwood:debug_app_android:0.2'
implementation 'com.github.stanwood:framework-network-android:1.5.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.10.0'
implementation 'com.github.stanwood:framework-network-android:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
kapt 'com.google.dagger:dagger-compiler:2.21'
kapt 'com.google.dagger:dagger-android-processor:2.21'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
def room_version = "2.1.0-alpha06"
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
kapt 'com.google.dagger:dagger-compiler:2.24'
kapt 'com.google.dagger:dagger-android-processor:2.24'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
def room_version = "2.2.0-rc01"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/io/stanwood/mhwdb/StanwoodApp.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package io.stanwood.mhwdb

import android.app.Activity
import android.app.Application
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector
import dagger.android.HasAndroidInjector
import io.stanwood.mhwdb.di.DaggerAppComponent
import timber.log.Timber
import javax.inject.Inject

class StanwoodApp : Application(), HasActivityInjector {
class StanwoodApp : Application(), HasAndroidInjector {

@Inject
lateinit var activityInjector: DispatchingAndroidInjector<Activity>
lateinit var activityInjector: DispatchingAndroidInjector<Any>

override fun activityInjector(): AndroidInjector<Activity> = activityInjector
override fun androidInjector(): AndroidInjector<Any> = activityInjector

override fun onCreate() {
super.onCreate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import dagger.Module
import dagger.Provides
import io.reactivex.schedulers.Schedulers
import io.stanwood.debugapp.LoggingInterceptor
import io.stanwood.framework.network.interceptor.ConnectivityInterceptor
import io.stanwood.framework.network.retrofit.BufferedSourceConverterFactory
import io.stanwood.framework.network.core.interceptor.ConnectivityInterceptor
import io.stanwood.framework.network.core.retrofit.BufferedSourceConverterFactory
import io.stanwood.mhwdb.BuildConfig
import io.stanwood.mhwdb.datasource.net.mhw.MhwApi
import okhttp3.Cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package io.stanwood.mhwdb.datasource.net.mhw

import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable

@Serializable
Expand All @@ -30,6 +29,6 @@ data class MhwArmor(
val type: String,
val rank: String,
val name: String,
@Optional val assets: MhwArmorAsset? = null,
@Optional val armorSet: MhwArmorSetInfo? = null
val assets: MhwArmorAsset? = null,
val armorSet: MhwArmorSetInfo? = null
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.stanwood.mhwdb.datasource.net.mhw

import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable

@Serializable
data class MhwArmorAsset(@Optional val imageMale: String? = null, @Optional val imageFemale: String? = null)
data class MhwArmorAsset(val imageMale: String? = null, val imageFemale: String? = null)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.stanwood.mhwdb.datasource.net.mhw

import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable

@Serializable
data class MhwWeapon(val id: Long, val type: String, val name: String, @Optional val assets: MhwWeaponAsset? = null)
data class MhwWeapon(val id: Long, val type: String, val name: String, val assets: MhwWeaponAsset? = null)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.stanwood.mhwdb.datasource.net.mhw

import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable

@Serializable
data class MhwWeaponAsset(@Optional val icon: String? = null, @Optional val image: String? = null)
data class MhwWeaponAsset(val icon: String? = null, val image: String? = null)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package io.stanwood.mhwdb.feature

import android.content.Context
import io.stanwood.framework.network.util.NoConnectivityException
import io.stanwood.framework.network.core.util.NoConnectivityException
import io.stanwood.mhwdb.R
import retrofit2.HttpException
import java.net.SocketTimeoutException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package io.stanwood.mhwdb.feature.armors.ui
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingComponent
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import io.stanwood.framework.databinding.recyclerview.BindingViewHolder
import io.stanwood.mhwdb.BR
import io.stanwood.mhwdb.databinding.LayoutArmorDetailsItemBinding
import io.stanwood.mhwdb.R
import io.stanwood.mhwdb.feature.armors.vm.ArmorDetailsItemViewModel

class ArmorDetailsAdapter(
Expand All @@ -31,12 +32,7 @@ class ArmorDetailsAdapter(

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
BindingViewHolder(
LayoutArmorDetailsItemBinding.inflate(
inflater,
parent,
false,
dataBindingComponent
)
DataBindingUtil.inflate(inflater, R.layout.layout_armor_details_item, parent, false, dataBindingComponent)
)

override fun onBindViewHolder(holder: BindingViewHolder, position: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,35 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingComponent
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import dagger.android.support.AndroidSupportInjection
import dagger.android.support.HasSupportFragmentInjector

import io.stanwood.framework.arch.core.rx.subscribeBy
import io.stanwood.framework.arch.di.factory.ViewModelFactory
import io.stanwood.framework.arch.nav.addNavigateUp
import io.stanwood.mhwdb.R
import io.stanwood.mhwdb.databinding.FragmentArmorDetailsBinding
import io.stanwood.mhwdb.feature.armors.vm.ArmorDetailsViewModel
import javax.inject.Inject

class ArmorDetailsFragment : Fragment(), HasSupportFragmentInjector {
class ArmorDetailsFragment : Fragment(), HasAndroidInjector {

@Inject
internal lateinit var viewModelFactory: ViewModelFactory<ArmorDetailsViewModel>
private lateinit var viewModel: ArmorDetailsViewModel
@Inject
internal lateinit var androidInjector: DispatchingAndroidInjector<Fragment>
internal lateinit var androidInjector: DispatchingAndroidInjector<Any>
@Inject
internal lateinit var dataBindingComponent: DataBindingComponent
private var binding: FragmentArmorDetailsBinding? = null
private var rcvAdapter: ArmorDetailsAdapter? = null

override fun supportFragmentInjector() = androidInjector
override fun androidInjector(): AndroidInjector<Any> = androidInjector

override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
Expand All @@ -62,7 +66,13 @@ class ArmorDetailsFragment : Fragment(), HasSupportFragmentInjector {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) =
FragmentArmorDetailsBinding.inflate(inflater, container, false, dataBindingComponent)
DataBindingUtil.inflate<FragmentArmorDetailsBinding>(
inflater,
R.layout.fragment_armor_details,
container,
false,
dataBindingComponent
)
.apply {
binding = this
}.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package io.stanwood.mhwdb.feature.armors.ui
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingComponent
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import io.stanwood.framework.databinding.recyclerview.BindingViewHolder
import io.stanwood.mhwdb.BR
import io.stanwood.mhwdb.R
import io.stanwood.mhwdb.databinding.LayoutArmorItemBinding
import io.stanwood.mhwdb.databinding.LayoutArmorSetItemBinding
import io.stanwood.mhwdb.feature.armors.vm.ArmorItem
Expand Down Expand Up @@ -38,23 +40,33 @@ class ArmorsAdapter(

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
when (viewType) {
ArmorItem.ArmorViewModel.VIEW_TYPE -> DividerViewHolder(LayoutArmorItemBinding.inflate(
inflater,
parent,
false,
dataBindingComponent
)
.apply {
root.setOnClickListener {
this.vm?.apply { clickCallback.invoke(this) }
}
})
else -> BindingViewHolder(LayoutArmorSetItemBinding.inflate(inflater, parent, false, dataBindingComponent)
.apply {
root.setOnClickListener {
this.vm?.apply { clickCallback.invoke(this) }
}
})

ArmorItem.ArmorViewModel.VIEW_TYPE -> DividerViewHolder(
DataBindingUtil.inflate<LayoutArmorItemBinding>(
inflater,
R.layout.layout_armor_item,
parent,
false,
dataBindingComponent
)
.apply {
root.setOnClickListener {
this.vm?.apply { clickCallback.invoke(this) }
}
})
else -> BindingViewHolder(
DataBindingUtil.inflate<LayoutArmorSetItemBinding>(
inflater,
R.layout.layout_armor_set_item,
parent,
false,
dataBindingComponent
)
.apply {
root.setOnClickListener {
this.vm?.apply { clickCallback.invoke(this) }
}
})
}

override fun onBindViewHolder(holder: BindingViewHolder, position: Int, payloads: MutableList<Any>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,36 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.content.res.ResourcesCompat
import androidx.databinding.DataBindingComponent
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.Navigation
import androidx.recyclerview.widget.LinearLayoutManager
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import dagger.android.support.AndroidSupportInjection
import dagger.android.support.HasSupportFragmentInjector
import io.stanwood.framework.arch.core.rx.subscribeBy
import io.stanwood.framework.arch.di.factory.ViewModelFactory
import io.stanwood.mhwdb.R
import io.stanwood.mhwdb.databinding.FragmentArmorBinding
import io.stanwood.mhwdb.feature.armors.vm.ArmorsViewModel
import javax.inject.Inject

class ArmorsFragment : Fragment(), HasSupportFragmentInjector {
class ArmorsFragment : Fragment(), HasAndroidInjector {

@Inject
internal lateinit var viewModelFactory: ViewModelFactory<ArmorsViewModel>
private lateinit var viewModel: ArmorsViewModel
@Inject
internal lateinit var androidInjector: DispatchingAndroidInjector<Fragment>
internal lateinit var androidInjector: DispatchingAndroidInjector<Any>
@Inject
internal lateinit var dataBindingComponent: DataBindingComponent
@Inject
internal lateinit var mainNavController: NavController
private var binding: FragmentArmorBinding? = null
private var rcvAdapter: ArmorsAdapter? = null

override fun supportFragmentInjector() = androidInjector
override fun androidInjector() = androidInjector

override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
Expand All @@ -69,7 +70,7 @@ class ArmorsFragment : Fragment(), HasSupportFragmentInjector {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) =
FragmentArmorBinding.inflate(inflater, container, false, dataBindingComponent)
DataBindingUtil.inflate<FragmentArmorBinding>(inflater, R.layout.fragment_armor, container, false, dataBindingComponent)
.apply {
binding = this
retryCallback = View.OnClickListener { viewModel.retry() }
Expand Down
Loading

0 comments on commit 9a606b7

Please sign in to comment.