Java Code Examples for android.view.animation.Animation#start()

The following examples show how to use android.view.animation.Animation#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageFetcher.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
/**
 * Once the image is downloaded, associates it to the imageView
 */
@Override
protected void onPostExecute(Bitmap bitmap) {
    if (isCancelled()) {
        bitmap = null;
    }
    addBitmapToCache(position, bitmap);
    if (imageViewReference != null) {
        ImageView imageView = imageViewReference.get();
        BitmapFetcherTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
        if (this == bitmapDownloaderTask) {
            imageView.setImageBitmap(bitmap);
            Animation anim = AnimationUtils.loadAnimation(imageView.getContext(), android.R.anim.fade_in);
            imageView.setAnimation(anim);
            anim.start();
        }
    } else {
        setInvisible();
    }
}
 
Example 2
Source File: WoDouGameBaseFragment.java    From android-tv-launcher with MIT License 6 votes vote down vote up
@Override
public void onFocusChange(View v, boolean hasFocus) {

    int focus = 0;
    if (hasFocus) {
        focus = R.anim.enlarge;
    } else {
        focus = R.anim.decrease;
    }
    //如果有焦点就放大,没有焦点就缩小
    Animation mAnimation = AnimationUtils.loadAnimation(
            getActivity().getApplication(), focus);
    mAnimation.setBackgroundColor(Color.TRANSPARENT);
    mAnimation.setFillAfter(hasFocus);
    v.startAnimation(mAnimation);
    mAnimation.start();
    v.bringToFront();
}
 
Example 3
Source File: AllApp.java    From android-tv-launcher with MIT License 6 votes vote down vote up
@Override
        public void onFocusChange(View v, boolean hasFocus) {

            int focus = 0;
            if (hasFocus) {
                focus = R.anim.enlarge;
            } else {
                focus = R.anim.decrease;
            }
//            如果有焦点就放大,没有焦点就缩小
            Animation mAnimation = AnimationUtils.loadAnimation(
                    mContext, focus);
            mAnimation.setBackgroundColor(Color.TRANSPARENT);
            mAnimation.setFillAfter(hasFocus);
            v.startAnimation(mAnimation);
            mAnimation.start();
            v.bringToFront();
        }
 
Example 4
Source File: EBrowserWindow.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void removeViewFromCurrentWindow(View child) {
//        Message msg = mWindLoop.obtainMessage();
//        msg.what = F_WHANDLER_REMOVE_VIEW;
//        msg.obj = child;
//        mWindLoop.sendMessage(msg);
//         Animation removeAnim = child.getAnimation();
//         if (null != removeAnim) {
//         removeAnim.start();
//         }
//         removeView(child);

//        View children = (View) msg.obj;
        Animation removeAnim = child.getAnimation();
        if (null != removeAnim) {
            removeAnim.start();
        }
        removeViewList(child);
//        msg.obj = null;
    }
 
Example 5
Source File: RedPacketForecastDialog.java    From letv with Apache License 2.0 5 votes vote down vote up
public void show() {
    try {
        super.show();
        if (this.mDialogDisplayCallback != null) {
            this.mDialogDisplayCallback.onShow();
        }
        StatisticsUtil.statistics(12);
        Animation anima = AnimationUtils.loadAnimation(RedPacketSdkManager.getInstance().getApplicationContext(), R.anim.forecast_view_show);
        this.mforecastView.setAnimation(anima);
        anima.start();
    } catch (Exception e) {
    }
}
 
Example 6
Source File: ColorChooserDialog.java    From Material-Color-Picker with Apache License 2.0 5 votes vote down vote up
private void animator(final ImageButton imageButton){
    Animation animation = AnimationUtils.loadAnimation(getContext(),R.anim.color_item);
    animation.setInterpolator(new AccelerateInterpolator());
    imageButton.setAnimation(animation);
    imageButton.setVisibility(View.VISIBLE);
    animation.start();
}
 
Example 7
Source File: ViewAnimationSetBuilder.java    From react-native-navigation with MIT License 5 votes vote down vote up
public void start() {
    for (Animation animation : pendingAnimations) {
        animation.start();
    }
    started = true;
    if (pendingAnimations.isEmpty()) finish();
}
 
Example 8
Source File: BindingAdapters.java    From Jockey with Apache License 2.0 5 votes vote down vote up
@BindingAdapter("animation")
public static void bindAnimation(View view, @Nullable Animation animation) {
    if (animation == null) {
        return;
    }

    view.setAnimation(animation);
    animation.start();
}
 
Example 9
Source File: EBrowserWindow.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void addViewToCurrentWindow(View child) {
    //Message msg = mWindLoop.obtainMessage();
    //msg.what = F_WHANDLER_ADD_VIEW;
    //msg.obj = child;
    //mWindLoop.sendMessage(msg);
    viewList.add(child);
    child.setTag(EViewEntry.F_PLUGIN_VIEW_TAG);
    Animation anim = child.getAnimation();
    addView(child);
    if (null != anim) {
        anim.start();
    }
    bringChildToFront(child);
}
 
Example 10
Source File: SimpleHUDDialog.java    From SimpleHUD with MIT License 5 votes vote down vote up
public void setImage(Context ctx, int resId) {
	ImageView image = (ImageView)findViewById(R.id.simplehud_image);
	image.setImageResource(resId);
	
	if(resId==R.drawable.simplehud_spinner) {
		Animation anim = AnimationUtils.loadAnimation(ctx, R.anim.progressbar);  
		anim.start();
		image.startAnimation(anim);
	}
}
 
Example 11
Source File: Game.java    From SchoolQuest with GNU General Public License v3.0 4 votes vote down vote up
public void setLoadingScreen(boolean loading, int... frames) {
    currentLoadingTime = 0;
    Animation loadingTextAnim;

    if (GameActivity.getInstance().findViewById(
            R.id.loading_text).getAnimation() != null) {
        loadingTextAnim = GameActivity.getInstance().findViewById(R.id.loading_text).
                getAnimation();
    } else if (GameActivity.getInstance().findViewById(
            R.id.loading_day_old).getAnimation() != null) {
        loadingTextAnim = GameActivity.getInstance().findViewById(R.id.loading_day_old).
                getAnimation();
    } else {
        loadingTextAnim = null;
    }

    int animDuration = 0;
    if (loadingTextAnim != null) {
        animDuration = (int) ((loadingTextAnim.getDuration() + loadingTextAnim.getStartOffset())
                * TARGET_FPS) / 1000;
        loadingTextAnim.start();
    }
    if (frames.length == 0) { loadingTime = 6 + animDuration; }
    else { loadingTime = frames[0] + animDuration; }

    if (loading) {
        this.loading = true;
        GameActivity.getInstance().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                GameActivity.getInstance().enableLoadingScreen();
            }
        });
    }
    else {
        GameActivity.getInstance().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                GameActivity.getInstance().disableLoadingScreen();
            }
        });
    }
}
 
Example 12
Source File: ColorChooserDialog.java    From Material-Color-Picker with Apache License 2.0 4 votes vote down vote up
private void animate(){
    Log.e("animate","true");
    Runnable r1 = new Runnable() {
        @Override
        public void run() {
            Log.e("animator 1","r");
            animator(one);
        }
    };

    Runnable r2 = new Runnable() {
        @Override
        public void run() {
            animator(two);
            animator(six);
        }
    };

    Runnable r3 = new Runnable() {
        @Override
        public void run() {
            animator(three);
            animator(seven);
            animator(eleven);
        }
    };

    Runnable r4 = new Runnable() {
        @Override
        public void run() {
            animator(four);
            animator(eight);
            animator(twelve);
            animator(sixteen);
        }
    };

    Runnable r5 = new Runnable() {
        @Override
        public void run() {
            animator(five);
            animator(nine);
            animator(thirteen);
            animator(seventeen);
        }
    };

    Runnable r6 = new Runnable() {
        @Override
        public void run() {
            animator(ten);
            animator(fourteen);
            animator(eighteen);
        }
    };

    Runnable r7 = new Runnable() {
        @Override
        public void run() {
            animator(fifteen);
            animator(nineteen);
        }
    };

    Runnable r8 = new Runnable() {
        @Override
        public void run() {
            animator(twenty);
        }
    };

    Runnable r9 = new Runnable() {
        @Override
        public void run() {
            Animation animation = AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_in);
            animation.setInterpolator(new AccelerateInterpolator());
            twentyOne.setAnimation(animation);
            twentyOne.setVisibility(View.VISIBLE);
            animation.start();
        }
    };



    android.os.Handler handler = new android.os.Handler();
    int counter = 85;
    handler.postDelayed(r1,counter);
    handler.postDelayed(r2,counter * 2);
    handler.postDelayed(r3,counter * 3);
    handler.postDelayed(r4,counter * 4);
    handler.postDelayed(r5,counter * 5);
    handler.postDelayed(r6,counter * 6);
    handler.postDelayed(r7,counter * 7);
    handler.postDelayed(r8,counter * 8);
    handler.postDelayed(r9,counter * 9);
}