3408 home help message (#3415)
* 3408: First draft of help message on empty home timeline * 3408: Move image spanning to utils; tweak gui a bit (looks like status) * 3408: Use proper R again; appease linter * 3408: Add doc; remove narrow comment * 3408: null is default * 3408: Add German text * 3408: Stack refresh animation on top of help message (reorder)
This commit is contained in:
parent
9484a8b2b9
commit
182df2bfae
9 changed files with 200 additions and 93 deletions
|
|
@ -6,15 +6,16 @@ import android.view.Gravity
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.databinding.ViewBackgroundMessageBinding
|
||||
import com.keylesspalace.tusky.util.addDrawables
|
||||
import com.keylesspalace.tusky.util.visible
|
||||
|
||||
/**
|
||||
* This view is used for screens with downloadable content which may fail.
|
||||
* Can show an image, text and button below them.
|
||||
* This view is used for screens with content which may be empty or might have failed to download.
|
||||
*/
|
||||
class BackgroundMessageView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
|
@ -47,4 +48,15 @@ class BackgroundMessageView @JvmOverloads constructor(
|
|||
binding.button.setOnClickListener(clickListener)
|
||||
binding.button.visible(clickListener != null)
|
||||
}
|
||||
|
||||
fun showHelp(@StringRes helpRes: Int) {
|
||||
val size: Int = binding.helpText.textSize.toInt() + 2
|
||||
val color = binding.helpText.currentTextColor
|
||||
val text = context.getText(helpRes)
|
||||
val textWithDrawables = addDrawables(text, color, size, context)
|
||||
|
||||
binding.helpText.setText(textWithDrawables, TextView.BufferType.SPANNABLE)
|
||||
|
||||
binding.helpText.visible(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue