use of android.view.WindowManager in project cw-advandroid by commonsguy.
the class Tapjacker method onCreate.
@Override
public void onCreate() {
super.onCreate();
v = new View(this);
v.setOnTouchListener(this);
mgr = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSPARENT);
params.gravity = Gravity.FILL_HORIZONTAL | Gravity.FILL_VERTICAL;
mgr.addView(v, params);
// stopSelf(); -- uncomment for "component-less" operation
}
use of android.view.WindowManager in project UltimateRecyclerView by cymcsg.
the class FloatingActionButton method init.
protected void init(Context context, AttributeSet attributeSet) {
mColorNormal = getColor(android.R.color.holo_blue_dark);
mColorPressed = getColor(android.R.color.holo_blue_light);
mIcon = 0;
mSize = SIZE_NORMAL;
if (attributeSet != null) {
initAttributes(context, attributeSet);
}
mCircleSize = getCircleSize(mSize);
mShadowRadius = getDimension(R.dimen.fab_shadow_radius);
mShadowOffset = getDimension(R.dimen.fab_shadow_offset);
mDrawableSize = (int) (mCircleSize + 2 * mShadowRadius);
//point size overhead
WindowManager mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = mWindowManager.getDefaultDisplay();
Point size = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
display.getSize(size);
mYHidden = size.y;
} else
mYHidden = display.getHeight();
updateBackground();
}
use of android.view.WindowManager in project OpenPanodroid by duerrfk.
the class PanoViewerActivity method convertCubicPano.
private void convertCubicPano() {
Assert.assertTrue(pano != null);
Log.i(LOG_TAG, "Converting panorama ...");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String str = prefs.getString("textureSize", "");
int maxTextureSize = GlobalConstants.DEFAULT_MAX_TEXTURE_SIZE;
if (!str.equals("")) {
try {
maxTextureSize = Integer.parseInt(str);
} catch (NumberFormatException ex) {
maxTextureSize = GlobalConstants.DEFAULT_MAX_TEXTURE_SIZE;
}
}
// On the one hand, we don't want to waste memory for textures whose resolution
// is too large for the device. On the other hand, we want to have a resolution
// that is high enough to give us good quality on any device. However, we don't
// know the resolution of the GLView a priori, and it could be resized later.
// Therefore, we use the display size to calculate the optimal texture size.
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
int maxDisplaySize = width > height ? width : height;
int optimalTextureSize = getOptimalFaceSize(maxDisplaySize, pano.getWidth(), GlobalConstants.DEFAULT_FOV_DEG);
int textureSize = toPowerOfTwo(optimalTextureSize);
textureSize = textureSize <= maxTextureSize ? textureSize : maxTextureSize;
Log.i(LOG_TAG, "Texture size: " + textureSize + " (optimal size was " + optimalTextureSize + ")");
panoConversionTask = new PanoConversionTask(textureSize);
panoConversionTask.execute(pano);
}
use of android.view.WindowManager in project AnimeTaste by daimajia.
the class DensityUtils method getScreenHeight.
@SuppressWarnings("deprecation")
public static int getScreenHeight(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
return display.getHeight();
}
use of android.view.WindowManager in project barcodescanner by dm77.
the class CameraPreview method getDisplayOrientation.
public int getDisplayOrientation() {
if (mCameraWrapper == null) {
//If we don't have a camera set there is no orientation so return dummy value
return 0;
}
Camera.CameraInfo info = new Camera.CameraInfo();
if (mCameraWrapper.mCameraId == -1) {
Camera.getCameraInfo(Camera.CameraInfo.CAMERA_FACING_BACK, info);
} else {
Camera.getCameraInfo(mCameraWrapper.mCameraId, info);
}
WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
int rotation = display.getRotation();
int degrees = 0;
switch(rotation) {
case Surface.ROTATION_0:
degrees = 0;
break;
case Surface.ROTATION_90:
degrees = 90;
break;
case Surface.ROTATION_180:
degrees = 180;
break;
case Surface.ROTATION_270:
degrees = 270;
break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
// compensate the mirror
result = (360 - result) % 360;
} else {
// back-facing
result = (info.orientation - degrees + 360) % 360;
}
return result;
}
Aggregations