當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。