android.support.wearable.watchface.WatchFaceService Java Examples

The following examples show how to use android.support.wearable.watchface.WatchFaceService. 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: DigitalWatchFaceService.java    From wear-os-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onInterruptionFilterChanged(int interruptionFilter) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onInterruptionFilterChanged: " + interruptionFilter);
    }
    super.onInterruptionFilterChanged(interruptionFilter);

    boolean inMuteMode = interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE;
    // We only need to update once a minute in mute mode.
    setInteractiveUpdateRateMs(inMuteMode ? MUTE_UPDATE_RATE_MS : NORMAL_UPDATE_RATE_MS);

    if (mMute != inMuteMode) {
        mMute = inMuteMode;
        int alpha = inMuteMode ? MUTE_ALPHA : NORMAL_ALPHA;
        mDatePaint.setAlpha(alpha);
        mHourPaint.setAlpha(alpha);
        mMinutePaint.setAlpha(alpha);
        mColonPaint.setAlpha(alpha);
        mAmPmPaint.setAlpha(alpha);
        invalidate();
    }
}
 
Example #2
Source File: SunsetsWatchFace.java    From american-sunsets-watch-face with Apache License 2.0 6 votes vote down vote up
@Override
public void onTapCommand(@TapType int tapType, int x, int y, long eventTime) {
    switch (tapType) {
        case WatchFaceService.TAP_TYPE_TAP:
            //switch between date infos
            if(INFO_DETAILS_MODE == 0) INFO_DETAILS_MODE =1;
            else INFO_DETAILS_MODE = 0;
            invalidate();
            break;

        case WatchFaceService.TAP_TYPE_TOUCH:
            break;
        case WatchFaceService.TAP_TYPE_TOUCH_CANCEL:
            break;

        default:
            super.onTapCommand(tapType, x, y, eventTime);
            break;
    }
}
 
Example #3
Source File: FormWatchFace.java    From FORMWatchFace with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(SurfaceHolder holder) {
    LOGD(TAG, "onCreate");
    super.onCreate(holder);

    updateDateStr();

    mMute = getInterruptionFilter() == WatchFaceService.INTERRUPTION_FILTER_NONE;
    handleConfigUpdated();

    mDateTypeface = Typeface.createFromAsset(getAssets(), "VT323-Regular.ttf");
    initClockRenderers();

    registerSystemSettingsListener();
    registerSharedPrefsListener();
    registerTimeZoneReceiver();

    initMuzei();
}
 
Example #4
Source File: AnalogComplicationWatchFaceService.java    From wear-os-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onInterruptionFilterChanged(int interruptionFilter) {
    super.onInterruptionFilterChanged(interruptionFilter);
    boolean inMuteMode = (interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE);

    /* Dim display in mute mode. */
    if (mMuteMode != inMuteMode) {
        mMuteMode = inMuteMode;
        mHourPaint.setAlpha(inMuteMode ? 100 : 255);
        mMinutePaint.setAlpha(inMuteMode ? 100 : 255);
        mSecondAndHighlightPaint.setAlpha(inMuteMode ? 80 : 255);
        invalidate();
    }
}
 
Example #5
Source File: FormWatchFace.java    From FORMWatchFace with Apache License 2.0 5 votes vote down vote up
@Override
public void onInterruptionFilterChanged(int interruptionFilter) {
    LOGD(TAG, "onInterruptionFilterChanged: " + interruptionFilter);
    super.onInterruptionFilterChanged(interruptionFilter);

    boolean inMuteMode = interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE;

    if (mMute != inMuteMode) {
        mMute = inMuteMode;
        updateWatchFaceStyle();
        postInvalidate();
    }
}
 
Example #6
Source File: WatchFace.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
@Override
public void onInterruptionFilterChanged( int interruptionFilter ) {
    super.onInterruptionFilterChanged( interruptionFilter );
    boolean inMuteMode = ( interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE );
    if ( mMute != inMuteMode ) {
        mMute = inMuteMode;
        mHourPaint.setAlpha(inMuteMode ? 100 : 255);
        mMinutePaint.setAlpha(inMuteMode ? 100 : 255);
        mSecondPaint.setAlpha(inMuteMode ? 80 : 255);
        invalidate();
    }
}