Skip to content

Instantly share code, notes, and snippets.

View AndrewHaisting's full-sized avatar

Andrew Haisting AndrewHaisting

View GitHub Profile

Test markdown gist!

  • Is there formatting?
  • Can I see it nice on mobile?
  1. Does it support numbers?

Subtitle

Body

// ...
dependencies {
// ...
detekt("io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version")
detekt("io.gitlab.arturbosch.detekt:detekt-cli:$detekt_version")
}
buildscript {
// ...
repositories {
// ...
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// ...
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.1.1"
}
Use the command below to get started:
./adb shell monkey -p com.example.packagename -v 500
-p specifies the package name
-v specifies low verbosity
For full details on flags, check out https://developer.android.com/studio/test/monkey
android {
// ...
signingConfigs {
debug {
keyAlias 'debug'
keyPassword 'android'
storeFile file('../debug.jks')
storePassword 'android'
}
}
<activity-alias
android:name="Launcher"
android:targetActivity=".ui.activity.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
override fun onBindViewHolder(holder: ViewHolder,
position: Int,
payloads: MutableList<Any>) {
if (!payloads.isEmpty()) {
// Because these updates can be batched,
// there can be multiple payloads for a single bind
when (payloads[0]) {
Payload.FAVORITE_CHANGE -> {
// Change only the "favorite" icon,
// leave background image alone:
override fun onImageClick(item: ImageItem) {
item.isFavorited = !item.isFavorited
recycler.adapter.notifyItemChanged(items.indexOf(item),
ImageAdapter.Payload.FAVORITE_CHANGE)
// We'll check for Payload.FAVORITE_CHANGE in our adapter
}
override fun onImageClick(item: ImageItem) {
item.isFavorited = !item.isFavorited
recycler.adapter.notifyItemChanged(items.indexOf(item))
}