This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Prevents TouchWiz from surrounding your app icon in a frame --> | |
<!-- Add to your manifest inside the application tag --> | |
<meta-data | |
android:name="com.samsung.android.icon_container.has_icon_container" | |
android:value="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Component( | |
modules = { | |
AppModule.class, JobsModule.class | |
} | |
) | |
public interface AppComponent | |
{ | |
Application getApplication (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Reusable | |
class InjectingSavedStateViewModelFactory @Inject constructor( | |
private val assistedFactories: Map<Class<out ViewModel>, @JvmSuppressWildcards AssistedSavedStateViewModelFactory<out ViewModel>>, | |
private val viewModelProviders: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>> | |
) { | |
/** | |
* Creates instance of ViewModel either annotated with @AssistedInject or @Inject and passes dependencies it needs. | |
*/ | |
fun create(owner: SavedStateRegistryOwner, defaultArgs: Bundle? = null) = | |
object : AbstractSavedStateViewModelFactory(owner, defaultArgs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#. | |
# Add to the end of existing file | |
#. | |
#. | |
# By default this is not a CI environment | |
# To configure for CI either pass to the gradle command -PisCI=true or | |
# set ORG_GRADLE_PROJECT_isCI=true in the environment | |
isCI=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outputs the reading time | |
# Read this in “about 4 minutes” | |
# Put into your _plugins dir in your Jekyll site | |
# Usage: Read this in about {{ page.content | reading_time }} | |
module ReadingTimeFilter | |
def reading_time( input ) | |
words_per_minute = 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FragmentViewBindingDelegate<T : ViewBinding>(private val factory: (View) -> T) : ReadOnlyProperty<Fragment, T> { | |
private var backingValue: T? = null | |
override operator fun getValue(thisRef: Fragment, property: KProperty<*>): T = when (val binding = backingValue) { | |
null -> { | |
thisRef.parentFragmentManager.registerFragmentLifecycleCallbacks(object : FragmentManager.FragmentLifecycleCallbacks() { | |
override fun onFragmentViewDestroyed(fm: FragmentManager, fragment: Fragment) { | |
if (fragment != thisRef) return | |
backingValue = null | |
fm.unregisterFragmentLifecycleCallbacks(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Typeface | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.BoxWithConstraints | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.RowScope | |
import androidx.compose.foundation.layout.fillMaxHeight | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.runtime.Composable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.DefaultLifecycleObserver | |
import androidx.lifecycle.LifecycleOwner | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
fun <T> Fragment.viewLifecycleAware(initialise: () -> T): ReadOnlyProperty<Fragment, T> = | |
object : ReadOnlyProperty<Fragment, T>, DefaultLifecycleObserver { | |
private var value: T? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.animation.core.* | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.BoxWithConstraints | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.getValue | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.geometry.Offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Navigates only if this is safely possible; when this Fragment is still the current destination. | |
*/ | |
fun Fragment.navigateSafe( | |
@IdRes resId: Int, | |
args: Bundle? = null, | |
navOptions: NavOptions? = null, | |
navigatorExtras: Navigator.Extras? = null | |
) { | |
if (mayNavigate()) findNavController().navigate( |
OlderNewer