示例#1
0
  public void setPushToTalk(final boolean talking) {
    mService.setPushToTalk(talking);

    int pushToTalkBackground =
        mViewPager != null
            ? R.color.push_to_talk_background
            : 0; // Use special 'second action bar' look for background of paged.

    if (pttView != null)
      pttView.setBackgroundResource(talking ? R.color.holo_blue_light : pushToTalkBackground);
  }
示例#2
0
  /**
   * Handles activity initialization when the Service has connected.
   *
   * <p>Should be called when there is a reason to believe that the connection might have became
   * valid. The connection MUST be established but other validity criteria may still be unfilled
   * such as server synchronization being complete.
   *
   * <p>The method implements the logic required for making sure that the Connected service is in
   * such a state that it fills all the connection criteria for ChannelList.
   *
   * <p>The method also takes care of making sure that its initialization code is executed only once
   * so calling it several times doesn't cause problems.
   */
  protected void onConnected() {
    // Tell the service that we are now visible.
    mService.setActivityVisible(true);

    // Update user control
    updateUserControlMenuItems();

    // Restore push to talk state, if toggled. Otherwise make sure it's turned off.
    if (settings.isPushToTalk() && mService.isRecording()) {
      if (settings.isPushToTalkToggle() && settings.isPushToTalkButtonShown()) setPushToTalk(true);
      else mService.setPushToTalk(false);
    }

    if (settings.isPushToTalk() && mService.isRecording())
      if (chatTarget != null) {
        listFragment.setChatTarget(chatTarget);
        chatFragment.setChatTarget(chatTarget);
      }

    // Showcase hints
    List<ShowcaseView> showcaseViews = new ArrayList<ShowcaseView>();
    if (settings.isPushToTalk() && settings.isPushToTalkButtonShown()) {
      ConfigOptions pttConfig = new ConfigOptions();
      pttConfig.shotType = ShowcaseView.TYPE_ONE_SHOT;
      pttConfig.showcaseId = Globals.SHOWCASE_PUSH_TO_TALK;
      showcaseViews.add(
          ShowcaseView.insertShowcaseView(
              pttView, this, R.string.hint_ptt, R.string.hint_ptt_summary, pttConfig));
    }

    if (mViewPager != null) {
      ConfigOptions switcherConfig = new ConfigOptions();
      switcherConfig.shotType = ShowcaseView.TYPE_ONE_SHOT;
      switcherConfig.showcaseId = Globals.SHOWCASE_SWITCHER;
      showcaseViews.add(
          ShowcaseView.insertShowcaseView(
              ShowcaseView.ITEM_ACTION_HOME,
              0,
              this,
              R.string.hint_switching,
              R.string.hint_switching_summary,
              switcherConfig));
    }

    ShowcaseViewQueue queue = new ShowcaseViewQueue(showcaseViews);
    queue.queueNext();
  }
  /**
   * Handles activity initialization when the Service has connected.
   *
   * <p>Should be called when there is a reason to believe that the connection might have became
   * valid. The connection MUST be established but other validity criteria may still be unfilled
   * such as server synchronization being complete.
   *
   * <p>The method implements the logic required for making sure that the Connected service is in
   * such a state that it fills all the connection criteria for ChannelList.
   *
   * <p>The method also takes care of making sure that its initialization code is executed only once
   * so calling it several times doesn't cause problems.
   */
  protected void onConnected() {
    // Tell the service that we are now visible.
    mService.setActivityVisible(true);

    // Update user control
    updateUserControlMenuItems();

    // Restore push to talk state, if toggled. Otherwise make sure it's turned off.
    if (settings.isPushToTalk() && mService.isRecording()) {
      if (settings.isPushToTalkToggle() && settings.isPushToTalkButtonShown()) setPushToTalk(true);
      else mService.setPushToTalk(false);
    }

    if (settings.isPushToTalk() && mService.isRecording())
      if (chatTarget != null) {
        listFragment.setChatTarget(chatTarget);
        chatFragment.setChatTarget(chatTarget);
      }
  }