diff --git a/apps/samples/toast.cc b/apps/samples/toast.cc new file mode 100755 index 00000000..ae31dd7c --- /dev/null +++ b/apps/samples/toast.cc @@ -0,0 +1,11 @@ +#include +#include +#include + +int main(int argc,const char*argv[]){ + App app(argc,argv); + Window* w = new Window(0,0,-1,-1); + w->setBackgroundColor(0xFF112233); + Toast::makeText(&app,"Press OK to exit",4000)->show(); + return app.exec(); +} diff --git a/scripts/idgen.py b/scripts/idgen.py index 3dfe5778..0731e9d4 100755 --- a/scripts/idgen.py +++ b/scripts/idgen.py @@ -223,5 +223,5 @@ if ( __name__ == "__main__"): shutil.copyfile(ftempids,fidxml) idgen.dict2RH(sys.argv[3]) msg="changed " - print(namespace+"'s IDs is:"+msg+ftempids+" : "+fidxml) + print(namespace+"'s IDs is "+msg+ftempids+" : "+fidxml) os.remove(ftempids) diff --git a/src/gui/widget/numberpicker.cc b/src/gui/widget/numberpicker.cc index f514819a..6013ed1d 100644 --- a/src/gui/widget/numberpicker.cc +++ b/src/gui/widget/numberpicker.cc @@ -109,7 +109,6 @@ NumberPicker::NumberPicker(Context* context,const AttributeSet& atts) } NumberPicker::~NumberPicker(){ - LOGD("mChildren.size=%d",mChildren.size()); } void NumberPicker::onIncDecClick(View&v){ diff --git a/src/gui/widget/textview.cc b/src/gui/widget/textview.cc index e70eaed3..88e260e0 100755 --- a/src/gui/widget/textview.cc +++ b/src/gui/widget/textview.cc @@ -31,19 +31,19 @@ DECLARE_WIDGET2(TextView,"cdroid:attr/textViewStyle") TextView::Drawables::Drawables(Context*ctx){ mIsRtlCompatibilityMode= false; - mHasTint = mHasTintMode= mOverride =false; + mHasTintMode= mOverride = false; mTintList= nullptr; mShowing[0] = mShowing[1] = nullptr; mShowing[2] = mShowing[3] = nullptr; mDrawableStart = mDrawableEnd = nullptr; mDrawableError = mDrawableTemp = nullptr; - mDrawableLeftInitial= mDrawableRightInitial=nullptr; - mDrawableSizeTop = mDrawableSizeBottom = mDrawableSizeLeft=0; - mDrawableSizeRight = mDrawableSizeStart = mDrawableSizeEnd=0; + mDrawableLeftInitial= mDrawableRightInitial = nullptr; + mDrawableSizeTop = mDrawableSizeBottom = mDrawableSizeLeft = 0; + mDrawableSizeRight = mDrawableSizeStart = mDrawableSizeEnd= 0; mDrawableSizeError = mDrawableSizeTemp = 0; - mDrawableWidthTop = mDrawableWidthBottom = mDrawableHeightLeft =0; - mDrawableHeightRight= mDrawableHeightStart = mDrawableHeightEnd =0; - mDrawableHeightError= mDrawableHeightTemp = mDrawablePadding =0; + mDrawableWidthTop = mDrawableWidthBottom = mDrawableHeightLeft= 0; + mDrawableHeightRight= mDrawableHeightStart = mDrawableHeightEnd = 0; + mDrawableHeightError= mDrawableHeightTemp = mDrawablePadding = 0; mCompoundRect.set(0,0,0,0); } @@ -51,10 +51,11 @@ TextView::Drawables::~Drawables(){ for(int i=0;i<4;i++){ delete mShowing[i]; } + delete mTintList; } bool TextView::Drawables::hasMetadata()const{ - return mDrawablePadding != 0 || mHasTintMode || mHasTint; + return mDrawablePadding != 0 || mHasTintMode || (mTintList!=nullptr); } bool TextView::Drawables::resolveWithLayoutDirection(int layoutDirection){ @@ -1036,7 +1037,7 @@ std::vectorTextView::getCompoundDrawables(){ void TextView::setCompoundDrawables(Drawable* left,Drawable* top,Drawable* right,Drawable*bottom){ // We're switching to absolute, discard relative. - Drawables*dr=mDrawables; + Drawables*dr = mDrawables; if (dr != nullptr) { if (dr->mDrawableStart != nullptr)dr->mDrawableStart->setCallback(nullptr); dr->mDrawableStart = nullptr; @@ -1049,23 +1050,21 @@ void TextView::setCompoundDrawables(Drawable* left,Drawable* top,Drawable* right if (!drawables) { // Clearing drawables... can we free the data structure? if (dr != nullptr) { - if (!dr->hasMetadata()) { - mDrawables = nullptr; - } else { - // We need to retain the last set padding, so just clear - // out all of the fields in the existing structure. - for (int i = 3/*dr->mShowing.length - 1*/; i >= 0; i--) { - if (dr->mShowing[i] != nullptr) { - dr->mShowing[i]->setCallback(nullptr); - } + // We need to retain the last set padding, so just clear + // out all of the fields in the existing structure. + for (int i = 3/*dr->mShowing.length - 1*/; i >= 0; i--) { + if (dr->mShowing[i] != nullptr) { + dr->mShowing[i]->setCallback(nullptr); delete dr->mShowing[i]; - dr->mShowing[i] = nullptr; } - dr->mDrawableSizeLeft = dr->mDrawableHeightLeft = 0; - dr->mDrawableSizeRight = dr->mDrawableHeightRight = 0; - dr->mDrawableSizeTop = dr->mDrawableWidthTop = 0; - dr->mDrawableSizeBottom= dr->mDrawableWidthBottom = 0; + dr->mShowing[i] = nullptr; } + dr->mDrawableSizeLeft = dr->mDrawableHeightLeft = 0; + dr->mDrawableSizeRight = dr->mDrawableHeightRight = 0; + dr->mDrawableSizeTop = dr->mDrawableWidthTop = 0; + dr->mDrawableSizeBottom= dr->mDrawableWidthBottom = 0; + delete mDrawables; + mDrawables = nullptr; } } else { if (dr == nullptr) mDrawables = dr = new Drawables(getContext()); @@ -1617,11 +1616,11 @@ ColorStateList* TextView::getLinkTextColors()const{ void TextView::applyCompoundDrawableTint(){ if (mDrawables == nullptr) return; - if ( (mDrawables->mHasTint==false)&&(mDrawables->mHasTintMode==false) )return ; + if ( (mDrawables->mTintList==nullptr)&&(mDrawables->mHasTintMode==false) )return ; ColorStateList* tintList = mDrawables->mTintList; const int tintMode = mDrawables->mTintMode; - const bool hasTint = mDrawables->mHasTint; + const bool hasTint = (mDrawables->mTintList!=nullptr); const bool hasTintMode = mDrawables->mHasTintMode; const std::vectorstate = getDrawableState(); @@ -1653,7 +1652,7 @@ void TextView::setCompoundDrawablePadding(int pad){ mDrawables->mDrawablePadding = pad; } else { if (mDrawables == nullptr) - mDrawables =new Drawables(getContext()); + mDrawables = new Drawables(getContext()); mDrawables->mDrawablePadding = pad; } invalidate(true); @@ -1755,7 +1754,6 @@ void TextView::setCompoundDrawableTintList(ColorStateList* tint){ mDrawables = new Drawables(getContext()); } mDrawables->mTintList = tint; - mDrawables->mHasTint = true; applyCompoundDrawableTint(); }