Skip to content

Instantly share code, notes, and snippets.

## Privacy Policy
built the Reddito di Cittadinanza App app as a Free app. This SERVICE is provided by at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Reddito di Cittadinanza App unless otherwise defined in this Privacy Policy.
class MainActivity : AppCompatActivity() {
companion object {
val data = arrayOf(
DummyData("1", "Title1.pdf", "https://css4.pub/2015/icelandic/dictionary.pdf"),
DummyData("2", "Title2.pdf", "https://css4.pub/2015/icelandic/dictionary.pdf"),
DummyData("3", "Title3.pdf", "https://css4.pub/2015/icelandic/dictionary.pdf"),
DummyData("4", "Title4.pdf", "https://css4.pub/2017/newsletter/drylab.pdf"),
DummyData("5", "Title5.pdf", "https://css4.pub/2017/newsletter/drylab.pdf"),
DummyData("6", "Title6.pdf", "https://css4.pub/2017/newsletter/drylab.pdf")
class AttachmentAdapter(var dummyes: Array<DummyData>, val listener: (DummyData) -> Unit) : RecyclerView.Adapter<ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_list, parent, false))
override fun getItemCount(): Int = dummyes.size
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val dummy = dummyes[position]
with(holder.itemView) {
@francescogatto
francescogatto / item_list.xml
Created October 15, 2019 12:49
[item_list.xml] #kkd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="80dp"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:padding="10dp">
@francescogatto
francescogatto / build.gradle
Last active October 15, 2019 16:58
[koin.gradle] #kkd
implementation 'org.koin:koin-android:2.0.1'
implementation 'org.koin:koin-androidx-scope:2.0.1'
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'
@francescogatto
francescogatto / initkoin.kt
Created October 15, 2019 16:54
[initkoin.kt] #kkd
startKoin {
androidContext(this@MyApplication)
}
@francescogatto
francescogatto / Extensions.kt
Created October 15, 2019 16:56
[Extensions.kt] #kkd
val globalContext: Context
get() = GlobalContext.get().koin.rootScope.androidContext()
@francescogatto
francescogatto / build.gradle
Created October 15, 2019 17:00
build.gradle init ktor #kkd
// Ktor for Android
implementation "io.ktor:ktor-client-android:1.2.5"
// Ktor JVM(necessary for logging extension)
implementation "io.ktor:ktor-client-logging-jvm:1.2.5"
// Ktor Logging extension
implementation "io.ktor:ktor-client-logging:1.2.5"
// Necessary to show logs in logcat
implementation "ch.qos.logback:logback-classic:1.2.3"
@francescogatto
francescogatto / build.gradle
Created October 15, 2019 17:01
build.gradle ktor #kkd
packagingOptions {
exclude 'META-INF/*.kotlin_module'
}
kotlinOptions {
jvmTarget = "1.8"
}
@francescogatto
francescogatto / Extensions.kt
Last active August 27, 2024 03:38
extensions init ktor #kkd
fun initKtorClient() = HttpClient(Android) {
install(Logging) {
logger = Logger.ANDROID
level = LogLevel.ALL
}
}