Java Code Examples for com.blankj.utilcode.util.ScreenUtils

The following examples show how to use com.blankj.utilcode.util.ScreenUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: YCAudioPlayer   Source File: CoverLoader.java    License: Apache License 2.0 6 votes vote down vote up
private Bitmap loadCoverByType(AudioBean music, Type type) {
    Bitmap bitmap;
    if (music.getType() == AudioBean.Type.LOCAL) {
        bitmap = loadCoverFromMediaStore(music.getAlbumId());
    } else {
        bitmap = loadCoverFromFile(music.getCoverPath());
    }
    switch (type) {
        case BLUR:
            return ImageUtils.blur(bitmap);
        case ROUND:
            bitmap = ImageUtils.resizeImage(bitmap, ScreenUtils.getScreenWidth() / 2, ScreenUtils.getScreenWidth() / 2);
            return ImageUtils.createCircleImage(bitmap);
        default:
            return bitmap;
    }
}
 
Example 2
Source Project: V2EX   Source File: AppService.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void checkNotifycation(String errorLog,ResponseListener<String> responseListener){

        Map<String, String> form = new HashMap<String,String>(){{
            put("version", AppUtils.getAppVersionName() + AppUtils.getAppVersionCode());
            put("deviceModel", DeviceUtils.getModel());
            put("sdkVersion", String.valueOf(DeviceUtils.getSDKVersionCode()));
            put("screen",  ScreenUtils.getScreenDensity() +
                    " " + ScreenUtils.getScreenHeight() +
                    "x" + ScreenUtils.getScreenWidth());
            put("errorLog", errorLog);
        }};
        RetrofitManager.create(AppApi.class)
                .checkNotifycation(form)
                .compose(RxUtil.io2main())
                .subscribe(new RxObserver<JsonObject>() {
                    @Override
                    public void _onNext(JsonObject jsonObject) {

                    }
                });
    }
 
Example 3
Source Project: SuperNote   Source File: LongImageUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * 截取scrollview的屏幕
 **/
public static Bitmap getScrollViewBitmap(ScrollView scrollView) {
    int h = 0;
    Bitmap bitmap;
    for (int i = 0; i < scrollView.getChildCount(); i++) {
        h += scrollView.getChildAt(i).getHeight();
    }
    // 创建对应大小的bitmap

    bitmap = Bitmap.createBitmap(ScreenUtils.getScreenWidth(), h,
            Bitmap.Config.ARGB_4444);
    final Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(Color.parseColor("#f2f7fa"));
    scrollView.draw(canvas);
    return bitmap;
}
 
Example 4
Source Project: YCAudioPlayer   Source File: CoverLoader.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取默认的bitmap视图
 * @param type          类型
 * @return              bitmap对象
 */
private Bitmap getDefaultCover(Type type) {
    switch (type) {
        case BLUR:
            return BitmapFactory.decodeResource(Utils.getApp().getResources(), R.drawable.default_cover);
        case ROUND:
            Bitmap bitmap = BitmapFactory.decodeResource(Utils.getApp().getResources(), R.drawable.default_cover);
            bitmap = ImageUtils.resizeImage(bitmap, ScreenUtils.getScreenWidth() / 2, ScreenUtils.getScreenWidth() / 2);
            return bitmap;
        default:
            return BitmapFactory.decodeResource(Utils.getApp().getResources(), R.drawable.default_cover);
    }
}
 
Example 5
Source Project: YCAudioPlayer   Source File: DetailVideoActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置视频宽高比是16:9
 */
private void initVideoPlayerSize() {
    int screenWidth = ScreenUtils.getScreenWidth();
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.height = (int) (9 * screenWidth / 16.0f);
    videoPlayer.setLayoutParams(params);
}
 
Example 6
Source Project: DoraemonKit   Source File: AlignRulerLineDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onPositionChanged(int x, int y) {
    /**
     * 限制边界
     */
    if (!isNormalMode()) {
        int iconSize = ConvertUtils.dp2px(30);
        if (y <= iconSize) {
            y = iconSize;
        }

        if (ScreenUtils.isPortrait()) {
            if (y >= getScreenLongSideLength() - iconSize) {
                y = getScreenLongSideLength() - iconSize;
            }
        } else {
            if (y >= getScreenShortSideLength() - iconSize) {
                y = getScreenShortSideLength() - iconSize;
            }
        }


        if (x <= iconSize) {
            x = iconSize;
        }
        if (ScreenUtils.isPortrait()) {
            if (x >= getScreenShortSideLength() - iconSize) {
                x = getScreenShortSideLength() - iconSize;
            }
        } else {
            if (x >= getScreenLongSideLength() - iconSize) {
                x = getScreenLongSideLength() - iconSize;
            }
        }
    }


    mAlignInfoView.showInfo(x, y);
}
 
Example 7
Source Project: DoraemonKit   Source File: AbsDokitView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 限制边界 调用的时候必须保证是在控件能获取到宽高德前提下
 */
private void resetBorderline(FrameLayout.LayoutParams normalFrameLayoutParams) {
    //如果是系统模式或者手动关闭动态限制边界
    if (!restrictBorderline() || !isNormalMode()) {
        return;
    }
    //LogHelper.i(TAG, "topMargin==>" + normalFrameLayoutParams.topMargin + "  leftMargin====>" + normalFrameLayoutParams.leftMargin);
    if (normalFrameLayoutParams.topMargin <= 0) {
        normalFrameLayoutParams.topMargin = 0;
    }

    if (ScreenUtils.isPortrait()) {
        if (normalFrameLayoutParams.topMargin >= getScreenLongSideLength() - mDokitViewHeight) {
            normalFrameLayoutParams.topMargin = getScreenLongSideLength() - mDokitViewHeight;
        }
    } else {
        if (normalFrameLayoutParams.topMargin >= getScreenShortSideLength() - mDokitViewHeight) {
            normalFrameLayoutParams.topMargin = getScreenShortSideLength() - mDokitViewHeight;
        }
    }


    if (normalFrameLayoutParams.leftMargin <= 0) {
        normalFrameLayoutParams.leftMargin = 0;
    }

    if (ScreenUtils.isPortrait()) {
        if (normalFrameLayoutParams.leftMargin >= getScreenShortSideLength() - mDokitViewWidth) {
            normalFrameLayoutParams.leftMargin = getScreenShortSideLength() - mDokitViewWidth;
        }
    } else {
        if (normalFrameLayoutParams.leftMargin >= getScreenLongSideLength() - mDokitViewWidth) {
            normalFrameLayoutParams.leftMargin = getScreenLongSideLength() - mDokitViewWidth;
        }
    }

}
 
Example 8
Source Project: DoraemonKit   Source File: AbsDokitView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取屏幕短边的长度 不包含statusBar
 *
 * @return
 */
public int getScreenShortSideLength() {
    if (ScreenUtils.isPortrait()) {
        return ScreenUtils.getAppScreenWidth();
    } else {
        return ScreenUtils.getAppScreenHeight();
    }
}
 
Example 9
Source Project: DoraemonKit   Source File: AbsDokitView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取屏幕长边的长度 不包含statusBar
 *
 * @return
 */
public int getScreenLongSideLength() {
    if (ScreenUtils.isPortrait()) {
        //ScreenUtils.getScreenHeight(); 包含statusBar
        //ScreenUtils.getAppScreenHeight(); 不包含statusBar
        return ScreenUtils.getAppScreenHeight();
    } else {
        return ScreenUtils.getAppScreenWidth();
    }
}
 
Example 10
Source Project: SuperNote   Source File: EditNotePresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
    public int getRequestImeHeight(BitmapFactory.Options option) {
        float width = option.outWidth;
        float height = option.outHeight;
//        屏幕宽
        float screenWidth = ScreenUtils.getScreenWidth();
        //计算宽、高缩放率
        float scanleWidth = (getRequestImeWidth()) / width;
        return (int) (height * scanleWidth);
    }
 
Example 11
Source Project: SuperNote   Source File: EditNotePresenter.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getNoteEditNeedHeight() {
    // 屏幕高度减去 状态栏高度、toolbar高度、底部工具栏高度
    float height = ScreenUtils.getScreenHeight() - ThemeUtils.getStatusBarHeight()
            - SizeUtils.dp2px(56) - SizeUtils.dp2px(48);
    return (int) height;
}
 
Example 12
Source Project: Pixel-Activity-Keep-Alive   Source File: PointActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
	super.onResume();
	Log.INSTANCE.e(TAG, " isScreenLock:" + ScreenUtils.isScreenLock());
	//windowAnimationStyle
	if (!isFirst) {
		finish();
	}
	isFirst = false;
	PixelActivityManager.isStarting = false;
}
 
Example 13
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static void saveViewY(View view, int y) {
    if (ScreenUtils.isPortrait()) {
        getSp().put(view.getClass().getSimpleName() + ".yP", y);
    } else {
        getSp().put(view.getClass().getSimpleName() + ".yL", y);
    }
}
 
Example 14
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static int getViewY(View view, int defaultVal) {
    if (ScreenUtils.isPortrait()) {
        return getSp().getInt(view.getClass().getSimpleName() + ".yP", defaultVal);
    } else {
        return getSp().getInt(view.getClass().getSimpleName() + ".yL", defaultVal);
    }
}
 
Example 15
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static void saveViewX(View view, int x) {
    if (ScreenUtils.isPortrait()) {
        getSp().put(view.getClass().getSimpleName() + ".xP", x);
    } else {
        getSp().put(view.getClass().getSimpleName() + ".xL", x);
    }
}
 
Example 16
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static int getViewX(View view) {
    if (ScreenUtils.isPortrait()) {
        return getSp().getInt(view.getClass().getSimpleName() + ".xP");
    } else {
        return getSp().getInt(view.getClass().getSimpleName() + ".xL");
    }
}
 
Example 17
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static void saveViewHeight(View view, int height) {
    if (ScreenUtils.isPortrait()) {
        getSp().put(view.getClass().getSimpleName() + ".heightP", height);
    } else {
        getSp().put(view.getClass().getSimpleName() + ".heightL", height);
    }
}
 
Example 18
Source Project: AndroidUtilCode   Source File: DebugConfig.java    License: Apache License 2.0 5 votes vote down vote up
public static int getViewHeight(View view, int height) {
    if (ScreenUtils.isPortrait()) {
        return getSp().getInt(view.getClass().getSimpleName() + ".heightP", height);
    } else {
        return getSp().getInt(view.getClass().getSimpleName() + ".heightL", height);
    }
}
 
Example 19
Source Project: EasyPopup   Source File: EverywherePopup.java    License: Apache License 2.0 5 votes vote down vote up
/**
     * 自适应触摸点 弹出
     * @param parent
     * @param touchX
     * @param touchY
     * @return
     */
    public EverywherePopup showEverywhere(View parent,int touchX, int touchY) {
//        if (isRealWHAlready()) {
            int screenHeight = ScreenUtils.getScreenHeight();
            int screenWidth = ScreenUtils.getScreenWidth();
            int offsetX=touchX;
            int offsetY=touchY;
            if (touchX<getWidth() && screenHeight-touchY<getHeight()){
                //左下弹出动画
                getPopupWindow().setAnimationStyle(R.style.LeftBottomPopAnim);
                offsetY=touchY-getHeight();
            }else if (touchX+getWidth()>screenWidth && touchY+getHeight()>screenHeight){
                //右下弹出动画
                getPopupWindow().setAnimationStyle(R.style.RightBottomPopAnim);
                offsetX=(touchX-getWidth());
                offsetY=touchY-getHeight();
            }else if (touchX+getWidth()>screenWidth){
                getPopupWindow().setAnimationStyle(R.style.RightTopPopAnim);
                offsetX=(touchX-getWidth());
            }else {
                getPopupWindow().setAnimationStyle(R.style.LeftTopPopAnim);
            }

            showAtLocation(parent, Gravity.NO_GRAVITY,offsetX,offsetY);
//        }
        return this;
    }
 
Example 20
public void register() {

        isRegister = true;

        keyboardHeightProvider.setKeyboardHeightObserver(new KeyboardHeightObserver() {
            @Override
            public void onKeyboardHeightChanged(int height, int orientation) {
                if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
                    return;
                }
                if(!isRegister){
                    return;
                }

                if (keyBoardHeight == height) {
                    return;
                } else {
                    keyBoardHeight = height;
                }

                if (keyBoardHeight <= 0) {//键盘收起
                    if (isMove) {

                        sendHandlerMsg(0);

                        isMove = true;
                    }
                } else {//键盘打开

                    int keyBorardTopY = ScreenUtils.getAppScreenHeight() - keyBoardHeight;
                    if (keyBorardTopY > (btnViewY + mBtnView.getHeight())) {
                        return;
                    }
                    int margin = keyBorardTopY - (btnViewY + mBtnView.getHeight());
                    Log.i("tag", "margin:" + margin);
                    sendHandlerMsg(margin);

                    isMove = true;
                }

            }
        });

        mBtnView.post(new Runnable() {
            @Override
            public void run() {
                btnViewY = getViewLocationYInScreen(mBtnView);
                keyboardHeightProvider.start();
            }
        });

    }
 
Example 21
Source Project: DoraemonKit   Source File: AbsDokitView.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 用于普通模式下的横竖屏切换
 */
private void portraitOrLandscape(FrameLayout.LayoutParams params) {
    Point point = DokitViewManager.getInstance().getDokitViewPos(mTag);
    if (point != null) {
        //横竖屏切换兼容
        if (ScreenUtils.isPortrait()) {
            if (mLastDokitViewPosInfo.isPortrait()) {
                params.leftMargin = point.x;
                params.topMargin = point.y;
            } else {
                params.leftMargin = (int) (point.x * mLastDokitViewPosInfo.getLeftMarginPercent());
                params.topMargin = (int) (point.y * mLastDokitViewPosInfo.getTopMarginPercent());
            }
        } else {
            if (mLastDokitViewPosInfo.isPortrait()) {
                params.leftMargin = (int) (point.x * mLastDokitViewPosInfo.getLeftMarginPercent());
                params.topMargin = (int) (point.y * mLastDokitViewPosInfo.getTopMarginPercent());
            } else {
                params.leftMargin = point.x;
                params.topMargin = point.y;
            }
        }
    } else {
        //横竖屏切换兼容
        if (ScreenUtils.isPortrait()) {
            if (mLastDokitViewPosInfo.isPortrait()) {
                params.leftMargin = mDokitViewLayoutParams.x;
                params.topMargin = mDokitViewLayoutParams.y;
            } else {
                params.leftMargin = (int) (mDokitViewLayoutParams.x * mLastDokitViewPosInfo.getLeftMarginPercent());
                params.topMargin = (int) (mDokitViewLayoutParams.y * mLastDokitViewPosInfo.getTopMarginPercent());
            }
        } else {
            if (mLastDokitViewPosInfo.isPortrait()) {
                params.leftMargin = (int) (mDokitViewLayoutParams.x * mLastDokitViewPosInfo.getLeftMarginPercent());
                params.topMargin = (int) (mDokitViewLayoutParams.y * mLastDokitViewPosInfo.getTopMarginPercent());
            } else {
                params.leftMargin = mDokitViewLayoutParams.x;
                params.topMargin = mDokitViewLayoutParams.y;
            }
        }
    }
    mLastDokitViewPosInfo.setPortrait();
    mLastDokitViewPosInfo.setLeftMargin(params.leftMargin);
    mLastDokitViewPosInfo.setTopMargin(params.topMargin);
}
 
Example 22
Source Project: DoraemonKit   Source File: LastDokitViewPosInfo.java    License: Apache License 2.0 4 votes vote down vote up
public void setPortrait() {
    this.isPortrait = ScreenUtils.isPortrait();
}
 
Example 23
Source Project: DoraemonKit   Source File: LastDokitViewPosInfo.java    License: Apache License 2.0 4 votes vote down vote up
public void setLeftMargin(int leftMargin) {
    this.leftMarginPercent = (float) leftMargin / (float) ScreenUtils.getAppScreenWidth();
}
 
Example 24
Source Project: DoraemonKit   Source File: LastDokitViewPosInfo.java    License: Apache License 2.0 4 votes vote down vote up
public void setTopMargin(int topMargin) {
    this.topMarginPercent = (float) topMargin / (float) ScreenUtils.getAppScreenHeight();
}
 
Example 25
Source Project: DoraemonKit   Source File: UIUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static float getDensity() {
    return ScreenUtils.getScreenDensity();
}
 
Example 26
Source Project: DoraemonKit   Source File: UIUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static int getDensityDpi() {
    return ScreenUtils.getScreenDensityDpi();
}
 
Example 27
Source Project: QPM   Source File: BasicInfoUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static List<InfoItem> getBaseInfo(Context context) {
    List<InfoItem> result = new ArrayList<>();
    // 基本信息
    result.add(new InfoItem("基本信息"));
    result.add(new InfoItem("是否ROOT", DeviceUtils.isDeviceRooted() ? "是" : "否"));
    result.add(new InfoItem("SDK版本", String.valueOf(DeviceUtils.getSDKVersionName())));
    result.add(new InfoItem("发布版本", Build.VERSION.RELEASE));
    result.add(new InfoItem("AndroidId", DeviceUtils.getAndroidID()));
    result.add(new InfoItem("设备厂商", DeviceUtils.getManufacturer()));
    result.add(new InfoItem("设备类型", DeviceUtils.getModel()));
    result.add(new InfoItem("产品型号", Build.PRODUCT));
    result.add(new InfoItem("主板型号", Build.BOARD));
    result.add(new InfoItem("显示型号", Build.DISPLAY));
    result.add(new InfoItem("序列号", Build.SERIAL));
    try{
        result.add(new InfoItem("IMEI", PhoneUtils.getIMEI()));
        result.add(new InfoItem("IMSI", PhoneUtils.getIMSI()));
    } catch (SecurityException e){
        //用户可能手动拒绝权限
    }
    result.add(new InfoItem("OCCID", getOCCID()));
    result.add(new InfoItem("SIM卡", PhoneUtils.isSimCardReady() ? "有" : "无"));

    // 网络相关
    result.add(new InfoItem("网络信息"));
    result.add(new InfoItem("Wifi名称", getWifiName(context)));
    result.add(new InfoItem("IP地址", NetworkUtils.getIPAddress(true)));
    result.add(new InfoItem("Mac地址", DeviceUtils.getMacAddress()));
    result.add(new InfoItem("运营商", NetworkUtils.getNetworkOperatorName()));
    result.add(new InfoItem("网络状态", getNetworkType()));
    result.add(new InfoItem("系统UA", System.getProperty("http.agent")));
    result.add(new InfoItem("聚美UA", getJMUserAgent(context)));

    //屏幕信息
    result.add(new InfoItem("屏幕信息"));
    result.add(new InfoItem("分辨率", getScreenSize(context)));
    result.add(new InfoItem("真实分辨率", ScreenUtils.getScreenWidth() + "x" + ScreenUtils.getScreenHeight()));
    result.add(new InfoItem("像素密度", String.valueOf(ScreenUtils.getScreenDensity())));
    result.add(new InfoItem("像素密度dp", String.valueOf(ScreenUtils.getScreenDensityDpi())));
    result.add(new InfoItem("屏幕尺寸", String.valueOf(getScreenInch(context) + "英寸")));

    // 硬件信息
    result.add(new InfoItem("硬件信息"));
    result.add(new InfoItem("CPU架构", getCPUType()));
    result.add(new InfoItem("CPU核数", String.valueOf(Runtime.getRuntime().availableProcessors())));
    result.add(new InfoItem("总内存", transferByte2MB(Runtime.getRuntime().totalMemory())));
    result.add(new InfoItem("最大内存", transferByte2MB(Runtime.getRuntime().maxMemory())));
    result.add(new InfoItem("剩余内存", transferByte2MB(Runtime.getRuntime().freeMemory())));
    result.add(new InfoItem("硬件信息", Build.HARDWARE));

    return result;
}
 
Example 28
Source Project: QPM   Source File: QPMFloatViewBaseComponent.java    License: Apache License 2.0 4 votes vote down vote up
private void createFloatView(final Context context) {
    wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    wmParams = new WindowManager.LayoutParams();
    if (Build.VERSION.SDK_INT >= 26) {//8.0新特性
        wmParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
    } else {
        wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
    }
    wmParams.flags |= 8;
    wmParams.gravity = Gravity.LEFT | Gravity.TOP;
    wmParams.x = 0;
    wmParams.y = 0;
    wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
    wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
    wmParams.format = 1;
    try {
        wm.addView(mRootView, wmParams);
    } catch (Exception e) {
        e.printStackTrace();
        stopSelf();
        return;
    }

    mRootView.setOnTouchListener(new View.OnTouchListener() {

        private float mTouchStartX;
        private float mTouchStartY;
        private float x;
        private float y;
        private float startX;
        private float startY;
        private boolean isMoved; // 一次touch操作中是否有移动过

        public boolean onTouch(View v, MotionEvent event) {
            // 获取相对屏幕的坐标,即以屏幕左上角为原点
            x = event.getRawX();
            if (SCREEN_VERTICAL == checkScreenOrientation()) {
                y = event.getRawY()
                        - DeviceUtils.getStatusBarHeight(context);
            } else {
                y = event.getRawY();
            }

            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    startX = x;
                    startY = y;
                    // 获取相对View的坐标,即以此View左上角为原点
                    mTouchStartX = event.getX();
                    mTouchStartY = event.getY();
                    isMoved = false;
                    break;
                case MotionEvent.ACTION_MOVE:
                    updateViewPosition();
                    break;
                case MotionEvent.ACTION_UP:
                    updateViewPosition();
                    mTouchStartX = mTouchStartY = 0;
                    if (!isMoved) {
                        isMoved = false;
                    }
                    // 模拟点击
                    if (Math.abs(x - startX) <= mTouchSlop
                            && Math.abs(y - startY) <= mTouchSlop) {
                        mRootView.performClick();
                    }
                    break;
            }
            return true;
        }

        private void updateViewPosition() {
            // 更新浮动窗口位置参数
            if (Math.abs(x - startX) > 10 || Math.abs(y - startY) > 10) {
                wmParams.x = (int) (x - mTouchStartX);
                wmParams.y = (int) (y - mTouchStartY);
                isMoved = true;
                wm.updateViewLayout(mRootView, wmParams);
            }
        }

        private int checkScreenOrientation() {
            int dev_width = ScreenUtils.getScreenWidth();
            int dev_height = ScreenUtils.getScreenHeight();
            int orientation = SCREEN_VERTICAL; // 0:竖屏 1:横屏
            if (dev_width > dev_height) {
                orientation = SCREEN_HORIZONTALLY;
            }
            return orientation;
        }
    });
}
 
Example 29
Source Project: SuperNote   Source File: EditNotePresenter.java    License: GNU General Public License v3.0 4 votes vote down vote up
private int getRequestImeWidth() {
    return (int) (ScreenUtils.getScreenWidth() - EditNoteConstans.imageMargin);
}
 
Example 30
Source Project: AndroidUtilCode   Source File: DeviceInfoItem.java    License: Apache License 2.0 4 votes vote down vote up
private static String getScreenInfo() {
    return "width=" + ScreenUtils.getScreenWidth() +
            ", height=" + ScreenUtils.getScreenHeight() +
            ", density=" + ScreenUtils.getScreenDensity();
}