implement favorite view

This commit is contained in:
Carlos Martinez
2020-02-06 11:32:39 -03:00
parent 1fa3f8c43d
commit f2c9082598
16 changed files with 108 additions and 16 deletions

View File

@@ -1,6 +1,32 @@
package com.hako.base.extensions
import android.os.Bundle
import android.view.View
import androidx.annotation.IdRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.navigation.fragment.NavHostFragment
fun AppCompatActivity.findNavHostFragment(@IdRes id: Int) =
supportFragmentManager.findFragmentById(id) as NavHostFragment
fun NavHostFragment.registerOnFragmentViewCreated(
recursive: Boolean = true,
listener: (currentFragment: Fragment) -> Unit
) {
childFragmentManager
.registerFragmentLifecycleCallbacks(object : FragmentManager.FragmentLifecycleCallbacks() {
override fun onFragmentViewCreated(
fm: FragmentManager,
f: Fragment,
v: View,
savedInstanceState: Bundle?
) {
super.onFragmentViewCreated(fm, f, v, savedInstanceState)
listener(f)
}
}, recursive)
}
fun buildNavigation(@IdRes id: Int, bundle: Bundle = Bundle()) = Pair(id, bundle)

View File

@@ -1,3 +1,7 @@
package com.hako.base.navigation
interface ShowFabButton
interface ShowFabButton {
fun shouldShowFabButton(): Boolean
fun fabButtonPressed(): () -> Unit = {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB