You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/keyboard_holder"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@color/keyboard_bg_root">
<!-- start of base keyboard-->
<LinearLayoutandroid:id="@+id/container_keyboard_main"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"app:layout_constraintBottom_toBottomOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/keyboard_header"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@color/keyboard_bg_root"android:minHeight="@dimen/frogo_dimen_64dp" />
<com.frogobox.libkeyboard.ui.main.MainKeyboard
android:id="@+id/keyboard_main"style="@style/KwKeyboardView"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@color/theme_dark_background_color" />
</LinearLayout>
<!-- End of base keyboard--><!-- below is the layout for your header menu on top of your base keyboard -->
<com.frogobox.appkeyboard.ui.keyboard.autotext.AutoTextKeyboard
android:id="@+id/keyboard_autotext"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<com.frogobox.appkeyboard.ui.keyboard.templatetext.TemplateTextKeyboard
android:id="@+id/keyboard_template_text"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<com.frogobox.appkeyboard.ui.keyboard.news.NewsKeyboard
android:id="@+id/keyboard_news"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<com.frogobox.appkeyboard.ui.keyboard.movie.MovieKeyboard
android:id="@+id/keyboard_moview"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<com.frogobox.appkeyboard.ui.keyboard.webview.WebiewKeyboard
android:id="@+id/keyboard_webview"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<com.frogobox.appkeyboard.ui.keyboard.form.FormKeyboard
android:id="@+id/keyboard_form"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
<!-- end of header menu layout -->
<com.frogobox.libkeyboard.ui.emoji.EmojiKeyboard
android:id="@+id/keyboard_emoji"android:layout_width="match_parent"android:layout_height="0dp"android:clickable="true"android:focusable="true"android:visibility="gone"app:layout_constraintBottom_toBottomOf="@id/container_keyboard_main"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@id/container_keyboard_main" />
</androidx.constraintlayout.widget.ConstraintLayout>
Step 4. Create Service Keyboard IME
Create Class Keyboard IME
classKeyboardIME : BaseKeyboardIME<YourIMELayoutBinding>() {
// set your custom keyboard layoutoverridefunsetupViewBinding(): YourIMELayoutBinding {
returnYourIMELayoutBinding.inflate(LayoutInflater.from(this), null, false)
}
overridefuninitialSetupKeyboard() {
binding?.keyboardMain?.setKeyboard(keyboard!!) // your base keyboard
binding?.mockMeasureHeightKeyboardMain?.setKeyboard(keyboard!!) // this code is for your keyboard header menu
}
overridefunsetupBinding() {
initialSetupKeyboard()
binding?.keyboardMain?.mOnKeyboardActionListener =this
binding?.keyboardEmoji?.mOnKeyboardActionListener =this
}
// redraw keyboard for capslock on/off stateoverridefuninvalidateAllKeys() {
binding?.keyboardMain?.invalidateAllKeys()
}
// call this function when navigating to your featureoverridefunhideMainKeyboard() {
binding?.apply {
keyboardMain.gone()
keyboardHeader.gone()
mockMeasureHeightKeyboard.invisible()
}
}
overridefunshowOnlyKeyboard() {
binding?.keyboardMain?.visible()
}
overridefunhideOnlyKeyboard() {
binding?.keyboardMain?.visible()
}
// setup emoji keyboard overridefunrunEmojiBoard() {
binding?.keyboardEmoji?.visible()
hideMainKeyboard()
binding?.keyboardEmoji?.openEmojiPalette()
}
}
For Emoji Keyboard, dont forget to implement Dependency Injection to load emoji asset manager