modify numberpicker,fix an uninit val

This commit is contained in:
侯歌 2023-02-28 14:45:04 +00:00
parent 07721f85e6
commit b1f117693f
4 changed files with 25 additions and 13 deletions

View File

@ -1,21 +1,31 @@
#include <cdroid.h>
#include <widget/R.h>
int main(int argc,const char*argv[]){
App app(argc,argv);
Window*w=new Window(0,0,1280,600);
LinearLayout*layout=new LinearLayout(1280,600);
layout->setOrientation(LinearLayout::VERTICAL);
NumberPicker*np1=new NumberPicker(200,90);
np1->setMinValue(1);
np1->setMaxValue(12);
np1->setSelector(7,-1);
np1->setMinHeight(220);
np1->setBackgroundColor(0xFF111111);
layout->addView(np1);
w->addView(layout);
for(int i=0;i<3;i++){
NumberPicker*np1=new NumberPicker(200,600);
EditText*edt =(EditText*)np1->findViewById(cdroid::R::id::numberpicker_input);
if(edt){
edt->setBackgroundColor(0xFFFF1100+(i*33)+11);
edt->setTextColor(0xFFFFFFFF);
edt->setTextSize(40);
}
np1->setMinValue(1);
np1->setMaxValue(12);
np1->setSelector(7,-1);
np1->setMinHeight(220);
np1->setBackgroundColor(0xFF111100+(i*33));
if(i==2)
np1->setFormatter([](int v)->std::string{
return std::to_string(v)+"";
});
layout->addView(np1,new LinearLayout::LayoutParams(-1,-1,0.3f)).setId(100+i);
}
w->addView(layout,new LinearLayout::LayoutParams(-1,-1));
w->requestLayout();
app.exec();
}

View File

@ -162,6 +162,7 @@ void NumberPicker::initView(){
mFlingScroller = new Scroller(getContext(), nullptr, true);
mAdjustScroller = new Scroller(getContext(), new DecelerateInterpolator(2.5f));
mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
mHideWheelUntilFocused=false;
setSelector(DEFAULT_SELECTOR_WHEEL_ITEM_COUNT,-1);
}
void NumberPicker::onLayout(bool changed, int left, int top, int width, int height){

View File

@ -32,7 +32,8 @@ typedef enum{
ROTATE_0,
ROTATE_90,
ROTATE_180,
ROTATE_270
ROTATE_270,
ROTATE_NUM
}GFX_ROTATION;
/**
@defgroup graphStruct Structs

View File

@ -304,7 +304,7 @@ INT GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*srcr
pixman_image_composite32(PIXMAN_OP_SRC,nsrc->image, NULL, ndst->image,rs.x,rs.y,0,0,dx,dy,rs.w,rs.h);
else*/
ret = MI_GFX_BitBlit(&gfxsrc,&stSrcRect,&gfxdst, &stDstRect,&opt,&fence);
MI_GFX_WaitAllDone(FALSE,fence);
MI_GFX_WaitAllDone(TRUE,fence);
}
return 0;
}