modify keyboard layout,add namespace,fix ime's predict selection

This commit is contained in:
houzh 2023-05-06 08:49:15 +00:00
parent e136aafddf
commit 254e7900eb
8 changed files with 208 additions and 191 deletions

View File

@ -60,6 +60,7 @@ public:
InputMethod* im = InputMethodManager::getInstance().im;
im->get_predicts(s,predicts);
commitText(s);
mText2IM.clear();
candidateView->setSuggestions(predicts,true,true);
}
};
@ -310,7 +311,7 @@ void InputMethodManager::commitText(const std::wstring&text,int newCursorPos){
int InputMethodManager::setInputMethod(InputMethod*method,const std::string&name){
im=method;
std::string layout =method->getKeyboardLayout(mInputType);
Keyboard*kbd=new Keyboard(imeWindow->getContext(),layout,1280,240);
Keyboard*kbd=new Keyboard(imeWindow->getContext(),layout,imeWindow->getWidth(),240);
imeWindow->kbdView->setKeyboard(kbd);
LOGD("inputmethod '%s':%p keyboardlayout:'%s' %p",name.c_str(),im,layout.c_str(),kbd);
return 0;

View File

@ -19,6 +19,7 @@ static std::map<const std::string,int>edgeFlagKVS={
int getDimensionOrFraction(const AttributeSet&attrs,const std::string&key,int base,int def){
const std::string value=attrs.getAttributeValue(key);
if(value.find("%")!=std::string::npos){
LOGD("%d %s[%.f]=%.2f",base,value.c_str(),std::stof(value),base*std::stof(value)/100);
return base*std::stof(value)/100;
}else if(value.find("px")!=std::string::npos){
return std::stoi(value);
@ -175,7 +176,16 @@ Keyboard::Keyboard(Context*context,const std::string& xmlLayoutResId,int width,i
loadKeyboard(context,xmlLayoutResId);
}
Keyboard::Keyboard(Context* context,const std::string& xmlLayoutResId, int modeId):Keyboard(context,xmlLayoutResId,0,0,modeId){
Keyboard::Keyboard(Context* context,const std::string& xmlLayoutResId, int modeId){
DisplayMetrics dm = context->getDisplayMetrics();
mDisplayWidth = dm.widthPixels;
mDisplayHeight= dm.heightPixels;
mDefaultHorizontalGap = 0;
mDefaultWidth = mDisplayWidth / 10;
mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth;
mKeyboardMode = modeId;
loadKeyboard(context,xmlLayoutResId);
}
Keyboard::~Keyboard(){
@ -194,34 +204,37 @@ typedef struct{
std::string package;
int x,y;
int displayWidth,displayHeight;
int defaultKeyWidth;
int keyboardMode;
int minWidth;//min width for keyboard's key row
}KeyboardData;
static void startTag(void *userData, const XML_Char *name, const XML_Char **satts){
KeyboardData*pd=(KeyboardData*)userData;
KeyboardData*pd = (KeyboardData*)userData;
AttributeSet atts(pd->context,pd->package);
Context*context=pd->context;
Keyboard* keyboard=pd->keyboard;
Keyboard::Row*row =pd->row;
Context*context = pd->context;
Keyboard* keyboard= pd->keyboard;
Keyboard::Row*row = pd->row;
int sz;
atts.set(satts);
if(0==strcmp(name,"Keyboard")){
sz= getDimensionOrFraction(atts,"horizontalGap",pd->displayWidth,keyboard->getHorizontalGap());
if(0 == strcmp(name,"Keyboard")){
sz = getDimensionOrFraction(atts,"keyWidth",pd->displayWidth,pd->defaultKeyWidth);
keyboard->setKeyWidth(sz);
sz = getDimensionOrFraction(atts,"horizontalGap",pd->displayWidth,keyboard->getHorizontalGap());
keyboard->setHorizontalGap(sz);
sz= getDimensionOrFraction(atts,"verticalGap",pd->displayHeight,keyboard->getVerticalGap());
sz = getDimensionOrFraction(atts,"verticalGap",pd->displayHeight,keyboard->getVerticalGap());
keyboard->setVerticalGap(sz);
sz= getDimensionOrFraction(atts,"keyHeight",pd->displayHeight,0);
sz = getDimensionOrFraction(atts,"keyHeight",pd->displayHeight,0);
keyboard->setKeyHeight(sz);
pd->minWidth=pd->y=0;
}else if(0==strcmp(name,"Row")){
pd->row=row=new Keyboard::Row(keyboard,context,atts);
pd->minWidth = pd->y = 0;
}else if(0 == strcmp(name,"Row")){
pd->row = row = new Keyboard::Row(keyboard,context,atts);
row->rowEdgeFlags = atts.getInt("rowEdgeFlags",0);
pd->x=0;
}else if(0==strcmp(name,"Key")){
if(row->mode==pd->keyboardMode){
pd->x = 0;
}else if(0 == strcmp(name,"Key")){
if(row->mode == pd->keyboardMode){
Keyboard::Key*key=new Keyboard::Key(row,pd->x,pd->y,context,atts);
if(row->mode==pd->keyboardMode)
if(row->mode == pd->keyboardMode)
row->mKeys.push_back(key);
pd->key=key;
}
@ -229,23 +242,23 @@ static void startTag(void *userData, const XML_Char *name, const XML_Char **satt
}
static void endTag(void *userData, const XML_Char *name){
KeyboardData*pd=(KeyboardData*)userData;
Context*context=pd->context;
Keyboard* keyboard=pd->keyboard;
Keyboard::Row*row =pd->row;
if(0==strcmp(name,"Key")){
if(row->mode==pd->keyboardMode){
Keyboard::Key*key=pd->key;
KeyboardData*pd = (KeyboardData*)userData;
Context*context = pd->context;
Keyboard* keyboard= pd->keyboard;
Keyboard::Row*row = pd->row;
if(0 == strcmp(name,"Key")){
if(row->mode == pd->keyboardMode){
Keyboard::Key*key = pd->key;
pd->keys->push_back(key);
pd->x+=key->width+key->gap;
pd->x += key->width+key->gap;
if(key->codes[0]==Keyboard::KEYCODE_SHIFT||key->codes[0]==Keyboard::KEYCODE_ALT)
keyboard->getModifierKeys().push_back(key);
}
}else if(0==strcmp(name,"Row")){
pd->y+=row->defaultHeight+row->verticalGap;
pd->minWidth=std::max(pd->x,pd->minWidth);
pd->x=0;
if(row->mode==pd->keyboardMode)
pd->y += row->defaultHeight+row->verticalGap;
pd->minWidth = std::max(pd->x,pd->minWidth);
pd->x = 0;
if(row->mode == pd->keyboardMode)
pd->rows->push_back(pd->row);
else delete pd->row;
}
@ -253,16 +266,17 @@ static void endTag(void *userData, const XML_Char *name){
void Keyboard::loadKeyboard(Context*context,const std::string&resid){
std::string package;
ULONGLONG tstart=SystemClock::uptimeMillis();
XML_Parser parser=XML_ParserCreateNS(NULL,':');
ULONGLONG tstart = SystemClock::uptimeMillis();
XML_Parser parser= XML_ParserCreateNS(NULL,' ');
context->getInputStream(resid,&package);
KeyboardData pd={&rows,&mKeys,context,this,nullptr,nullptr,package,0,0};
KeyboardData pd = {&rows,&mKeys,context,this,nullptr,nullptr,package,0,0};
XML_SetUserData(parser,&pd);
XML_SetElementHandler(parser, startTag, endTag);
pd.displayWidth = mDisplayWidth;
pd.displayHeight= mDisplayHeight;
pd.keyboardMode = mKeyboardMode;
pd.defaultKeyWidth=mDefaultWidth;
int len = 0;
std::unique_ptr<std::istream>stream=context->getInputStream(resid);
if(stream){
@ -281,15 +295,16 @@ void Keyboard::loadKeyboard(Context*context,const std::string&resid){
XML_ParserFree(parser);
mTotalHeight= pd.y-mDefaultVerticalGap;
mTotalWidth = pd.minWidth;
mProximityThreshold =mDefaultWidth*.6f;//SEARCH_DISTANCE;
mProximityThreshold*=mProximityThreshold;
LOGD("%s endof loadkeyboard %d rows %d keys gaps=%d,%d parsed size=%dx%d",
resid.c_str(),rows.size(),mKeys.size(),
getHorizontalGap(),getVerticalGap(),mTotalWidth,mTotalHeight);
mProximityThreshold = mDefaultWidth*.6f;//SEARCH_DISTANCE;
mProximityThreshold*= mProximityThreshold;
LOGD("%s endof loadkeyboard %d rows %d keys gaps=%d,%d parsed size=%dx%d display=%dx%d",
resid.c_str(),rows.size(),mKeys.size(), getHorizontalGap(),getVerticalGap(),
mTotalWidth,mTotalHeight,mDisplayWidth,mDisplayHeight);
}
void Keyboard::resize(int newWidth,int newHeight){
int numRows = rows.size();
LOGD("%dx%d",newWidth,newHeight);
for (int rowIndex = 0; rowIndex < numRows; ++rowIndex) {
Row* row = rows.at(rowIndex);
int numKeys = row->mKeys.size();

View File

@ -480,7 +480,7 @@ void Layout::pushLineData(int start,int ytop,int descent,int width){
void Layout::relayout(bool force){
TextExtents extents;
FontExtents fontextents;
double total_width=0;
double total_width = 0;
int start=0,ytop=0;
std::wstring word;
if(!(force||mLayout)) return;
@ -500,21 +500,21 @@ void Layout::relayout(bool force){
case WORDBREAK_NOBREAK:
word.append(1,mText[i]);
measureSize(word,extents);
if(mBreakStrategy && (total_width+extents.x_advance>mWidth)){
if(mBreakStrategy && (total_width + extents.x_advance > mWidth)){
pushLineData(start,ytop,fontextents.descent,ceil(total_width));
ytop += mLineHeight;
mLineCount++;
word.erase();
total_width=0 ; start=i;
}else if(mBreakStrategy){
total_width+=extents.x_advance;
total_width += extents.x_advance;
}
if(mBreakStrategy)word.erase();
break;
case WORDBREAK_BREAK:{
word.append(1,mText[i]);
measureSize(word,extents);
int outofwidth=(total_width+extents.x_advance>mWidth);
int outofwidth=(total_width + extents.x_advance >mWidth);
if( (( (breaks[0]==WORDBREAK_BREAK) && ( outofwidth && (mBreakStrategy==0) ))||(linebreak==LINEBREAK_MUSTBREAK))){
pushLineData(start,ytop,fontextents.descent,ceil(total_width));
ytop += mLineHeight;
@ -524,7 +524,7 @@ void Layout::relayout(bool force){
if(outofwidth)//char[i] is wordbreak char must be in old lines
start=i-(word.length()-1);
}
total_width+=extents.x_advance;
total_width += extents.x_advance;
word.erase();
}
break;
@ -535,7 +535,7 @@ void Layout::relayout(bool force){
if(start<=mText.length()){
measureSize(mText.substr(start),extents);
total_width=extents.x_advance;
total_width = extents.x_advance;
pushLineData(start,ytop,fontextents.descent,ceil(total_width));
ytop += mLineHeight;
if( (mColumns==COLUMNS_ELLIPSIZE) && (total_width>mWidth) ){
@ -603,6 +603,7 @@ void Layout::drawText(Canvas&canvas,int firstLine,int lastLine){
}
void Layout::draw(Canvas&canvas){
canvas.set_font_size(mFontSize);
relayout();
drawText(canvas,0,mLineCount);
}

View File

@ -1,68 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
keyWidth="9.%p"
horizontalGap=".3%p"
verticalGap="5%p"
keyHeight="21%p"
>
android:keyWidth="9.%p"
android:horizontalGap=".3%p"
android:verticalGap="5%p"
android:keyHeight="21%p">
<Row>
<Key codes="113" keyLabel="q" keyEdgeFlags="left"/>
<Key codes="119" keyLabel="w"/>
<Key codes="101" keyLabel="e"/>
<Key codes="114" keyLabel="r"/>
<Key codes="116" keyLabel="t"/>
<Key codes="121" keyLabel="y"/>
<Key codes="117" keyLabel="u"/>
<Key codes="105" keyLabel="i"/>
<Key codes="111" keyLabel="o"/>
<Key codes="112" keyLabel="p" keyEdgeFlags="right"/>
<Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="119" android:keyLabel="w"/>
<Key android:codes="101" android:keyLabel="e"/>
<Key android:codes="114" android:keyLabel="r"/>
<Key android:codes="116" android:keyLabel="t"/>
<Key android:codes="121" android:keyLabel="y"/>
<Key android:codes="117" android:keyLabel="u"/>
<Key android:codes="105" android:keyLabel="i"/>
<Key android:codes="111" android:keyLabel="o"/>
<Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="97" keyLabel="a" horizontalGap="4%p"
keyEdgeFlags="left"/>
<Key codes="115" keyLabel="s"/>
<Key codes="100" keyLabel="d"/>
<Key codes="102" keyLabel="f"/>
<Key codes="103" keyLabel="g"/>
<Key codes="104" keyLabel="h"/>
<Key codes="106" keyLabel="j"/>
<Key codes="107" keyLabel="k"/>
<Key codes="108" keyLabel="l" keyEdgeFlags="right"/>
<Key android:codes="97" android:keyLabel="a" android:horizontalGap="4%p"
android:keyEdgeFlags="left"/>
<Key android:codes="115" android:keyLabel="s"/>
<Key android:codes="100" android:keyLabel="d"/>
<Key android:codes="102" android:keyLabel="f"/>
<Key android:codes="103" android:keyLabel="g"/>
<Key android:codes="104" android:keyLabel="h"/>
<Key android:codes="106" android:keyLabel="j"/>
<Key android:codes="107" android:keyLabel="k"/>
<Key android:codes="108" android:keyLabel="l" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="@mipmap/sym_keyboard_shift"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="122" keyLabel="z"/>
<Key codes="120" keyLabel="x"/>
<Key codes="99" keyLabel="c"/>
<Key codes="118" keyLabel="v"/>
<Key codes="98" keyLabel="b"/>
<Key codes="110" keyLabel="n"/>
<Key codes="109" keyLabel="m"/>
<Key codes="-5" keyIcon="@mipmap/sym_keyboard_delete"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
<Key android:codes="-1" android:keyIcon="@mipmap/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:codes="122" android:keyLabel="z"/>
<Key android:codes="120" android:keyLabel="x"/>
<Key android:codes="99" android:keyLabel="c"/>
<Key android:codes="118" android:keyLabel="v"/>
<Key android:codes="98" android:keyLabel="b"/>
<Key android:codes="110" android:keyLabel="n"/>
<Key android:codes="109" android:keyLabel="m"/>
<Key android:codes="-5" android:keyIcon="@mipmap/sym_keyboard_delete"
android:keyWidth="15%p" android:keyEdgeFlags="right"
android:isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="@mipmap/sym_keyboard_done"
keyWidth="15%p" keyEdgeFlags="left"/>
<Key codes="-2" keyLabel="123" keyWidth="10%p"/>
<Key android:codes="-3" android:keyIcon="@mipmap/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left"/>
<Key android:codes="-2" android:keyLabel="123" android:keyWidth="10%p"/>
<!--
codes: -101 is not a framework-defined key code but a key code that is
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="@mipmap/sym_keyboard_language_switch"
keyWidth="10%p"/>
<Key codes="32" keyIcon="@mipmap/sym_keyboard_space"
keyWidth="30%p" isRepeatable="true"/>
<Key codes="46,44" keyLabel=". ,"
keyWidth="15%p"/>
<Key codes="10" keyIcon="@mipmap/sym_keyboard_return"
keyWidth="20%p" keyEdgeFlags="right"/>
<Key android:codes="-101" android:keyIcon="@mipmap/sym_keyboard_language_switch"
android:keyWidth="10%p"/>
<Key android:codes="32" android:keyIcon="@mipmap/sym_keyboard_space"
android:keyWidth="30%p" android:isRepeatable="true"/>
<Key android:codes="46,44" android:keyLabel=". ,"
android:keyWidth="15%p"/>
<Key android:codes="10" android:keyIcon="@mipmap/sym_keyboard_return"
android:keyWidth="20%p" android:keyEdgeFlags="right"/>
</Row>
</Keyboard>

View File

@ -19,69 +19,69 @@
-->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
keyWidth="10%p"
horizontalGap="0px"
verticalGap="0px"
keyHeight="@dimen/key_height"
>
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="@dimen/key_height">
<Row>
<Key codes="49" keyLabel="1" keyEdgeFlags="left"/>
<Key codes="50" keyLabel="2"/>
<Key codes="51" keyLabel="3"/>
<Key codes="52" keyLabel="4"/>
<Key codes="53" keyLabel="5"/>
<Key codes="54" keyLabel="6"/>
<Key codes="55" keyLabel="7"/>
<Key codes="56" keyLabel="8"/>
<Key codes="57" keyLabel="9"/>
<Key codes="48" keyLabel="0" keyEdgeFlags="right"/>
<Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
<Key android:codes="50" android:keyLabel="2"/>
<Key android:codes="51" android:keyLabel="3"/>
<Key android:codes="52" android:keyLabel="4"/>
<Key android:codes="53" android:keyLabel="5"/>
<Key android:codes="54" android:keyLabel="6"/>
<Key android:codes="55" android:keyLabel="7"/>
<Key android:codes="56" android:keyLabel="8"/>
<Key android:codes="57" android:keyLabel="9"/>
<Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="64" keyLabel="\@" keyEdgeFlags="left"/>
<Key codes="35" keyLabel="\#"/>
<Key codes="36" keyLabel="$"/>
<Key codes="37" keyLabel="%"/>
<Key codes="38" keyLabel="&amp;"/>
<Key codes="42" keyLabel="*"/>
<Key codes="45" keyLabel="-"/>
<Key codes="61" keyLabel="="/>
<Key codes="40" keyLabel="("/>
<Key codes="41" keyLabel=")" keyEdgeFlags="right"/>
<Key android:codes="64" android:keyLabel="\@" android:keyEdgeFlags="left"/>
<Key android:codes="35" android:keyLabel="\#"/>
<Key android:codes="36" android:keyLabel="$"/>
<Key android:codes="37" android:keyLabel="%"/>
<Key android:codes="38" android:keyLabel="&amp;"/>
<Key android:codes="42" android:keyLabel="*"/>
<Key android:codes="45" android:keyLabel="-"/>
<Key android:codes="61" android:keyLabel="="/>
<Key android:codes="40" android:keyLabel="("/>
<Key android:codes="41" android:keyLabel=")" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="@mipmap/sym_keyboard_shift"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="33" keyLabel="!" />
<Key codes="34" keyLabel="&quot;"/>
<Key codes="39" keyLabel="\'"/>
<Key codes="58" keyLabel=":"/>
<Key codes="59" keyLabel=";"/>
<Key codes="47" keyLabel="/" />
<Key codes="63" keyLabel="\?"/>
<Key codes="-5" keyIcon="@mipmap/sym_keyboard_delete"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
<Key android:codes="-1" android:keyIcon="@mipmap/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:codes="33" android:keyLabel="!" />
<Key android:codes="34" android:keyLabel="&quot;"/>
<Key android:codes="39" android:keyLabel="\'"/>
<Key android:codes="58" android:keyLabel=":"/>
<Key android:codes="59" android:keyLabel=";"/>
<Key android:codes="47" android:keyLabel="/" />
<Key android:codes="63" android:keyLabel="\?"/>
<Key android:codes="-5" android:keyIcon="@mipmap/sym_keyboard_delete"
android:keyWidth="15%p" android:keyEdgeFlags="right"
android:isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="@mipmap/sym_keyboard_done"
keyWidth="15%p" keyEdgeFlags="left" />
<Key codes="-2" keyLabel="ABC" keyWidth="10%p" />
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-3" android:keyIcon="@mipmap/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left" />
<Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="10%p" />
<!--
codes: -101 is not a framework-defined key code but a key code that is
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.android.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="@mipmap/sym_keyboard_language_switch"
keyWidth="10%p" />
<Key codes="32" keyIcon="@mipmap/sym_keyboard_space" keyWidth="30%p"
isRepeatable="true"/>
<Key codes="44" keyLabel="," keyWidth="15%p" />
<Key codes="10" keyIcon="@mipmap/sym_keyboard_return"
keyWidth="20%p" keyEdgeFlags="right"
<Key android:codes="-101" android:keyIcon="@mipmap/sym_keyboard_language_switch"
android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@mipmap/sym_keyboard_space" android:keyWidth="30%p"
android:isRepeatable="true"/>
<Key android:codes="44" android:keyLabel="," android:keyWidth="15%p" />
<Key android:codes="10" android:keyIcon="@mipmap/sym_keyboard_return"
android:keyWidth="20%p" android:keyEdgeFlags="right"
/>
</Row>
</Keyboard>

View File

@ -22,65 +22,64 @@
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="@dimen/key_height"
>
android:keyHeight="@dimen/key_height">
<Row>
<Key codes="126" keyLabel="~" keyEdgeFlags="left"/>
<Key codes="177" keyLabel="±"/>
<Key codes="215" keyLabel="×"/>
<Key codes="247" keyLabel="÷"/>
<Key codes="8226" keyLabel="•"/>
<Key codes="176" keyLabel="°"/>
<Key codes="96" keyLabel="`"/>
<Key codes="180" keyLabel="´"/>
<Key codes="123" keyLabel="{"/>
<Key codes="125" keyLabel="}" keyEdgeFlags="right"/>
<Key android:codes="126" android:keyLabel="~" android:keyEdgeFlags="left"/>
<Key android:codes="177" android:keyLabel="±"/>
<Key android:codes="215" android:keyLabel="×"/>
<Key android:codes="247" android:keyLabel="÷"/>
<Key android:codes="8226" android:keyLabel="•"/>
<Key android:codes="176" android:keyLabel="°"/>
<Key android:codes="96" android:keyLabel="`"/>
<Key android:codes="180" android:keyLabel="´"/>
<Key android:codes="123" android:keyLabel="{"/>
<Key android:codes="125" android:keyLabel="}" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="169" keyLabel="©" keyEdgeFlags="left"/>
<Key codes="163" keyLabel="£"/>
<Key codes="8364" keyLabel="€"/>
<Key codes="94" keyLabel="^"/>
<Key codes="174" keyLabel="®"/>
<Key codes="165" keyLabel="¥"/>
<Key codes="95" keyLabel="_"/>
<Key codes="43" keyLabel="+"/>
<Key codes="91" keyLabel="["/>
<Key codes="93" keyLabel="]" keyEdgeFlags="right"/>
<Key android:codes="169" android:keyLabel="©" android:keyEdgeFlags="left"/>
<Key android:codes="163" android:keyLabel="£"/>
<Key android:codes="8364" android:keyLabel="€"/>
<Key android:codes="94" android:keyLabel="^"/>
<Key android:codes="174" android:keyLabel="®"/>
<Key android:codes="165" android:keyLabel="¥"/>
<Key android:codes="95" android:keyLabel="_"/>
<Key android:codes="43" android:keyLabel="+"/>
<Key android:codes="91" android:keyLabel="["/>
<Key android:codes="93" android:keyLabel="]" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key codes="-1" keyIcon="@mipmap/sym_keyboard_shift"
keyWidth="15%p" isModifier="true"
isSticky="true" keyEdgeFlags="left"/>
<Key codes="161" keyLabel="¡" />
<Key codes="60" keyLabel="&lt;"/>
<Key codes="62" keyLabel="&gt;"/>
<Key codes="162" keyLabel="¢"/>
<Key codes="124" keyLabel="|"/>
<Key codes="92" keyLabel="\\" />
<Key codes="191" keyLabel="¿"/>
<Key codes="-5" keyIcon="@mipmap/sym_keyboard_delete"
keyWidth="15%p" keyEdgeFlags="right"
isRepeatable="true"/>
<Key android:codes="-1" android:keyIcon="@mipmap/sym_keyboard_shift"
android:keyWidth="15%p" isModifier="true"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:codes="161" android:keyLabel="¡" />
<Key android:codes="60" android:keyLabel="&lt;"/>
<Key android:codes="62" android:keyLabel="&gt;"/>
<Key android:codes="162" android:keyLabel="¢"/>
<Key android:codes="124" android:keyLabel="|"/>
<Key android:codes="92" android:keyLabel="\\" />
<Key android:codes="191" android:keyLabel="¿"/>
<Key android:codes="-5" android:keyIcon="@mipmap/sym_keyboard_delete"
android:keyWidth="15%p" android:keyEdgeFlags="right"
android:isRepeatable="true"/>
</Row>
<Row rowEdgeFlags="bottom">
<Key codes="-3" keyIcon="@mipmap/sym_keyboard_done"
keyWidth="15%p" keyEdgeFlags="left" />
<Key codes="-2" keyLabel="ABC" keyWidth="10%p" />
<Key android:codes="-3" android:keyIcon="@mipmap/sym_keyboard_done"
android:keyWidth="15%p" android:keyEdgeFlags="left" />
<Key android:codes="-2" android:keyLabel="ABC" android:keyWidth="10%p" />
<!--
codes: -101 is not a framework-defined key code but a key code that is
android:codes: -101 is not a framework-defined key code but a key code that is
privately defined in com.example.@.softkeyboard.LatinKeyboardView.
-->
<Key codes="-101" keyIcon="@mipmap/sym_keyboard_language_switch"
keyWidth="10%p" />
<Key codes="32" keyIcon="@mipmap/sym_keyboard_space" keyWidth="30%p"
isRepeatable="true"/>
<Key codes="8230" keyLabel="…" keyWidth="15%p" />
<Key codes="10" keyIcon="@mipmap/sym_keyboard_return"
keyWidth="20%p" keyEdgeFlags="right" />
<Key android:codes="-101" android:keyIcon="@mipmap/sym_keyboard_language_switch"
android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@mipmap/sym_keyboard_space" android:keyWidth="30%p"
android:isRepeatable="true"/>
<Key android:codes="8230" android:keyLabel="…" android:keyWidth="15%p" />
<Key android:codes="10" android:keyIcon="@mipmap/sym_keyboard_return"
android:keyWidth="20%p" android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -713,7 +713,7 @@ void TabLayout::applyModeAndGravity(){
// If we're scrollable, or fixed at start, inset using padding
paddingStart = std::max(0, mContentInsetStart - mTabPaddingStart);
}
//ViewCompat.setPaddingRelative(mTabStrip, paddingStart, 0, 0, 0);
mTabStrip->setPaddingRelative(paddingStart, 0, 0, 0);
switch (mMode) {
case MODE_FIXED:
@ -1071,7 +1071,7 @@ void TabLayout::TabView::update() {
mTextView = textView;
mDefaultMaxLines = mTextView->getMaxLines();
}
//TextViewCompat.setTextAppearance(mTextView, mTabTextAppearance);
//mTextView->setTextAppearance(mTabTextAppearance);
if (mParent->mTabTextColors) {
mTextView->setTextColor(new ColorStateList(*mParent->mTabTextColors));
}

View File

@ -1738,6 +1738,8 @@ void TextView::onDraw(Canvas& canvas) {
clipTop += std::min(.0f, mShadowDy - mShadowRadius);
clipBottom += std::max(.0f, mShadowDy + mShadowRadius);
}
canvas.rectangle(clipLeft, clipTop, clipRight-clipLeft, clipBottom-clipTop);
canvas.clip();
int voffsetText = 0;
int voffsetCursor = 0;