mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-30 03:08:12 +08:00
modify looper
This commit is contained in:
parent
1d215d213d
commit
3d1621d4fc
@ -42,7 +42,10 @@ App::App(int argc,const char*argv[],const struct option*extoptions){
|
||||
mQuitFlag = false;
|
||||
mExitCode = 0;
|
||||
mInst = this;
|
||||
|
||||
if(argc>0){
|
||||
const char*p = strrchr(argv[0],'/');
|
||||
if(p)setName(p+1);
|
||||
}
|
||||
LOGD("App %s started",(argc&&argv)?argv[0]:"");
|
||||
cla.addArguments(ARGS,sizeof(ARGS)/sizeof(CLA::Argument));
|
||||
cla.setSwitchChars("-");
|
||||
|
@ -72,9 +72,12 @@ Looper::~Looper() {
|
||||
delete hdl;
|
||||
}mEventHandlers.clear();
|
||||
}
|
||||
Looper*Looper::mInst=nullptr;
|
||||
Looper*Looper::getDefault(){
|
||||
if(mInst==nullptr)mInst=new Looper(false);
|
||||
static thread_local Looper*mInst=nullptr;
|
||||
if(mInst==nullptr){
|
||||
mInst=new Looper(false);
|
||||
//LOGI("*Looper::getDefault=%p",mInst);
|
||||
}
|
||||
return mInst;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,6 @@ private:
|
||||
std::vector<Response> mResponses;
|
||||
size_t mResponseIndex;
|
||||
nsecs_t mNextMessageUptime;
|
||||
static Looper*mInst;
|
||||
private:
|
||||
int pollEvents(int timeoutMillis);
|
||||
int pollInner(int timeoutMillis);
|
||||
|
@ -73,7 +73,8 @@ View* LayoutInflater::inflate(const std::string&resource,ViewGroup*root,bool att
|
||||
if(mContext){
|
||||
std::string package;
|
||||
std::unique_ptr<std::istream>stream=mContext->getInputStream(resource,&package);
|
||||
if(stream && stream->good()) v=inflate(package,*stream,root,attachToRoot && (root!=nullptr));
|
||||
if(stream && stream->good()) v = inflate(package,*stream,root,attachToRoot && (root!=nullptr));
|
||||
LOGE_IF(stream==nullptr||stream->good()==false,"faild to load resource %s",resource.c_str());
|
||||
}else{
|
||||
std::ifstream fin(resource);
|
||||
v=inflate(resource,fin,root,root!=nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user