1 package jp
.gr
.java_conf
.ofnhwx
.olib
.compatibility
;
3 import java
.lang
.reflect
.Method
;
5 import android
.app
.Activity
;
6 import android
.os
.Build
;
7 import android
.util
.Log
;
13 public final class OCompatibility
{
15 private static final String TAG
= OCompatibility
.class.getSimpleName();
17 private OCompatibility() {}
19 public static final class Version
{
23 public static final boolean isAndroid21() {
24 return Build
.VERSION
.SDK_INT
> 4;
27 public static final boolean isAndroid30() {
28 return Build
.VERSION
.SDK_INT
> 10;
31 public static final boolean isAndroid40() {
32 return Build
.VERSION
.SDK_INT
> 13;
37 public static final class MenuItem
{
41 public static final int SHOW_AS_ACTION_NEVER
= 0;
42 public static final int SHOW_AS_ACTION_IF_ROOM
= 1;
43 public static final int SHOW_AS_ACTION_ALWAYS
= 2;
44 public static final int SHOW_AS_ACTION_WITH_TEXT
= 4;
45 public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
= 8;
49 public static final void invalidateOptionsMenu(Activity activity
) {
50 if (!Version
.isAndroid30()) {
54 Method m
= activity
.getClass().getMethod("invalidateOptionsMenu");
56 } catch (Exception e
) {
57 Log
.e(TAG
, "invalidateOptionsMenu", e
);