27 lines
834 B
Java
27 lines
834 B
Java
package androidx.core.view;
|
|
|
|
import android.os.Build;
|
|
import android.view.View;
|
|
import android.view.Window;
|
|
import androidx.annotation.IdRes;
|
|
import androidx.annotation.NonNull;
|
|
public final class WindowCompat {
|
|
public static final int FEATURE_ACTION_BAR = 8;
|
|
public static final int FEATURE_ACTION_BAR_OVERLAY = 9;
|
|
public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
|
|
|
|
private WindowCompat() {
|
|
}
|
|
|
|
@NonNull
|
|
public static <T extends View> T requireViewById(@NonNull Window window, @IdRes int i) {
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
return (T) window.requireViewById(i);
|
|
}
|
|
T t = (T) window.findViewById(i);
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new IllegalArgumentException("ID does not reference a View inside this Window");
|
|
}
|
|
}
|