Only use reflection method when API is unavailable for call
This commit is contained in:
parent
4782c144f0
commit
a28c50a13d
|
@ -116,16 +116,20 @@ public class GL2JNIView extends GLSurfaceView
|
||||||
|
|
||||||
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
||||||
|
|
||||||
int rederType = prefs.getInt("render_type", LAYER_TYPE_HARDWARE);
|
int renderType = prefs.getInt("render_type", LAYER_TYPE_HARDWARE);
|
||||||
try {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
Method setLayerType = this.getClass().getMethod(
|
this.setLayerType(renderType, null);
|
||||||
"setLayerType", new Class[] { int.class, Paint.class });
|
} else {
|
||||||
if (setLayerType != null)
|
try {
|
||||||
setLayerType.invoke(this, new Object[] { rederType, null });
|
Method setLayerType = this.getClass().getMethod(
|
||||||
} catch (NoSuchMethodException e) {
|
"setLayerType", new Class[] { int.class, Paint.class });
|
||||||
} catch (IllegalArgumentException e) {
|
if (setLayerType != null)
|
||||||
} catch (IllegalAccessException e) {
|
setLayerType.invoke(this, new Object[] { renderType, null });
|
||||||
} catch (InvocationTargetException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vjoy_d_custom = VJoy.readCustomVjoyValues(context);
|
vjoy_d_custom = VJoy.readCustomVjoyValues(context);
|
||||||
|
|
Loading…
Reference in New Issue