fix TextView::textAppearance

This commit is contained in:
侯歌 2022-02-09 13:03:44 +08:00
parent c647538ab6
commit d5e8fc7fec
3 changed files with 40 additions and 36 deletions

View File

@ -50,7 +50,7 @@ class IDGenerater(object):
i=0 i=0
print self.Handler.idlist print self.Handler.idlist
for k in self.Handler.idlist: for k in self.Handler.idlist:
fr.write("%8s%-24s= 0x%08X"%('',k,self.idstart+i)) fr.write("%8s%-24s= 0x%08X /*%10d*/"%('',k,self.idstart+i,self.idstart+i))
if(i<dsize-1): if(i<dsize-1):
fr.write(" ,") fr.write(" ,")
fr.write("\n") fr.write("\n")

58
src/gui/widget/R.h Executable file → Normal file
View File

@ -7,35 +7,35 @@ namespace cdroid{
class R{ class R{
public: public:
enum id { enum id {
parentPanel = 0x000003E8 , parentPanel = 0x000003E8 /* 1000*/ ,
topPanel = 0x000003E9 , topPanel = 0x000003E9 /* 1001*/ ,
titleDividerTop = 0x000003EA , title_template = 0x000003EA /* 1002*/ ,
title_template = 0x000003EB , icon = 0x000003EB /* 1003*/ ,
icon = 0x000003EC , alertTitle = 0x000003EC /* 1004*/ ,
alertTitle = 0x000003ED , titleDivider = 0x000003ED /* 1005*/ ,
titleDivider = 0x000003EE , contentPanel = 0x000003EE /* 1006*/ ,
contentPanel = 0x000003EF , scrollView = 0x000003EF /* 1007*/ ,
scrollView = 0x000003F0 , message = 0x000003F0 /* 1008*/ ,
message = 0x000003F1 , customPanel = 0x000003F1 /* 1009*/ ,
customPanel = 0x000003F2 , custom = 0x000003F2 /* 1010*/ ,
custom = 0x000003F3 , buttonPanel = 0x000003F3 /* 1011*/ ,
buttonPanel = 0x000003F4 , leftSpacer = 0x000003F4 /* 1012*/ ,
button2 = 0x000003F5 , button1 = 0x000003F5 /* 1013*/ ,
button3 = 0x000003F6 , button3 = 0x000003F6 /* 1014*/ ,
button1 = 0x000003F7 , button2 = 0x000003F7 /* 1015*/ ,
text1 = 0x000003F8 , rightSpacer = 0x000003F8 /* 1016*/ ,
titleDividerNoCustom = 0x000003F9 , titleDividerNoCustom = 0x000003F9 /* 1017*/ ,
textSpacerNoTitle = 0x000003FA , text1 = 0x000003FA /* 1018*/ ,
textSpacerNoButtons = 0x000003FB , select_dialog_listview = 0x000003FB /* 1019*/ ,
increment = 0x000003FC , increment = 0x000003FC /* 1020*/ ,
numberpicker_input = 0x000003FD , numberpicker_input = 0x000003FD /* 1021*/ ,
decrement = 0x000003FE , decrement = 0x000003FE /* 1022*/ ,
leftSpacer = 0x000003FF , textSpacerNoTitle = 0x000003FF /* 1023*/ ,
rightSpacer = 0x00000400 , textSpacerNoButtons = 0x00000400 /* 1024*/ ,
select_dialog_listview = 0x00000401 , titleDividerTop = 0x00000401 /* 1025*/ ,
background = 0x00000402 , background = 0x00000402 /* 1026*/ ,
progress = 0x00000403 , progress = 0x00000403 /* 1027*/ ,
secondaryProgress = 0x00000404 secondaryProgress = 0x00000404 /* 1028*/
};//endof enum id };//endof enum id
};//endof class R };//endof class R

View File

@ -230,9 +230,7 @@ TextAppearanceAttributes::TextAppearanceAttributes(){
mTextColorLink= nullptr; mTextColorLink= nullptr;
} }
void TextAppearanceAttributes::readTextAppearance(Context*ctx,const AttributeSet&att){ void TextAppearanceAttributes::readTextAppearance(Context*ctx,const AttributeSet&atts){
const std::string ta=att.getString("textAppearance");
const AttributeSet atts=ctx->obtainStyledAttributes(ta);
if(atts.hasAttribute("textColorHighlight")) if(atts.hasAttribute("textColorHighlight"))
mTextColorHighlight = ctx->getColor(atts.getString("textColorHighlight")); mTextColorHighlight = ctx->getColor(atts.getString("textColorHighlight"));
if(atts.hasAttribute("textColor")) if(atts.hasAttribute("textColor"))
@ -275,11 +273,17 @@ TextView::TextView(Context*ctx,const AttributeSet& attrs)
setMinWidth(attrs.getDimensionPixelSize("minWidth", INT_MIN)); setMinWidth(attrs.getDimensionPixelSize("minWidth", INT_MIN));
setMaxWidth(attrs.getDimensionPixelSize("maxWidth", INT_MAX)); setMaxWidth(attrs.getDimensionPixelSize("maxWidth", INT_MAX));
mSingleLine=attrs.getBoolean("singleline",true); mSingleLine=attrs.getBoolean("singleline",true);
if(attrs.hasAttribute("textAppearance")){
TextAppearanceAttributes attributes; TextAppearanceAttributes attributes;
const std::string appearance=attrs.getString("textAppearance");
if(appearance.empty()==false){
AttributeSet attrs2=ctx->obtainStyledAttributes(appearance);
attrs2.inherit(attrs);
attributes.readTextAppearance(ctx,attrs2);
}else{
attributes.readTextAppearance(ctx,attrs); attributes.readTextAppearance(ctx,attrs);
applyTextAppearance(&attributes);
} }
applyTextAppearance(&attributes);
setMarqueeRepeatLimit(attrs.getInt("marqueeRepeatLimit",mMarqueeRepeatLimit)); setMarqueeRepeatLimit(attrs.getInt("marqueeRepeatLimit",mMarqueeRepeatLimit));
setEllipsize(attrs.getInt("ellipsize",std::map<const std::string,int>{ setEllipsize(attrs.getInt("ellipsize",std::map<const std::string,int>{