mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-23 17:48:50 +00:00
Add empty state for conversation list
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package org.thoughtcrime.securesms.components.registration;
|
||||
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.content.Context;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
|
||||
|
||||
public class PulsingFloatingActionButton extends FloatingActionButton {
|
||||
|
||||
private boolean pulsing;
|
||||
|
||||
public PulsingFloatingActionButton(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public PulsingFloatingActionButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public PulsingFloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void startPulse(long periodMillis) {
|
||||
if (!pulsing) {
|
||||
pulsing = true;
|
||||
pulse(periodMillis);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPulse() {
|
||||
pulsing = false;
|
||||
}
|
||||
|
||||
private void pulse(long periodMillis) {
|
||||
if (!pulsing) return;
|
||||
|
||||
this.animate().scaleX(1.2f).scaleY(1.2f).setDuration(150).setListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
clearAnimation();
|
||||
animate().scaleX(1.0f).scaleY(1.0f).setDuration(150).setListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
PulsingFloatingActionButton.this.postDelayed(() -> pulse(periodMillis), periodMillis);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user