mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-29 19:18:07 +00:00
fix / word around issues with clipboard toolbar
This commit is contained in:
parent
c80b92dbdc
commit
da69d04993
4 changed files with 12 additions and 20 deletions
|
@ -64,7 +64,11 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
|||
spacebarBackground = Settings.getInstance().current.mColors.selectAndColorDrawable(keyboardViewAttr, ColorType.SPACE_BAR_BACKGROUND)
|
||||
keyboardViewAttr.recycle()
|
||||
val keyboardAttr = context.obtainStyledAttributes(attrs, R.styleable.Keyboard, defStyle, R.style.SuggestionStripView)
|
||||
listOf(ToolbarKey.LEFT, ToolbarKey.RIGHT, ToolbarKey.COPY, ToolbarKey.SELECT_ALL, ToolbarKey.CLEAR_CLIPBOARD)
|
||||
// todo (maybe): setting the correct color only works because the activated state is inverted
|
||||
// even when state is activated, the not activated color is set
|
||||
// in suggestionStripView the same thing works correctly, wtf?
|
||||
// need to properly fix it (and maybe undo the inverted isActivated) when adding a toggle key
|
||||
listOf(ToolbarKey.LEFT, ToolbarKey.RIGHT, ToolbarKey.COPY, ToolbarKey.SELECT_ALL, ToolbarKey.CLEAR_CLIPBOARD, ToolbarKey.ONE_HANDED)
|
||||
.forEach { toolbarKeys.add(createToolbarKey(context, keyboardAttr, it)) }
|
||||
keyboardAttr.recycle()
|
||||
}
|
||||
|
|
|
@ -554,9 +554,9 @@ private fun stateList(pressed: Int, normal: Int): ColorStateList {
|
|||
return ColorStateList(states, intArrayOf(pressed, normal))
|
||||
}
|
||||
|
||||
private fun activatedStateList(activated: Int, normal: Int): ColorStateList {
|
||||
val states = arrayOf(intArrayOf(android.R.attr.state_activated), intArrayOf(-android.R.attr.state_activated))
|
||||
return ColorStateList(states, intArrayOf(activated, normal))
|
||||
private fun activatedStateList(normal: Int, activated: Int): ColorStateList {
|
||||
val states = arrayOf(intArrayOf(-android.R.attr.state_activated), intArrayOf(android.R.attr.state_activated))
|
||||
return ColorStateList(states, intArrayOf(normal, activated))
|
||||
}
|
||||
|
||||
enum class ColorType {
|
||||
|
|
|
@ -25,13 +25,13 @@ fun createToolbarKey(context: Context, keyboardAttr: TypedArray, key: ToolbarKey
|
|||
button.scaleX = 1.2f
|
||||
button.scaleY = 1.2f
|
||||
}
|
||||
button.isActivated = when (key) {
|
||||
button.isActivated = !when (key) {
|
||||
INCOGNITO -> Settings.readAlwaysIncognitoMode(DeviceProtectedUtils.getSharedPreferences(context))
|
||||
ONE_HANDED -> Settings.getInstance().current.mOneHandedModeEnabled
|
||||
AUTOCORRECT -> Settings.getInstance().current.mAutoCorrectionEnabledPerUserSettings
|
||||
else -> true
|
||||
}
|
||||
button.setImageDrawable(keyboardAttr.getDrawable(getStyleableIconId(key)))
|
||||
button.setImageDrawable(keyboardAttr.getDrawable(getStyleableIconId(key))?.mutate())
|
||||
return button
|
||||
}
|
||||
|
||||
|
|
|
@ -29,23 +29,11 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="?attr/suggestionStripViewStyle"
|
||||
>
|
||||
<!-- empty view to move clear button to the right -->
|
||||
style="?attr/suggestionStripViewStyle" >
|
||||
<!-- empty view to move buttons to the right -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
<ImageButton
|
||||
android:id="@+id/clipboard_clear"
|
||||
android:layout_width="@dimen/config_suggestions_strip_edge_key_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:padding="8dp"
|
||||
android:hapticFeedbackEnabled="false"
|
||||
android:soundEffectsEnabled="false"
|
||||
android:scaleType="fitCenter"
|
||||
style="?attr/suggestionWordStyle" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Add table
Reference in a new issue