mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Apply several fixes for beta feedback.
* Remove overscroll from avatar picker recyclers. * Center crop wallpaper previews. * If no media thumb exists, return bubble projection instead.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package org.thoughtcrime.securesms.util.views;
|
||||
|
||||
|
||||
import android.view.ViewStub;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NullableStub<T> {
|
||||
|
||||
private ViewStub viewStub;
|
||||
private T view;
|
||||
|
||||
public NullableStub(@Nullable ViewStub viewStub) {
|
||||
this.viewStub = viewStub;
|
||||
}
|
||||
|
||||
private @Nullable T get() {
|
||||
if (viewStub != null && view == null) {
|
||||
view = (T) viewStub.inflate();
|
||||
viewStub = null;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public @NonNull T require() {
|
||||
return Objects.requireNonNull(get());
|
||||
}
|
||||
|
||||
public boolean isResolvable() {
|
||||
return viewStub != null || resolved();
|
||||
}
|
||||
|
||||
public boolean resolved() {
|
||||
return view != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user