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
FROM balenalib/raspberrypi3-openjdk:8-jdk | |
ENV APPLICATION_USER ktor | |
RUN useradd -ms /bin/bash $APPLICATION_USER | |
RUN mkdir /app | |
RUN chown -R $APPLICATION_USER /app | |
USER $APPLICATION_USER |
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
<androidx.constraintlayout.widget.ConstraintLayout | |
android:id="@+id/a_container_id" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="52dp" | |
android:layout_marginEnd="16dp" | |
android:maxWidth="296dp" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent"> |
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
abstract class ViewBindingDiffUtilCallback<Item : ViewBindingAdapterItem> : | |
DiffUtil.ItemCallback<Item>() |
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.view.LayoutInflater | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.viewbinding.ViewBinding | |
abstract class ViewBindingAdapter<Item : ViewBindingAdapterItem, VB : ViewBinding>( | |
diffCallback: ViewBindingDiffUtilCallback<Item> | |
) : ListAdapter<Item, ViewBindingViewHolder<Item, VB>>(diffCallback) { | |
override fun onBindViewHolder(holder: ViewBindingViewHolder<Item, VB>, position: Int) = | |
holder.bind(item = getItem(position)) |
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.recyclerview.widget.RecyclerView | |
import androidx.viewbinding.ViewBinding | |
abstract class ViewBindingViewHolder<Item : ViewBindingAdapterItem, out VB : ViewBinding>( | |
protected val binding: VB | |
) : RecyclerView.ViewHolder(binding.root) { | |
abstract fun bind(item: Item) | |
open fun bind(item: Item, payloads: List<Any>) { | |
if (payloads.isEmpty()) { | |
bind(item = item) |
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
interface ViewBindingAdapterItem { | |
val itemViewType: Int | |
} |
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
private val client = HttpClient(OkHttp) { | |
install(JsonFeature) { | |
serializer = GsonSerializer() | |
} | |
install(HttpTimeout) { | |
requestTimeoutMillis = 30_000 | |
} | |
install(Logging) { | |
logger = Logger.DEFAULT |
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
subprojects { | |
// Accessing the `PluginContainer` in order to use `whenPluginAdded` function | |
project.plugins.configure(project = project) | |
} | |
// Extension function on `PluginContainer` | |
fun PluginContainer.configure(project: Project) { | |
whenPluginAdded { | |
when (this) { | |
is AppPlugin -> { |
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
val compile_sdk_version: Int by rootProject | |
val min_sdk_version: Int by rootProject | |
val target_sdk_version: Int by rootProject | |
android { | |
compileSdkVersion(compile_sdk_version) | |
defaultConfig { | |
minSdkVersion(min_sdk_version) | |
targetSdkVersion(target_sdk_version) | |
} |
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
ext.set("alwaysUpdateBuildId", false) | |
val alwaysUpdateBuildId by extra { false } | |
(this as ExtensionAware).extra["alwaysUpdateBuildId"] = false |