Search in sources :

Example 1 with SlideView

use of org.telegram.ui.Components.SlideView in project Telegram-FOSS by Telegram-FOSS-Team.

the class ChangePhoneActivity method setPage.

public void setPage(int page, boolean animated, Bundle params, boolean back) {
    if (page == 3) {
        doneButton.setVisibility(View.GONE);
    } else {
        if (page == 0) {
            checkPermissions = true;
        }
        doneButton.setVisibility(View.VISIBLE);
    }
    final SlideView outView = views[currentViewNum];
    final SlideView newView = views[page];
    currentViewNum = page;
    newView.setParams(params, false);
    actionBar.setTitle(newView.getHeaderName());
    newView.onShow();
    newView.setX(back ? -AndroidUtilities.displaySize.x : AndroidUtilities.displaySize.x);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.setDuration(300);
    animatorSet.playTogether(ObjectAnimator.ofFloat(outView, "translationX", back ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(newView, "translationX", 0));
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            newView.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            outView.setVisibility(View.GONE);
            outView.setX(0);
        }
    });
    animatorSet.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) SlideView(org.telegram.ui.Components.SlideView)

Example 2 with SlideView

use of org.telegram.ui.Components.SlideView in project Telegram-FOSS by Telegram-FOSS-Team.

the class CancelAccountDeletionActivity method setPage.

public void setPage(int page, boolean animated, Bundle params, boolean back) {
    if (page == 3 || page == 0) {
        doneButton.setVisibility(View.GONE);
    } else {
        doneButton.setVisibility(View.VISIBLE);
    }
    final SlideView outView = views[currentViewNum];
    final SlideView newView = views[page];
    currentViewNum = page;
    newView.setParams(params, false);
    actionBar.setTitle(newView.getHeaderName());
    newView.onShow();
    newView.setX(back ? -AndroidUtilities.displaySize.x : AndroidUtilities.displaySize.x);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.setDuration(300);
    animatorSet.playTogether(ObjectAnimator.ofFloat(outView, "translationX", back ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(newView, "translationX", 0));
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            newView.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            outView.setVisibility(View.GONE);
            outView.setX(0);
        }
    });
    animatorSet.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) SlideView(org.telegram.ui.Components.SlideView)

Example 3 with SlideView

use of org.telegram.ui.Components.SlideView in project Telegram-FOSS by Telegram-FOSS-Team.

the class LoginActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    if (newAccount) {
        ConnectionsManager.getInstance(currentAccount).setAppPaused(false, false);
    }
    AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
    fragmentView.requestLayout();
    try {
        if (currentViewNum >= 1 && currentViewNum <= 4 && views[currentViewNum] instanceof LoginActivitySmsView) {
            int time = ((LoginActivitySmsView) views[currentViewNum]).openTime;
            if (time != 0 && Math.abs(System.currentTimeMillis() / 1000 - time) >= 24 * 60 * 60) {
                views[currentViewNum].onBackPressed(true);
                setPage(0, false, null, true);
            }
        }
    } catch (Exception e) {
        FileLog.e(e);
    }
    if (currentViewNum == 0 && !needRequestPermissions) {
        SlideView view = views[currentViewNum];
        if (view != null) {
            view.onShow();
        }
    }
}
Also used : TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) SlideView(org.telegram.ui.Components.SlideView)

Example 4 with SlideView

use of org.telegram.ui.Components.SlideView in project Telegram-FOSS by Telegram-FOSS-Team.

the class LoginActivity method saveSelfArgs.

@Override
public void saveSelfArgs(Bundle outState) {
    try {
        Bundle bundle = new Bundle();
        bundle.putInt("currentViewNum", currentViewNum);
        bundle.putInt("syncContacts", syncContacts ? 1 : 0);
        for (int a = 0; a <= currentViewNum; a++) {
            SlideView v = views[a];
            if (v != null) {
                v.saveStateParams(bundle);
            }
        }
        SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.clear();
        putBundleToEditor(bundle, editor, null);
        editor.commit();
    } catch (Exception e) {
        FileLog.e(e);
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Bundle(android.os.Bundle) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) SlideView(org.telegram.ui.Components.SlideView)

Example 5 with SlideView

use of org.telegram.ui.Components.SlideView in project Telegram-FOSS by Telegram-FOSS-Team.

the class PassportActivity method setPage.

public void setPage(int page, boolean animated, Bundle params) {
    if (page == 3) {
        doneItem.setVisibility(View.GONE);
    }
    final SlideView outView = views[currentViewNum];
    final SlideView newView = views[page];
    currentViewNum = page;
    newView.setParams(params, false);
    newView.onShow();
    if (animated) {
        newView.setTranslationX(AndroidUtilities.displaySize.x);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorSet.setDuration(300);
        animatorSet.playTogether(ObjectAnimator.ofFloat(outView, "translationX", -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(newView, "translationX", 0));
        animatorSet.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                newView.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                outView.setVisibility(View.GONE);
                outView.setX(0);
            }
        });
        animatorSet.start();
    } else {
        newView.setTranslationX(0);
        newView.setVisibility(View.VISIBLE);
        if (outView != newView) {
            outView.setVisibility(View.GONE);
        }
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) SlideView(org.telegram.ui.Components.SlideView)

Aggregations

SlideView (org.telegram.ui.Components.SlideView)6 Animator (android.animation.Animator)4 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)4 AnimatorSet (android.animation.AnimatorSet)4 ObjectAnimator (android.animation.ObjectAnimator)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 SuppressLint (android.annotation.SuppressLint)2 Paint (android.graphics.Paint)2 TextPaint (android.text.TextPaint)2 StateListAnimator (android.animation.StateListAnimator)1 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 VerticalPositionAutoAnimator (org.telegram.ui.Components.VerticalPositionAutoAnimator)1