当前位置: 首页>>代码示例>>Java>>正文


Java DisplayManager.getDisplay方法代码示例

本文整理汇总了Java中android.hardware.display.DisplayManager.getDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayManager.getDisplay方法的具体用法?Java DisplayManager.getDisplay怎么用?Java DisplayManager.getDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.hardware.display.DisplayManager的用法示例。


在下文中一共展示了DisplayManager.getDisplay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyDisplayRefreshRate

import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
private void applyDisplayRefreshRate(float videoFrameRate) {
    boolean is24Fps = Math.abs(videoFrameRate - FRAME_RATE_FOR_FILM) < FRAME_RATE_EPSILON;
    if (mIsFilmModeSet && !is24Fps) {
        setPreferredRefreshRate(mDefaultRefreshRate);
        mIsFilmModeSet = false;
    } else if (!mIsFilmModeSet && is24Fps) {
        DisplayManager displayManager = (DisplayManager) getSystemService(
                Context.DISPLAY_SERVICE);
        Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);

        float[] refreshRates = display.getSupportedRefreshRates();
        for (float refreshRate : refreshRates) {
            // Be conservative and set only when the display refresh rate supports 24fps.
            if (Math.abs(videoFrameRate - refreshRate) < REFRESH_RATE_EPSILON) {
                setPreferredRefreshRate(refreshRate);
                mIsFilmModeSet = true;
                return;
            }
        }
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:22,代码来源:MainActivity.java

示例2: getOrientation

import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
public Orientation getOrientation() {
    Point s;
    try {
        DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
        Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
        s = new Point();
        display.getSize(s);
    } catch (Exception e) {
        Log.w(TAG, "Error retrieving screen orientation");
        EasyTracker.getTracker().sendException("projection", e, false);
        return Orientation.LANDSCAPE;
    }
    return s.x > s.y ? Orientation.LANDSCAPE : Orientation.PORTRAIT;
}
 
开发者ID:iwo,项目名称:SCR-Screen-Recorder-app,代码行数:15,代码来源:ProjectionThread.java

示例3: ScaledLayout

import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
public ScaledLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    Point size = new Point();
    DisplayManager displayManager = (DisplayManager) getContext()
            .getSystemService(Context.DISPLAY_SERVICE);
    Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
    display.getRealSize(size);
    mMaxWidth = size.x;
    mMaxHeight = size.y;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:11,代码来源:ScaledLayout.java

示例4: TvViewUiManager

import android.hardware.display.DisplayManager; //导入方法依赖的package包/类
public TvViewUiManager(Context context, TunableTvView tvView, TunableTvView pipView,
        FrameLayout contentView, TvOptionsManager tvOptionManager) {
    mContext = context;
    mResources = mContext.getResources();
    mTvView = tvView;
    mPipView = pipView;
    mContentView = contentView;
    mTvOptionsManager = tvOptionManager;

    DisplayManager displayManager = (DisplayManager) mContext
            .getSystemService(Context.DISPLAY_SERVICE);
    Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
    Point size = new Point();
    display.getSize(size);
    mWindowWidth = size.x;
    mWindowHeight = size.y;

    // Have an assumption that PIP and TvView Shrinking happens only in full screen.
    mTvViewShrunkenStartMargin = mResources
            .getDimensionPixelOffset(R.dimen.shrunken_tvview_margin_start);
    mTvViewShrunkenEndMargin =
            mResources.getDimensionPixelOffset(R.dimen.shrunken_tvview_margin_end)
                    + mResources.getDimensionPixelSize(R.dimen.side_panel_width);
    int papMarginHorizontal = mResources
            .getDimensionPixelOffset(R.dimen.papview_margin_horizontal);
    int papSpacing = mResources.getDimensionPixelOffset(R.dimen.papview_spacing);
    mTvViewPapWidth = (mWindowWidth - papSpacing) / 2 - papMarginHorizontal;
    mTvViewPapStartMargin = papMarginHorizontal + mTvViewPapWidth + papSpacing;
    mTvViewPapEndMargin = papMarginHorizontal;
    mTvViewFrame = createMarginLayoutParams(0, 0, 0, 0);

    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);

    mLinearOutSlowIn = AnimationUtils
            .loadInterpolator(mContext, android.R.interpolator.linear_out_slow_in);
    mFastOutLinearIn = AnimationUtils
            .loadInterpolator(mContext, android.R.interpolator.fast_out_linear_in);

    mPipViewHorizontalMargin = mResources
            .getDimensionPixelOffset(R.dimen.pipview_margin_horizontal);
    mPipViewTopMargin = mResources.getDimensionPixelOffset(R.dimen.pipview_margin_top);
    mPipViewBottomMargin = mResources.getDimensionPixelOffset(R.dimen.pipview_margin_bottom);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:44,代码来源:TvViewUiManager.java


注:本文中的android.hardware.display.DisplayManager.getDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。