mirror of
https://github.com/fcitx5-android/fcitx5-android.git
synced 2026-08-02 20:16:06 +08:00
parent
81e04ec06b
commit
aa6c3a0c82
@ -87,6 +87,7 @@ class ThemePrefs(sharedPreferences: SharedPreferences) :
|
||||
int(R.string.clipboard_entry_radius, "clipboard_entry_radius", 2, 0, 48, "dp")
|
||||
|
||||
enum class PunctuationPosition(override val stringRes: Int) : ManagedPreferenceEnum {
|
||||
None(R.string.punctuation_pos_none),
|
||||
Bottom(R.string.punctuation_pos_bottom),
|
||||
TopRight(R.string.punctuation_pos_top_right);
|
||||
}
|
||||
|
||||
@ -298,6 +298,7 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
|
||||
topToTop = parentId
|
||||
bottomToBottom = parentId
|
||||
}
|
||||
altText.visibility = View.VISIBLE
|
||||
altText.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
// reset
|
||||
bottomToBottom = unset; bottomMargin = 0
|
||||
@ -316,6 +317,7 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
|
||||
topToTop = parentId; topMargin = vMargin
|
||||
bottomToTop = altText.existingOrNewId
|
||||
}
|
||||
altText.visibility = View.VISIBLE
|
||||
altText.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
// reset
|
||||
topToTop = unset; topMargin = 0
|
||||
@ -327,6 +329,18 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyNoAltTextPosition() {
|
||||
mainText.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
// reset
|
||||
topMargin = 0
|
||||
bottomToTop = unset
|
||||
// set
|
||||
topToTop = parentId
|
||||
bottomToBottom = parentId
|
||||
}
|
||||
altText.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun applyLayout(orientation: Int) {
|
||||
when (ThemeManager.prefs.punctuationPosition.getValue()) {
|
||||
PunctuationPosition.Bottom -> when (orientation) {
|
||||
@ -334,6 +348,7 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
|
||||
else -> applyBottomAltTextPosition()
|
||||
}
|
||||
PunctuationPosition.TopRight -> applyTopRightAltTextPosition()
|
||||
PunctuationPosition.None -> applyNoAltTextPosition()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@
|
||||
<string name="punctuation_position">Punctuation position</string>
|
||||
<string name="punctuation_pos_bottom">Bottom (Portrait only)</string>
|
||||
<string name="punctuation_pos_top_right">Top Right</string>
|
||||
<string name="punctuation_pos_none">None</string>
|
||||
<string name="expand_toolbar_by_default">Expand toolbar by default</string>
|
||||
<string name="popup_on_key_press">Popup on key press</string>
|
||||
<string name="disable_animation">Disable animation</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user