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


Java WatchFaceStyle类代码示例

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


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

示例1: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
        public void onCreate(SurfaceHolder holder) {
            super.onCreate(holder);

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

            // Let us initialize them all here
//            bob = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
            backGround = new Paint() {{ setARGB(255, 120, 190, 0); }};
            textPaint = createPaint(false, 40);
            boldTextPaint = createPaint(true, 40);
            whiteBackground = createPaint(false, 0);
            darkText = new Paint() {{ setARGB(255, 50, 50, 50); setTextSize(18); }};

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

            calendar = Calendar.getInstance();
        }
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:26,代码来源:PacktWatchFace.java

示例2: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    engine = this;

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

    Resources resources = WatchFaceService.this.getResources();

    timeOffsetY = resources.getDimension(R.dimen.clock_offset_y);
    dateOffsetY = resources.getDimension(R.dimen.offset_date_y);
    lineOffsetY = resources.getDimension(R.dimen.offset_line_y);
    currentWeatherOffsetY = resources.getDimension(R.dimen.offset_current_weather_y);

    initPaint();

    currentTime = Calendar.getInstance();
    notifyHandheld();
}
 
开发者ID:hieple7985,项目名称:nano-go-ubiquitous,代码行数:25,代码来源:WatchFaceService.java

示例3: onCreate

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

示例4: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(wearDripWatchFaceService.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setAmbientPeekMode(WatchFaceStyle.AMBIENT_PEEK_MODE_HIDDEN)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .setAcceptsTapEvents(true)
            .build());

    timeTick = new Handler(Looper.myLooper());
    startTimerIfNecessary();

    //watchFace = wearDripWatchFace.newInstance(wearDripWatchFaceService.this);

}
 
开发者ID:LadyViktoria,项目名称:wearDrip,代码行数:19,代码来源:wearDripWatchFaceService.java

示例5: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);
    IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND);
    MessageReceiver messageReceiver = new MessageReceiver();
    LocalBroadcastManager.getInstance(WatchFaceService.this).registerReceiver(messageReceiver, messageFilter);

    setUpGoogleApiClient();

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

    timeTick = new Handler(Looper.myLooper());
    startTimerIfNecessary();

    watchFace = WatchFace.newInstance(WatchFaceService.this);
}
 
开发者ID:sahilandroid19,项目名称:WearApp,代码行数:22,代码来源:WatchFaceService.java

示例6: onCreate

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

示例7: onCreate

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

示例8: onCreate

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

示例9: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@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();
}
 
开发者ID:moyheen,项目名称:radar-watch-face,代码行数:19,代码来源:AndelaWatchFace.java

示例10: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder){
	super.onCreate(holder);

	setWatchFaceStyle(new WatchFaceStyle.Builder(IOWatchFace.this)
			.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
			.setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
			.setHotwordIndicatorGravity(Gravity.TOP | Gravity.RIGHT)
			.setShowSystemUiTime(false)
			.setAcceptsTapEvents(true)
			.build());
	Resources resources=IOWatchFace.this.getResources();

	mBackgroundPaint=new Paint();
	//mBackgroundPaint.setColor(0xFFFFFFFF);
	mBackgroundPaint.setColor(0xFF000000);


	paint=new Paint(Paint.ANTI_ALIAS_FLAG);
	paint.setStyle(Paint.Style.STROKE);
	paint.setStrokeWidth(1f*getResources().getDisplayMetrics().density);
	paint.setColor(0xFFFFFFFF);
	//paint.setStrokeCap(Paint.Cap.ROUND);

	time=new Time();
}
 
开发者ID:grishka,项目名称:io16watchface,代码行数:27,代码来源:IOWatchFace.java

示例11: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFace.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setShowSystemUiTime(false)
            .setAcceptsTapEvents(true)
            .build());
    resources = MyWatchFace.this.getResources();
    mYOffset = resources.getDimension(R.dimen.digital_y_offset);

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(resources.getColor(R.color.background));
    mTextPaint = new Paint();
    mTextPaint = createTextPaint(resources.getColor(R.color.digital_text));
    battery = BitmapFactory.decodeResource(resources, R.drawable.battery);
    mTime = new Time();
}
 
开发者ID:irshuLx,项目名称:Android-Wear-Watchface,代码行数:21,代码来源:MyWatchFace.java

示例12: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    setWatchFaceStyle(new WatchFaceStyle.Builder(WatchFace.this)
            .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
            .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
            .setStatusBarGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL)
            .setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_TRANSLUCENT)
            .setShowSystemUiTime(false)
            .build());

    resetColors();

    mCalendar = Calendar.getInstance();
}
 
开发者ID:FruitieX,项目名称:materialwatch,代码行数:17,代码来源:WatchFace.java

示例13: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

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

    Resources resources = BitcoinWatchFaceService.this.getResources();


    googleApiClient = new GoogleApiClient.Builder(getBaseContext())
            .addApi(Wearable.API)
            .build();

    googleApiClient.connect();

    Storage storage = new Storage(getBaseContext());
    viewModelFactory = new WatchFaceViewModelFactory(storage, getBaseContext());

    watchFaceTimer = new WatchFaceTimer(this, storage, googleApiClient);

    drawer = new WatchFaceDrawer(resources);
}
 
开发者ID:tobiasheine,项目名称:BitcoinWatcher,代码行数:27,代码来源:BitcoinWatchFaceService.java

示例14: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

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

    Resources resources = HexWatchFaceService.this.getResources();
    mYOffset = resources.getDimension(R.dimen.y_offset);

    mHexPaint = createTextPaint();
    mHexPaint.setTextSize(resources.getDimension(R.dimen.text_size_time));

    mDayPaint = createTextPaint();
    mDayPaint.setFakeBoldText(true);
    mDayPaint.setTextSize(resources.getDimension(R.dimen.text_size_date));

    mDatePaint = createTextPaint();
    mDatePaint.setTextSize(resources.getDimension(R.dimen.text_size_date));

    mTime = new Time();
}
 
开发者ID:jrdnull,项目名称:HexWatch,代码行数:26,代码来源:HexWatchFaceService.java

示例15: onCreate

import android.support.wearable.watchface.WatchFaceStyle; //导入依赖的package包/类
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    mBackgroundBitMap = BitmapFactory.decodeResource(getResources(), R.drawable.custom_background);

    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();
}
 
开发者ID:mortenjust,项目名称:trajectoryclock-wear,代码行数:24,代码来源:MyWatchFaceService.java


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