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


Java WatchFaceService类代码示例

本文整理汇总了Java中android.support.wearable.watchface.WatchFaceService的典型用法代码示例。如果您正苦于以下问题:Java WatchFaceService类的具体用法?Java WatchFaceService怎么用?Java WatchFaceService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WatchFaceService类属于android.support.wearable.watchface包,在下文中一共展示了WatchFaceService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onComplicationTapped

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
/**
 * Handles what to do once a complication is tapped
 *
 * @param id of the complication tapped
 */
private void onComplicationTapped(int id) {
    final ComplicationData complicationData = mActiveComplicationDataSparseArray.get(id);

    if (complicationData != null) {
        if (complicationData.getTapAction() != null) {
            try {
                complicationData.getTapAction().send();
            } catch (PendingIntent.CanceledException e) {
                Log.d(TAG, "Something went wrong with tapping a complication");
            }

        } else if (complicationData.getType() == ComplicationData.TYPE_NO_PERMISSION) {
            ComponentName componentName = new ComponentName(
                    mContext, WatchFaceService.class);

            Intent permissionRequestIntent =
                    ComplicationHelperActivity.createPermissionRequestHelperIntent(
                            mContext, componentName);

            startActivity(permissionRequestIntent);
        }
    }
}
 
开发者ID:Nxt3,项目名称:IO_Classic_WatchFace,代码行数:29,代码来源:IOClassicWatchFaceService.java

示例2: onTapCommand

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onTapCommand(@TapType int tapType, int x, int y, long eventTime) {
    switch (tapType) {
        case WatchFaceService.TAP_TYPE_TAP:
            //detect screen area (CENTER_LEFT, CENTER_RIGHT, BOTTOM_CENTER)
            handleTouch(x,y);
            invalidate();
            break;

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

        default:
            super.onTapCommand(tapType, x, y, eventTime);
            break;
    }
}
 
开发者ID:marcouberti,项目名称:adrenaline_watch_face,代码行数:20,代码来源:SonicBoomFace.java

示例3: onTapCommand

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:marcouberti,项目名称:american_sunsets_watch_face,代码行数:21,代码来源:SunsetsWatchFace.java

示例4: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:mjhassanpur,项目名称:sunshine-wear,代码行数:23,代码来源:DigitalWatchFaceService.java

示例5: onCreate

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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();
}
 
开发者ID:romannurik,项目名称:FORMWatchFace,代码行数:20,代码来源:FormWatchFace.java

示例6: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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;
        mHourPaint.setAlpha(alpha);
        mMinutePaint.setAlpha(alpha);
        mColonPaint.setAlpha(alpha);
        mAmPmPaint.setAlpha(alpha);
        invalidate();
    }
}
 
开发者ID:AndroidAvanzato,项目名称:Capitolo6,代码行数:22,代码来源:DigitalWatchFaceService.java

示例7: onTapCommand

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onTapCommand(@TapType int tapType, int x, int y, long eventTime) {
    switch (tapType) {
        case WatchFaceService.TAP_TYPE_TAP:
            mBlurred = !mBlurred;
            SharedPreferences preferences =
                    PreferenceManager.getDefaultSharedPreferences(MuzeiWatchFace.this);
            preferences.edit().putBoolean(BLURRED_PREF_KEY, mBlurred).apply();
            updateWatchFaceStyle();
            invalidate();
            break;
        default:
            super.onTapCommand(tapType, x, y, eventTime);
            break;
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:17,代码来源:MuzeiWatchFace.java

示例8: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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;
        updateWatchFaceStyle();
        invalidate();
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:18,代码来源:MuzeiWatchFace.java

示例9: onTapCommand

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onTapCommand(
        @TapType int tapType, int x, int y, long eventTime) {
    switch (tapType) {
        case WatchFaceService.TAP_TYPE_TAP:
            // Handle the tap
            Toast.makeText(PacktWatchFace.this, "Tapped", Toast.LENGTH_SHORT).show();
            break;

        // There are other cases, not mentioned here. <a href="https://developer.android.com/training/wearables/watch-faces/interacting.html">Read Android guide</a>
        default:
            super.onTapCommand(tapType, x, y, eventTime);
            break;
    }
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:16,代码来源:PacktWatchFace.java

示例10: onTapCommand

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onTapCommand(
        @TapType int tapType, int x, int y, long eventTime) {
    switch (tapType) {
        case WatchFaceService.TAP_TYPE_TAP:
            break;
        case WatchFaceService.TAP_TYPE_TOUCH:
            break;
        case WatchFaceService.TAP_TYPE_TOUCH_CANCEL:
            break;
        default:
            super.onTapCommand(tapType, x, y, eventTime);
            break;
    }
}
 
开发者ID:LadyViktoria,项目名称:wearDrip,代码行数:16,代码来源:wearDripWatchFace.java

示例11: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:stevengatto,项目名称:PavlovWatchface,代码行数:13,代码来源:AnalogWatchFaceServiceUpdated.java

示例12: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onInterruptionFilterChanged(int interruptionFilter) {
    super.onInterruptionFilterChanged(interruptionFilter);
    boolean inMuteMode = (interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE);
    if (mMute != inMuteMode) {
        mMute = inMuteMode;

        invalidate();
    }
}
 
开发者ID:alessandrocucci,项目名称:WatchFaceTutorial,代码行数:11,代码来源:CanvasHand.java

示例13: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:romannurik,项目名称:FORMWatchFace,代码行数:14,代码来源:FormWatchFace.java

示例14: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:13,代码来源:WatchFace.java

示例15: onInterruptionFilterChanged

import android.support.wearable.watchface.WatchFaceService; //导入依赖的package包/类
@Override
public void onInterruptionFilterChanged(int interruptionFilter) {
  super.onInterruptionFilterChanged(interruptionFilter);
  boolean inMuteMode = (interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE);
  if (mute != inMuteMode) {
    mute = inMuteMode;
    allFill.setAlpha(inMuteMode ? 100 : 255);
    secondFill.setAlpha(inMuteMode ? 80 : 255);
    invalidate();
  }
}
 
开发者ID:jimblackler,项目名称:YourPhotosWatch,代码行数:12,代码来源:BaseWatchService.java


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