Refactor: Keyboard2View: Take layout id attr

Removes EmojiBottomRow.
This commit is contained in:
Jules Aguillon 2024-01-13 23:22:26 +01:00
parent eddf9c6c11
commit b114c78bf1
3 changed files with 7 additions and 16 deletions

View File

@ -3,6 +3,6 @@
<juloo.keyboard2.EmojiGroupButtonsBar android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<juloo.keyboard2.EmojiGridView android:id="@+id/emoji_grid" android:layout_width="fill_parent" android:layout_height="@dimen/emoji_grid_height" android:orientation="vertical" android:numColumns="auto_fit" android:columnWidth="45sp" android:background="?attr/colorKeyboard"/>
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<juloo.keyboard2.EmojiBottomRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/emoji_key_bg"/>
<juloo.keyboard2.Keyboard2View layout="@xml/emoji_bottom_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/emoji_key_bg"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,14 +0,0 @@
package juloo.keyboard2;
import android.content.Context;
import android.util.AttributeSet;
public class EmojiBottomRow extends Keyboard2View
{
public EmojiBottomRow(Context context, AttributeSet attrs)
{
super(context, attrs);
KeyboardData kw = KeyboardData.load(getResources(), R.xml.emoji_bottom_row);
setKeyboard(kw);
}
}

View File

@ -54,7 +54,12 @@ public class Keyboard2View extends View
_pointers = new Pointers(this, _config);
refresh_navigation_bar(context);
setOnTouchListener(this);
reset();
int layout_id = (attrs == null) ? 0 :
attrs.getAttributeResourceValue(null, "layout", 0);
if (layout_id == 0)
reset();
else
setKeyboard(KeyboardData.load(getResources(), layout_id));
}
private Window getParentWindow(Context context)