I've been trying to solve a mysterious problem with the SoftKeyboard project I'm working on. The source of the problem from all of the research I've done may be related to the layout file that I've created. Lint complains of too many views beyond 80 and it types fine for my speed but I'm after fact action response from this and can't figure out where the source of the lag is.
I've done all of the Android Manifest tricks and XML tricks I could find, tried converting to the new Constraint Layout Relative Layout made it worse. I don't know how to use Trace View in Android Studio 2.2RC Build so not sure if threads are the issue. But the question I have is how could I make this file more efficient to improve the lag.
Further sometimes when I press a key it fires and others it misses and yet if I randomly toggle all of my fingers super fast across the keypad canvas area like taping my fingers super fast the input seems to keep up with my input events but the output trails behind quite slow like 4-6 seconds behind and it's annoying. For all of the keyboards on Play I see none of them have this issue as I can type super fast and when I stop the input the output stops at the same time.
So I see there are quite a few people who know how to build a great performing keyboard but this one is super slow when trying to type fast. Also if I type a huge amount of data in say like an SMS message it crashes the keyboard and that is the other part really bugging me like there is a buffer limit to this code.
The limit here is 30000 I was only able to paste part of the layout file and since I don't have enough reputation I can't reply..
Can any of the keyboard gurus out here tell me what I'm missing?
<?xml version="1.0" encoding="utf-8"?>
<!--suppress ALL -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="false"
android:focusableInTouchMode="false"
android:gravity="bottom">
<LinearLayout
android:id="@+id/num_keyLay"
android:layout_width="match_parent"
android:layout_height="54.2dp"
android:orientation="horizontal"
android:weightSum="10"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/ksOne_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksOne_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/key_drwable_selector"
android:text="1"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/kstwo_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/kstwo_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="2"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksthree_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksthree_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="3"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksFour_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksFour_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="4"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksFive_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksFive_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="5"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksSix_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksSix_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="6"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksSeven_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksSeven_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="7"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksEight_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksEight_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="8"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksNine_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksNine_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="9"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/ksZero_btn_LiLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/ksZero_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="0"
android:textSize="25sp"
android:textColor="@android:color/white"
android:textStyle="bold"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/line_firstLay"
android:layout_width="match_parent"
android:layout_height="54.2dp"
android:orientation="horizontal"
android:weightSum="10"
tools:ignore="DisableBaselineAlignment">
<LinearLayout
android:id="@+id/q_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/q_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="q"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/Q_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="Q"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/w_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/w_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="w"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/W_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="W"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/e_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/e_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="e"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/E_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="E"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/r_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/r_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="r"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/R_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="R"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/t_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/t_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="t"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/T_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="T"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/y_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/y_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="y"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/Y_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="Y"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/u_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/u_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="u"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/U_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="U"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/i_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >
<Button
android:id="@+id/i_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="i"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/I_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/key_drwable_selector"
android:text="I"
android:textColor="@color/white"
android:textSize="25sp"
android:textStyle="bold"
android:textAllCaps="false"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/o_btn_ReLay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/backgroud_black"
android:orientation="horizontal" >