Search in sources :

Example 6 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project actor-platform by actorapp.

the class InputBarFragment method showAudio.

protected void showAudio() {
    if (Build.VERSION.SDK_INT >= 23) {
        if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) {
            requestPermissions(new String[] { Manifest.permission.RECORD_AUDIO, Manifest.permission.VIBRATE }, PERMISSION_REQUEST_RECORD_AUDIO);
            return;
        }
    }
    if (isAudioVisible) {
        return;
    }
    isAudioVisible = true;
    hideView(attachButton);
    hideView(messageEditText);
    hideView(emojiButton);
    audioFile = ActorSDK.sharedActor().getMessenger().getInternalTempFile("voice_msg", "opus");
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    voiceRecordActor.send(new VoiceCaptureActor.Start(audioFile));
    slideAudio(0);
    audioTimer.setText("00:00");
    TranslateAnimation animation = new TranslateAnimation(Screen.getWidth(), 0, 0, 0);
    animation.setDuration(160);
    audioContainer.clearAnimation();
    audioContainer.setAnimation(animation);
    audioContainer.animate();
    audioContainer.setVisibility(View.VISIBLE);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0.2f);
    alphaAnimation.setDuration(800);
    alphaAnimation.setRepeatMode(AlphaAnimation.REVERSE);
    alphaAnimation.setRepeatCount(AlphaAnimation.INFINITE);
    recordPoint.clearAnimation();
    recordPoint.setAnimation(alphaAnimation);
    recordPoint.animate();
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) VoiceCaptureActor(im.actor.sdk.core.audio.VoiceCaptureActor) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 7 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project actor-platform by actorapp.

the class ViewUtils method showView.

public static void showView(final View view, boolean isAnimated, boolean isSlow) {
    if (view == null) {
        return;
    }
    if (isAnimated) {
        if (view.getVisibility() != View.VISIBLE) {
            AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
            alphaAnimation.setDuration(isSlow ? 300 : 150);
            alphaAnimation.setInterpolator(MaterialInterpolator.getInstance());
            view.clearAnimation();
            view.startAnimation(alphaAnimation);
            view.setVisibility(View.VISIBLE);
        }
    } else {
        view.setVisibility(View.VISIBLE);
    }
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 8 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project actor-platform by actorapp.

the class ViewUtils method goneView.

public static void goneView(final View view, boolean isAnimated, boolean isSlow) {
    if (view == null) {
        return;
    }
    if (isAnimated) {
        if (view.getVisibility() != View.GONE) {
            AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
            alphaAnimation.setDuration(isSlow ? 300 : 150);
            alphaAnimation.setInterpolator(MaterialInterpolator.getInstance());
            view.clearAnimation();
            view.startAnimation(alphaAnimation);
            view.setVisibility(View.GONE);
        }
    } else {
        view.setVisibility(View.GONE);
    }
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation)

Example 9 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project android_frameworks_base by ParanoidAndroid.

the class TransformsAndAnimationsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.transforms_and_animations);
    button1 = (Button) findViewById(R.id.button1);
    button2 = (Button) findViewById(R.id.button2);
    button3 = (Button) findViewById(R.id.button3);
    button1a = (Button) findViewById(R.id.button1a);
    button2a = (Button) findViewById(R.id.button2a);
    button3a = (Button) findViewById(R.id.button3a);
    button1b = (Button) findViewById(R.id.button1b);
    button2b = (Button) findViewById(R.id.button2b);
    button3b = (Button) findViewById(R.id.button3b);
    button4 = (Button) findViewById(R.id.button4);
    button5 = (Button) findViewById(R.id.button5);
    button6 = (Button) findViewById(R.id.button6);
    button7 = (Button) findViewById(R.id.button7);
    button8 = (Button) findViewById(R.id.button8);
    layersNoneCB = (CheckBox) findViewById(R.id.layersNoneCB);
    layersHardwareCB = (CheckBox) findViewById(R.id.layersHwCB);
    layersSoftwareCB = (CheckBox) findViewById(R.id.layersSwCB);
    layersNoneCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_NONE);
                layersHardwareCB.setChecked(false);
                layersSoftwareCB.setChecked(false);
            }
        }
    });
    layersSoftwareCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_SOFTWARE);
                layersHardwareCB.setChecked(false);
                layersNoneCB.setChecked(false);
            }
        }
    });
    layersHardwareCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_HARDWARE);
                layersNoneCB.setChecked(false);
                layersSoftwareCB.setChecked(false);
            }
        }
    });
    button1a.setAlpha(.5f);
    button2a.setAlpha(.5f);
    button3a.setAlpha(.5f);
    button3.setTranslationX(50);
    button7.setTranslationX(50);
    button8.setTranslationX(50);
    final AlphaAnimation alphaAnim = new AlphaAnimation(1, 0);
    alphaAnim.setDuration(1000);
    alphaAnim.setRepeatCount(Animation.INFINITE);
    alphaAnim.setRepeatMode(Animation.REVERSE);
    final TranslateAnimation transAnim = new TranslateAnimation(0, -50, 0, 0);
    transAnim.setDuration(1000);
    transAnim.setRepeatCount(Animation.INFINITE);
    transAnim.setRepeatMode(Animation.REVERSE);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            button1.startAnimation(alphaAnim);
            button2.startAnimation(alphaAnim);
            button3.startAnimation(alphaAnim);
            button1a.startAnimation(alphaAnim);
            button2a.startAnimation(alphaAnim);
            button3a.startAnimation(alphaAnim);
            button1b.startAnimation(alphaAnim);
            button2b.startAnimation(alphaAnim);
            button3b.startAnimation(alphaAnim);
            startAnimator(button1b);
            startAnimator(button2b);
            startAnimator(button3b);
            button7.startAnimation(transAnim);
            button8.startAnimation(transAnim);
        }
    }, 2000);
}
Also used : CheckBox(android.widget.CheckBox) TranslateAnimation(android.view.animation.TranslateAnimation) CompoundButton(android.widget.CompoundButton) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 10 with AlphaAnimation

use of android.view.animation.AlphaAnimation in project ExpandTextView by mugku.

the class ExpandableTextView method applyAlphaAnimation.

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static void applyAlphaAnimation(View view, float alpha) {
    if (isPostHoneycomb()) {
        view.setAlpha(alpha);
    } else {
        AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
        // make it instant
        alphaAnimation.setDuration(0);
        alphaAnimation.setFillAfter(true);
        view.startAnimation(alphaAnimation);
    }
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) TargetApi(android.annotation.TargetApi)

Aggregations

AlphaAnimation (android.view.animation.AlphaAnimation)349 Animation (android.view.animation.Animation)152 TranslateAnimation (android.view.animation.TranslateAnimation)102 AnimationSet (android.view.animation.AnimationSet)101 ScaleAnimation (android.view.animation.ScaleAnimation)65 View (android.view.View)33 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)30 LinearInterpolator (android.view.animation.LinearInterpolator)28 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)26 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)26 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)26 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)26 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)26 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)26 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)26 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)26 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)26 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)26 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)26 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)26