當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。