當前位置: 首頁>>代碼示例>>Java>>正文


Java WatchFaceStyle.Builder方法代碼示例

本文整理匯總了Java中android.support.wearable.watchface.WatchFaceStyle.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java WatchFaceStyle.Builder方法的具體用法?Java WatchFaceStyle.Builder怎麽用?Java WatchFaceStyle.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.wearable.watchface.WatchFaceStyle的用法示例。


在下文中一共展示了WatchFaceStyle.Builder方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setNewWatchFaceStyle

import android.support.wearable.watchface.WatchFaceStyle; //導入方法依賴的package包/類
private void setNewWatchFaceStyle() {
    WatchFaceStyle.Builder watchfaceStyleBuilder = new WatchFaceStyle.Builder(ExampleWatchFace.this)
            .setAmbientPeekMode(WatchFaceStyle.AMBIENT_PEEK_MODE_VISIBLE)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false);

    if(mLightTheme) { watchfaceStyleBuilder = watchfaceStyleBuilder.setViewProtectionMode(WatchFaceStyle.PROTECT_STATUS_BAR | WatchFaceStyle.PROTECT_HOTWORD_INDICATOR); }

    setWatchFaceStyle(watchfaceStyleBuilder.build());
}
 
開發者ID:patloew,項目名稱:watch-face-example,代碼行數:12,代碼來源:ExampleWatchFace.java

示例2: buildStyle

import android.support.wearable.watchface.WatchFaceStyle; //導入方法依賴的package包/類
@Override
protected WatchFaceStyle buildStyle(final WatchFaceStyle.Builder builder) {
    return builder
            .setStatusBarGravity(Gravity.RIGHT | Gravity.TOP)
            .setHotwordIndicatorGravity(Gravity.CENTER)
            .setViewProtection(WatchFaceStyle.PROTECT_HOTWORD_INDICATOR)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .build();
}
 
開發者ID:rycus86,項目名稱:StringTheory,代碼行數:10,代碼來源:StringTheoryWatchFace.java

示例3: buildStyle

import android.support.wearable.watchface.WatchFaceStyle; //導入方法依賴的package包/類
@Override
protected WatchFaceStyle buildStyle(final WatchFaceStyle.Builder builder) {
    return builder.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setHotwordIndicatorGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP)
            .setStatusBarGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP)
            .build();
}
 
開發者ID:rycus86,項目名稱:TriangularWatchFace,代碼行數:8,代碼來源:TriangularWatchFace.java

示例4: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //導入方法依賴的package包/類
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
    Log.d();
    // Watch face style
    WatchFaceStyle.Builder builder = new WatchFaceStyle.Builder(mService);
    builder.setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE);
    builder.setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_OPAQUE);
    builder.setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE);
    builder.setShowSystemUiTime(false);
    builder.setAmbientPeekMode(WatchFaceStyle.AMBIENT_PEEK_MODE_VISIBLE);
    builder.setHotwordIndicatorGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP);
    builder.setShowUnreadCountIndicator(false);
    builder.setStatusBarGravity(Gravity.RIGHT | Gravity.TOP);
    builder.setViewProtection(WatchFaceStyle.PROTECT_HOTWORD_INDICATOR | WatchFaceStyle.PROTECT_STATUS_BAR);
    setWatchFaceStyle(builder.build());

    mIs24HourFormat = DateFormat.is24HourFormat(mService);

    mSettingsHelper = SettingsHelper.get(SimpleWatchFaceService.this);

    mSettingsHelper.addSettingsChangeListener(mSettingsChangeListener);
    mBackgroundPicture = mSettingsHelper.getBackgroundPicture();

    // Paints
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mBackgroundPaint.setStrokeWidth(1);

    mHourMinutesPaint = new Paint();
    mSecondsPaint = new Paint();
    mAmPmPaint = new Paint();
    mDatePaint = new Paint();

    // Colors
    updateColors();
    updatePaints();

    // Margins
    mMarginBorders = getResources().getDimensionPixelOffset(R.dimen.wf_margin_borders);
    mMarginSeconds = getResources().getDimensionPixelOffset(R.dimen.wf_margin_seconds);
    mMarginDate = getResources().getDimensionPixelOffset(R.dimen.wf_margin_date);
}
 
開發者ID:BoD,項目名稱:SimpleWatchface,代碼行數:44,代碼來源:SimpleWatchFaceService.java


注:本文中的android.support.wearable.watchface.WatchFaceStyle.Builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。