예제 #1
0
  @Override
  public String play(String action, String... args) {

    if (action.equalsIgnoreCase(AutomatorConstants.ACTION_SELECT)) {
      assertArgCount(action, args, 1);
      final TabHost tabs = this.getTabHost();
      final String title = args[0];
      AutomationManager.runOnUIThread(
          new Runnable() {
            public void run() {
              tabs.setCurrentTabByTag(title);
            }
          });
      return null;
    } else if (action.equalsIgnoreCase(AutomatorConstants.ACTION_SELECT_INDEX)) {
      assertArgCount(action, args, 1);
      final TabHost tabs = this.getTabHost();
      final int index = getIndexArg(action, args[0]);

      AutomationManager.runOnUIThread(
          new Runnable() {
            public void run() {
              tabs.setCurrentTab(index - 1);
            }
          });
      return null;
    }
    return super.play(action, args);
  }
예제 #2
0
 @Override
 public void onTabChanged(String tabId) {
   AutomationManager.recordTab(AutomatorConstants.ACTION_SELECT, tabId);
 }