本文整理汇总了Java中android.util.Rational类的典型用法代码示例。如果您正苦于以下问题:Java Rational类的具体用法?Java Rational怎么用?Java Rational使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rational类属于android.util包,在下文中一共展示了Rational类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onUserLeaveHint
import android.util.Rational; //导入依赖的package包/类
@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());
}
}
}
开发者ID:moonlight-stream,项目名称:moonlight-android,代码行数:17,代码来源:Game.java
示例2: minimize
import android.util.Rational; //导入依赖的package包/类
/** 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());
}
开发者ID:googlesamples,项目名称:android-PictureInPicture,代码行数:13,代码来源:MediaSessionPlaybackActivity.java
示例3: onCreate
import android.util.Rational; //导入依赖的package包/类
@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();
}
});
}
开发者ID:Suleiman19,项目名称:Android-O-Sample,代码行数:30,代码来源:PipActivity.java
示例4: onPictureInPictureClick
import android.util.Rational; //导入依赖的package包/类
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();
}
};
}
开发者ID:akexorcist,项目名称:Android-O-Feature,代码行数:15,代码来源:PictureInPictureActivity.java
示例5: toString
import android.util.Rational; //导入依赖的package包/类
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();
}
开发者ID:jameliu,项目名称:Camera2,代码行数:9,代码来源:CaptureDataSerializer.java
示例6: onEnterIntoPIPClicked
import android.util.Rational; //导入依赖的package包/类
public void onEnterIntoPIPClicked(View view) {
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(new Rational(10, 16)) // Portrait Aspect Ratio
.build();
enterPictureInPictureMode(params);
}
开发者ID:AgoraIO,项目名称:Agora-Picture-in-Picture-Android,代码行数:7,代码来源:VideoChatViewActivity.java
示例7: init
import android.util.Rational; //导入依赖的package包/类
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
}
开发者ID:cuiml123,项目名称:ideal-camera,代码行数:62,代码来源:CameraCapabilities.java
示例8: pipActivity
import android.util.Rational; //导入依赖的package包/类
public void pipActivity(View view) {
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(new Rational(9,16)) // Portrait Aspect Ratio
.build();
enterPictureInPictureMode(params);
}
开发者ID:opentok,项目名称:opentok-android-sdk-samples,代码行数:7,代码来源:MainActivity.java
注:本文中的android.util.Rational类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论