static { // API Level 11 is Build.VERSION_CODES.HONEYCOMB. // When right/left adjustment mode, outInsets uses touchableRegion to cut out IME rectangle. // Because only after API.11(HONEYCOMB) supports touchableRegion, filter it. InsetsCalculator tmpCalculator = null; if (Build.VERSION.SDK_INT >= 11) { // Try to create RegsionInsetsCalculator if the API level is high enough. try { Class<?> clazz = Class.forName( new StringBuilder(MozcView.class.getCanonicalName()) .append('$') .append("RegionInsetsCalculator") .toString()); tmpCalculator = InsetsCalculator.class.cast(clazz.newInstance()); } catch (ClassNotFoundException e) { MozcLog.e(e.getMessage(), e); } catch (IllegalArgumentException e) { MozcLog.e(e.getMessage(), e); } catch (IllegalAccessException e) { MozcLog.e(e.getMessage(), e); } catch (InstantiationException e) { MozcLog.e(e.getMessage(), e); } } if (tmpCalculator == null) { tmpCalculator = new DefaultInsetsCalculator(); } insetsCalculator = tmpCalculator; }