Search in sources :

Example 16 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project AnExplorer by 1hakr.

the class FabSpeedDial method removeFabMenuItems.

private void removeFabMenuItems() {
    if (touchGuard != null)
        touchGuard.setVisibility(GONE);
    ViewCompat.animate(menuItemsLayout).setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)).alpha(0f).setInterpolator(new FastOutLinearInInterpolator()).setListener(new ViewPropertyAnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(View view) {
            super.onAnimationStart(view);
            isAnimating = true;
        }

        @Override
        public void onAnimationEnd(View view) {
            super.onAnimationEnd(view);
            menuItemsLayout.removeAllViews();
            isAnimating = false;
        }
    }).start();
}
Also used : FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) ViewPropertyAnimatorListenerAdapter(android.support.v4.view.ViewPropertyAnimatorListenerAdapter) View(android.view.View) TextView(android.widget.TextView)

Example 17 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project Android-Week-View by alamkanak.

the class WeekView method init.

private void init() {
    // Scrolling initialization.
    mGestureDetector = new GestureDetectorCompat(mContext, mGestureListener);
    mScroller = new OverScroller(mContext, new FastOutLinearInInterpolator());
    mMinimumFlingVelocity = ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity();
    mScaledTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
    // Measure settings for time column.
    mTimeTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTimeTextPaint.setTextAlign(Paint.Align.RIGHT);
    mTimeTextPaint.setTextSize(mTextSize);
    mTimeTextPaint.setColor(mHeaderColumnTextColor);
    Rect rect = new Rect();
    mTimeTextPaint.getTextBounds("00 PM", 0, "00 PM".length(), rect);
    mTimeTextHeight = rect.height();
    mHeaderMarginBottom = mTimeTextHeight / 2;
    initTextTimeWidth();
    // Measure settings for header row.
    mHeaderTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHeaderTextPaint.setColor(mHeaderColumnTextColor);
    mHeaderTextPaint.setTextAlign(Paint.Align.CENTER);
    mHeaderTextPaint.setTextSize(mTextSize);
    mHeaderTextPaint.getTextBounds("00 PM", 0, "00 PM".length(), rect);
    mHeaderTextHeight = rect.height();
    mHeaderTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
    // Prepare header background paint.
    mHeaderBackgroundPaint = new Paint();
    mHeaderBackgroundPaint.setColor(mHeaderRowBackgroundColor);
    // Prepare day background color paint.
    mDayBackgroundPaint = new Paint();
    mDayBackgroundPaint.setColor(mDayBackgroundColor);
    mFutureBackgroundPaint = new Paint();
    mFutureBackgroundPaint.setColor(mFutureBackgroundColor);
    mPastBackgroundPaint = new Paint();
    mPastBackgroundPaint.setColor(mPastBackgroundColor);
    mFutureWeekendBackgroundPaint = new Paint();
    mFutureWeekendBackgroundPaint.setColor(mFutureWeekendBackgroundColor);
    mPastWeekendBackgroundPaint = new Paint();
    mPastWeekendBackgroundPaint.setColor(mPastWeekendBackgroundColor);
    // Prepare hour separator color paint.
    mHourSeparatorPaint = new Paint();
    mHourSeparatorPaint.setStyle(Paint.Style.STROKE);
    mHourSeparatorPaint.setStrokeWidth(mHourSeparatorHeight);
    mHourSeparatorPaint.setColor(mHourSeparatorColor);
    // Prepare the "now" line color paint
    mNowLinePaint = new Paint();
    mNowLinePaint.setStrokeWidth(mNowLineThickness);
    mNowLinePaint.setColor(mNowLineColor);
    // Prepare today background color paint.
    mTodayBackgroundPaint = new Paint();
    mTodayBackgroundPaint.setColor(mTodayBackgroundColor);
    // Prepare today header text color paint.
    mTodayHeaderTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTodayHeaderTextPaint.setTextAlign(Paint.Align.CENTER);
    mTodayHeaderTextPaint.setTextSize(mTextSize);
    mTodayHeaderTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mTodayHeaderTextPaint.setColor(mTodayHeaderTextColor);
    // Prepare event background color.
    mEventBackgroundPaint = new Paint();
    mEventBackgroundPaint.setColor(Color.rgb(174, 208, 238));
    // Prepare header column background color.
    mHeaderColumnBackgroundPaint = new Paint();
    mHeaderColumnBackgroundPaint.setColor(mHeaderColumnBackgroundColor);
    // Prepare event text size and color.
    mEventTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mEventTextPaint.setStyle(Paint.Style.FILL);
    mEventTextPaint.setColor(mEventTextColor);
    mEventTextPaint.setTextSize(mEventTextSize);
    // Set default event color.
    mDefaultEventColor = Color.parseColor("#9fc6e7");
    mScaleDetector = new ScaleGestureDetector(mContext, new ScaleGestureDetector.OnScaleGestureListener() {

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            mIsZooming = false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            mIsZooming = true;
            goToNearestOrigin();
            return true;
        }

        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            mNewHourHeight = Math.round(mHourHeight * detector.getScaleFactor());
            invalidate();
            return true;
        }
    });
}
Also used : Rect(android.graphics.Rect) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) ScaleGestureDetector(android.view.ScaleGestureDetector) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) OverScroller(android.widget.OverScroller) TextPaint(android.text.TextPaint)

Example 18 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project ServiceStack.Java by ServiceStack.

the class LoginActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Twitter(new TwitterAuthConfig(getString(R.string.twitter_key), getString(R.string.twitter_secret))));
    setContentView(R.layout.login);
    Toolbar toolbar = (Toolbar) findViewById(R.id.loginToolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    txtStatus = (TextView) findViewById(R.id.txtStatus);
    UiHelpers.setStatus(txtStatus, "");
    // see this max value coming back here, we animale towards that value
    animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 500);
    animation.setRepeatMode(ValueAnimator.REVERSE);
    animation.setRepeatCount(100);
    animation.setDuration(1500);
    animation.setInterpolator(new FastOutLinearInInterpolator());
    LoginActivity activity = this;
    ImageButton btnTwitter = (ImageButton) findViewById(R.id.btnTwitter);
    twitterAuth = new TwitterAuthClient();
    btnTwitter.setOnClickListener(view -> {
        startProgressBar();
        twitterAuth.authorize(activity, new Callback<TwitterSession>() {

            @Override
            public void success(Result<TwitterSession> result) {
                UiHelpers.setStatus(txtStatus, "Local twitter sign-in successful, signing into server...");
                TwitterSession session = result.data;
                App.get().getServiceClient().postAsync(new dtos.Authenticate().setProvider("twitter").setAccessToken(session.getAuthToken().token).setAccessTokenSecret(session.getAuthToken().secret).setRememberMe(true), r -> {
                    UiHelpers.setStatus(txtStatus, "Server twitter sign-in successful, opening chat...");
                    App.get().saveTwitterAccessToken(session.getAuthToken());
                    Intent intent = new Intent(activity, MainActivity.class);
                    stopProgressBar();
                    startActivity(intent);
                }, error -> {
                    UiHelpers.setStatusError(txtStatus, "Server twitter sign-in failed", error);
                    stopProgressBar();
                });
            }

            @Override
            public void failure(TwitterException exception) {
                exception.printStackTrace();
                stopProgressBar();
            }
        });
    });
    facebookCallback = CallbackManager.Factory.create();
    LoginManager.getInstance().registerCallback(facebookCallback, new FacebookCallback<LoginResult>() {

        @Override
        public void onSuccess(LoginResult loginResult) {
            UiHelpers.setStatus(txtStatus, "Local facebook sign-in successful, signing into server...");
            App.get().getServiceClient().postAsync(new dtos.Authenticate().setProvider("facebook").setAccessToken(loginResult.getAccessToken().getToken()).setRememberMe(true), r -> {
                UiHelpers.setStatus(txtStatus, "Server facebook sign-in successful, opening chat...");
                Intent intent = new Intent(activity, MainActivity.class);
                stopProgressBar();
                startActivity(intent);
            }, error -> {
                UiHelpers.setStatusError(txtStatus, "Server facebook sign-in failed", error);
                stopProgressBar();
            });
        }

        @Override
        public void onCancel() {
            stopProgressBar();
        }

        @Override
        public void onError(FacebookException exception) {
            Log.e(exception);
            stopProgressBar();
        }
    });
    ImageButton btnFacebook = (ImageButton) findViewById(R.id.btnFacebook);
    btnFacebook.setOnClickListener(view -> {
        startProgressBar();
        LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email"));
    });
    ImageButton btnAnon = (ImageButton) findViewById(R.id.btnAnon);
    btnAnon.setOnClickListener(view -> {
        UiHelpers.setStatus(txtStatus, "Opening chat as guest...");
        startGuestChatActivity(App.get().getServiceClient());
    });
    dtos.Authenticate authDto = App.get().getSavedAccessToken();
    if (authDto != null) {
        UiHelpers.setStatus(txtStatus, "Signing in with saved " + authDto.getProvider() + " AccessToken...");
        App.get().getServiceClient().postAsync(authDto, r -> {
            Intent intent = new Intent(activity, MainActivity.class);
            stopProgressBar();
            startActivity(intent);
        }, error -> {
            UiHelpers.setStatusError(txtStatus, "Error logging into " + authDto.getProvider() + " using Saved AccessToken", error);
            stopProgressBar();
        });
    }
}
Also used : Result(com.twitter.sdk.android.core.Result) ImageButton(android.widget.ImageButton) Text(org.w3c.dom.Text) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) Intent(android.content.Intent) Twitter(com.twitter.sdk.android.Twitter) TwitterAuthConfig(com.twitter.sdk.android.core.TwitterAuthConfig) TwitterException(com.twitter.sdk.android.core.TwitterException) View(android.view.View) AccessToken(com.facebook.AccessToken) FacebookException(com.facebook.FacebookException) ObjectAnimator(android.animation.ObjectAnimator) LoginResult(com.facebook.login.LoginResult) AppCompatActivity(android.support.v7.app.AppCompatActivity) FacebookCallback(com.facebook.FacebookCallback) CallbackManager(com.facebook.CallbackManager) LoginManager(com.facebook.login.LoginManager) TwitterAuthClient(com.twitter.sdk.android.core.identity.TwitterAuthClient) TextView(android.widget.TextView) Callback(com.twitter.sdk.android.core.Callback) AndroidServiceClient(net.servicestack.android.AndroidServiceClient) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Toolbar(android.support.v7.widget.Toolbar) Fabric(io.fabric.sdk.android.Fabric) Log(net.servicestack.client.Log) ValueAnimator(android.animation.ValueAnimator) TwitterSession(com.twitter.sdk.android.core.TwitterSession) TwitterSession(com.twitter.sdk.android.core.TwitterSession) LoginResult(com.facebook.login.LoginResult) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Twitter(com.twitter.sdk.android.Twitter) TwitterAuthConfig(com.twitter.sdk.android.core.TwitterAuthConfig) Intent(android.content.Intent) TwitterAuthClient(com.twitter.sdk.android.core.identity.TwitterAuthClient) ImageButton(android.widget.ImageButton) FacebookException(com.facebook.FacebookException) TwitterException(com.twitter.sdk.android.core.TwitterException) Toolbar(android.support.v7.widget.Toolbar)

Example 19 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project ServiceStack.Java by ServiceStack.

the class LoginButtonsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Twitter(new TwitterAuthConfig(getString(R.string.twitter_key), getString(R.string.twitter_secret))));
    setContentView(R.layout.login_buttons);
    Toolbar toolbar = (Toolbar) findViewById(R.id.loginToolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    txtStatus = (TextView) findViewById(R.id.txtStatus);
    UiHelpers.setStatus(txtStatus, "");
    // see this max value coming back here, we animale towards that value
    animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 500);
    animation.setRepeatMode(ValueAnimator.REVERSE);
    animation.setRepeatCount(100);
    animation.setDuration(1500);
    animation.setInterpolator(new FastOutLinearInInterpolator());
    LoginButtonsActivity activity = this;
    btnTwitterLogin = (TwitterLoginButton) findViewById(R.id.btnTwitterLogin);
    btnTwitterLogin.setCallback(new Callback<TwitterSession>() {

        @Override
        public void success(Result<TwitterSession> result) {
            startProgressBar();
            UiHelpers.setStatus(txtStatus, "Local twitter sign-in successful, signing into server...");
            TwitterSession session = result.data;
            App.get().getServiceClient().postAsync(new dtos.Authenticate().setProvider("twitter").setAccessToken(session.getAuthToken().token).setAccessTokenSecret(session.getAuthToken().secret).setRememberMe(true), r -> {
                UiHelpers.setStatus(txtStatus, "Server twitter sign-in successful, opening chat...");
                App.get().saveTwitterAccessToken(session.getAuthToken());
                Intent intent = new Intent(activity, MainActivity.class);
                stopProgressBar();
                startActivity(intent);
            }, error -> {
                UiHelpers.setStatusError(txtStatus, "Server twitter sign-in failed", error);
                stopProgressBar();
            });
        }

        @Override
        public void failure(TwitterException exception) {
            Log.e(exception);
            stopProgressBar();
        }
    });
    facebookCallback = CallbackManager.Factory.create();
    btnFacebookLogin = (LoginButton) findViewById(R.id.btnFacebookLogin);
    btnFacebookLogin.setReadPermissions("email");
    btnFacebookLogin.registerCallback(facebookCallback, new FacebookCallback<LoginResult>() {

        @Override
        public void onSuccess(LoginResult loginResult) {
            UiHelpers.setStatus(txtStatus, "Local facebook sign-in successful, signing into server...");
            App.get().getServiceClient().postAsync(new dtos.Authenticate().setProvider("facebook").setAccessToken(loginResult.getAccessToken().getToken()).setRememberMe(true), r -> {
                UiHelpers.setStatus(txtStatus, "Server facebook sign-in successful, opening chat...");
                Intent intent = new Intent(activity, MainActivity.class);
                stopProgressBar();
                startActivity(intent);
            }, error -> {
                UiHelpers.setStatusError(txtStatus, "Server facebook sign-in failed", error);
                stopProgressBar();
            });
        }

        @Override
        public void onCancel() {
            stopProgressBar();
        }

        @Override
        public void onError(FacebookException exception) {
            Log.e(exception);
            stopProgressBar();
        }
    });
    Button btnGuestLogin = (Button) findViewById(R.id.btnGuestLogin);
    btnGuestLogin.setOnClickListener(view -> {
        UiHelpers.setStatus(txtStatus, "Opening chat as guest...");
        startGuestChatActivity(App.get().getServiceClient());
    });
    dtos.Authenticate authDto = App.get().getSavedAccessToken();
    if (authDto != null) {
        UiHelpers.setStatus(txtStatus, "Signing in with saved " + authDto.getProvider() + " AccessToken...");
        App.get().getServiceClient().postAsync(authDto, r -> {
            Intent intent = new Intent(activity, MainActivity.class);
            stopProgressBar();
            startActivity(intent);
        }, error -> {
            UiHelpers.setStatusError(txtStatus, "Error logging into " + authDto.getProvider() + " using Saved AccessToken", error);
            stopProgressBar();
        });
    }
}
Also used : Result(com.twitter.sdk.android.core.Result) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) Intent(android.content.Intent) Twitter(com.twitter.sdk.android.Twitter) TwitterAuthConfig(com.twitter.sdk.android.core.TwitterAuthConfig) TwitterException(com.twitter.sdk.android.core.TwitterException) View(android.view.View) Button(android.widget.Button) LoginButton(com.facebook.login.widget.LoginButton) AccessToken(com.facebook.AccessToken) FacebookException(com.facebook.FacebookException) ObjectAnimator(android.animation.ObjectAnimator) LoginResult(com.facebook.login.LoginResult) AppCompatActivity(android.support.v7.app.AppCompatActivity) FacebookCallback(com.facebook.FacebookCallback) CallbackManager(com.facebook.CallbackManager) TextView(android.widget.TextView) Callback(com.twitter.sdk.android.core.Callback) AndroidServiceClient(net.servicestack.android.AndroidServiceClient) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Toolbar(android.support.v7.widget.Toolbar) TwitterLoginButton(com.twitter.sdk.android.core.identity.TwitterLoginButton) Fabric(io.fabric.sdk.android.Fabric) Log(net.servicestack.client.Log) Activity(android.app.Activity) ValueAnimator(android.animation.ValueAnimator) TwitterSession(com.twitter.sdk.android.core.TwitterSession) TwitterSession(com.twitter.sdk.android.core.TwitterSession) LoginResult(com.facebook.login.LoginResult) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Twitter(com.twitter.sdk.android.Twitter) TwitterAuthConfig(com.twitter.sdk.android.core.TwitterAuthConfig) Intent(android.content.Intent) Button(android.widget.Button) LoginButton(com.facebook.login.widget.LoginButton) TwitterLoginButton(com.twitter.sdk.android.core.identity.TwitterLoginButton) FacebookException(com.facebook.FacebookException) TwitterException(com.twitter.sdk.android.core.TwitterException) Toolbar(android.support.v7.widget.Toolbar)

Example 20 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project 91Pop by DanteAndroid.

the class BasePlayVideo method hideCommentLayout.

private void hideCommentLayout() {
    if (commentLayoutShown) {
        etCommentInputLayout.animate().scaleX(0).setInterpolator(new FastOutLinearInInterpolator()).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                etCommentInputLayout.setVisibility(View.GONE);
                fab.show();
            }
        }).start();
    }
    commentLayoutShown = false;
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator)

Aggregations

FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)23 View (android.view.View)11 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)10 Animator (android.animation.Animator)9 ValueAnimator (android.animation.ValueAnimator)9 TextView (android.widget.TextView)9 ObjectAnimator (android.animation.ObjectAnimator)8 Interpolator (android.view.animation.Interpolator)7 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)6 AnimatorSet (android.animation.AnimatorSet)5 Point (android.graphics.Point)4 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)4 Intent (android.content.Intent)3 Paint (android.graphics.Paint)3 ViewPropertyAnimatorListenerAdapter (android.support.v4.view.ViewPropertyAnimatorListenerAdapter)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 ImageView (android.widget.ImageView)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 TargetApi (android.annotation.TargetApi)2 LinearGradient (android.graphics.LinearGradient)2