23 lines
624 B
Java
23 lines
624 B
Java
|
package androidx.core.app;
|
||
|
|
||
|
import android.app.Dialog;
|
||
|
import android.os.Build;
|
||
|
import android.view.View;
|
||
|
import androidx.annotation.NonNull;
|
||
|
public class DialogCompat {
|
||
|
private DialogCompat() {
|
||
|
}
|
||
|
|
||
|
@NonNull
|
||
|
public static View requireViewById(@NonNull Dialog dialog, int i) {
|
||
|
if (Build.VERSION.SDK_INT >= 28) {
|
||
|
return dialog.requireViewById(i);
|
||
|
}
|
||
|
View findViewById = dialog.findViewById(i);
|
||
|
if (findViewById != null) {
|
||
|
return findViewById;
|
||
|
}
|
||
|
throw new IllegalArgumentException("ID does not reference a View inside this Dialog");
|
||
|
}
|
||
|
}
|