當前位置: 首頁>>代碼示例>>Java>>正文


Java TransitionDrawable.startTransition方法代碼示例

本文整理匯總了Java中android.graphics.drawable.TransitionDrawable.startTransition方法的典型用法代碼示例。如果您正苦於以下問題:Java TransitionDrawable.startTransition方法的具體用法?Java TransitionDrawable.startTransition怎麽用?Java TransitionDrawable.startTransition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.TransitionDrawable的用法示例。


在下文中一共展示了TransitionDrawable.startTransition方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setImageDrawable

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView.
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td =
                new TransitionDrawable(new Drawable[] {
                        new ColorDrawable(android.R.color.transparent),
                        drawable
                });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(
                new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}
 
開發者ID:liuyanggithub,項目名稱:SuperSelector,代碼行數:26,代碼來源:ImageWorker.java

示例2: setImageBitmap

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
public void setImageBitmap(@Nullable final Drawable fromDrawable, @Nullable final Bitmap toBitmap) {
    final int width = getMeasuredWidth();
    final int height = getMeasuredHeight();

    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            final TransitionDrawable td = new TransitionDrawable(new Drawable[]{
                    fromDrawable, new BitmapDrawable(getResources(),
                    getScaleType() == ScaleType.CENTER_CROP ?
                            centerCrop(getResources(), toBitmap, width, height) :
                            toBitmap)});
            RImageView.super.setImageDrawable(td);
            td.startTransition(300);
        }
    };

    if (width == 0 || height == 0) {
        post(runnable);
    } else {
        runnable.run();
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:24,代碼來源:RImageView.java

示例3: crossfadeTargetBackground

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void crossfadeTargetBackground(PaletteTarget target, Pair<View, Integer> t, int newColor) {

        final Drawable oldColor = t.first.getBackground();
        final Drawable[] drawables = new Drawable[2];

        drawables[0] = oldColor != null ? oldColor : new ColorDrawable(t.first.getSolidColor());
        drawables[1] = new ColorDrawable(newColor);
        TransitionDrawable transitionDrawable = new TransitionDrawable(drawables);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            t.first.setBackground(transitionDrawable);
        } else {
            //noinspection deprecation
            t.first.setBackgroundDrawable(transitionDrawable);
        }
        transitionDrawable.startTransition(target.targetCrossfadeSpeed);
    }
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:18,代碼來源:BitmapPalette.java

示例4: processImageResult

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void processImageResult(ImageResult imageResult) {
        if (imageResult != null) {
            ImageRequest request = imageResult.getRequest();
            ImageView imageView = request.target.get();
            if (imageView != null) {
                Object tag = imageView.getTag();
                if (tag != null && tag.equals(request.url)) {
                    TransitionDrawable drawable = new TransitionDrawable(new Drawable[]{EMPTY_DRAWABLE, new BitmapDrawable(imageResult.getBitmap())});
                    imageView.setImageDrawable(drawable);
                    drawable.startTransition(1000);
//                    imageView.setImageBitmap(imageResult.getBitmap());
                }
            }
        }
    }
 
開發者ID:IstiN,項目名稱:android-training-2017,代碼行數:16,代碼來源:Malevich.java

示例5: startTrans

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void startTrans(int targetPosition, ImageView targetImage, RecyclingBitmapDrawable startBp, RecyclingBitmapDrawable endBp) {
    if (endBp == null)
        endBp = loadBitmap(targetPosition);
    TransitionDrawable td = new TransitionDrawable(new Drawable[] {startBp, endBp});
    targetImage.setImageDrawable(td);
    td.setCrossFadeEnabled(true);
    td.startTransition(mSwitchAnimTime);
}
 
開發者ID:codeestX,項目名稱:ECardFlow,代碼行數:9,代碼來源:ECardFlowLayout.java

示例6: onPostExecute

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Drawable result) {
    if (result != null) {
        if (mBlurredArt.getDrawable() != null) {
            final TransitionDrawable td =
                    new TransitionDrawable(new Drawable[]{
                            mBlurredArt.getDrawable(),
                            result
                    });
            mBlurredArt.setImageDrawable(td);
            td.startTransition(400);

        } else {
            mBlurredArt.setImageDrawable(result);
        }
    }
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:18,代碼來源:QuickControlsFragment.java

示例7: changeActionBarColor

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void changeActionBarColor() {

		int color = SettingsActivity.getPrimaryColor(this);
		Drawable colorDrawable = new ColorDrawable(color);

		if (oldBackground == null) {
            getSupportActionBar().setBackgroundDrawable(colorDrawable);
		} else {
			TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, colorDrawable });
            getSupportActionBar().setBackgroundDrawable(td);
			td.startTransition(200);
		}

		oldBackground = colorDrawable;

        setUpStatusBar();
	}
 
開發者ID:medalionk,項目名稱:simple-share-android,代碼行數:18,代碼來源:DocumentsActivity.java

示例8: repeatTransition

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
void repeatTransition(final TransitionDrawable trans, final int timeInterval) {
        r = new Runnable() {
            @Override
            public void run() {
                if (flag) {
//                    Log.d("tagg", "straight");
                    trans.startTransition(timeInterval);
                    flag = false;
                } else {
//                    Log.d("tagg", "reverse");
                    trans.reverseTransition(timeInterval);
                    flag = true;
                }
                hand.postDelayed(this, (2*timeInterval));
            }
        };
        hand.post(r);
    }
 
開發者ID:mayankagg9722,項目名稱:InstagramGradientLibrary,代碼行數:19,代碼來源:AnimateActivity.java

示例9: onPostExecute

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Drawable result) {
    if (result != null) {
        if (mBlurredArt.getDrawable() != null) {
            final TransitionDrawable td =
                    new TransitionDrawable(new Drawable[]{
                            mBlurredArt.getDrawable(),
                            result
                    });
            mBlurredArt.setImageDrawable(td);
            td.startTransition(200);

        } else {
            mBlurredArt.setImageDrawable(result);
        }
    }
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:18,代碼來源:Timber5.java

示例10: setColor

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void setColor(int color) {

    int darkColor = VideoInfoCommonClass.getDarkerColor(color);
    ColorDrawable[] colord = {new ColorDrawable(mLastColor), new ColorDrawable(darkColor)};
    TransitionDrawable trans = new TransitionDrawable(colord);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        mApplicationFrameLayout.setBackground(trans);
    else
        mApplicationFrameLayout.setBackgroundDrawable(trans);
    trans.startTransition(200);
    mLastColor = darkColor;
    if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
        getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getActivity().getWindow().setStatusBarColor(VideoInfoCommonClass.getAlphaColor(darkColor, 160));
    }

}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:20,代碼來源:BrowserByShow.java

示例11: open

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
void open()
{
    ColorDrawable[] color = {new ColorDrawable(Color.parseColor("#00ffffff")), new ColorDrawable(Color.parseColor("#CC000000"))};
    TransitionDrawable trans = new TransitionDrawable(color);
    //This will work also on old devices. The latest API says you have to use setBackground instead.
    rel.setBackgroundDrawable(trans);
    trans.startTransition(100);


    //rel.setBackgroundColor(Color.parseColor("#CC000000"));
    web.setVisibility(View.VISIBLE);
    fb.setVisibility(View.VISIBLE);
    email.setVisibility(View.VISIBLE);
    webtxt.setVisibility(View.VISIBLE);
    fbtxt.setVisibility(View.VISIBLE);
    emailtxt.setVisibility(View.VISIBLE);

}
 
開發者ID:SkylineLabs,項目名稱:FindX,代碼行數:19,代碼來源:AboutDevelopers.java

示例12: setContent

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void setContent() {
    setContentView(R.layout.activity_login);
    screen = (RelativeLayout)findViewById(R.id.rl);
    ColorDrawable[] color = {new ColorDrawable(getResources().getColor(R.color.colorAccent)), new ColorDrawable(getResources().getColor(R.color.colorPrimary)) };
    TransitionDrawable trans = new TransitionDrawable(color);
    screen.setBackgroundDrawable(trans);
    trans.startTransition(1800);

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.default_web_client_id)).requestEmail().build();
    mGoogleApiClient = new GoogleApiClient.Builder(getBaseContext())
            .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();
    mAuth = FirebaseAuth.getInstance();

    FirebaseDatabase database = FirebaseDatabase.getInstance();
    root= database.getReference("room_names");
    loadRooms();
    new CountDownTimer(2500, 1000) {
        public void onTick(long millisUntilDone) { }
        public void onFinish() {
            currentUser = mAuth.getCurrentUser();
            updateUI(currentUser);
        }
    }.start();
}
 
開發者ID:YoungPeacock,項目名稱:FantaF1,代碼行數:26,代碼來源:LoginActivity.java

示例13: display

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
/**
 * @param bitmap
 * @param imageView
 */
public void display(Bitmap bitmap, ImageView imageView) {
    Drawable oldDrawable = imageView.getDrawable();
    Drawable oldBitmapDrawable = null;
    //如果原先的imageView沒drawable就創建一個透明的drawable
    if (null == oldDrawable) {
        oldBitmapDrawable = new ColorDrawable(Color.TRANSPARENT);
    }
    //如果原先就是TransitionDrawable,就獲得第二張圖片
    else if (oldDrawable instanceof TransitionDrawable) {
        oldBitmapDrawable = ((TransitionDrawable) oldDrawable).getDrawable(1);
    } else {
        oldBitmapDrawable = oldDrawable;
    }
    TransitionDrawable td = new TransitionDrawable(new Drawable[]{
            oldBitmapDrawable,
            new BitmapDrawable(Resources.getSystem(), bitmap)
    });
    imageView.setImageDrawable(td);
    td.startTransition(durationMillis);
}
 
開發者ID:J1aDong,項目名稱:Gank-Meizi,代碼行數:25,代碼來源:DrawableFadeDisplayer.java

示例14: setImageBitmap

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
/**
 * Called when the processing is complete and the final bitmap should be set on the ImageView.
 *
 * @param imageView The ImageView to set the bitmap to.
 * @param bitmap    The new bitmap to set.
 */
private void setImageBitmap(ImageView imageView, Bitmap bitmap) {

    if (mFadeInBitmap) {
        // Transition drawable to fade from loading bitmap to final bitmap
        final TransitionDrawable td =
                new TransitionDrawable(new Drawable[]{
                        new ColorDrawable(android.R.color.transparent),
                        new BitmapDrawable(mResources, bitmap)
                });
        imageView.setBackgroundDrawable(imageView.getDrawable());
        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageBitmap(bitmap);
    }
}
 
開發者ID:AppLozic,項目名稱:Applozic-Android-Chat-Sample,代碼行數:23,代碼來源:ImageLoader.java

示例15: fadeThumbnailIn

import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void fadeThumbnailIn(SnippetArticle snippet, Bitmap thumbnail) {
    mImageCallback = null;
    if (thumbnail == null) return; // Nothing to do, we keep the placeholder.

    // We need to crop and scale the downloaded bitmap, as the ImageView we set it on won't be
    // able to do so when using a TransitionDrawable (as opposed to the straight bitmap).
    // That's a limitation of TransitionDrawable, which doesn't handle layers of varying sizes.
    Resources res = mThumbnailView.getResources();
    int targetSize = res.getDimensionPixelSize(R.dimen.snippets_thumbnail_size);
    Bitmap scaledThumbnail = ThumbnailUtils.extractThumbnail(
            thumbnail, targetSize, targetSize, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);

    // Store the bitmap to skip the download task next time we display this snippet.
    snippet.setThumbnailBitmap(scaledThumbnail);

    // Cross-fade between the placeholder and the thumbnail.
    Drawable[] layers = {mThumbnailView.getDrawable(),
            new BitmapDrawable(mThumbnailView.getResources(), scaledThumbnail)};
    TransitionDrawable transitionDrawable = new TransitionDrawable(layers);
    mThumbnailView.setImageDrawable(transitionDrawable);
    transitionDrawable.startTransition(FADE_IN_ANIMATION_TIME_MS);
}
 
開發者ID:JackyAndroid,項目名稱:AndroidChromium,代碼行數:23,代碼來源:SnippetArticleViewHolder.java


注:本文中的android.graphics.drawable.TransitionDrawable.startTransition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。