Android Open Source - Droideez Window Utils






From Project

Back to project page Droideez.

License

The source code is released under:

MIT License

If you think the Android project Droideez listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.caseycrites.droideez;
//w w  w  . ja  va  2  s .  c o m
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Point;
import android.os.Build;
import android.view.Display;
import android.view.WindowManager;

/**
 * Collection of methods related to the device screen.
 */
public class WindowUtils {

  private boolean mThirteenOrHigher;
  private Display mDisplay;

  private WindowUtils(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mDisplay = wm.getDefaultDisplay();
    mThirteenOrHigher = Build.VERSION.SDK_INT >= 13;
  }

  /**
   * Get an WindowUtils instance.
   *
   * @param context
   * @return WindowUtils
   */
  public static WindowUtils with(Context context) {
    return new WindowUtils(context);
  }

  /**
   * Get the default displays dimensions.
   *
   * @return Point
   */
  @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
  public Point getDimensions() {
    Point size = new Point();
    if (mThirteenOrHigher) {
      mDisplay.getSize(size);
    } else {
      size.x = mDisplay.getWidth();
      size.y = mDisplay.getHeight();
    }
    return size;
  }
}




Java Source Code List

com.caseycrites.droideez.BitmapUtils.java
com.caseycrites.droideez.FileUtils.java
com.caseycrites.droideez.IntentUtils.java
com.caseycrites.droideez.StreamUtils.java
com.caseycrites.droideez.TypefaceUtils.java
com.caseycrites.droideez.ViewUtils.java
com.caseycrites.droideez.WindowUtils.java