mirror of
https://github.com/imcarlost/Friendlists.git
synced 2026-04-10 02:46:54 -04:00
implement favorite view
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
package com.hako.base.navigation
|
||||
|
||||
interface ShowFabButton
|
||||
interface ShowFabButton {
|
||||
fun shouldShowFabButton(): Boolean
|
||||
|
||||
fun fabButtonPressed(): () -> Unit = {}
|
||||
}
|
||||
BIN
base/src/main/res/drawable-hdpi/ic_heart.png
Normal file
BIN
base/src/main/res/drawable-hdpi/ic_heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 778 B |
BIN
base/src/main/res/drawable-mdpi/ic_heart.png
Normal file
BIN
base/src/main/res/drawable-mdpi/ic_heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 457 B |
BIN
base/src/main/res/drawable-xhdpi/ic_heart.png
Normal file
BIN
base/src/main/res/drawable-xhdpi/ic_heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 890 B |
BIN
base/src/main/res/drawable-xxhdpi/ic_heart.png
Normal file
BIN
base/src/main/res/drawable-xxhdpi/ic_heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1023 B |
BIN
base/src/main/res/drawable-xxxhdpi/ic_heart.png
Normal file
BIN
base/src/main/res/drawable-xxxhdpi/ic_heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user