Start align text when displaying in smallest size otherwise center.

This commit is contained in:
Alex Hart 2022-04-06 15:42:40 -03:00 committed by Cody Henthorne
parent 6054285ddb
commit ce8dafd33d

View file

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.mediasend.v2.text
import android.text.Editable
import android.text.TextWatcher
import android.util.TypedValue
import android.view.Gravity
import android.widget.EditText
import android.widget.TextView
import org.signal.core.util.BreakIteratorCompat
@ -30,6 +31,12 @@ class TextStoryTextWatcher private constructor(private val textView: TextView) :
else -> 18f
}
if (expectedTextSize < 24f) {
textView.gravity = Gravity.START
} else {
textView.gravity = Gravity.CENTER
}
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, DimensionUnit.DP.toPixels(expectedTextSize))
}