Android Open Source - BubbleNote Utils






From Project

Back to project page BubbleNote.

License

The source code is released under:

MIT License

If you think the Android project BubbleNote 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 io.github.vickychijwani.bubblenote;
/*from w  w  w  . ja va  2 s .c  om*/
import android.content.Context;
import android.graphics.Point;
import android.view.Display;
import android.view.WindowManager;

public class Utils {

    private static Point sScreenSize = null;

    private Utils() {}

    public static int getStatusBarHeight(Context context) {
        int result = 0;
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = context.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    public static int getScreenWidth(Context context) {
        fetchScreenSize(context);
        return sScreenSize.x;
    }

    public static int getScreenHeight(Context context) {
        fetchScreenSize(context);
        return sScreenSize.y;
    }

    private static void fetchScreenSize(Context context) {
        if (sScreenSize != null) return;
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        sScreenSize = new Point();
        display.getSize(sScreenSize);
    }

}




Java Source Code List

io.github.vickychijwani.bubblenote.BubbleNoteActivity.java
io.github.vickychijwani.bubblenote.BubbleNoteService.java
io.github.vickychijwani.bubblenote.Utils.java