mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
29 lines
460 B
Java
29 lines
460 B
Java
package org.thoughtcrime.securesms.util.views;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
import android.view.ViewStub;
|
|
|
|
public class Stub<T> {
|
|
|
|
private ViewStub viewStub;
|
|
private T view;
|
|
|
|
public Stub(@NonNull ViewStub viewStub) {
|
|
this.viewStub = viewStub;
|
|
}
|
|
|
|
public T get() {
|
|
if (view == null) {
|
|
view = (T)viewStub.inflate();
|
|
viewStub = null;
|
|
}
|
|
|
|
return view;
|
|
}
|
|
|
|
public boolean resolved() {
|
|
return view != null;
|
|
}
|
|
|
|
}
|