add context.getPackageName

This commit is contained in:
houzh 2023-03-22 09:32:49 +00:00
parent 6ef1eb6c4c
commit a014db4443
4 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,10 @@ const DisplayMetrics& Assets::getDisplayMetrics(){
return mDisplayMetrics;
}
const std::string Assets::getPackageName()const{
return mName;
}
const std::string Assets::getTheme()const{
return mThemeName;
}

View File

@ -38,6 +38,7 @@ public:
~Assets();
int loadStyles(const std::string&resid);
void clearStyles();
const std::string getPackageName()const override;
const std::string getTheme()const override;
void setTheme(const std::string&theme)override;
const DisplayMetrics&getDisplayMetrics()override;

View File

@ -20,7 +20,7 @@ static std::vector<std::string> split(const std::string & path) {
return vec;
}
AttributeSet::AttributeSet():AttributeSet(nullptr,std::string()){
AttributeSet::AttributeSet():AttributeSet(nullptr,""){
}
AttributeSet::AttributeSet(Context*ctx,const std::string&package){

View File

@ -15,6 +15,7 @@ class Drawable;
class ColorStateList;
class Context{
public:
virtual const std::string getPackageName()const=0;
virtual const std::string getTheme()const=0;
virtual void setTheme(const std::string&theme)=0;
virtual const DisplayMetrics&getDisplayMetrics()=0;