That fuck shit the fascists are using
at master 43 lines 1.2 kB view raw
1package org.tm.archive.components 2 3import android.content.Context 4import android.util.AttributeSet 5import android.widget.TextView 6import androidx.core.content.withStyledAttributes 7import com.google.android.material.card.MaterialCardView 8import org.tm.archive.R 9import org.tm.archive.util.visible 10 11/** 12 * A small card with a circular progress indicator in it. Usable in place 13 * of a ProgressDialog, which is deprecated. 14 * 15 * Remember to add this as the last UI element in your XML hierarchy so it'll 16 * draw over top of other elements. 17 */ 18class ProgressCard @JvmOverloads constructor( 19 context: Context, 20 attrs: AttributeSet? = null 21) : MaterialCardView(context, attrs) { 22 23 private val title: TextView 24 25 init { 26 inflate(context, R.layout.progress_card, this) 27 28 title = findViewById(R.id.progress_card_text) 29 30 if (attrs != null) { 31 context.withStyledAttributes(attrs, R.styleable.ProgressCard) { 32 setTitleText(getString(R.styleable.ProgressCard_progressCardTitle)) 33 } 34 } else { 35 setTitleText(null) 36 } 37 } 38 39 fun setTitleText(titleText: String?) { 40 title.visible = !titleText.isNullOrEmpty() 41 title.text = titleText 42 } 43}