本文整理汇总了Java中android.view.WindowInsets.isRound方法的典型用法代码示例。如果您正苦于以下问题:Java WindowInsets.isRound方法的具体用法?Java WindowInsets.isRound怎么用?Java WindowInsets.isRound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.WindowInsets
的用法示例。
在下文中一共展示了WindowInsets.isRound方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = MyWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
float textSizeSmall = resources.getDimension(R.dimen.digital_text_size_small);
float textSizeVerySmall = resources.getDimension(R.dimen.digital_text_very_size_small);
mTextPaint.setTextSize(textSize);
dateTextPaint.setTextSize(textSizeSmall);
lineTextPaint.setTextSize(textSizeVerySmall);
mLowTempPaint.setTextSize(mLowTextSize);
mHighTempPaint.setTextSize(mHighTextSize);
}
示例2: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = MyWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
hourPaint.setTextSize(textSize);
minutePaint.setTextSize(textSize);
colonPaint.setTextSize(textSize);
highPaint.setTextSize(textSize);
lowPaint.setTextSize(textSize);
colonWidth = colonPaint.measureText(":");
}
示例3: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = MyDigitalWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
textPaintTime.setTextSize(resources.getDimension(R.dimen.time_text_size));
textPaintTimeBold.setTextSize(resources.getDimension(R.dimen.time_text_size));
textPaintDate.setTextSize(resources.getDimension(R.dimen.date_text_size));
textPaintTemp.setTextSize(resources.getDimension(R.dimen.temp_text_size));
textPaintTempBold.setTextSize(resources.getDimension(R.dimen.temp_text_size));
}
示例4: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
Resources res = WatchFaceService.this.getResources();
boolean isRound = insets.isRound();
float highTempTextSize = res.getDimension(isRound ? R.dimen.round_size_text_high_temp : R.dimen.square_size_text_high_temp);
float lowTempTextSize = res.getDimension(isRound ? R.dimen.round_size_text_low_temp : R.dimen.square_size_text_low_temp);
float textSize = res.getDimension(isRound ? R.dimen.clock_text_size_round : R.dimen.clock_text_size);
float dateTextSize = res.getDimension(isRound ? R.dimen.round_size_text_date : R.dimen.square_size_text_date);
highTempPaint.setTextSize(highTempTextSize);
lowTempPaint.setTextSize(lowTempTextSize);
timePaint.setTextSize(textSize);
datePaint.setTextSize(dateTextSize);
}
示例5: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = SunshineWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
float textDateSize = resources.getDimension(isRound
? R.dimen.digital_date_text_size_round : R.dimen.digital_date_text_size);
mTextPaint.setTextSize(textSize);
mAlphaTextPaint.setTextSize(textDateSize);
mAlphaTempPaint.setTextSize(textDateSize);
}
示例6: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override public WindowInsets onApplyWindowInsets(final WindowInsets insets) {
heading.setTextColor(-1);
if(insets.isRound()) {
heading.setGravity(Gravity.CENTER_HORIZONTAL);
// Adjust paddings for round devices
if(!hasAdjustedPadding) {
final int padding = heading.getPaddingTop();
heading.setPadding(padding, 2 * padding, padding, padding);
list.setPadding(padding, 0, padding, 0);
hasAdjustedPadding = true;
}
} else {
heading.setGravity(Gravity.START);
}
return super.onApplyWindowInsets(insets);
}
示例7: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = SunshineWatchFace.this.getResources();
boolean isRound = insets.isRound();
mTimeXOffset = resources.getDimension(isRound
? R.dimen.digital_time_x_offset_round : R.dimen.digital_time_x_offset);
float timeTextSize = resources.getDimension(isRound
? R.dimen.digital_time_text_size_round : R.dimen.digital_time_text_size);
mTimePaint.setTextSize(timeTextSize);
float dateTextSize = resources.getDimension(isRound
? R.dimen.date_text_size_round : R.dimen.date_text_size);
mDatePaint.setTextSize(dateTextSize);
float temperatureTextSize = resources.getDimension(isRound
? R.dimen.temperature_text_size_round : R.dimen.temperature_text_size);
mTemperaturePaint.setTextSize(temperatureTextSize);
}
示例8: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = WatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
mYOffset = resources.getDimension(isRound
? R.dimen.digital_y_offset_round : R.dimen.digital_y_offset);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
mTextPaint.setTextSize(textSize);
}
示例9: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources res = MyWatchFace.this.getResources();
boolean isRound = insets.isRound();
// 時間部分のサイズ
float textSize = res.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
// 日付部分のサイズ
float dateSize = res.getDimension(isRound ? R.dimen.date_text_size_round : R.dimen.date_text_size_sq);
// バッテリーレベルのサイズ
float battSize = res.getDimension(isRound ? R.dimen.batt_text_size_ro : R.dimen.batt_text_size_sq);
mHourPaint.setTextSize(textSize);
mMinutesPaint.setTextSize(textSize);
mSeparatorPaint.setTextSize(textSize);
mDatePaint.setTextSize(dateSize);
mBattTextPaint.setTextSize(battSize);
}
示例10: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets){
super.onApplyWindowInsets(insets);
boolean isRound=insets.isRound();
digitSize=(getResources().getDisplayMetrics().widthPixels)/(isRound ? 10.5f : 9.5f);
paths=new float[10][];
cachedDigits=new Bitmap[10];
paint.setColor(0xFFFFFFFF);
for(int i=0;i<10;i++){
paths[i]=new float[DigitPaths.PATHS[i].length];
for(int j=0; j<paths[i].length; j++){
paths[i][j]=DigitPaths.PATHS[i][j]*digitSize;
}
cachedDigits[i]=Bitmap.createBitmap(Math.round(digitSize*2), Math.round(digitSize*2), Bitmap.Config.ALPHA_8);
Canvas canvas=new Canvas(cachedDigits[i]);
canvas.translate(digitSize, digitSize);
canvas.drawLines(paths[i], paint);
}
}
示例11: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override public WindowInsets onApplyWindowInsets(final WindowInsets insets) {
if(insets.isRound()) {
heading.setGravity(Gravity.CENTER_HORIZONTAL);
// Adjust paddings for round devices
if(!hasAdjustedPadding) {
final int padding = heading.getPaddingTop();
heading.setPadding(padding, 2 * padding, padding, padding);
list.setPadding(padding, 0, padding, 0);
hasAdjustedPadding = true;
}
} else {
heading.setGravity(Gravity.START);
}
return super.onApplyWindowInsets(insets);
}
示例12: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.isRound()) {
roundScreen = true;
Log.i(LOGTAG, "onApplyWindowInsets: detected a round Screen!");
}
else {
roundScreen = false;
Log.i(LOGTAG, "onApplyWindowInsets: detected a rectangular Screen!");
}
// Update the value in the preferences:
SharedPreferences.Editor edit = preferences.edit();
edit.putBoolean(getString(R.string.pref_roundScreen), roundScreen);
edit.apply();
// note: Because at this early stage of execution, the googleApiClient is most likely
// not connected. So we will sync the roundScreen setting in the onConnected() callback...
// unregister the window insets listener:
fl_root.setOnApplyWindowInsetsListener(null);
return insets;
}
示例13: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = SunshineWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
mTextPaint.setTextSize(textSize);
textSize = resources.getDimension(isRound
? R.dimen.digital_date_size_round : R.dimen.digital_date_size);
mDatePaint.setTextSize(textSize);
mMaxPaint.setTextSize(textSize);
mMinPaint.setTextSize(textSize);
format = new SimpleDateFormat("EEE, MMM dd", Locale.US);
}
示例14: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
if (insets.isRound()) {
inset = -2;
setWatchFaceStyle(new WatchFaceStyle.Builder(EarthWatchFaceService.this)
.setHotwordIndicatorGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)
.setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_TRANSLUCENT)
.setShowSystemUiTime(true)
.setShowUnreadCountIndicator(true)
.setStatusBarGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP)
.setViewProtectionMode(WatchFaceStyle.PROTECT_HOTWORD_INDICATOR
| WatchFaceStyle.PROTECT_STATUS_BAR)
.build());
} else {
inset = getResources().getDimensionPixelOffset(R.dimen.padding_square);
setWatchFaceStyle(new WatchFaceStyle.Builder(EarthWatchFaceService.this)
.setHotwordIndicatorGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)
.setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_TRANSLUCENT)
.setShowSystemUiTime(true)
.setShowUnreadCountIndicator(true)
.setStatusBarGravity(Gravity.END | Gravity.TOP)
.setViewProtectionMode(WatchFaceStyle.PROTECT_HOTWORD_INDICATOR
| WatchFaceStyle.PROTECT_STATUS_BAR)
.build());
}
}
示例15: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
super.onApplyWindowInsets(insets);
// Load resources that have alternate values for round watches.
Resources resources = SunshineWatchFace.this.getResources();
boolean isRound = insets.isRound();
mXOffset = resources.getDimension(isRound
? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
float textSize = resources.getDimension(isRound
? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
float dateSize = resources.getDimension(isRound
? R.dimen.digital_date_text_size_round : R.dimen.digital_date_text_size);
mHourPaint.setTextSize(textSize);
mMinutePaint.setTextSize(textSize);
mMaxTempPaint.setTextSize(textSize);
mMinTempPaint.setTextSize(textSize);
mDatePaint.setTextSize(dateSize);
}