本文整理汇总了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);
}
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}