mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-05 05:37:53 +08:00
drawablecontainer.s fading in/out tested OK
This commit is contained in:
parent
8f9c352a51
commit
e9f4043673
@ -43,6 +43,7 @@ BitmapDrawable::BitmapState::BitmapState(const BitmapState&bitmapState){
|
||||
mTransparency = bitmapState.mTransparency;
|
||||
//mRebuildShader = bitmapState.mRebuildShader;
|
||||
mAutoMirrored = bitmapState.mAutoMirrored;
|
||||
mResource = bitmapState.mResource;
|
||||
}
|
||||
|
||||
BitmapDrawable::BitmapState::~BitmapState(){
|
||||
|
@ -489,21 +489,23 @@ static void startElement(void *userData, const XML_Char *name, const XML_Char **
|
||||
|
||||
if(it!=drawableParsers.end()) {
|
||||
auto item = pd->items.back();
|
||||
if(strcmp(name,"shape")||((strcmp(name,"item")==0)&&atts.hasAttribute("drawable"))){
|
||||
if( strcmp(name,"shape")||(((strcmp(name,"item")==0)||(strcmp(name,"transition")==0))&&atts.hasAttribute("drawable"))){
|
||||
Drawable* d = it->second(pd->ctx,atts);
|
||||
if(d){
|
||||
auto cs = d->getConstantState();
|
||||
if(cs)cs->mResource =pd->resourceFile;
|
||||
if(cs){
|
||||
cs->mResource = atts.getString("drawable");
|
||||
LOGD_IF(atts.hasAttribute("drawable"),"%p.res=%s",cs->mResource.c_str());
|
||||
}
|
||||
}
|
||||
item->drawable = d;
|
||||
}else if(strcmp(name,"transition")==0){
|
||||
LOGD("");
|
||||
}
|
||||
LOGV("created drawable %s:%p props:%d",name,item->drawable,item->props.size());
|
||||
}
|
||||
}
|
||||
|
||||
static Drawable*parseShapeDrawable(Context*ctx,const AttributeSet&atts,const std::vector<AttributeSet>&props,const std::vector<std::string>&names) {
|
||||
static Drawable*parseShapeDrawable(Context*ctx,const AttributeSet&atts,
|
||||
const std::vector<AttributeSet>&props,const std::vector<std::string>&names) {
|
||||
const AttributeSet* corners = nullptr,*gradient = nullptr,*padding = nullptr;
|
||||
const AttributeSet* size = nullptr, *stroke = nullptr,*solid = nullptr;
|
||||
|
||||
|
@ -430,7 +430,7 @@ int DrawableContainer::getChangingConfigurations()const{
|
||||
}
|
||||
|
||||
void DrawableContainer::setAlpha(int alpha) {
|
||||
if (!mHasAlpha || mAlpha != alpha) {
|
||||
if (!mHasAlpha || (mAlpha != alpha)) {
|
||||
mHasAlpha = true;
|
||||
mAlpha = alpha;
|
||||
if (mCurrDrawable != nullptr) {
|
||||
@ -645,9 +645,9 @@ void DrawableContainer::animate(bool schedule) {
|
||||
} else {
|
||||
mExitAnimationEnd = 0;
|
||||
}
|
||||
LOGV_IF(mCurrDrawable&&mLastDrawable,"%p Cur %d:%p alpha=%d ; Last %d:%p alpha=%d",this,
|
||||
mCurIndex,mCurrDrawable,mCurrDrawable->getAlpha(),
|
||||
mLastIndex,mLastDrawable,mLastDrawable->getAlpha());
|
||||
LOGD_IF(mCurrDrawable&&mLastDrawable,"%p \nCur %d:%p[%s] alpha=%d\nLast %d:%p[%s] alpha=%d",this,
|
||||
mCurIndex,mCurrDrawable,mCurrDrawable->getConstantState()->mResource.c_str(),mCurrDrawable->getAlpha(),
|
||||
mLastIndex,mLastDrawable,mLastDrawable->getConstantState()->mResource.c_str(),mLastDrawable->getAlpha());
|
||||
if (schedule && animating) {
|
||||
scheduleSelf(mAnimationRunnable, now + 1000 / 60);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user