LayoutInflater support andrroid:id (perfectgit status)

This commit is contained in:
houzh 2022-01-23 07:57:09 +00:00
parent d14df04bc4
commit 10d5924ef8
18 changed files with 181 additions and 118 deletions

View File

@ -22,7 +22,7 @@ add_custom_target(uidemopo
COMMENT "xgettext:Make MultiLanguage files (.po) for files in DIR:${PROJECT_SOURCE_DIR}" COMMENT "xgettext:Make MultiLanguage files (.po) for files in DIR:${PROJECT_SOURCE_DIR}"
) )
CreatePAK( ${PROJECT_SOURCE_DIR}/assets ${PROJECT_BINARY_DIR}/uidemo.pak uidemo) CreatePAK(uidemo ${PROJECT_SOURCE_DIR}/assets ${PROJECT_BINARY_DIR}/uidemo.pak ${PROJECT_SOURCE_DIR}/R.h)
add_custom_target(uidemotranslate add_custom_target(uidemotranslate
COMMAND python ${CMAKE_SOURCE_DIR}/src/tools/po2json.py ${CMAKE_CURRENT_BINARY_DIR}/uidemo.po COMMAND python ${CMAKE_SOURCE_DIR}/src/tools/po2json.py ${CMAKE_CURRENT_BINARY_DIR}/uidemo.po

17
apps/uidemo/R.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
/*Generated by machine ,Do not edit!!!*/
namespace uidemo{
class R{
public:
enum id {
tablayout = 0x00002710 ,
viewpager = 0x00002711
};//endof enum id
};//endof class R
}//endof namespace

View File

@ -18,7 +18,7 @@
> >
</ImageButton> </ImageButton>
<TabLayout <TabLayout
android:id="200" android:id="@id/tablayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="transparent" android:background="transparent"
@ -35,7 +35,7 @@
</ImageButton> </ImageButton>
</LinearLayout> </LinearLayout>
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="400" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!--Generated by CDdroid's machine,Do not edit !!!-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<id name="tablayout">0x00002710</id>
<id name="viewpager">0x00002711</id>
</resources>

View File

@ -10,7 +10,7 @@
#include <string.h> #include <string.h>
#include <core/textutils.h> #include <core/textutils.h>
#include <fileadapter.h> #include <fileadapter.h>
#include <R.h>
class FileTypeAdapter:public PagerAdapter{ class FileTypeAdapter:public PagerAdapter{
public: public:
int getCount()override{return 3;} int getCount()override{return 3;}
@ -71,9 +71,9 @@ public:
MediaWindow::MediaWindow(int x,int y,int w,int h):Window(x,y,w,h){ MediaWindow::MediaWindow(int x,int y,int w,int h):Window(x,y,w,h){
ViewGroup*vg=(ViewGroup*)LayoutInflater::from(getContext())->inflate("layout/main.xml",this); ViewGroup*vg=(ViewGroup*)LayoutInflater::from(getContext())->inflate("layout/main.xml",this);
mAdapter=new FileTypeAdapter(); mAdapter=new FileTypeAdapter();
mTabLayout=(TabLayout*)vg->findViewById(200); mTabLayout=(TabLayout*)vg->findViewById(uidemo::R::id::tablayout);
mPager = (ViewPager*)vg->findViewById(400); mPager = (ViewPager*)vg->findViewById(uidemo::R::id::viewpager);
mTabLayout->setSelectedTabIndicatorColor(0x8000FF00); mTabLayout->setSelectedTabIndicatorColor(0x8000FF00);
mTabLayout->setSelectedTabIndicatorHeight(4); mTabLayout->setSelectedTabIndicatorHeight(4);
mTabLayout->setTabIndicatorGravity(Gravity::BOTTOM);//TOP/BOTTOM/CENTER_VERTICAL/FILL_VERTICAL mTabLayout->setTabIndicatorGravity(Gravity::BOTTOM);//TOP/BOTTOM/CENTER_VERTICAL/FILL_VERTICAL

View File

@ -1,9 +1,10 @@
function(CreatePAK ResourceDIR PakPath projectname) function(CreatePAK project ResourceDIR PakPath rhpath)
add_custom_target(${projectname}_res add_custom_target(${project}_Resource
COMMAND python ${CMAKE_SOURCE_DIR}/scripts/idgen.py ${ResourceDIR} ${rhpath}
COMMAND zip -r -0 ${PakPath} ./ COMMAND zip -r -0 ${PakPath} ./
WORKING_DIRECTORY ${ResourceDIR}) WORKING_DIRECTORY ${ResourceDIR})
add_dependencies(${projectname} ${projectname}_res) add_dependencies(${project} ${project}_Resource)
message("Package ${ResourceDIR} to:${PakPath}") message("Package ${ResourceDIR} to:${PakPath}")
install(FILES ${PakPath} DESTINATION data) install(FILES ${PakPath} DESTINATION data)
endfunction() endfunction()

View File

@ -2,6 +2,7 @@
import xml.sax import xml.sax
import os import os
import sys import sys
import time
class CDROIDHandler( xml.sax.ContentHandler ): class CDROIDHandler( xml.sax.ContentHandler ):
def __init__(self): def __init__(self):
@ -16,18 +17,17 @@ class CDROIDHandler( xml.sax.ContentHandler ):
pos=name.find('/'); pos=name.find('/');
if pos<0: if pos<0:
return return
name=name[pos+1:] name=name[pos+1:].strip()
if name[0].isalpha() or (name[0]=='_'): if (name[0].isalpha() or (name[0]=='_')) and (name not in self.idlist) :
self.idlist.append(name)
pos=name.find('.xml')
if pos>0:
self.idlist.append(name) self.idlist.append(name)
def groupby(self): def groupby(self):
new_ids = [] new_ids = []
for id in self.idlist: for id in self.idlist:
if id not in new_ids: if id not in new_ids:
new_ids.append(id) new_ids.append(id)
self.idlist=new_ids self.idlist=new_ids
print new_ids
return new_ids return new_ids
class IDGenerater(object): class IDGenerater(object):
@ -39,17 +39,18 @@ class IDGenerater(object):
self.Handler = CDROIDHandler() self.Handler = CDROIDHandler()
self.parser.setContentHandler( self.Handler ) self.parser.setContentHandler( self.Handler )
def dict2RH(self,filepath): def dict2RH(self,filepath,namespace):
fr=open(filepath,"w") fr=open(filepath,"w")
fr.write("#pragma once\n\n") fr.write("#pragma once\n\n")
fr.write("/*Generated by machine ,Do not edit!!!*/\n\n") fr.write("/*Generated by machine ,Do not edit!!!*/\n\n")
fr.write("namespace cdroid{\n\n") fr.write("namespace %s{\n\n"%(namespace))
fr.write("class R{\npublic:\n") fr.write("class R{\npublic:\n")
fr.write("%4senum id {\n"%('')) fr.write("%4senum id {\n"%(''))
dsize =len(self.Handler.idlist) dsize =len(self.Handler.idlist)
i=0 i=0
print self.Handler.idlist
for k in self.Handler.idlist: for k in self.Handler.idlist:
fr.write("%8s%-16s= 0x%08X"%('',k,self.idstart+i)) fr.write("%8s%-24s= 0x%08X"%('',k,self.idstart+i))
if(i<dsize-1): if(i<dsize-1):
fr.write(" ,") fr.write(" ,")
fr.write("\n") fr.write("\n")
@ -83,18 +84,28 @@ class IDGenerater(object):
fname=os.path.join(top, item) fname=os.path.join(top, item)
if item.find('.xml')<0 or self.dirHasId(fname)<0: if item.find('.xml')<0 or self.dirHasId(fname)<0:
continue continue
newestdate=os.stat(fname);
self.parser.parse(fname) self.parser.parse(fname)
#print self.Handler.groupby() #print self.Handler.groupby()
if ( __name__ == "__main__"): if ( __name__ == "__main__"):
idstart=1000 idstart=10000
if len(sys.argv)<3: if len(sys.argv)<3:
print sys.argv[0]#+'assetspath R.h_path ID.xml' print sys.argv[0]#+'assetspath R.h_path ID.xml'
if len(sys.argv)>3: validassetsdir=['assets','res','resources']
idstart=int(sys.argv[3]) segments=sys.argv[1].split('/')
for i in range(0,len(segments)):
if segments[i] in validassetsdir:
break
namespace=segments[i]
if sys.argv[2].find("widget/R.h")>=0 and (namespace=='gui'):
namespace='cdroid'
idstart=1000
print "namespace="+namespace
idgen=IDGenerater(idstart) idgen=IDGenerater(idstart)
idgen.scanxml(sys.argv[1]) idgen.scanxml(sys.argv[1])
idgen.dict2RH(sys.argv[2]) idgen.dict2RH(sys.argv[2],namespace)
if not os.path.exists(sys.argv[1]+"/values"): if not os.path.exists(sys.argv[1]+"/values"):
os.makedirs(sys.argv[1]+"/values") os.makedirs(sys.argv[1]+"/values")
idgen.dict2ID(sys.argv[1]+"/values/ID.xml") idgen.dict2ID(sys.argv[1]+"/values/ID.xml")

View File

@ -57,7 +57,7 @@ add_custom_target(systempak
COMMENT "package system resource" COMMENT "package system resource"
) )
CreatePAK(${PROJECT_SOURCE_DIR}/res ${PROJECT_BINARY_DIR}/cdroid.pak gui) CreatePAK(gui ${PROJECT_SOURCE_DIR}/res ${PROJECT_BINARY_DIR}/cdroid.pak ${PROJECT_SOURCE_DIR}/widget/R.h)
set_target_properties(gui_static PROPERTIES OUTPUT_NAME "gui") set_target_properties(gui_static PROPERTIES OUTPUT_NAME "gui")
file(GLOB_RECURSE allfiles RELATIVE "${PROJECT_SOURCE_DIR}/" "*.h") file(GLOB_RECURSE allfiles RELATIVE "${PROJECT_SOURCE_DIR}/" "*.h")

View File

@ -16,7 +16,6 @@ namespace cdroid{
Assets::Assets(){ Assets::Assets(){
addResource("cdroid.pak","cdroid"); addResource("cdroid.pak","cdroid");
getId("homescreen");
} }
Assets::Assets(const std::string&path):Assets(){ Assets::Assets(const std::string&path):Assets(){
@ -45,6 +44,7 @@ int Assets::addResource(const std::string&path,const std::string&name){
std::vector<std::string>entries; std::vector<std::string>entries;
pak->getEntries(entries); pak->getEntries(entries);
LOGD("entries.count=%d pakpath=%s",entries.size(),path.c_str()); LOGD("entries.count=%d pakpath=%s",entries.size(),path.c_str());
fetchIdFromResource(name+":values/ID.xml");
return pak?0:-1; return pak?0:-1;
} }
@ -61,32 +61,42 @@ static bool guessExtension(ZIPArchive*pak,std::string&ioname){
return ret; return ret;
} }
//"@android:drawable/ic_dialog_email" //"@[+][package:]id/filname"
//"@drawable/test" void Assets::parseResource(const std::string&fullResId,std::string*res,std::string*ns)const{
ZIPArchive*Assets::getResource(const std::string&fullResId,std::string*relativeResid)const{ std::string pkg=mName;
std::string pakName=mName; size_t pos=fullResId.find(":");
size_t pos=fullResId.find(':');
std::string relname; std::string relname;
if(pos!=std::string::npos){ if(pos!=std::string::npos){
int startat=(fullResId.find('@')==std::string::npos)?0:1; const int pluspos=fullResId.find('+');
pakName=fullResId.substr(startat,pos-startat); const int atpos=fullResId.find('@');
const int startat=(pluspos!=std::string::npos)?pluspos:((atpos==std::string::npos)?0:atpos);
pkg=fullResId.substr(startat,pos-startat);
relname=fullResId.substr(pos+1); relname=fullResId.substr(pos+1);
}else{ }else{//@+id/
pos=mName.find_last_of('/'); pos=mName.find_last_of('/');
if(pos!=std::string::npos) if(pos!=std::string::npos)
pakName=mName.substr(pos+1); pkg=mName.substr(pos+1);
pos=fullResId.find('@'); pos=fullResId.find('+');
if(pos==std::string::npos)
pos=fullResId.find('@');
if(pos!=std::string::npos)relname=fullResId.substr(pos+1); if(pos!=std::string::npos)relname=fullResId.substr(pos+1);
else relname=fullResId; else relname=fullResId;
} }
auto it=mResources.find(pakName); if(res)*res=relname;
if(ns)*ns=pkg;
}
ZIPArchive*Assets::getResource(const std::string&fullResId,std::string*relativeResid)const{
std::string package,resname;
parseResource(fullResId,&resname,&package);
auto it=mResources.find(package);
ZIPArchive*pak=nullptr; ZIPArchive*pak=nullptr;
if(it!=mResources.end()){//convert noextname ->extname. if(it!=mResources.end()){//convert noextname ->extname.
pak=it->second; pak=it->second;
guessExtension(pak,relname); guessExtension(pak,resname);
if(relativeResid) *relativeResid=relname; if(relativeResid) *relativeResid=resname;
} }
LOGV_IF(relname.size(),"resource for [%s::%s:%s] is%s found",pakName.c_str(),fullResId.c_str(),relname.c_str(),(pak?"":" not")); LOGV_IF(resname.size(),"resource for [%s::%s:%s] is%s found",package.c_str(),fullResId.c_str(),resname.c_str(),(pak?"":" not"));
return pak; return pak;
} }
@ -98,6 +108,25 @@ std::unique_ptr<std::istream> Assets::getInputStream(const std::string&fullresid
return is; return is;
} }
int Assets::fetchIdFromResource(const std::string&fullresid){
int count=0;
std::string package;
parseResource(fullresid,nullptr,&package);
package+=":id/";
auto func=[&](const std::string&section,const AttributeSet*att1,
const AttributeSet&att2,const std::string&value,int index){
if(section.length()&&section[0]=='i'&&section[1]=='d'){
const std::string name=package+att2.getString("name");
mIDS[name]=TextUtils::strtol(value);
count++;
LOG(DEBUG)<<name<<"-->"<<value;
}
};
loadKeyValues(fullresid,func);
LOGD("load %d ids from %s",count,fullresid.c_str());
return count;
}
void Assets::loadStrings(const std::string&lan){ void Assets::loadStrings(const std::string&lan){
const std::string fname="strings/strings-"+lan+".json"; const std::string fname="strings/strings-"+lan+".json";
Json::CharReaderBuilder builder; Json::CharReaderBuilder builder;
@ -135,16 +164,14 @@ RefPtr<ImageSurface>Assets::getImage(const std::string&fullresid){
return img; return img;
} }
int Assets::getId(const std::string&key){ int Assets::getId(const std::string&key)const{
auto func=[&](const std::string&section,const AttributeSet*att1, std::string resid,pkg;
const AttributeSet&att2,const std::string&value,int index){ if(key.empty())return -1;
if(section.length()&&section[0]=='i'&&section[1]=='d'){ if(key.length()&&(key.find('/')==std::string::npos))
const std::string name=att2.getString("name"); return TextUtils::strtol(key);
mIDS[name]=TextUtils::strtol(value); parseResource(key,&resid,&pkg);
LOG(DEBUG)<<name<<"========>>>>>"<<value; auto it=mIDS.find(pkg+":"+resid);
} return it==mIDS.end()?-1:it->second;
};
loadKeyValues("cdroid:xml/ID.xml",func);
} }
const std::string& Assets::getString(const std::string& id,const std::string&lan){ const std::string& Assets::getString(const std::string& id,const std::string&lan){
@ -279,11 +306,11 @@ int Assets::loadKeyValues(const std::string&fullresid,std::function<void(const s
const AttributeSet*,const AttributeSet&,const std::string&,int)>func){ const AttributeSet*,const AttributeSet&,const std::string&,int)>func){
int len = 0; int len = 0;
char buf[256]; char buf[256];
std::string resname;
ZIPArchive*pak=getResource(fullresid,&resname);
void*zfile=pak?pak->getZipHandle(resname):nullptr;
ZipInputStream stream(zfile); std::unique_ptr<std::istream>stream=getInputStream(fullresid);
LOGE_IF(stream==nullptr,"%s load failed",fullresid.c_str());
if(stream==nullptr)
return 0;
XML_Parser parser=XML_ParserCreate(nullptr); XML_Parser parser=XML_ParserCreate(nullptr);
std::string curKey; std::string curKey;
std::string curValue; std::string curValue;
@ -293,8 +320,8 @@ int Assets::loadKeyValues(const std::string&fullresid,std::function<void(const s
XML_SetElementHandler(parser, startElement, endElement); XML_SetElementHandler(parser, startElement, endElement);
XML_SetCharacterDataHandler(parser,CharacterHandler); XML_SetCharacterDataHandler(parser,CharacterHandler);
do { do {
stream.read(buf,sizeof(buf)); stream->read(buf,sizeof(buf));
len=stream.gcount(); len=stream->gcount();
if (XML_Parse(parser, buf,len,len==0) == XML_STATUS_ERROR) { if (XML_Parse(parser, buf,len,len==0) == XML_STATUS_ERROR) {
const char*es=XML_ErrorString(XML_GetErrorCode(parser)); const char*es=XML_ErrorString(XML_GetErrorCode(parser));
LOGE("%s at line %ld",es, XML_GetCurrentLineNumber(parser)); LOGE("%s at line %ld",es, XML_GetCurrentLineNumber(parser));

View File

@ -17,7 +17,9 @@ private:
std::map<const std::string,std::weak_ptr<Drawable::ConstantState>>mDrawables; std::map<const std::string,std::weak_ptr<Drawable::ConstantState>>mDrawables;
std::map<const std::string,class ZIPArchive*>mResources; std::map<const std::string,class ZIPArchive*>mResources;
std::map<const std::string,AttributeSet>mStyles; std::map<const std::string,AttributeSet>mStyles;
void parseResource(const std::string&fullresid,std::string*res,std::string*ns)const;
ZIPArchive*getResource(const std::string & fullresid, std::string* relativeResid)const; ZIPArchive*getResource(const std::string & fullresid, std::string* relativeResid)const;
int fetchIdFromResource(const std::string&fullresid);
protected: protected:
std::string mName; std::string mName;
DisplayMetrics mDisplayMetrics; DisplayMetrics mDisplayMetrics;
@ -33,7 +35,7 @@ public:
int loadStyles(const std::string&resid); int loadStyles(const std::string&resid);
void clearStyles(); void clearStyles();
const DisplayMetrics&getDisplayMetrics()override; const DisplayMetrics&getDisplayMetrics()override;
int getId(const std::string&)override; int getId(const std::string&)const override;
const std::string& getString(const std::string&id,const std::string&lan="")override; const std::string& getString(const std::string&id,const std::string&lan="")override;
RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)override; RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)override;
std::vector<std::string> getStringArray(const std::string&resname,const std::string&arrayname)const; std::vector<std::string> getStringArray(const std::string&resname,const std::string&arrayname)const;

View File

@ -19,7 +19,7 @@ class ColorStateList;
class Context{ class Context{
public: public:
virtual const DisplayMetrics&getDisplayMetrics()=0; virtual const DisplayMetrics&getDisplayMetrics()=0;
virtual int getId(const std::string&)=0; virtual int getId(const std::string&)const=0;
virtual const std::string& getString(const std::string&id,const std::string&lan="")=0; virtual const std::string& getString(const std::string&id,const std::string&lan="")=0;
static RefPtr<Cairo::ImageSurface> loadImage( std::istream&istream ){ static RefPtr<Cairo::ImageSurface> loadImage( std::istream&istream ){
return Cairo::ImageSurface::create_from_stream(istream); return Cairo::ImageSurface::create_from_stream(istream);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:cdroid="http://schemas.android.com/apk/res/android"> <layer-list xmlns:cdroid="http://schemas.android.com/apk/res/android">
<item cdroid:id="0"> <item cdroid:id="@+cdroid:id/background">
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">
<corners cdroid:radius="5dip" /> <corners cdroid:radius="5dip" />
<gradient <gradient
@ -14,7 +14,7 @@
</shape> </shape>
</item> </item>
<item cdroid:id="1"> <item cdroid:id="@+cdroid:id/progress">
<clip> <clip>
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">
<corners cdroid:radius="5dip" /> <corners cdroid:radius="5dip" />
@ -29,7 +29,7 @@
</clip> </clip>
</item> </item>
<item cdroid:id="2"> <item cdroid:id="@+cdroid:id/secondaryProgress">
<clip> <clip>
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">
<corners cdroid:radius="5dip" /> <corners cdroid:radius="5dip" />

View File

@ -1,6 +1,6 @@
<layer-list xmlns:cdroid="http://schemas.android.com/apk/res/android"> <layer-list xmlns:cdroid="http://schemas.android.com/apk/res/android">
<item cdroid:id="0"> <item cdroid:id="@+cdroid:id/background">
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">
<corners cdroid:radius="5dip" /> <corners cdroid:radius="5dip" />
<gradient <gradient
@ -13,7 +13,7 @@
</shape> </shape>
</item> </item>
<item cdroid:id="1"> <item cdroid:id="@+cdroid:id/progress">
<clip cdroid:clipOrientation="vertical" cdroid:gravity = "bottom"> <clip cdroid:clipOrientation="vertical" cdroid:gravity = "bottom">
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">
<corners cdroid:radius="5dip" /> <corners cdroid:radius="5dip" />
@ -28,7 +28,7 @@
</clip> </clip>
</item> </item>
<item cdroid:id="2"> <item cdroid:id="@+cdroid:id/secondaryProgress">
<clip cdroid:clipOrientation="vertical" <clip cdroid:clipOrientation="vertical"
cdroid:gravity = "bottom"> cdroid:gravity = "bottom">
<shape cdroid:shape="rectangle"> <shape cdroid:shape="rectangle">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:cdroid="http://schemas.android.com/apk/res/android"> <merge xmlns:cdroid="http://schemas.android.com/apk/res/android">
<ImageButton cdroid:id="1@+id/increment" <ImageButton cdroid:id="@+cdroid:id/increment"
cdroid:layout_width="fill_parent" cdroid:layout_width="fill_parent"
cdroid:layout_height="wrap_content" cdroid:layout_height="wrap_content"
cdroid:background="cdroid:drawable/numberpicker_up_btn" cdroid:background="cdroid:drawable/numberpicker_up_btn"
@ -8,14 +8,14 @@
cdroid:paddingBottom="22dip" cdroid:paddingBottom="22dip"
cdroid:contentDescription="@string/number_picker_increment_button" /> cdroid:contentDescription="@string/number_picker_increment_button" />
<EditText <EditText
cdroid:id="0@+id/numberpicker_input" cdroid:id="@+cdroid:id/numberpicker_input"
cdroid:layout_width="fill_parent" cdroid:layout_width="fill_parent"
cdroid:layout_height="wrap_content" cdroid:layout_height="wrap_content"
cdroid:textAppearance="@style/TextAppearance.Large.Inverse.NumberPickerInputText" cdroid:textAppearance="@style/TextAppearance.Large.Inverse.NumberPickerInputText"
cdroid:gravity="center" cdroid:gravity="center"
cdroid:singleLine="true" cdroid:singleLine="true"
cdroid:background="cdroid:drawable/numberpicker_input" /> cdroid:background="cdroid:drawable/numberpicker_input" />
<ImageButton cdroid:id="2@+id/decrement" <ImageButton cdroid:id="@+cdroid:id/decrement"
cdroid:layout_width="fill_parent" cdroid:layout_width="fill_parent"
cdroid:layout_height="wrap_content" cdroid:layout_height="wrap_content"
cdroid:background="cdroid:drawable/numberpicker_down_btn" cdroid:background="cdroid:drawable/numberpicker_down_btn"

View File

@ -7,19 +7,21 @@
<id name="parentPanel">0x000003ec</id> <id name="parentPanel">0x000003ec</id>
<id name="topPanel">0x000003ed</id> <id name="topPanel">0x000003ed</id>
<id name="title_template">0x000003ee</id> <id name="title_template">0x000003ee</id>
<id name="icon">0x000003ef</id> <id name="alertTitle">0x000003ef</id>
<id name="alertTitle">0x000003f0</id> <id name="titleDivider">0x000003f0</id>
<id name="titleDivider">0x000003f1</id> <id name="contentPanel">0x000003f1</id>
<id name="contentPanel">0x000003f2</id> <id name="scrollView">0x000003f2</id>
<id name="scrollView">0x000003f3</id> <id name="message">0x000003f3</id>
<id name="message">0x000003f4</id> <id name="customPanel">0x000003f4</id>
<id name="customPanel">0x000003f5</id> <id name="custom">0x000003f5</id>
<id name="custom">0x000003f6</id> <id name="buttonPanel">0x000003f6</id>
<id name="buttonPanel">0x000003f7</id> <id name="leftSpacer">0x000003f7</id>
<id name="leftSpacer">0x000003f8</id> <id name="button1">0x000003f8</id>
<id name="button1">0x000003f9</id> <id name="button3">0x000003f9</id>
<id name="button3">0x000003fa</id> <id name="button2">0x000003fa</id>
<id name="button2">0x000003fb</id> <id name="rightSpacer">0x000003fb</id>
<id name="rightSpacer">0x000003fc</id> <id name="background">0x000003fc</id>
<id name="progress">0x000003fd</id>
<id name="secondaryProgress">0x000003fe</id>
</resources> </resources>

View File

@ -1,41 +1,38 @@
#ifndef __CDROID_R_H__ #pragma once
#define __CDROID_R_H__
/*Generated by machine ,Do not edit!!!*/
namespace cdroid{ namespace cdroid{
class R{ class R{
public: public:
enum id{ enum id {
background=0, increment = 0x000003E8 ,
progress, numberpicker_input = 0x000003E9 ,
secondaryProgress, decrement = 0x000003EA ,
toggle, icon = 0x000003EB ,
text1, parentPanel = 0x000003EC ,
numberpicker_input,//for numberpicker topPanel = 0x000003ED ,
increment,//for numberpicker title_template = 0x000003EE ,
decrement,//for numberpicker alertTitle = 0x000003EF ,
/**for dialog */ titleDivider = 0x000003F0 ,
parentPanel, contentPanel = 0x000003F1 ,
topPanel, scrollView = 0x000003F2 ,
contentPanel, message = 0x000003F3 ,
buttonPanel, customPanel = 0x000003F4 ,
customPanel, custom = 0x000003F5 ,
custom, buttonPanel = 0x000003F6 ,
scrollView, leftSpacer = 0x000003F7 ,
message, button1 = 0x000003F8 ,
leftSpacer, button3 = 0x000003F9 ,
button1, button2 = 0x000003FA ,
button2, rightSpacer = 0x000003FB ,
button3, background = 0x000003FC ,
rightSpacer, progress = 0x000003FD ,
secondaryProgress = 0x000003FE
};//endof enum id
};//endof class R
}//endof namespace
textSpacerNoButtons,
titleDividerNoCustom,
titleDivider,
titleDividerTop,
textSpacerNoTitle,
title_template,
icon,
alertTitle,
};
};
}
#endif

View File

@ -1016,7 +1016,7 @@ void TabLayout::TabView::update() {
mIconView->setImageDrawable(nullptr); mIconView->setImageDrawable(nullptr);
} }
mCustomTextView = (TextView*) custom->findViewById(cdroid::R::id::text1); //mCustomTextView = (TextView*) custom->findViewById(cdroid::R::id::text1);
if (mCustomTextView != nullptr) { if (mCustomTextView != nullptr) {
mDefaultMaxLines = mCustomTextView->getMaxLines();// TextViewCompat.getMaxLines(mCustomTextView); mDefaultMaxLines = mCustomTextView->getMaxLines();// TextViewCompat.getMaxLines(mCustomTextView);
} }

View File

@ -152,7 +152,7 @@ View::View(Context*ctx,const AttributeSet&attrs){
initView(); initView();
mContext=ctx; mContext=ctx;
mID = attrs.getInt("id",NO_ID); mID = ctx->getId(attrs.getString("id"));
mMinWidth = attrs.getDimensionPixelSize("minWidth",0); mMinWidth = attrs.getDimensionPixelSize("minWidth",0);
mMinHeight= attrs.getDimensionPixelSize("minHeight",0); mMinHeight= attrs.getDimensionPixelSize("minHeight",0);
mContentDescription=attrs.getString("contentDescription"); mContentDescription=attrs.getString("contentDescription");