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();
}
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);
}
}
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);
}
}
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);
}
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);
}
}
Aggregations