List of usage examples for android.widget FrameLayout setY
public void setY(float y)
From source file:tv.ouya.sdk.OuyaUnityPlugin.java
private static void updateSafeArea(float progress) { // bring in by % float percent = 0.1f; float ratio = 1 - (1 - progress) * percent; float halfRatio = 1 - (1 - progress) * percent * 0.5f; float maxWidth = getDisplayWidth(); float maxHeight = getDisplayHeight(); Activity activity = IOuyaActivity.GetActivity(); FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); LayoutParams layout = content.getLayoutParams(); layout.width = (int) (maxWidth * ratio); layout.height = (int) (maxHeight * ratio); content.setLayoutParams(layout);// w w w .j a v a 2 s . c o m content.setX(maxWidth - maxWidth * halfRatio); content.setY(maxHeight - maxHeight * halfRatio); }
From source file:tv.ouya.sdk.CordovaOuyaPlugin.java
protected void setSafeArea(CallbackContext callback, final float progress) { final Activity activity = cordova.getActivity(); if (null != activity) { Runnable runnable = new Runnable() { public void run() { // bring in by % float percent = 0.1f; float ratio = 1 - (1 - progress) * percent; float halfRatio = 1 - (1 - progress) * percent * 0.5f; float maxWidth = getDisplayWidth(); float maxHeight = getDisplayHeight(); FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); ViewGroup.LayoutParams layout = content.getLayoutParams(); layout.width = (int) (maxWidth * ratio); layout.height = (int) (maxHeight * ratio); content.setLayoutParams(layout); content.setX(maxWidth - maxWidth * halfRatio); content.setY(maxHeight - maxHeight * halfRatio); }/*ww w. j ava2s. c o m*/ }; activity.runOnUiThread(runnable); } callback.success(); }