From 5404d4feb29343402191dccda3cc3b528098e6d5 Mon Sep 17 00:00:00 2001 From: houzh Date: Tue, 11 Jul 2023 16:58:54 +0800 Subject: [PATCH] rename createiItemDrawable to createWrappedDrawable --- src/gui/drawables/animatedrotatedrawable.cc | 2 +- src/gui/drawables/clipdrawable.cc | 2 +- src/gui/drawables/drawable.cc | 4 ++-- src/gui/drawables/drawable.h | 2 +- src/gui/drawables/insetdrawable.cc | 2 +- src/gui/drawables/rotatedrawable.cc | 2 +- src/gui/drawables/scaledrawable.cc | 2 +- src/gui/widget/progressbar.cc | 4 ---- 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/drawables/animatedrotatedrawable.cc b/src/gui/drawables/animatedrotatedrawable.cc index ee5e1e56..3a3e9807 100755 --- a/src/gui/drawables/animatedrotatedrawable.cc +++ b/src/gui/drawables/animatedrotatedrawable.cc @@ -196,7 +196,7 @@ Drawable*AnimatedRotateDrawable::inflate(Context*ctx,const AttributeSet&atts){ ad->setPivotYRelative(true); ad->setFramesCount(atts.getInt("framesCount")); ad->setFramesDuration(atts.getInt("frameDuration")); - Drawable*child = createItemDrawable(ctx,atts); + Drawable*child = createWrappedDrawable(ctx,atts); ad->setDrawable(child); return ad; diff --git a/src/gui/drawables/clipdrawable.cc b/src/gui/drawables/clipdrawable.cc index d518382a..b51784f3 100755 --- a/src/gui/drawables/clipdrawable.cc +++ b/src/gui/drawables/clipdrawable.cc @@ -101,7 +101,7 @@ void ClipDrawable::draw(Canvas& canvas){ } Drawable*ClipDrawable::inflate(Context*ctx,const AttributeSet&atts){ - Drawable*d = Drawable::createItemDrawable(ctx,atts); + Drawable*d = Drawable::createWrappedDrawable(ctx,atts); const int gravity= atts.getGravity("gravity",Gravity::LEFT); const std::string sOrientation = atts.getString("clipOrientation"); const int orientation = (sOrientation.compare("vertical")==0)?VERTICAL:HORIZONTAL; diff --git a/src/gui/drawables/drawable.cc b/src/gui/drawables/drawable.cc index e1d4ee94..4d969b6d 100644 --- a/src/gui/drawables/drawable.cc +++ b/src/gui/drawables/drawable.cc @@ -303,7 +303,7 @@ class ParseData { }; -Drawable*Drawable::createItemDrawable(Context*ctx,const AttributeSet&atts) { +Drawable*Drawable::createWrappedDrawable(Context*ctx,const AttributeSet&atts) { RefPtr img; std::string resname = atts.getString("color"); if(!resname.empty()) { @@ -335,7 +335,7 @@ static std::mapdrawableParsers= { {"layer-list", LayerDrawable::inflate}, {"level-list", LevelListDrawable::inflate}, {"selector", StateListDrawable::inflate}, - {"item", Drawable::createItemDrawable }, + {"item", Drawable::createWrappedDrawable }, {"ripple", RippleDrawable::inflate}, {"animated-rotate", AnimatedRotateDrawable::inflate}, {"animation-list", AnimationDrawable::inflate} diff --git a/src/gui/drawables/drawable.h b/src/gui/drawables/drawable.h index 2793bb3c..cf32dcf4 100755 --- a/src/gui/drawables/drawable.h +++ b/src/gui/drawables/drawable.h @@ -133,7 +133,7 @@ public: static int resolveOpacity(int op1,int op2); static float scaleFromDensity(float pixels, int sourceDensity, int targetDensity); static int scaleFromDensity(int pixels, int sourceDensity, int targetDensity, bool isSize); - static Drawable*createItemDrawable(Context* ctx,const AttributeSet&atts); + static Drawable*createWrappedDrawable(Context* ctx,const AttributeSet&atts); static Drawable*fromStream(Context*ctx,std::istream&stream,const std::string& basePath=std::string(), const std::string&package=std::string()); static Drawable*inflate(Context* ctx,const std::string& pathName); diff --git a/src/gui/drawables/insetdrawable.cc b/src/gui/drawables/insetdrawable.cc index cebf54ce..778290ea 100755 --- a/src/gui/drawables/insetdrawable.cc +++ b/src/gui/drawables/insetdrawable.cc @@ -112,7 +112,7 @@ Drawable*InsetDrawable::inflate(Context*ctx,const AttributeSet&atts){ const int insetTop = atts.getInt("insetTop",inset); const int insetRight = atts.getInt("insetRight",inset); const int insetBottom= atts.getInt("insetBottom",inset); - Drawable*d = createItemDrawable(ctx,atts); + Drawable*d = createWrappedDrawable(ctx,atts); return new InsetDrawable(d,insetLeft,insetTop,insetRight,insetBottom); } diff --git a/src/gui/drawables/rotatedrawable.cc b/src/gui/drawables/rotatedrawable.cc index 92f10e97..5e8a97fb 100755 --- a/src/gui/drawables/rotatedrawable.cc +++ b/src/gui/drawables/rotatedrawable.cc @@ -154,7 +154,7 @@ void RotateDrawable::draw(Canvas& canvas) { } Drawable*RotateDrawable::inflate(Context*ctx,const AttributeSet&atts){ - Drawable*d = createItemDrawable(ctx,atts); + Drawable*d = createWrappedDrawable(ctx,atts); RotateDrawable*rd = new RotateDrawable(d); rd->setPivotX(atts.getFraction("pivotX",1,1,0)); rd->setPivotY(atts.getFraction("pivotY",1,1,0)); diff --git a/src/gui/drawables/scaledrawable.cc b/src/gui/drawables/scaledrawable.cc index abc85ed1..951b55f3 100755 --- a/src/gui/drawables/scaledrawable.cc +++ b/src/gui/drawables/scaledrawable.cc @@ -94,7 +94,7 @@ Drawable*ScaleDrawable::inflate(Context*ctx,const AttributeSet&atts){ const int sw = getDimensionOrFraction(atts,"scaleWidth",100,0); const int sh = getDimensionOrFraction(atts,"scaleHeight",100,0); const int gravity = atts.getGravity("scaleGravity",Gravity::LEFT); - Drawable*d = createItemDrawable(ctx,atts); + Drawable*d = createWrappedDrawable(ctx,atts); return new ScaleDrawable(d,gravity,float(sw)/100.f,float(sh)/100.f); } } diff --git a/src/gui/widget/progressbar.cc b/src/gui/widget/progressbar.cc index cccf62b6..93fdd45b 100644 --- a/src/gui/widget/progressbar.cc +++ b/src/gui/widget/progressbar.cc @@ -444,10 +444,6 @@ void ProgressBar::setProgressDrawable(Drawable*d){ mMaxHeight = drawableHeight; requestLayout(); } - if(dynamic_cast(d)){ - ClipDrawable*cd = dynamic_cast(((LayerDrawable*)d)->findDrawableByLayerId(R::id::progress)); - LOGD("Orientation=%d",cd->getOrientation()); - } applyProgressTints(); }