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


Java LiveCard类代码示例

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


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

示例1: onStartCommand

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    TimelineManager manager = TimelineManager.from(this);
    LiveCard card = manager.createLiveCard("awesome");

    RemoteViews view = new RemoteViews(this.getPackageName(), R.layout.live_card_layout);
    view.setTextViewText(android.R.id.text1, "Amazing");
    card.setViews(view);

    Intent menuIntent = new Intent(this, CardActivity.class);
    menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    card.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0));

    card.publish(LiveCard.PublishMode.REVEAL);

    return START_STICKY;
}
 
开发者ID:briangriffey,项目名称:glass-full-activity,代码行数:19,代码来源:LaunchActivityService.java

示例2: onStartCommand

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (mLiveCard == null) {
        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
        mRenderer = new OrientationRecorderRenderer(this, recordingOrientationManager);

        LiveCard direct = mLiveCard.setDirectRenderingEnabled(true);
        direct.getSurfaceHolder().addCallback(mRenderer);
        direct.getSurfaceHolder().setKeepScreenOn(true);

        // Display the options menu when the live card is tapped.
        Intent menuIntent = new Intent(this, OrientationRecorderMenuActivity.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);
    }
    
    SharedPreferences prefs =
                    getSharedPreferences(PREFERENCES_NAME, MODE_PRIVATE);
    int uom = prefs.getInt(PREFS_UOM_KEY, OrientationRecorderView.UOM_DEFAULT);
    mRenderer.setUom(uom);

    return START_STICKY;
}
 
开发者ID:euedge,项目名称:orientation-recorder,代码行数:26,代码来源:OrientationRecorderService.java

示例3: rosTopic

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
/**
 * This method connects to the server which has an instance of the ROSBridge server running.
 * On connection it requests a subscription to the passed topic and creates the topic manager to
 * listen to updates from that topic. 
 * @param new_topic String: Topic selected for debugging/viewing.
 */
private void rosTopic(String new_topic){
	mTopicManager = new TopicManager(new_topic.trim() , HOST_ADDRESS, mConnection);
	try {
		mConnection.connect(HOST_ADDRESS, mTopicManager);
	} catch (WebSocketException e) {
		e.printStackTrace();
	}
	if (mLiveCard == null) {
		mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
		mRenderer = new TopicRenderer(this, mTopicManager);

		mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mRenderer);
		//display the options menu when the live card is tapped.
		Intent menuIntent = new Intent(this, TopicMenuActivity.class);
		menuIntent.putExtra("Destroy", true);
		menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
		mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0));
		mLiveCard.publish(LiveCard.PublishMode.REVEAL);
	}
}
 
开发者ID:unl-nimbus-lab,项目名称:ros_glass_tools,代码行数:27,代码来源:TopicService.java

示例4: createWarning

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
/**
 * This method takes a string error message and creates a live card displaying that warning on the Glass.
 * This allows the service to alert the user when a defined behavor has occured.
 * @param error_message String : error message to dispaly
 */
public void createWarning(String error_message) {
	//if we have to live card create one
	if (mLiveCard == null){
		mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
	}
	//get rid of the old one
	if(mLiveCard.isPublished()){
		mLiveCard.unpublish();
	}
	//Create the view for the live card including the error message.
	TextView text = new TextView(this);
	text.setText(error_message);
	RemoteViews views = new RemoteViews(getBaseContext().getPackageName(), R.layout.warn_card);
	views.setTextViewText(R.id.warn_text, error_message	);
	mLiveCard.setViews(views);
	
	//publish the live card and ensure that it takes up display
     Intent intent = new Intent(this, MenuActivity.class);
     mLiveCard.setAction(PendingIntent.getActivity(this, 0, intent, 0));
     mLiveCard.publish(LiveCard.PublishMode.REVEAL);
}
 
开发者ID:unl-nimbus-lab,项目名称:ros_glass_tools,代码行数:27,代码来源:ROSMonitorService.java

示例5: startNewTimer

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
/** 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;
}
 
开发者ID:googleglass,项目名称:gdk-timer-sample,代码行数:23,代码来源:TimerLiveCardManager.java

示例6: onCreate

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mFromLiveCardVoice = getIntent().getBooleanExtra(LiveCard.EXTRA_FROM_LIVECARD_VOICE, false);
    if (mFromLiveCardVoice) {
        // When activated by voice from a live card, enable voice commands. The menu
        // will automatically "jump" ahead to the items (skipping the guard phrase
        // that was already said at the live card).
        getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
    }

    // Bind to the Timer service to retrive the current timer's data.
    Intent serviceIntent = new Intent(this, TimerService.class);
    serviceIntent.putExtra(
        TimerService.EXTRA_TIMER_HASH_CODE,
        getIntent().getIntExtra(TimerService.EXTRA_TIMER_HASH_CODE, 0));
    serviceIntent.setData(getIntent().getData());
    bindService(serviceIntent, mConnection, 0);
}
 
开发者ID:googleglass,项目名称:gdk-timer-sample,代码行数:21,代码来源:MenuActivity.java

示例7: onStartCommand

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (mLiveCard == null) {
        SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_TAG);
        mRenderer = new LevelRenderer(sensorManager, this);

        mLiveCard.setDirectRenderingEnabled(true);
        mLiveCard.getSurfaceHolder().addCallback(mRenderer);

        // Display the options menu when the live card is tapped.
        Intent menuIntent = new Intent(this, LevelMenuActivity.class);
        menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

        mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0));

        mLiveCard.publish(LiveCard.PublishMode.REVEAL);
    }
    return START_STICKY;
}
 
开发者ID:googleglass,项目名称:gdk-level-sample,代码行数:22,代码来源:LevelService.java

示例8: onStartCommand

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (mLiveCard == null) {
        mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
        mRenderer = new HudRenderer(this, mObdManager);

        mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mRenderer);

        // Display the options menu when the live card is tapped.
        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(LiveCard.PublishMode.REVEAL);
    }

    return START_STICKY;
}
 
开发者ID:ZackFreedman,项目名称:Voidstar-AutoHud,代码行数:19,代码来源:HudService.java

示例9: onStartCommand

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
  public int onStartCommand(Intent intent, int flags, int startId) {
RemoteViews aRV = new RemoteViews(this.getPackageName(),
              R.layout.card_text);
      if (mLiveCard == null) {
          mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID);
          aRV.setTextViewText(R.id.main_text, INTRO);
          mLiveCard.setViews(aRV);
          Intent mIntent = new Intent(this, MainActivity.class);
          mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
          mLiveCard.setAction(PendingIntent.getActivity(this, 0, mIntent, 0));
          mLiveCard.publish(LiveCard.PublishMode.REVEAL);
      } 
      return START_STICKY;
  }
 
开发者ID:nkp,项目名称:ichack14,代码行数:16,代码来源:MainService.java

示例10: stopTimer

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
/**
 * Stops the {@link Timer}/{@link LiveCard} and returns whether or not the manager is empty of
 * {@link Timer}.
 */
public boolean stopTimer(int timerHashCode) {
    Timer timer = findTimer(timerHashCode);

    if (timer != null) {
        LiveCard liveCard = mTimers.get(timer);

        liveCard.unpublish();
        timer.reset();
        mTimers.remove(timer);
    }
    return mTimers.isEmpty();
}
 
开发者ID:googleglass,项目名称:gdk-timer-sample,代码行数:17,代码来源:TimerLiveCardManager.java

示例11: testStartNewTimer

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
public void testStartNewTimer() {
    Timer timer = mManager.startNewTimer(INITIAL_DURATION_MILLIS);
    LiveCard liveCard = mManager.getLiveCard(timer);

    assertNotNull(timer);
    assertNotNull(liveCard);
    assertTrue(timer.isStarted());
    assertEquals(INITIAL_DURATION_MILLIS, timer.getDurationMillis());
    assertTrue(liveCard.isPublished());
}
 
开发者ID:googleglass,项目名称:gdk-timer-sample,代码行数:11,代码来源:TimerLiveCardManagerTest.java

示例12: onCreate

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFromLiveCardVoice = getIntent().getBooleanExtra(LiveCard.EXTRA_FROM_LIVECARD_VOICE, false);
    if (mFromLiveCardVoice) {
        // When activated by voice from a live card, enable voice commands. The menu
        // will automatically "jump" ahead to the items (skipping the guard phrase
        // that was already said at the live card).
        getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
    }
    bindService(new Intent(this, CompassService.class), mConnection, 0);
}
 
开发者ID:googleglass,项目名称:gdk-compass-sample,代码行数:13,代码来源:CompassMenuActivity.java

示例13: getLiveCard

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
LiveCard getLiveCard() {
    return liveCard;
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:4,代码来源:StatsService.java

示例14: StatsReceiver

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
public StatsReceiver( LiveCard liveCard, RemoteViews rv ) {
	this.liveCard = liveCard;
	this.rv = rv;
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:5,代码来源:StatsReceiver.java

示例15: testLiveCardIsPublished

import com.google.android.glass.timeline.LiveCard; //导入依赖的package包/类
public void testLiveCardIsPublished() {
    LiveCard liveCard = service.getLiveCard();
    assertNotNull( liveCard );
    assertTrue( liveCard.isPublished() );
}
 
开发者ID:coderoshi,项目名称:glass,代码行数:6,代码来源:StatsServiceTest.java


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