modify app.cc,disable logs in help mode

This commit is contained in:
侯歌 2024-07-30 18:22:53 +08:00
parent c2319fe7f0
commit 9dd2b97289
2 changed files with 9 additions and 7 deletions

View File

@ -46,23 +46,25 @@ App::App(int argc,const char*argv[],const std::vector<CLA::Argument>&extoptions)
mQuitFlag = false;
mExitCode = 0;
mInst = this;
Typeface::setContext(this);
cla.addArguments(ARGS,sizeof(ARGS)/sizeof(CLA::Argument));
cla.addArguments(extoptions.data(),extoptions.size());
cla.setSwitchChars("-");
cla.parse(argc,argv);
rotation = (getArgAsInt("rotate",0)/90)%4;
if(hasSwitch("help")){
std::cout<<cla.getUsageString()<<std::endl;
std::cout<<"params.count="<<getParamCount()<<std::endl;
exit(EXIT_SUCCESS);
LogSetModuleLevel(nullptr,LOG_FATAL);
mQuitFlag=1;
}
Typeface::setContext(this);
onInit();
setName(std::string(argc?argv[0]:__progname));
LOGI("CDROID Ver:%d.%d.%d Build %d",BUILD::VERSION::Major,BUILD::VERSION::Minor,BUILD::VERSION::Patch,BUILD::VERSION::BuildNumber);
LOGI("App [%s] started c++=%d",mName.c_str(),__cplusplus);
View::VIEW_DEBUG = hasSwitch("debug");
if(hasSwitch("help")){
std::cout<<cla.getUsageString()<<std::endl;
std::cout<<"params.count="<<getParamCount()<<std::endl;
exit(0);
}
Looper::prepare(false);
Choreographer & chograph = Choreographer::getInstance();
chograph.setFrameDelay(getArgAsInt("framedelay",chograph.getFrameDelay()));

View File

@ -144,7 +144,7 @@ protected:
}
float calculateSpeedPerPixel(DisplayMetrics& displayMetrics) {
return /*MILLISECONDS_PER_INCH*/100.f / displayMetrics.densityDpi;
return SnapHelper::MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
}
public:
MyLinearSmoothScroller(SnapHelper*snap,RecyclerView*rv)