Skip to content

Commit aa6c3a0

Browse files
eagleoflqjrocka
andauthored
Add option to hide altText (#720)
Co-authored-by: Rocka <i@rocka.me>
1 parent 81e04ec commit aa6c3a0

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

app/src/main/java/org/fcitx/fcitx5/android/data/theme/ThemePrefs.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ThemePrefs(sharedPreferences: SharedPreferences) :
8787
int(R.string.clipboard_entry_radius, "clipboard_entry_radius", 2, 0, 48, "dp")
8888

8989
enum class PunctuationPosition(override val stringRes: Int) : ManagedPreferenceEnum {
90+
None(R.string.punctuation_pos_none),
9091
Bottom(R.string.punctuation_pos_bottom),
9192
TopRight(R.string.punctuation_pos_top_right);
9293
}

app/src/main/java/org/fcitx/fcitx5/android/input/keyboard/KeyView.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
298298
topToTop = parentId
299299
bottomToBottom = parentId
300300
}
301+
altText.visibility = View.VISIBLE
301302
altText.updateLayoutParams<ConstraintLayout.LayoutParams> {
302303
// reset
303304
bottomToBottom = unset; bottomMargin = 0
@@ -316,6 +317,7 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
316317
topToTop = parentId; topMargin = vMargin
317318
bottomToTop = altText.existingOrNewId
318319
}
320+
altText.visibility = View.VISIBLE
319321
altText.updateLayoutParams<ConstraintLayout.LayoutParams> {
320322
// reset
321323
topToTop = unset; topMargin = 0
@@ -327,13 +329,26 @@ class AltTextKeyView(ctx: Context, theme: Theme, def: KeyDef.Appearance.AltText)
327329
}
328330
}
329331

332+
private fun applyNoAltTextPosition() {
333+
mainText.updateLayoutParams<ConstraintLayout.LayoutParams> {
334+
// reset
335+
topMargin = 0
336+
bottomToTop = unset
337+
// set
338+
topToTop = parentId
339+
bottomToBottom = parentId
340+
}
341+
altText.visibility = View.GONE
342+
}
343+
330344
private fun applyLayout(orientation: Int) {
331345
when (ThemeManager.prefs.punctuationPosition.getValue()) {
332346
PunctuationPosition.Bottom -> when (orientation) {
333347
Configuration.ORIENTATION_LANDSCAPE -> applyTopRightAltTextPosition()
334348
else -> applyBottomAltTextPosition()
335349
}
336350
PunctuationPosition.TopRight -> applyTopRightAltTextPosition()
351+
PunctuationPosition.None -> applyNoAltTextPosition()
337352
}
338353
}
339354

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<string name="punctuation_position">Punctuation position</string>
123123
<string name="punctuation_pos_bottom">Bottom (Portrait only)</string>
124124
<string name="punctuation_pos_top_right">Top Right</string>
125+
<string name="punctuation_pos_none">None</string>
125126
<string name="expand_toolbar_by_default">Expand toolbar by default</string>
126127
<string name="popup_on_key_press">Popup on key press</string>
127128
<string name="disable_animation">Disable animation</string>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy