com.google.android.glass.timeline.LiveCard.PublishMode Java Examples
The following examples show how to use
com.google.android.glass.timeline.LiveCard.PublishMode.
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: CompassService.java From PTVGlass with MIT License | 6 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (mLiveCard == null) { mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID); mRenderer = new CompassRenderer(this, mOrientationManager, mLandmarks); mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mRenderer); // Display the options menu when the live card is tapped. Intent menuIntent = new Intent(this, CompassMenuActivity.class); menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0)); mLiveCard.publish(PublishMode.REVEAL); } return START_STICKY; }
Example #2
Source File: StopwatchService.java From PTVGlass with MIT License | 6 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (mLiveCard == null) { Log.d(TAG, "Publishing LiveCard"); mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_TAG); // Keep track of the callback to remove it before unpublishing. mCallback = new ChronometerDrawer(this); mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mCallback); Intent menuIntent = new Intent(this, MenuActivity.class); menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0)); mLiveCard.publish(PublishMode.REVEAL); Log.d(TAG, "Done publishing LiveCard"); } else { // TODO(alainv): Jump to the LiveCard when API is available. } return START_STICKY; }
Example #3
Source File: TimerService.java From PTVGlass with MIT License | 6 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (mLiveCard == null) { mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_TAG); mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mTimerDrawer); Intent menuIntent = new Intent(this, MenuActivity.class); menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0)); mLiveCard.publish(PublishMode.REVEAL); } else { // TODO(alainv): Jump to the LiveCard when API is available. } return START_STICKY; }
Example #4
Source File: TimerLiveCardManager.java From gdk-timer-sample with Apache License 2.0 | 6 votes |
/** Starts a new {@link Timer}/{@link LiveCard} combination with the provided duration. */ public Timer startNewTimer(long durationMillis) { Timer timer = new Timer(durationMillis); TimerDrawer drawer = new TimerDrawer(mContext, timer); LiveCard liveCard = new LiveCard(mContext, timer.toString()); liveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(drawer); liveCard.setVoiceActionEnabled(true); Intent menuIntent = new Intent(mContext, MenuActivity.class); menuIntent.setData(Uri.parse("glass.timer:" + timer.hashCode())); menuIntent.putExtra(TimerService.EXTRA_TIMER_HASH_CODE, timer.hashCode()); liveCard.setAction(PendingIntent.getActivity(mContext, 0, menuIntent, 0)); if (mContext instanceof Service) { liveCard.attach((Service) mContext); } liveCard.publish(PublishMode.REVEAL); timer.start(); mTimers.put(timer, liveCard); return timer; }
Example #5
Source File: LocationService.java From open-quartz with Apache License 2.0 | 6 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (mLiveCard == null) { Log.d(LocationService.TAG, "Publishing LiveCard"); // mLiveCard = mTimelineManager // .createLiveCard(LocationService.LIVE_CARD_TAG); // Keep track of the callback to remove it before unpublishing. mCallback = new ChronometerDrawer(this); mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder() .addCallback(mCallback); final Intent menuIntent = new Intent(this, MenuActivity.class); menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0)); mLiveCard.publish(PublishMode.REVEAL); Log.d(LocationService.TAG, "Done publishing LiveCard"); } else { // TODO(alainv): Jump to the LiveCard when API is available. } return Service.START_STICKY; }