com.daimajia.androidanimations.library.YoYo Java Examples

The following examples show how to use com.daimajia.androidanimations.library.YoYo. 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: CommentsActivity.java    From StreamHub-Android-SDK with MIT License 6 votes vote down vote up
private void setListenersToViews() {
    postNewCommentIv.setOnClickListener(this);
    notification.setOnClickListener(this);
    commentsLV.setOnScrollListener(onScrollListener);

    swipeView.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
    swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            swipeView.setRefreshing(true);
            mCommentsAdapter = null;
            commentsArray.clear();
            mCommentsAdapter = new CommentsAdapter(getApplication(), commentsArray);
            commentsLV.setAdapter(mCommentsAdapter);
            bootstrapClientCall();

            YoYo.with(Techniques.FadeIn).duration(700).playOn(findViewById(R.id.commentsLV));
        }
    });
}
 
Example #2
Source File: ViewAnimationActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
private void randomAnimation() {
    int gen = mRandom.nextInt(5);
    switch (gen) {
        case 0:
            YoYo.with(Techniques.Flash).duration(1000).playOn(mButton);
            break;
        case 1:
            YoYo.with(Techniques.Shake).duration(1000).playOn(mButton);
            break;
        case 2:
            YoYo.with(Techniques.FadeInUp).duration(1000).playOn(mButton);
            break;
        case 3:
            YoYo.with(Techniques.RotateIn).duration(1000).playOn(mButton);
            break;
        case 4:
            YoYo.with(Techniques.Wave).duration(1000).playOn(mButton);
            break;
        default:
            YoYo.with(Techniques.Tada).duration(1000).playOn(mButton);
            break;
    }
}
 
Example #3
Source File: ReaderFragment.java    From Readily with MIT License 6 votes vote down vote up
private void showNotification(String text){
	if (!TextUtils.isEmpty(text)){
		notification.setText(text);
		setCurrentTime(System.currentTimeMillis());

		if (notificationHided){
			YoYo.with(Techniques.SlideInDown).
					duration(NOTIF_APPEARING_DURATION).
					playOn(notification);
			notification.postDelayed(new Runnable() {
				@Override
				public void run(){
					notification.setVisibility(View.VISIBLE);
				}
			}, NOTIF_APPEARING_DURATION);

			YoYo.with(Techniques.FadeOut).
					duration(NOTIF_APPEARING_DURATION).
					playOn(upLogo);
			notificationHided = false;
		}
	}
}
 
Example #4
Source File: ReaderFragment.java    From Readily with MIT License 6 votes vote down vote up
private boolean hideNotification(boolean force){
	if (!notificationHided){
		if (force || System.currentTimeMillis() - localTime > NOTIF_SHOWING_LENGTH){
			YoYo.with(Techniques.SlideOutUp).
					duration(NOTIF_APPEARING_DURATION).
					playOn(notification);
			notification.postDelayed(new Runnable() {
				@Override
				public void run(){
					notification.setVisibility(View.INVISIBLE);
				}
			}, NOTIF_APPEARING_DURATION);

			YoYo.with(Techniques.FadeIn).
					duration(NOTIF_APPEARING_DURATION).
					playOn(upLogo);
			notificationHided = true;
		}
	}
	return notificationHided;
}
 
Example #5
Source File: PlayActivity.java    From FixMath with Apache License 2.0 6 votes vote down vote up
void animClickFigures(String figureType){

        for (int i = Up; i <= Down; i++) {
            for (int x = 0; x <= 4; x++) {
                String TextViewId = "var" + i + "x" + x;
                int id = getResources().getIdentifier(TextViewId, "id", getPackageName());
                TextView allTextContainer = (TextView) findViewById(id);
                if(allTextContainer.getTag() != null) {
                    String containerTags = allTextContainer.getTag().toString();

                    if (containerTags.equals(figureType)) {
                        YoYo.with(Techniques.RubberBand)
                                .duration(500)
                                .playOn(allTextContainer);
                    }
                }

            }
        }
    }
 
Example #6
Source File: PhotosViewSlider.java    From PhotoViewSlider with Apache License 2.0 6 votes vote down vote up
private void showImage(String url, String description, int currentPosition) {
    txtDescriptionGallery.setText(description);
    txtCurrentPosition.setText(String.valueOf(currentPosition+1));
    txtPhotosTotal.setText(String.valueOf(photos.size()));
    Picasso.with(getContext()).load(url).fit()
            .placeholder(R.drawable.photodefault)
            .into(imgPhoto);

    btnShare.setOnClickListener(this);
    viewDialog.setOnTouchListener(this);

    builder.setContentView(viewDialog);
    builder.show();
    YoYo.with(techniqueAnimation)
            .duration(700)
            .playOn(imgPhoto);
}
 
Example #7
Source File: ReaderFragment.java    From Readily with MIT License 6 votes vote down vote up
private void showInfo(int wpm, String percentLeft){
	wpmTextView.setText(wpm + " WPM");
	positionTextView.setText(percentLeft);

	if (infoHided){
		YoYo.with(Techniques.FadeIn).
				duration(NOTIF_APPEARING_DURATION * 2).
				playOn(infoLayout);
		infoLayout.postDelayed(new Runnable() {
			@Override
			public void run(){
				infoLayout.setVisibility(View.VISIBLE);
			}
		}, NOTIF_APPEARING_DURATION);
		infoHided = false;
	}
}
 
Example #8
Source File: HomeActivity.java    From black-mirror with MIT License 6 votes vote down vote up
/**
 * Zdarzenie, które oznjamia o wykryciu słowa kluczowego.
 */
@Override
public void onActivationKeywordDetected() {
    Log.i("ACTIVATION PHRASE ", " DETECTED ");
    commandRecognizingAnimation.startAnimation();
    activationKeywordTextIndicator.setVisibility(INVISIBLE);
    activeSpeechIndicator.setVisibility(View.INVISIBLE);
    // Zacznij słuchać komendy.
    commandSpeechRecognizer.startListeningCommand();
    if (welcomeView.getVisibility() == View.VISIBLE) {
        YoYo.with(Techniques.Tada)
                .onEnd(new YoYo.AnimatorCallback() {
                    @Override
                    public void call(Animator animator) {
                        welcomeView.setVisibility(View.INVISIBLE);
                    }
                }).playOn(welcomeView);
    }
}
 
Example #9
Source File: ViewGroup2.java    From backstack with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.lbs_vg2_next_screen) public void onClick(){
    linearBackStack.builder((layoutInflater, container) -> {
        ViewGroup viewGroup = (ViewGroup) layoutInflater.inflate(R.layout.lbs_viewgroup3, container, false);
        container.addView(viewGroup);
        return viewGroup;
    }).addAnimator((v, e) -> {
        YoYo.with(Techniques.SlideInRight)
                .duration(200)
                .onEnd((animator)->e.done())
                .playOn(v);
    }).removeAnimator((v, e) -> {
        YoYo.with(Techniques.SlideOutRight)
                .duration(200)
                .onEnd((animator)->e.done())
                .playOn(v);
    }).build();
}
 
Example #10
Source File: CachedFilesAdapter.java    From Readily with MIT License 6 votes vote down vote up
private void inflateMainMenu(View v){
	final View actionView = v.findViewById(R.id.action_view);

	YoYo.with(Techniques.FadeOut).
			duration(DURATION).
			playOn(actionView);

	YoYo.with(Techniques.SlideInRight).
			duration(DURATION).
			playOn(v.findViewById(R.id.main_view));
	actionView.postDelayed(new Runnable() {
		@Override
		public void run(){
			actionView.setVisibility(View.GONE);
		}
	}, DURATION);
}
 
Example #11
Source File: TimeWidgetView.java    From black-mirror with MIT License 6 votes vote down vote up
/**
 * Metoda pokazująca widżet dla podanej strefy czasowej.
 *
 * @param timezone strefa czasowa.
 */
public void show(String timezone) {
    clock.setTimeZone(timezone);
    clock.setFormat24Hour(clock.getFormat24Hour());
    clock.setFormat12Hour(null);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(timezone));
    String[] dayNames = new DateFormatSymbols(new Locale("pl")).getWeekdays();
    String[] monthNames = new DateFormatSymbols(new Locale("pl")).getMonths();
    date.setText(String.format(context.getString(R.string.date_format), dayNames[calendar.get(Calendar.DAY_OF_WEEK)],
            Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)),
            monthNames[calendar.get(Calendar.MONTH)]));
    YoYo.with(Techniques.ZoomIn)
            .onStart(new YoYo.AnimatorCallback() {
                @Override
                public void call(Animator animator) {
                    setVisibility(VISIBLE);
                }
            })
            .playOn(this);
}
 
Example #12
Source File: SlideBarChartView.java    From SlidePager with MIT License 5 votes vote down vote up
/**
 * Set up listeners for all the views in {@link #mChartProgressList}
 */
private void setListeners() {
    for (final BarChartProgressView barChartProgressView : mChartProgressList) {
        if (barChartProgressView != null) {

            barChartProgressView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    int index = barChartProgressView.getIntTag();
                    boolean allowed = true;
                    if (mCallback != null) {
                        allowed = mCallback.isDaySelectable(mPagePosition, index);
                    }
                    if (allowed) {
                        if (mCallback != null) {
                            mCallback.onDaySelected(mPagePosition, index);
                        }
                        toggleSelectedViews(index);
                    } else {
                        if (mShakeIfNotSelectable) {
                            YoYo.with(Techniques.Shake)
                                    .duration(NOT_ALLOWED_SHAKE_ANIMATION_DURATION)
                                    .playOn(SlideBarChartView.this);
                        }
                    }
                }
            });
        }
    }
}
 
Example #13
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
private void countToStart(){
    final Timer Counter = new Timer();
    final TextView counterView = (TextView) findViewById(R.id.counterView);

    sfxManager.TimerSfxPlay(true);

    Counter.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {


                    countSeconds--;
                    counterView.setText("" + countSeconds);
                    YoYo.with(Techniques.TakingOff)
                            .duration(900)
                            .playOn(counterView);

                    if (countSeconds == -1) {
                        Counter.cancel();
                        counterView.setVisibility(View.INVISIBLE);
                        sfxManager.TimerSfxPlay(false);
                        //TU POPRAWIC
                        startTimer(timeChallenge);

                        setNewLevel();
                        setVisibilityComponents(false, true);
                        setBackgroundColor();
                        setNewCalculationsAndLogic(passedLinesIndexer);
                        setCorrectFrameFigures();
                        isCounting = false;
                    }
                }
            });
        }
    }, 1000, 1000);
}
 
Example #14
Source File: SplashActivity.java    From MagicPrint-ECommerce-App-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    session =new UserSession(SplashActivity.this);

  Typeface typeface = ResourcesCompat.getFont(this, R.font.blacklist);

  TextView appname= findViewById(R.id.appname);
  appname.setTypeface(typeface);

    YoYo.with(Techniques.Bounce)
            .duration(7000)
            .playOn(findViewById(R.id.logo));

    YoYo.with(Techniques.FadeInUp)
            .duration(5000)
            .playOn(findViewById(R.id.appname));

        new Handler().postDelayed(new Runnable() {

        /*
         * Showing splash screen with a timer. This will be useful when you
         * want to show case your app logo / company
         */

            @Override
            public void run() {
                // This method will be executed once the timer is over
                // Start your app main activity
                startActivity(new Intent(SplashActivity.this,WelcomeActivity.class));
                finish();
            }
        }, SPLASH_TIME_OUT);
    }
 
Example #15
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
private void restoreCorrectLineAnimation(){
    ImageView backLine = (ImageView) findViewById(R.id.back_line);
    backLine.setImageBitmap(BitmapManager.decodeSampledBitmapFromResource(getResources(),
            R.drawable.aaas, backLine.getWidth(), backLine.getHeight()));
    YoYo.with(Techniques.ZoomIn)
            .duration(500)
            .playOn(backLine);
}
 
Example #16
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
private void popUpLevelCorrectScoreAnimation(){
    TextView scorePopUp = (TextView) findViewById(R.id.level_correct_scorePopUp);
    scorePopUp.setText("5000");
    YoYo.with(Techniques.TakingOff)
            .duration(3200)
            .playOn(scorePopUp);

}
 
Example #17
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void WriteBlankAnimation(View animBlank) {
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(animBlank.getId()));


    sfxManager.KeyboardClickPlay(true);

    new ParticleSystem(this, 5, R.drawable.star_white, 800)
            .setScaleRange(0.7f, 1.3f)
            .setSpeedRange(0.1f, 0.25f)
            .setRotationSpeedRange(90, 180)
            .setFadeOut(200, new AccelerateInterpolator())
            .oneShot(animBlank, 100);
}
 
Example #18
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void OpenPointerAnimation() {
    if(Pointer != null) {
        ImageView pointer = (ImageView) findViewById(Pointer.getId());
        YoYo.with(Techniques.FlipInX)
                .duration(500)
                .playOn(pointer);
    }
}
 
Example #19
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
private void closePointerAnimation() {
    if(Pointer != null) {
        ImageView pointer = (ImageView) findViewById(Pointer.getId());
        YoYo.with(Techniques.ZoomOut)
            .duration(200)
            .playOn(pointer);
    }
}
 
Example #20
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void KeyboardClose(View view) {
    View keyboardView = findViewById(R.id.t_keyboard);
    setClickableRecursive(keyboardView, false);
    YoYo.with(Techniques.ZoomOut)
            .duration(400)
            .playOn(keyboardView);
    closePointerAnimation();
    isKeyboardOpen = false;

    sfxManager.KeybordClosePlay();

}
 
Example #21
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
public void KeyboardClose() {
    View keyboardView = findViewById(R.id.t_keyboard);
    setClickableRecursive(keyboardView, false);
    YoYo.with(Techniques.ZoomOut)
            .duration(400)
            .playOn(keyboardView);
    closePointerAnimation();
    isKeyboardOpen = false;



}
 
Example #22
Source File: SlideChartView.java    From SlidePager with MIT License 5 votes vote down vote up
/**
 * Set up listeners for all the views in {@link #mProgressList}
 */
private void setListeners() {
    for (final ProgressView progressView : mProgressList) {
        if (progressView != null) {

            progressView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    int index = progressView.getIntTag();
                    boolean allowed = true;
                    if (mCallback != null) {
                        allowed = mCallback.isDaySelectable(mPagePosition, index);
                    }
                    if (allowed) {
                        if (mCallback != null) {
                            mCallback.onDaySelected(mPagePosition, index);
                        }
                        toggleSelectedViews(index);
                    } else {
                        if (mShakeIfNotSelectable) {
                            YoYo.with(Techniques.Shake)
                                    .duration(NOT_ALLOWED_SHAKE_ANIMATION_DURATION)
                                    .playOn(SlideChartView.this);
                        }
                    }
                }
            });
        }
    }
}
 
Example #23
Source File: SlideView.java    From SlidePager with MIT License 5 votes vote down vote up
/**
 * Set up listeners for all the views in {@link #mProgressList}
 */
private void setListeners() {
    for (final ProgressView progressView : mProgressList) {
        if (progressView != null) {

            progressView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    int index = progressView.getIntTag();
                    boolean allowed = true;
                    if (mCallback != null) {
                        allowed = mCallback.isDaySelectable(mPagePosition, index);
                    }
                    if (allowed) {
                        if (mCallback != null) {
                            mCallback.onDaySelected(mPagePosition, index);
                        }
                        toggleSelectedViews(index);
                        animateSelectedTranslation(view);
                    } else {
                        if (mShakeIfNotSelectable) {
                            YoYo.with(Techniques.Shake)
                                    .duration(NOT_ALLOWED_SHAKE_ANIMATION_DURATION)
                                    .playOn(SlideView.this);
                        }
                    }
                }
            });
        }
    }
}
 
Example #24
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 5 votes vote down vote up
private void correctLevelAnimation() {
        ImageView backLine = (ImageView) findViewById(R.id.back_line);
        backLine.setImageBitmap(BitmapManager.decodeSampledBitmapFromResource(getResources(),
            R.drawable.correct , backLine.getWidth(), backLine.getHeight()));
        YoYo.with(Techniques.ZoomIn)
                .duration(300)
                .playOn(backLine);
}
 
Example #25
Source File: CachedFilesAdapter.java    From Readily with MIT License 5 votes vote down vote up
private void inflateActionMenu(View v){
	View actionView = v.findViewById(R.id.action_view);
	View mainView = v.findViewById(R.id.main_view);

	actionView.setMinimumHeight(mainView.getHeight());

	YoYo.with(Techniques.SlideOutRight).
			duration(DURATION).
			playOn(mainView);

	actionView.setVisibility(View.VISIBLE);
	YoYo.with(Techniques.FadeIn).
			duration(DURATION).
			playOn(actionView);
}
 
Example #26
Source File: ReaderFragment.java    From Readily with MIT License 5 votes vote down vote up
public void performPlay(){
	if (isPaused()){
		paused++;
		YoYo.with(Techniques.Pulse).
				duration(READER_PULSE_DURATION).
				playOn(readerLayout);
		if (!settingsBundle.isSwipesEnabled()){ prevButton.setVisibility(View.INVISIBLE); }
		hideNotification(true);
		hideInfo();
		readerHandler.postDelayed(this, READER_PULSE_DURATION + 100);
	}
}
 
Example #27
Source File: ReaderFragment.java    From Readily with MIT License 5 votes vote down vote up
private void hideInfo(){
	if (!infoHided){
		YoYo.with(Techniques.FadeOut).
				duration(NOTIF_APPEARING_DURATION).
				playOn(infoLayout);
		infoLayout.postDelayed(new Runnable() {
			@Override
			public void run(){
				infoLayout.setVisibility(View.INVISIBLE);
			}
		}, NOTIF_APPEARING_DURATION);
		infoHided = true;
	}
}
 
Example #28
Source File: ReaderFragment.java    From Readily with MIT License 5 votes vote down vote up
private void startReader(final TextParser parser){
	changeParser(parser);
	final int resultCode = parser.getResultCode();
	if (resultCode == TextParser.RESULT_CODE_OK){
		final int initialPosition = Math.max(readable.getPosition() - Constants.READER_START_OFFSET, 0);
		reader = new Reader(handler, initialPosition);
		Activity activity = getActivity();
		if (activity != null){
			activity.runOnUiThread(new Runnable() {
				@Override
				public void run(){
					parsingProgressBar.clearAnimation();
					parsingProgressBar.setVisibility(View.GONE);
					readerLayout.setVisibility(View.VISIBLE);
					if (initialPosition < wordList.size()){
						showNotification(R.string.tap_to_start);
						progress = readable.calcProgress(initialPosition, 0);
						reader.updateView(initialPosition);
						showInfo(reader);
					} else {
						showNotification(R.string.reading_is_completed);
						reader.setCompleted(true);
					}
					YoYo.with(Techniques.FadeIn).
							duration(READER_PULSE_DURATION).
							playOn(readerLayout);
				}
			});
		}
	} else {
		notifyBadParser(resultCode);
	}
}
 
Example #29
Source File: ReaderFragment.java    From Readily with MIT License 5 votes vote down vote up
public void performPause(){
	if (!isPaused()){
		paused++;
		YoYo.with(Techniques.Pulse).
				duration(READER_PULSE_DURATION).
				playOn(readerLayout);
		if (!settingsBundle.isSwipesEnabled()){ prevButton.setVisibility(View.VISIBLE); }
		showNotification(R.string.pause);
		showInfo(this);
	}
}
 
Example #30
Source File: WeatherWidgetView.java    From black-mirror with MIT License 5 votes vote down vote up
/**
 * Wypełnia widok modelem podanym w projekcie oraz wykonuje
 * animację pokazania widżetu.
 *
 * @param weatherResponse model reprezentujący dane pogody.
 */
public void show(WeatherResponse weatherResponse) {
    fillWeatherInfo(weatherResponse);
    if (getVisibility() == INVISIBLE) {
        YoYo.with(Techniques.ZoomIn).onStart(new YoYo.AnimatorCallback() {
            @Override
            public void call(Animator animator) {
                setVisibility(VISIBLE);
            }
        }).playOn(this);
    } else {
        YoYo.with(Techniques.FadeIn).playOn(this);
    }
}