CWボタンがテキストだと言語により長すぎるので画像ボタンに変える
This commit is contained in:
parent
8a6ad18ba7
commit
b7bd83a2c5
@ -15,6 +15,7 @@ import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatButton
|
||||
import androidx.appcompat.widget.AppCompatImageButton
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.google.android.flexbox.JustifyContent
|
||||
import jp.juggler.subwaytooter.ActMain
|
||||
@ -85,7 +86,7 @@ class ItemViewHolder(
|
||||
|
||||
lateinit var llContentWarning: View
|
||||
lateinit var tvContentWarning: MyTextView
|
||||
lateinit var btnContentWarning: AppCompatButton
|
||||
lateinit var btnContentWarning: AppCompatImageButton
|
||||
|
||||
lateinit var llContents: View
|
||||
lateinit var tvMentions: MyTextView
|
||||
@ -645,13 +646,13 @@ class ItemViewHolder(
|
||||
}
|
||||
gravity = Gravity.CENTER_VERTICAL
|
||||
|
||||
btnContentWarning = compatButton {
|
||||
btnContentWarning = imageButton {
|
||||
backgroundDrawable =
|
||||
ContextCompat.getDrawable(context, R.drawable.bg_button_cw)
|
||||
minWidthCompat = dip(40)
|
||||
padding = dip(4)
|
||||
//tools:text="見る"
|
||||
}.lparams(wrapContent, dip(40)) {
|
||||
contentDescription = context.getString(R.string.show)
|
||||
imageResource = R.drawable.ic_eye
|
||||
imageTintList = ColorStateList.valueOf(context.attrColor(R.attr.colorTextContent))
|
||||
}.lparams(dip(40), dip(40)) {
|
||||
endMargin = dip(8)
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import jp.juggler.util.ui.setIconDrawableId
|
||||
import jp.juggler.util.ui.textOrGone
|
||||
import jp.juggler.util.ui.vg
|
||||
import org.jetbrains.anko.backgroundColor
|
||||
import org.jetbrains.anko.imageResource
|
||||
import org.jetbrains.anko.textColor
|
||||
|
||||
private val log = LogCategory("ItemViewHolderShowStatus")
|
||||
@ -207,7 +208,9 @@ private fun ItemViewHolder.showSpoilerTextAndContent(status: TootStatus) {
|
||||
// 予約投稿でも使う
|
||||
fun ItemViewHolder.setContentVisibility(shown: Boolean) {
|
||||
llContents.visibility = if (shown) View.VISIBLE else View.GONE
|
||||
btnContentWarning.setText(if (shown) R.string.hide else R.string.show)
|
||||
btnContentWarning.contentDescription = activity.getString(if (shown) R.string.hide else R.string.show)
|
||||
btnContentWarning.imageResource = if (shown) R.drawable.outline_compress_24 else R.drawable.outline_expand_24
|
||||
|
||||
statusShowing?.let { status ->
|
||||
val r = status.auto_cw
|
||||
tvContent.minLines = r?.originalLineCount ?: -1
|
||||
|
5
app/src/main/res/drawable/outline_compress_24.xml
Normal file
5
app/src/main/res/drawable/outline_compress_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,9v2h16V9H4zM16,4l-1.41,-1.41L13,4.17V1h-2v3.19L9.39,2.61L8,4l4,4L16,4zM4,14h16v-2H4V14zM8,19l1.39,1.39L11,18.81V22h2v-3.17l1.59,1.59L16,19l-4,-4L8,19z"/>
|
||||
</vector>
|
7
app/src/main/res/drawable/outline_expand_24.xml
Normal file
7
app/src/main/res/drawable/outline_expand_24.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,20h16v2h-16z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,2h16v2h-16z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M9.41,13.59l-1.41,1.41l4,4l4,-4l-1.41,-1.41l-1.59,1.58l0,-6.34l1.59,1.58l1.41,-1.41l-4,-4l-4,4l1.41,1.41l1.59,-1.58l0,6.34z"/>
|
||||
</vector>
|
Loading…
x
Reference in New Issue
Block a user