Search in sources :

Example 81 with WindowManager

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);
}
Also used : SharedPreferences(android.content.SharedPreferences) Display(android.view.Display) WindowManager(android.view.WindowManager)

Example 82 with WindowManager

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();
}
Also used : WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 83 with WindowManager

use of android.view.WindowManager in project barcodescanner by dm77.

the class DisplayUtils method getScreenResolution.

public static Point getScreenResolution(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point screenResolution = new Point();
    if (android.os.Build.VERSION.SDK_INT >= 13) {
        display.getSize(screenResolution);
    } else {
        screenResolution.set(display.getWidth(), display.getHeight());
    }
    return screenResolution;
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 84 with WindowManager

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();
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 85 with WindowManager

use of android.view.WindowManager in project UltimateAndroid by cymcsg.

the class Utils method init.

public static void init(Context context) {
    if (sInitialed || context == null) {
        return;
    }
    sInitialed = true;
    DisplayMetrics dm = new DisplayMetrics();
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    wm.getDefaultDisplay().getMetrics(dm);
    SCREEN_WIDTH_PIXELS = dm.widthPixels;
    SCREEN_HEIGHT_PIXELS = dm.heightPixels;
    SCREEN_DENSITY = dm.density;
    SCREEN_WIDTH_DP = (int) (SCREEN_WIDTH_PIXELS / dm.density);
    SCREEN_HEIGHT_DP = (int) (SCREEN_HEIGHT_PIXELS / dm.density);
}
Also used : DisplayMetrics(android.util.DisplayMetrics) WindowManager(android.view.WindowManager)

Aggregations

WindowManager (android.view.WindowManager)409 Display (android.view.Display)185 Point (android.graphics.Point)129 DisplayMetrics (android.util.DisplayMetrics)103 View (android.view.View)43 IWindowManager (android.view.IWindowManager)37 Context (android.content.Context)36 Resources (android.content.res.Resources)25 ImageView (android.widget.ImageView)24 Configuration (android.content.res.Configuration)20 SuppressLint (android.annotation.SuppressLint)19 Camera (android.hardware.Camera)17 Intent (android.content.Intent)16 Rect (android.graphics.Rect)16 RemoteException (android.os.RemoteException)15 LayoutParams (android.view.WindowManager.LayoutParams)15 TextView (android.widget.TextView)15 Dialog (android.app.Dialog)14 Method (java.lang.reflect.Method)12 PackageManager (android.content.pm.PackageManager)11