微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.util.Rational的实例源码

项目:moonlight-android    文件Game.java   
@Override
public void onUserLeaveHint() {
    super.onUserLeaveHint();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (prefConfig.enablePip && connected) {
            enterPictureInPictureMode(
                    new PictureInPictureParams.Builder()
                            .setAspectRatio(new Rational(prefConfig.width,prefConfig.height))
                            .setSourceRectHint(new Rect(
                                    streamView.getLeft(),streamView.getTop(),streamView.getRight(),streamView.getBottom()))
                            .build());
        }
    }
}
项目:android-PictureInPicture    文件MediaSessionPlaybackActivity.java   
/** Enters Picture-in-Picture mode. */
void minimize() {
    if (mMovieView == null) {
        return;
    }
    // Hide the controls in picture-in-picture mode.
    mMovieView.hideControls();
    // Calculate the aspect ratio of the PiP screen.
    Rational aspectRatio = new Rational(mMovieView.getWidth(),mMovieView.getHeight());
    mPictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
    enterPictureInPictureMode(mPictureInPictureParamsBuilder.build());
}
项目:android-PictureInPicture    文件MainActivity.java   
/** Enters Picture-in-Picture mode. */
void minimize() {
    if (mMovieView == null) {
        return;
    }
    // Hide the controls in picture-in-picture mode.
    mMovieView.hideControls();
    // Calculate the aspect ratio of the PiP screen.
    Rational aspectRatio = new Rational(mMovieView.getWidth(),mMovieView.getHeight());
    mPictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
    enterPictureInPictureMode(mPictureInPictureParamsBuilder.build());
}
项目:Android-O-Sample    文件PipActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pip_test);

    mFramePlayer = findViewById(R.id.frame_mock_player);
    mBtnPip = findViewById(R.id.btn_minimize);

    mBtnPip.setonClickListener(view -> {
        if (android.os.Build.VERSION.SDK_INT >= 26) {
            //Trigger PiP mode
            try {
                Rational rational = new Rational(mFramePlayer.getWidth(),mFramePlayer.getHeight());

                PictureInPictureParams mParams =
                        new PictureInPictureParams.Builder()
                                .setAspectRatio(rational)
                                .build();

                enterPictureInPictureMode(mParams);
            } catch (IllegalStateException e) {
                e.printstacktrace();
            }
        } else {
            Toast.makeText(PipActivity.this,"API 26 needed to perform PiP",Toast.LENGTH_SHORT).show();
        }
    });

}
项目:Android-O-Feature    文件PictureInPictureActivity.java   
private View.OnClickListener onPictureInPictureClick() {
    return view -> {
        if (exoPlayer != null && exoPlayer.getPlaybackState() == SimpleExoPlayer.STATE_READY) {
            int videoWidth = exoPlayer.getVideoFormat().width;
            int videoHeight = exoPlayer.getVideoFormat().height;
            PictureInPictureParams params = new PictureInPictureParams.Builder()
                    .setAspectRatio(new Rational(videoWidth,videoHeight))
                    .build();
            enterPictureInPictureMode(params);
        } else {
            Toast.makeText(PictureInPictureActivity.this,R.string.video_playback_not_ready,Toast.LENGTH_SHORT).show();
        }
    };
}
项目:Camera2    文件CaptureDataSerializer.java   
private static String toString(ColorSpaceTransform transform) {
    StringBuilder str = new StringBuilder();
    Rational[] rationals = new Rational[9];
    transform.copyElements(rationals,0);
    str.append("ColorSpaceTransform: ");
    str.append(Arrays.toString(rationals));
    return str.toString();
}
项目:Agora-Picture-in-Picture-Android    文件VideoChatViewActivity.java   
public void onEnterIntoPIPClicked(View view) {
    PictureInPictureParams params = new PictureInPictureParams.Builder()
            .setAspectRatio(new Rational(10,16)) // Portrait Aspect Ratio
            .build();
    enterPictureInPictureMode(params);
}
项目:ideal-camera    文件CameraCapabilities.java   
private void init() {
    initCapabilities();
    StreamConfigurationMap configurationMap = mcharacteristics.get(SCALER_STREAM_CONfigURATION_MAP);
    mSupportedPreviewSizes.addAll(Arrays.asList(configurationMap.getoutputSizes(SurfaceTexture.class)));
    for (int format : configurationMap.getoutputFormats()) {
        mSupportedPreviewFormats.add(format);
    }

    // Todo: We only support MediaRecorder video capture
    mSupportedVideoSizes.addAll(Arrays.asList(configurationMap.getoutputSizes(MediaRecorder.class)));

    // Todo: We only support JPEG image capture
    mSupportedPhotoSizes.addAll(Arrays.asList(configurationMap.getoutputSizes(ImageFormat.JPEG)));
    mSupportedPhotoFormats.addAll(mSupportedPreviewFormats);
    mActiveArray = mcharacteristics.get(Cameracharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);

    buildSceneModes(mcharacteristics);
    buildFlashModes(mcharacteristics);
    buildFocusModes(mcharacteristics);
    buildWhiteBalances(mcharacteristics);

    buildAntibandingModes(mcharacteristics);

    buildColorEffects(mcharacteristics);

    // Todo: Populate mSupportedFeatures

    // Todo: Populate mPreferredPreviewSizeforVideo

    Range<Integer> ecRange = mcharacteristics.get(CONTROL_AE_COMPENSATION_RANGE);
    mminexposureCompensation = ecRange.getLower();
    mMaxExposureCompensation = ecRange.getUpper();

    Rational ecStep = mcharacteristics.get(CONTROL_AE_COMPENSATION_STEP);
    mExposureCompensationStep = (float) ecStep.getNumerator() / ecStep.getDenominator();

    mMaxnumOfFacesSupported = mcharacteristics.get(STATISTICS_INFO_MAX_FACE_COUNT);
    mMaxnumOfMeteringArea = mcharacteristics.get(CONTROL_MAX_REGIONS_AE);

    mMaxZoomratio = mcharacteristics.get(SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
    // Todo: Populate mHorizontalViewAngle
    // Todo: Populate mVerticalViewAngle
    // Todo: Populate mZoomratioList
    // Todo: Populate mMaxZoomIndex

    if (supports(FocusMode.AUTO)) {
        mMaxnumOfFocusAreas = mcharacteristics.get(CONTROL_MAX_REGIONS_AF);
        if (mMaxnumOfFocusAreas > 0) {
            mSupportedFeatures.add(Feature.FOCUS_AREA);
        }
    }
    if (mMaxnumOfMeteringArea > 0) {
        mSupportedFeatures.add(Feature.METERING_AREA);
    }

    if (mMaxZoomratio > mcharacteristics.get(SCALER_AVAILABLE_MAX_DIGITAL_ZOOM)) {
        mSupportedFeatures.add(Feature.ZOOM);
    }

    // Todo: Detect other features
}
项目:opentok-android-sdk-samples    文件MainActivity.java   
public void pipActivity(View view) {
    PictureInPictureParams params = new PictureInPictureParams.Builder()
            .setAspectRatio(new Rational(9,16)) // Portrait Aspect Ratio
            .build();
    enterPictureInPictureMode(params);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。