Java Code Examples for java.lang.reflect.Field.getInt()

The following are Jave code examples for showing how to use getInt() of the java.lang.reflect.Field class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: InstantUpload   File: NikonEventFormat.java   View Source Code Vote up 6 votes
/**
 * Looks up and returns the name of the code give if there is a constant
 * field in EosEventConstants which starts with the given prefix
 *
 * @param prefix the field name prefix
 * @param code image format code
 *
 * @return the printable name of the given code
 */
private static String getCodeName(String prefix, int code) {
    Field[] fields = NikonEventConstants.class.getDeclaredFields();

    for (Field f: fields) {
        String name = f.getName();
        if (name.startsWith(prefix)) {
            try {
                if (f.getInt(null) == code) {
                    return name.substring(prefix.length());
                }
            } catch (Exception e) {
                //
                // Nothing to do
                //
            }
        }
    }
    return "Unknown";
}
 
Example 2
Project: Phoenix-for-VK   File: StatusbarUtil.java   View Source Code Vote up 6 votes
private static boolean setMiuiStatusBarDarkMode(Activity activity, boolean darkmode) {
    Class<? extends Window> clazz = activity.getWindow().getClass();
    try {
        int darkModeFlag;
        Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");

        Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
        darkModeFlag = field.getInt(layoutParams);
        Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
        extraFlagField.invoke(activity.getWindow(), darkmode ? darkModeFlag : 0, darkModeFlag);
        return true;
    } catch (Exception ignored) {

    }

    return false;
}
 
Example 3
Project: CalendarView_master   File: BaseActivity.java   View Source Code Vote up 6 votes
/**
 * 设置小米黑色状态栏字体
 */
@SuppressLint("PrivateApi")
private void setMIUIStatusBarDarkMode() {
    if (isMiUi) {
        Class<? extends Window> clazz = getWindow().getClass();
        try {
            int darkModeFlag;
            Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
            Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
            darkModeFlag = field.getInt(layoutParams);
            Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
            extraFlagField.invoke(getWindow(), darkModeFlag, darkModeFlag);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example 4
Project: CoordinatorLayoutExample-master   File: StatusBarUtil.java   View Source Code Vote up 6 votes
/**
 * 设置状态栏字体图标为深色,需要MIUIV6以上
 * @param window 需要设置的窗口
 * @param dark 是否把状态栏字体及图标颜色设置为深色
 * @return  boolean 成功执行返回true
 *
 */
public static boolean MIUISetStatusBarLightMode(Window window, boolean dark) {
    boolean result = false;
    if (window != null) {
        Class clazz = window.getClass();
        try {
            int darkModeFlag = 0;
            Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
            Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
            darkModeFlag = field.getInt(layoutParams);
            Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
            if(dark){
                extraFlagField.invoke(window,darkModeFlag,darkModeFlag);//状态栏透明且黑色字体
            }else{
                extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
            }
            result=true;
        }catch (Exception e){

        }
    }
    return result;
}
 
Example 5
Project: hanlpStudy   File: ReflectionHelper.java   View Source Code Vote up 6 votes
public static void setStaticFinalField(
        Field field, Object value)
        throws NoSuchFieldException, IllegalAccessException
{
    // 获得 public 权限
    field.setAccessible(true);
    // 将modifiers域设为非final,这样就可以修改了
    Field modifiersField =
            Field.class.getDeclaredField(MODIFIERS_FIELD);
    modifiersField.setAccessible(true);
    int modifiers = modifiersField.getInt(field);
    // 去掉 final 标志位
    modifiers &= ~Modifier.FINAL;
    modifiersField.setInt(field, modifiers);
    FieldAccessor fa = reflection.newFieldAccessor(
            field, false
    );
    fa.set(null, value);
}
 
Example 6
Project: MultiScrollDemo   File: StatusBarUtil.java   View Source Code Vote up 5 votes
/**
 * 设置Flyme4+的darkMode,darkMode时候字体颜色及icon变黑
 * http://open-wiki.flyme.cn/index.php?title=Flyme%E7%B3%BB%E7%BB%9FAPI
 */
public static boolean darkModeForFlyme4(Window window, boolean dark) {
    boolean result = false;
    if (window != null) {
        try {
            WindowManager.LayoutParams e = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
            Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
            darkFlag.setAccessible(true);
            meizuFlags.setAccessible(true);
            int bit = darkFlag.getInt(null);
            int value = meizuFlags.getInt(e);
            if (dark) {
                value |= bit;
            } else {
                value &= ~bit;
            }

            meizuFlags.setInt(e, value);
            window.setAttributes(e);
            result = true;
        } catch (Exception var8) {
            Log.e("StatusBar", "darkIcon: failed");
        }
    }

    return result;
}
 
Example 7
Project: BaseCore   File: FlymeHelper.java   View Source Code Vote up 5 votes
/**
 * 设置状态栏图标为深色和魅族特定的文字风格
 * 可以用来判断是否为Flyme用户
 *
 * @param isFontColorDark 是否把状态栏字体及图标颜色设置为深色
 * @return boolean 成功执行返回true
 */
@Override
public boolean setStatusBarLightMode(Activity activity, boolean isFontColorDark) {
    Window window = activity.getWindow();
    boolean result = false;
    if (window != null) {
        try {
            WindowManager.LayoutParams lp = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField("meizuFlags");
            darkFlag.setAccessible(true);
            meizuFlags.setAccessible(true);
            int bit = darkFlag.getInt(null);
            int value = meizuFlags.getInt(lp);
            if (isFontColorDark) {
                value |= bit;
            } else {
                value &= ~bit;
            }
            meizuFlags.setInt(lp, value);
            window.setAttributes(lp);
            result = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return result;
}
 
Example 8
Project: medialibrary   File: ApiHelper.java   View Source Code Vote up 5 votes
public static int getIntFieldIfExists(Class<?> klass, String fieldName,
                                      Class<?> obj, int defaultVal) {
    try {
        Field f = klass.getDeclaredField(fieldName);
        return f.getInt(obj);
    } catch (Exception e) {
        return defaultVal;
    }
}
 
Example 9
Project: sstore-soft   File: TestSysProcFragmentId.java   View Source Code Vote up 5 votes
/**
 * testUniqueIds
 */
public void testUniqueIds() throws Exception {
    Class<SysProcFragmentId> clazz = SysProcFragmentId.class;
    Map<Integer, String> ids = new HashMap<Integer, String>();
    for (Field f : clazz.getDeclaredFields()) {
       String f_name = f.getName(); 
       int id = f.getInt(null);
       assertTrue(f_name, id >= 0);
       
       assertFalse(String.format("Duplicate id %d for %s <-> %s", id, f_name, ids.get(id)),
                   ids.containsKey(id));
       ids.put(id, f_name);
    } // FOR
    assertFalse(ids.isEmpty());
}
 
Example 10
Project: RedirectStorage   File: RedirectStorage.java   View Source Code Vote up 5 votes
private static void invokeEnvironmentSdcardMethod(PathCallback callback)
        throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
    Field sCurrentUserField = getCurrentUserField();
    AbstractWrapper wrapper = getInstalledWrapper(sCurrentUserField);
    if (wrapper != null) {
        // Update current wrapper
        wrapper.setCallback(callback);
        wrapper.setEnable(true);
    } else {
        // Install new wrapper
        Environment.UserEnvironment o = (Environment.UserEnvironment) sCurrentUserField
                .get(null);
        int user = 0;
        try {
            Field mUserIdField = o.getClass().getDeclaredField("mUserId");
            mUserIdField.setAccessible(true);
            user = mUserIdField.getInt(o);
        } catch (Exception e) {
            e.printStackTrace();
        }
        AbstractWrapper abstractWrapper = AbstractWrapper.getWrapper(o,
                callback, user);
        if (abstractWrapper == null) {
            Log.e(TAG, "Can not create wrapper, it looks like not support your ROM: " +
                    Build.VERSION.SDK_INT);
            return;
        }
        sCurrentUserField.set(null, abstractWrapper);
    }
}
 
Example 11
Project: jdk8u-jdk   File: KtabZero.java   View Source Code Vote up 5 votes
static void check(boolean showBeMissing) throws Exception {
    KeyTab kt = KeyTab.getInstance(NAME);
    if (kt.isMissing() != showBeMissing) {
        throw new Exception("isMissing is not " + showBeMissing);
    }
    Field f = KeyTab.class.getDeclaredField("kt_vno");
    f.setAccessible(true);
    if (f.getInt(kt) != KeyTabConstants.KRB5_KT_VNO) {
        throw new Exception("kt_vno is " + f.getInt(kt));
    }
}
 
Example 12
Project: boohee_v5.6   File: bt.java   View Source Code Vote up 5 votes
private static int a(Object obj, String str) {
    try {
        Field declaredField = DisplayMetrics.class.getDeclaredField(str);
        declaredField.setAccessible(true);
        return declaredField.getInt(obj);
    } catch (Exception e) {
        e.printStackTrace();
        return -1;
    }
}
 
Example 13
Project: CoordinatorLayoutExample-master   File: StatusBarUtil.java   View Source Code Vote up 5 votes
/**
 * 设置状态栏图标为深色和魅族特定的文字风格
 * 可以用来判断是否为Flyme用户
 * @param window 需要设置的窗口
 * @param dark 是否把状态栏字体及图标颜色设置为深色
 * @return  boolean 成功执行返回true
 *
 */
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
    boolean result = false;
    if (window != null) {
        try {
            WindowManager.LayoutParams lp = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField("meizuFlags");
            darkFlag.setAccessible(true);
            meizuFlags.setAccessible(true);
            int bit = darkFlag.getInt(null);
            int value = meizuFlags.getInt(lp);
            if (dark) {
                value |= bit;
            } else {
                value &= ~bit;
            }
            meizuFlags.setInt(lp, value);
            window.setAttributes(lp);
            result = true;
        } catch (Exception e) {

        }
    }
    return result;
}
 
Example 14
Project: bit-client   File: Dispatcher.java   View Source Code Vote up 5 votes
private int getBusID(EventBus a) {
    try {
        Field declaredField = EventBus.class.getDeclaredField("busID");
        declaredField.setAccessible(true);
        return declaredField.getInt(a);
    } catch (Exception ex) {
        return 0;
    }
}
 
Example 15
Project: LiuAGeAndroid   File: StatusUtils.java   View Source Code Vote up 5 votes
/**
 * 设置魅族状态栏模式
 *
 * @param activity activity
 * @param darkmode 是否是黑暗系
 * @return 是否设置成功
 */
public static boolean setMeizuStatusBarDarkMode(Activity activity, boolean darkmode) {
    boolean result = false;
    if (activity != null) {
        try {
            WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField("meizuFlags");
            darkFlag.setAccessible(true);
            meizuFlags.setAccessible(true);
            int bit = darkFlag.getInt(null);
            int value = meizuFlags.getInt(lp);
            if (darkmode) {
                value |= bit;
            } else {
                value &= ~bit;
            }
            meizuFlags.setInt(lp, value);
            activity.getWindow().setAttributes(lp);
            result = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return result;
}
 
Example 16
Project: openjdk-jdk10   File: DefaultCharBindingMap.java   View Source Code Vote up 4 votes
private void initMap() {
    chars = new Hashtable<>();
    //first add latters and digits represented by KeyEvent.VK_. fields
    Field[] fields = KeyEvent.class.getFields();
    for (Field field : fields) {
        String name = field.getName();
        if ((field.getModifiers() & Modifier.PUBLIC) != 0
                && (field.getModifiers() & Modifier.STATIC) != 0
                && field.getType() == Integer.TYPE
                && name.startsWith("VK_")
                && name.length() == 4) {
            String latter = name.substring(3, 4);
            try {
                int key = field.getInt(null);
                addChar(latter.toLowerCase().charAt(0), key, 0);
                if (!latter.toUpperCase().equals(latter.toLowerCase())) {
                    addChar(latter.toUpperCase().charAt(0), key, InputEvent.SHIFT_MASK);
                }
            } catch (IllegalAccessException e) {
                throw new AssertionError("Never could happen!", e);
            }
        }
    }
    //add special simbols
    addChar('\t', KeyEvent.VK_TAB, 0);
    addChar(' ', KeyEvent.VK_SPACE, 0);
    addChar('!', KeyEvent.VK_1, InputEvent.SHIFT_MASK);
    addChar('"', KeyEvent.VK_QUOTE, InputEvent.SHIFT_MASK);
    addChar('#', KeyEvent.VK_3, InputEvent.SHIFT_MASK);
    addChar('$', KeyEvent.VK_4, InputEvent.SHIFT_MASK);
    addChar('%', KeyEvent.VK_5, InputEvent.SHIFT_MASK);
    addChar('&', KeyEvent.VK_7, InputEvent.SHIFT_MASK);
    addChar('\'', KeyEvent.VK_QUOTE, 0);
    addChar('(', KeyEvent.VK_9, InputEvent.SHIFT_MASK);
    addChar(')', KeyEvent.VK_0, InputEvent.SHIFT_MASK);
    addChar('*', KeyEvent.VK_8, InputEvent.SHIFT_MASK);
    addChar('+', KeyEvent.VK_EQUALS, InputEvent.SHIFT_MASK);
    addChar(',', KeyEvent.VK_COMMA, 0);
    addChar('-', KeyEvent.VK_MINUS, 0);
    addChar('.', KeyEvent.VK_PERIOD, 0);
    addChar('/', KeyEvent.VK_SLASH, 0);
    addChar(':', KeyEvent.VK_SEMICOLON, InputEvent.SHIFT_MASK);
    addChar(';', KeyEvent.VK_SEMICOLON, 0);
    addChar('<', KeyEvent.VK_COMMA, InputEvent.SHIFT_MASK);
    addChar('=', KeyEvent.VK_EQUALS, 0);
    addChar('>', KeyEvent.VK_PERIOD, InputEvent.SHIFT_MASK);
    addChar('?', KeyEvent.VK_SLASH, InputEvent.SHIFT_MASK);
    addChar('@', KeyEvent.VK_2, InputEvent.SHIFT_MASK);
    addChar('[', KeyEvent.VK_OPEN_BRACKET, 0);
    addChar('\\', KeyEvent.VK_BACK_SLASH, 0);
    addChar(']', KeyEvent.VK_CLOSE_BRACKET, 0);
    addChar('^', KeyEvent.VK_6, InputEvent.SHIFT_MASK);
    addChar('_', KeyEvent.VK_MINUS, InputEvent.SHIFT_MASK);
    addChar('`', KeyEvent.VK_BACK_QUOTE, 0);
    addChar('{', KeyEvent.VK_OPEN_BRACKET, InputEvent.SHIFT_MASK);
    addChar('|', KeyEvent.VK_BACK_SLASH, InputEvent.SHIFT_MASK);
    addChar('}', KeyEvent.VK_CLOSE_BRACKET, InputEvent.SHIFT_MASK);
    addChar('~', KeyEvent.VK_BACK_QUOTE, InputEvent.SHIFT_MASK);
    addChar('\n', KeyEvent.VK_ENTER, 0);
}
 
Example 17
Project: SearchLayout   File: FlexSearchLayout.java   View Source Code Vote up 4 votes
private void initSearchView() {
    SearchView searchView = mBinding.svSearch;
    //设置搜索框左边距
    LinearLayout editFrame = (LinearLayout) findViewById(R.id.search_edit_frame);
    LinearLayout.LayoutParams editP = (LayoutParams) editFrame.getLayoutParams();
    editP.leftMargin = 0;
    editP.rightMargin = 0;
    ImageView imageView = (ImageView) findViewById(R.id.search_mag_icon);
    imageView.setAdjustViewBounds(true);
    imageView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LinearLayout.LayoutParams lp3 = (LayoutParams) imageView.getLayoutParams();
    lp3.gravity = Gravity.CENTER_VERTICAL;
    lp3.leftMargin = (int) (DensityUtil.dip2px(8f) * DensityUtil.getBaseScale(getContext()));
    lp3.rightMargin = (int) (DensityUtil.dip2px(-2f) * DensityUtil.getBaseScale(getContext()));

    View view = searchView.findViewById(R.id.search_plate);
    view.setBackgroundColor(getResources().getColor(R.color.colorTransparent));
    EditText editText = (EditText) searchView.findViewById(R.id.search_src_text);
    editText.setBackgroundColor(Color.TRANSPARENT);
    editText.setTextSize(11.5f);
    editText.setTextColor(getResources().getColor(R.color.colorText));
    editText.setHintTextColor(getResources().getColor(R.color.colorHint));
    try {
        Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
        fCursorDrawableRes.setAccessible(true);
        int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
        Field fEditor = TextView.class.getDeclaredField("mEditor");
        fEditor.setAccessible(true);
        Object editor = fEditor.get(editText);
        Class<?> clazz = editor.getClass();
        Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
        fCursorDrawable.setAccessible(true);
        if (mCursorDrawableRes <= 0) return;
        Drawable cursorDrawable = ContextCompat.getDrawable(searchView.getContext(), mCursorDrawableRes);
        if (cursorDrawable == null) return;
        Drawable tintDrawable = DrawableCompat.wrap(cursorDrawable);
        DrawableCompat.setTintList(tintDrawable, ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.bg_search)));
        Drawable[] drawables = new Drawable[]{tintDrawable, tintDrawable};
        fCursorDrawable.set(editor, drawables);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
 
Example 18
Project: openjdk-jdk10   File: ServiceContextData.java   View Source Code Vote up 4 votes
public ServiceContextData( Class cls )
{
    if (ORB.ORBInitDebug)
        dprint( "ServiceContextData constructor called for class " + cls ) ;

    scClass = cls ;

    try {
        if (ORB.ORBInitDebug)
            dprint( "Finding constructor for " + cls ) ;

        // Find the appropriate constructor in cls
        Class[] args = new Class[2] ;
        args[0] = InputStream.class ;
        args[1] = GIOPVersion.class;
        try {
            scConstructor = cls.getConstructor( args ) ;
        } catch (NoSuchMethodException nsme) {
            throwBadParam( "Class does not have an InputStream constructor", nsme ) ;
        }

        if (ORB.ORBInitDebug)
            dprint( "Finding SERVICE_CONTEXT_ID field in " + cls ) ;

        // get the ID from the public static final int SERVICE_CONTEXT_ID
        Field fld = null ;
        try {
            fld = cls.getField( "SERVICE_CONTEXT_ID" ) ;
        } catch (NoSuchFieldException nsfe) {
            throwBadParam( "Class does not have a SERVICE_CONTEXT_ID member", nsfe ) ;
        } catch (SecurityException se) {
            throwBadParam( "Could not access SERVICE_CONTEXT_ID member", se ) ;
        }

        if (ORB.ORBInitDebug)
            dprint( "Checking modifiers of SERVICE_CONTEXT_ID field in " + cls ) ;

        int mod = fld.getModifiers() ;
        if (!Modifier.isPublic(mod) || !Modifier.isStatic(mod) ||
            !Modifier.isFinal(mod) )
            throwBadParam( "SERVICE_CONTEXT_ID field is not public static final", null ) ;

        if (ORB.ORBInitDebug)
            dprint( "Getting value of SERVICE_CONTEXT_ID in " + cls ) ;

        try {
            scId = fld.getInt( null ) ;
        } catch (IllegalArgumentException iae) {
            throwBadParam( "SERVICE_CONTEXT_ID not convertible to int", iae ) ;
        } catch (IllegalAccessException iae2) {
            throwBadParam( "Could not access value of SERVICE_CONTEXT_ID", iae2 ) ;
        }
    } catch (BAD_PARAM nssc) {
        if (ORB.ORBInitDebug)
            dprint( "Exception in ServiceContextData constructor: " + nssc ) ;
        throw nssc ;
    } catch (Throwable thr) {
        if (ORB.ORBInitDebug)
            dprint( "Unexpected Exception in ServiceContextData constructor: " +
                    thr ) ;
    }

    if (ORB.ORBInitDebug)
        dprint( "ServiceContextData constructor completed" ) ;
}
 
Example 19
Project: WearVibrationCenter   File: NotificationTextParser.java   View Source Code Vote up 4 votes
private void parseRemoteView(RemoteViews views)
{
	try {
		Class remoteViewsClass = RemoteViews.class;
		Class baseActionClass = Class.forName("android.widget.RemoteViews$Action");


		Field actionsField = remoteViewsClass.getDeclaredField("mActions");

		actionsField.setAccessible(true);

		@SuppressWarnings("unchecked")
           ArrayList<Object> actions = (ArrayList<Object>) actionsField.get(views);
		for (Object action : actions) {
               if (!action.getClass().getName().contains("$ReflectionAction"))
				continue;

			Field typeField = action.getClass().getDeclaredField("type");
			typeField.setAccessible(true);
			int type = typeField.getInt(action);
               if (type != 9 && type != 10)
				continue;


			int viewId = -1;
			try
			{
				Field idField = baseActionClass.getDeclaredField("viewId");
				idField.setAccessible(true);
				viewId = idField.getInt(action);
			}
			catch (NoSuchFieldException ignored)
			{
			}

			Field valueField = action.getClass().getDeclaredField("value");
			valueField.setAccessible(true);
			CharSequence value = (CharSequence) valueField.get(action);
			
			if (value == null ||
                   value.equals("...") ||
                   isInteger(value.toString()) ||
                   text.contains(value))
               {
				continue;
			}

			if (viewId == android.R.id.title)
			{
				if (title == null || title.length() < value.length())
					title = value.toString().trim();
			}
			else
				text += formatCharSequence(value) + "\n\n";

		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 20
Project: boohee_v5.6   File: DrawableUtils.java   View Source Code Vote up 4 votes
public static Rect getOpticalBounds(Drawable drawable) {
    if (sInsetsClazz != null) {
        try {
            drawable = DrawableCompat.unwrap(drawable);
            Object insets = drawable.getClass().getMethod("getOpticalInsets", new Class[0]).invoke(drawable, new Object[0]);
            if (insets != null) {
                Rect result = new Rect();
                for (Field field : sInsetsClazz.getFields()) {
                    String name = field.getName();
                    Object obj = -1;
                    switch (name.hashCode()) {
                        case -1383228885:
                            if (name.equals("bottom")) {
                                obj = 3;
                                break;
                            }
                            break;
                        case 115029:
                            if (name.equals("top")) {
                                obj = 1;
                                break;
                            }
                            break;
                        case 3317767:
                            if (name.equals(PeriodRecord.LEFT)) {
                                obj = null;
                                break;
                            }
                            break;
                        case 108511772:
                            if (name.equals(PeriodRecord.RIGHT)) {
                                obj = 2;
                                break;
                            }
                            break;
                    }
                    switch (obj) {
                        case null:
                            result.left = field.getInt(insets);
                            break;
                        case 1:
                            result.top = field.getInt(insets);
                            break;
                        case 2:
                            result.right = field.getInt(insets);
                            break;
                        case 3:
                            result.bottom = field.getInt(insets);
                            break;
                        default:
                            break;
                    }
                }
                return result;
            }
        } catch (Exception e) {
            Log.e(TAG, "Couldn't obtain the optical insets. Ignoring.");
        }
    }
    return INSETS_NONE;
}