Skip to content

Instantly share code, notes, and snippets.

View DarrenAtherton49's full-sized avatar

Darren Atherton DarrenAtherton49

View GitHub Profile
@DarrenAtherton49
DarrenAtherton49 / styles.xml
Created November 6, 2020 21:53
Implement Material design on Android
<resources>
<!-- https://medium.com/over-engineering/setting-up-a-material-components-theme-for-android-fbf7774da739 -->
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryVariant">@color/primaryLight</item>
<item name="colorOnPrimary">@color/primaryText</item>
<item name="colorSecondary">@color/secondary</item>
<item name="colorSecondaryVariant">@color/secondaryLight</item>
<item name="colorOnSecondary">@color/secondaryText</item>
<item name="colorError">@color/error</item>
@DarrenAtherton49
DarrenAtherton49 / ExampleFragment.kt
Last active September 14, 2020 15:32
Exclude certain Groupie Items from spacing item decoration
recyclerView.addItemDecoration(
LinearSpacingItemDecoration(
spacingInPixels = resources.getDimensionPixelSize(R.dimen.item_spacing),
excludeItem = { item ->
item is RadioButtonItem || item is CheckBoxItem
}
)
)
@DarrenAtherton49
DarrenAtherton49 / .git-commit-template
Created August 21, 2019 22:01 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@DarrenAtherton49
DarrenAtherton49 / GetPosts.kt
Last active July 21, 2017 15:43
Parameterised reactive use cases in Kotlin
class GetPosts @Inject constructor(
uiExecutor: UiExecutor,
@Named("ioExecutor") backgroundExecutor: BackgroundExecutor,
private val redditRepository: RedditRepository
) : ReactiveUseCase<List<RedditLink>>(uiExecutor, backgroundExecutor) {
fun execute(onNext: (List<RedditLink>) -> Unit,
onError: (Throwable) -> Unit,
onCompleted: () -> Unit) {