Skip to content

Commit

Permalink
Merge pull request #24 from stanwood/develop
Browse files Browse the repository at this point in the history
0.6.0
  • Loading branch information
ubuntudroid authored Apr 18, 2019
2 parents 9a102e0 + aa34bff commit 320b31e
Show file tree
Hide file tree
Showing 24 changed files with 588 additions and 130 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
Expand Down
137 changes: 112 additions & 25 deletions .idea/codeStyles/Project.xml

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

4 changes: 4 additions & 0 deletions .idea/encodings.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.core.content.res.ResourcesCompat
import androidx.databinding.DataBindingComponent
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.support.AndroidSupportInjection
Expand Down Expand Up @@ -72,6 +73,7 @@ class ArmorsFragment : Fragment(), HasSupportFragmentInjector {
.apply {
binding = this
retryCallback = View.OnClickListener { viewModel.retry() }
toWeaponsCallback = Navigation.createNavigateOnClickListener(R.id.showWeapons)
}.root

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -102,7 +104,7 @@ class ArmorsFragment : Fragment(), HasSupportFragmentInjector {
})
navigator.subscribeBy(
viewLifecycleOwner,
onSuccess = { mainNavController.navigate(it.navDirections, it.navOptions) })
onSuccess = { it.navigate(mainNavController) })
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
/*
* Copyright (c) 2019 stanwood GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.stanwood.mhwdb.feature.armors.vm

import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.PublishSubject
import io.stanwood.framework.arch.core.ViewModel
import io.stanwood.framework.arch.core.rx.ResourceStatusTransformer
import io.stanwood.framework.arch.nav.Direction
import io.stanwood.framework.arch.nav.NavigationTarget
import io.stanwood.mhwdb.NavGraphMainDirections
import io.stanwood.mhwdb.feature.armors.dataprovider.ArmorDataProvider
Expand Down Expand Up @@ -53,7 +75,7 @@ class ArmorsViewModel @Inject constructor(private val dataProvider: ArmorDataPro
expandedSetsSubject.onNext(expandedSets)
}
is ArmorItem.ArmorViewModel -> {
navigation.onNext(NavigationTarget(NavGraphMainDirections.showArmorDetails(item.id)))
navigation.onNext(Direction(NavGraphMainDirections.showArmorDetails(item.id)))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 stanwood GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.stanwood.mhwdb.feature.container.ui

import android.os.Bundle
Expand All @@ -11,6 +32,7 @@ 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.syncWith
import io.stanwood.framework.ui.extensions.setApplyWindowInsetsToChild
import io.stanwood.mhwdb.R
import io.stanwood.mhwdb.databinding.FragmentContainerBinding
Expand Down Expand Up @@ -47,6 +69,9 @@ class ContainerFragment : Fragment(), HasSupportFragmentInjector {
.apply {
binding = this
root.setApplyWindowInsetsToChild()
childNavController?.let {
binding?.bottomNav?.syncWith(it, lifecycle)
}
}.root

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand All @@ -58,7 +83,9 @@ class ContainerFragment : Fragment(), HasSupportFragmentInjector {
}
viewModel.apply {
navigator.subscribeBy(viewLifecycleOwner, onNext = {
childNavController?.navigate(it.navDirections, it.navOptions)
childNavController?.let { navController ->
it.navigate(navController)
}
})
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
/*
* Copyright (c) 2019 stanwood GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.stanwood.mhwdb.feature.container.vm

import androidx.annotation.IdRes
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.stanwood.framework.arch.core.ViewModel
import io.stanwood.framework.arch.nav.Direction
import io.stanwood.framework.arch.nav.NavigationTarget
import io.stanwood.mhwdb.NavGraphContainerDirections
import io.stanwood.mhwdb.R
Expand All @@ -17,13 +39,12 @@ class ContainerViewModel @Inject constructor() : ViewModel {
if (id == currentSelectedId) {
true
} else when (id) {
R.id.action_armor -> NavGraphContainerDirections.showArmor()
R.id.action_weapon -> NavGraphContainerDirections.showWeapons()
R.id.thirdItem -> NavGraphContainerDirections.showArmor()
R.id.armorFragment -> NavGraphContainerDirections.showArmor()
R.id.weaponsPagerFragment -> NavGraphContainerDirections.showWeapons()
else -> null
}
?.let {
navigation.onNext(NavigationTarget(it))
navigation.onNext(Direction(it))
true
}
?: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 stanwood GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.stanwood.mhwdb.feature.onboarding.ui

import android.os.Bundle
Expand Down Expand Up @@ -48,7 +69,7 @@ class OnboardingFragment : Fragment(), HasSupportFragmentInjector {
binding?.also { bind ->
bind.lifecycleOwner = viewLifecycleOwner
bind.btnContinue.setOnClickListener { viewModel.nextPage() }
navigator.subscribeBy(viewLifecycleOwner, onNext = { findNavController().navigate(it.navDirections, it.navOptions) })
navigator.subscribeBy(viewLifecycleOwner, onNext = { it.navigate(findNavController()) })
}
}
}
Expand Down
Loading

0 comments on commit 320b31e

Please sign in to comment.