android.support.wearable.watchface.WatchFaceStyle Java Examples

The following examples show how to use android.support.wearable.watchface.WatchFaceStyle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mTime = new Time();
}
 
Example #2
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mTime = new Time();
}
 
Example #3
Source File: AndelaWatchFace.java    From radar-watch-face with MIT License 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(AndelaWatchFace.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    initializeText();

    initializeDate();
}
 
Example #4
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mTime = new Time();
}
 
Example #5
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this).build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mCalendar = Calendar.getInstance();
}
 
Example #6
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mTime = new Time();
}
 
Example #7
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this).build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mCalendar = Calendar.getInstance();
}
 
Example #8
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this).build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mCalendar = Calendar.getInstance();
}
 
Example #9
Source File: MyWatchFaceService.java    From watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this).build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mCalendar = Calendar.getInstance();
}
 
Example #10
Source File: EarthWatchFaceService.java    From earth with GNU General Public License v3.0 6 votes vote down vote up
@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());
    }
}
 
Example #11
Source File: MyWatchFaceService.java    From io2015-codelabs with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mTime = new Time();
}
 
Example #12
Source File: CustomWatchFaceService.java    From AndroidDemoProjects with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle( new WatchFaceStyle.Builder( CustomWatchFaceService.this )
                    .setBackgroundVisibility( WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE )
                    .setCardPeekMode( WatchFaceStyle.PEEK_MODE_VARIABLE )
                    .setShowSystemUiTime( false )
                    .build()
    );

    initBackground();
    initDisplayText();

    mDisplayTime = new Time();
}
 
Example #13
Source File: MyWatchFace.java    From AndroidDemoProjects with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFace.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mHourHandBitmap = loadBitmaps(R.array.hourHandIds);
    mMinuteHandBitmap = loadBitmaps(R.array.minuteHandIds);
    mSecondsHandBitmap = loadBitmaps( R.array.secondHandIds );

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor( Color.parseColor("black") );

    mTime = new Time();

    mFilterPaint = new Paint();
    mFilterPaint.setFilterBitmap(true);

    initTickPaint();
}
 
Example #14
Source File: BatmanWatchFaceService.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
        //see https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceStyle.Builder.html for more info on the methods use
        //in the next command
    setWatchFaceStyle(new WatchFaceStyle.Builder(BatmanWatchFaceService.this)
            .setStatusBarGravity(Gravity.TOP | Gravity.END) //where the battery and connect icons shows.
            .build());
    Resources resources = BatmanWatchFaceService.this.getResources();
    mYOffset = resources.getDimension(R.dimen.digital_y_offset);

    bm_c = BitmapFactory.decodeResource(resources,R.drawable.batman2c);
    bm_bw = BitmapFactory.decodeResource(resources,R.drawable.batman2bw);
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(resources.getColor(R.color.digital_background));

    mTextPaint_time = new Paint();
    mTextPaint_time = createTextPaint(resources.getColor(R.color.digital_text));
    mTextPaint_date = new Paint();
    mTextPaint_date = createTextPaint(resources.getColor(R.color.digital_text));

    mTime = new Time();
}
 
Example #15
Source File: beerWatchFaceService.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
    /* initialize your watch face */

    setWatchFaceStyle(new WatchFaceStyle.Builder(beerWatchFaceService.this)
            .setStatusBarGravity(Gravity.TOP | Gravity.END) //where the battery and connect icons shows.
            .build());
    //setup initial Paint colors.
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);
    mBackgroundPaint.setAntiAlias(true);

    mtextPaint = new Paint();
    mtextPaint.setColor(Color.YELLOW);
    mtextPaint.setAntiAlias(true);
    mtextPaint.setTypeface(BOLD_TYPEFACE);  //which font.
    //mtextPaint.setTextSize(resources.getDimension(R.dimen.digital_text_size));
    mtextPaint.setTextSize(45);

}
 
Example #16
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #17
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #18
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #19
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #20
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #21
Source File: ComplicationWatchFaceService.java    From complications with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(ComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .build());

    mCalendar = Calendar.getInstance();

    initializeBackground();

    // TODO: Step 2, intro 3
    initializeComplications();

    initializeHands();
}
 
Example #22
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);
    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);
    mHandPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
    mHandPaint.setStyle(Paint.Style.STROKE);

    mTime = new Time();
}
 
Example #23
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    final int backgroundResId = R.drawable.custom_background;

    mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), backgroundResId);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mTime = new Time();
}
 
Example #24
Source File: beerWatchFaceService.java    From wearable with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
    /* initialize your watch face */

    setWatchFaceStyle(new WatchFaceStyle.Builder(beerWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)  //we are NOT showing the actual time
            .setStatusBarGravity(Gravity.TOP | Gravity.RIGHT) //where the battery and connect icons shows.
            .setHotwordIndicatorGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL)  //where 'OK google' shows
            .build());
    //setup initial Paint colors.
    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);
    mBackgroundPaint.setAntiAlias(true);

    mtextPaint = new Paint();
    mtextPaint.setColor(Color.YELLOW);
    mtextPaint.setAntiAlias(true);
    mtextPaint.setTypeface(BOLD_TYPEFACE);  //which font.
    //mtextPaint.setTextSize(resources.getDimension(R.dimen.digital_text_size));
    mtextPaint.setTextSize(45);

}
 
Example #25
Source File: MyWatchFaceService.java    From android-codelab-watchface with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(Color.BLACK);

    mHandPaint = new Paint();
    mHandPaint.setColor(Color.WHITE);
    mHandPaint.setStrokeWidth(STROKE_WIDTH);
    mHandPaint.setAntiAlias(true);
    mHandPaint.setStrokeCap(Paint.Cap.ROUND);

    mTime = new Time();
}
 
Example #26
Source File: AnalogComplicationWatchFaceService.java    From wear-os-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    Log.d(TAG, "onCreate");

    super.onCreate(holder);

    // Used throughout watch face to pull user's preferences.
    Context context = getApplicationContext();
    mSharedPref =
            context.getSharedPreferences(
                    getString(R.string.analog_complication_preference_file_key),
                    Context.MODE_PRIVATE);

    mCalendar = Calendar.getInstance();

    setWatchFaceStyle(
            new WatchFaceStyle.Builder(AnalogComplicationWatchFaceService.this)
                    .setAcceptsTapEvents(true)
                    .setHideNotificationIndicator(true)
                    .build());

    loadSavedPreferences();
    initializeComplicationsAndBackground();
    initializeWatchFace();
}
 
Example #27
Source File: TeslaWatchFaceService.java    From rnd-android-wear-tesla with MIT License 5 votes vote down vote up
private void configureStyle() {
    setWatchFaceStyle(new WatchFaceStyle.Builder(TeslaWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle
                    .BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .build());
}
 
Example #28
Source File: FormWatchFace.java    From FORMWatchFace with Apache License 2.0 5 votes vote down vote up
private void updateWatchFaceStyle() {
    setWatchFaceStyle(new WatchFaceStyle.Builder(FormWatchFace.this)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
            .setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_TRANSLUCENT)
            .setStatusBarGravity(Gravity.TOP | Gravity.CENTER)
            .setHotwordIndicatorGravity(Gravity.TOP | Gravity.CENTER)
            .setViewProtection(0)
            .setShowUnreadCountIndicator(mShowNotificationCount && !mMute)
            .build());
}
 
Example #29
Source File: WatchFace.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
private void initWatchFaceStyle() {
    setWatchFaceStyle( new WatchFaceStyle.Builder( WatchFace.this )
            .setCardPeekMode( WatchFaceStyle.PEEK_MODE_SHORT )
            .setBackgroundVisibility( WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE )
            .setShowSystemUiTime( false )
            .build() );
}
 
Example #30
Source File: myWatchFaceService.java    From wearable with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
    /* initialize your watch face */

    setWatchFaceStyle(new WatchFaceStyle.Builder(myWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)  //we are showing the time, so it doesn't need too.
            .setStatusBarGravity(Gravity.TOP | Gravity.RIGHT) //where the battery and connect icons shows.
            .setHotwordIndicatorGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL)  //where 'OK google' shows
            .setViewProtection(WatchFaceStyle.PROTECT_STATUS_BAR)  //background for the status bar, assuming light background too.
            .build());

    //setup access to the resources.
    Resources resources = myWatchFaceService.this.getResources();
    //setup variables.
    mYOffset = resources.getDimension(R.dimen.digital_y_offset);
    mAmString = resources.getString(R.string.digital_am);
    mPmString = resources.getString(R.string.digital_pm);

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(mInteractiveBackgroundColor);
    mHourPaint = createTextPaint(mInteractiveHourDigitsColor, BOLD_TYPEFACE);
    mMinutePaint = createTextPaint(mInteractiveMinuteDigitsColor);
    mSecondPaint = createTextPaint(mInteractiveSecondDigitsColor);
    mAmPmPaint = createTextPaint(resources.getColor(R.color.digital_am_pm));
    mColonPaint = createTextPaint(resources.getColor(R.color.digital_colons));

    //setup init time.

    mTime = new Time();
}