mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
CFV2 Save to Disk / Copy Text Content.
This commit is contained in:
committed by
Cody Henthorne
parent
399421e20e
commit
b785b3f887
@@ -2,8 +2,11 @@ package org.thoughtcrime.securesms.components
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.withStyledAttributes
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
/**
|
||||
* A small card with a circular progress indicator in it. Usable in place
|
||||
@@ -16,7 +19,25 @@ class ProgressCard @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : MaterialCardView(context, attrs) {
|
||||
|
||||
private val title: TextView
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.progress_card, this)
|
||||
|
||||
title = findViewById(R.id.progress_card_text)
|
||||
|
||||
if (attrs != null) {
|
||||
context.withStyledAttributes(attrs, R.styleable.ProgressCard) {
|
||||
setTitleText(getString(R.styleable.ProgressCard_progressCardTitle))
|
||||
}
|
||||
} else {
|
||||
setTitleText(null)
|
||||
}
|
||||
}
|
||||
|
||||
fun setTitleText(titleText: String?) {
|
||||
title.visible = !titleText.isNullOrEmpty()
|
||||
title.text = titleText
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,26 @@ import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.thoughtcrime.securesms.R
|
||||
|
||||
/**
|
||||
* Displays a small progress spinner in a card view, as a non-cancellable dialog fragment.
|
||||
*/
|
||||
class ProgressCardDialogFragment : DialogFragment(R.layout.progress_card_dialog) {
|
||||
|
||||
private val args: ProgressCardDialogFragmentArgs by navArgs()
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
isCancelable = false
|
||||
return super.onCreateDialog(savedInstanceState).apply {
|
||||
this.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
view.findViewById<ProgressCard>(R.id.progress_card).setTitleText(args.title)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user