-
Notifications
You must be signed in to change notification settings - Fork 216
/
Utils.java
34 lines (26 loc) · 896 Bytes
/
Utils.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package hotchemi.android.rate;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Build;
final class Utils {
private Utils() {
}
static boolean underHoneyComb() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
}
static boolean isLollipop() {
return Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1;
}
static int getDialogTheme() {
return isLollipop() ? R.style.CustomLollipopDialogStyle : 0;
}
@SuppressLint("NewApi")
static AlertDialog.Builder getDialogBuilder(Context context) {
if (underHoneyComb()) {
return new AlertDialog.Builder(context);
} else {
return new AlertDialog.Builder(context, getDialogTheme());
}
}
}