Skip to content

Commit

Permalink
dark-mode-fix-emoji-seperator
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayw1 committed Jan 4, 2025
1 parent d643435 commit f8b1979
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 11 deletions.
30 changes: 23 additions & 7 deletions app/src/main/java/be/scri/services/SimpleKeyboardIME.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ abstract class SimpleKeyboardIME(
DISPLAY_INFORMATION,
}

override fun onCreate() {
super.onCreate()
keyboardBinding = KeyboardViewKeyboardBinding.inflate(layoutInflater)
keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
onCreateInputView()
setupCommandBarTheme(binding)
}

private fun updateCommandBarHintandPrompt() {
val commandBarButton = keyboardBinding.commandBar
val hintMessage = HintUtils.getCommandBarHint(currentState, language)
Expand Down Expand Up @@ -156,8 +164,18 @@ abstract class SimpleKeyboardIME(
ScribeState.SELECT_COMMAND -> keyboardView?.setEnterKeyColor(null, isDarkMode = isDarkMode)
else -> keyboardView?.setEnterKeyColor(getColor(R.color.dark_scribe_blue))
}

if (isDarkMode == true) {
val color = ContextCompat.getColorStateList(this, R.color.light_key_color)
binding.scribeKey.foregroundTintList = color
} else {
val colorLight = ContextCompat.getColorStateList(this, R.color.light_key_text_color)
binding.scribeKey.foregroundTintList = colorLight
}
}



override fun onFinishInputView(finishingInput: Boolean) {
super.onFinishInputView(finishingInput)
currentState = ScribeState.IDLE
Expand All @@ -179,13 +197,8 @@ abstract class SimpleKeyboardIME(
}
}

override fun onCreate() {
super.onCreate()
keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
onCreateInputView()
setupCommandBarTheme(binding)
keyboardBinding = KeyboardViewKeyboardBinding.inflate(layoutInflater)
}



protected fun switchToCommandToolBar() {
val binding = KeyboardViewCommandOptionsBinding.inflate(layoutInflater)
Expand Down Expand Up @@ -219,6 +232,7 @@ abstract class SimpleKeyboardIME(
else -> switchToToolBar()
}
updateEnterKeyColor(isUserDarkMode)
// updateCloseButtonColor(isUserDarkMode)
}

private fun switchToToolBar() {
Expand Down Expand Up @@ -265,6 +279,7 @@ abstract class SimpleKeyboardIME(
binding.pluralBtn.setTextColor(Color.WHITE)
binding.separator2.setBackgroundColor(getColor(R.color.special_key_dark))
binding.separator3.setBackgroundColor(getColor(R.color.special_key_dark))
binding.separator4.setBackgroundColor(getColor(R.color.special_key_dark))
}

else -> {
Expand All @@ -276,6 +291,7 @@ abstract class SimpleKeyboardIME(
binding.pluralBtn.setTextColor(Color.BLACK)
binding.separator2.setBackgroundColor(getColor(R.color.special_key_light))
binding.separator3.setBackgroundColor(getColor(R.color.special_key_light))
binding.separator4.setBackgroundColor(getColor(R.color.special_key_light))
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/emoji_phone_background_rounded.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/light_key_press_color">
android:color="@android:color/transparent">
<item android:id="@+id/phone_emoji_color">
<layer-list>
<item android:id="@+id/button_background_shape">
<shape android:shape="rectangle">
<solid android:color="#80ffbb33" />
<solid android:color="#00ffbb33" /> <!-- Fully transparent -->
<corners android:radius="@dimen/command_button_corner_radius" />
</shape>
</item>
Expand Down
24 changes: 22 additions & 2 deletions app/src/main/res/layout/keyboard_view_command_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
app:layout_constraintStart_toEndOf="@+id/separator_3"
app:layout_constraintTop_toTopOf="@+id/command_field" />


<Button
android:id="@+id/emoji_btn_phone_1"
android:layout_width="0dp"
Expand All @@ -123,16 +124,35 @@
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toStartOf="@+id/plural_btn" />


<View
android:id="@+id/separator_4"
android:layout_width="1dp"
android:layout_height="0dp"
android:background="@color/special_key_light"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/plural_btn"
app:layout_constraintEnd_toStartOf="@+id/emoji_btn_phone_2"
app:layout_constraintHeight_percent="0.8"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toEndOf="@+id/emoji_btn_phone_1"

app:layout_constraintTop_toTopOf="@+id/plural_btn"
app:layout_constraintVertical_bias="0.5" />


<TextView
android:id="@+id/emoji_space_phone"
android:layout_width="wrap_content"
android:layout_height="@dimen/toolbar_icon_height"
android:text=" "
android:text=""
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/plural_btn"
app:layout_constraintStart_toEndOf="@+id/emoji_btn_phone_1"
app:layout_constraintEnd_toStartOf="@+id/emoji_btn_phone_2"
app:layout_constraintTop_toTopOf="@+id/plural_btn" />
app:layout_constraintTop_toTopOf="@+id/plural_btn"

/>

<Button
android:id="@+id/emoji_btn_phone_2"
Expand Down

0 comments on commit f8b1979

Please sign in to comment.