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


Java WindowInsets.isRound方法代码示例

本文整理汇总了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);
}
 
开发者ID:rashikaranpuria,项目名称:ubiquitous,代码行数:21,代码来源:MyWatchFace.java

示例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(":");
}
 
开发者ID:changja88,项目名称:Android_Sunshine_Watch,代码行数:21,代码来源:MyWatchFace.java

示例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));
}
 
开发者ID:Hitesh880443,项目名称:SunshineWithWear,代码行数:17,代码来源:MyDigitalWatchFace.java

示例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);
}
 
开发者ID:hieple7985,项目名称:nano-go-ubiquitous,代码行数:18,代码来源:WatchFaceService.java

示例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);


}
 
开发者ID:oscarbujinkan,项目名称:Go-Ubiquitous,代码行数:22,代码来源:SunshineWatchFace.java

示例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);
}
 
开发者ID:LadyViktoria,项目名称:wearDrip,代码行数:18,代码来源:HeadingListView.java

示例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);
}
 
开发者ID:DmitryMalkovich,项目名称:go-ubiquitous,代码行数:19,代码来源:SunshineWatchFace.java

示例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);
}
 
开发者ID:jainkamini,项目名称:Sunshinewear,代码行数:20,代码来源:WatchFace.java

示例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);
}
 
开发者ID:f97one,项目名称:MirageWatch,代码行数:25,代码来源:MyWatchFace.java

示例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);
	}

}
 
开发者ID:grishka,项目名称:io16watchface,代码行数:24,代码来源:IOWatchFace.java

示例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);
}
 
开发者ID:denley,项目名称:WearPreferenceActivity,代码行数:17,代码来源:HeadingListView.java

示例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;
}
 
开发者ID:demantz,项目名称:WearGuitarTuner,代码行数:25,代码来源:MainActivity.java

示例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);
}
 
开发者ID:flaviokreis,项目名称:Sunshine-Wear,代码行数:24,代码来源:SunshineWatchFace.java

示例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());
    }
}
 
开发者ID:oxoooo,项目名称:earth,代码行数:27,代码来源:EarthWatchFaceService.java

示例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);
}
 
开发者ID:PedroCarrillo,项目名称:sunshine-wear-watchface,代码行数:20,代码来源:SunshineWatchFace.java


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