コード例 #1
0
ファイル: RecentsView.java プロジェクト: xuwanjin/SystemUI
  /** Launches the task that Recents was launched from, if possible */
  public boolean launchPreviousTask() {
    Log.d(TAG, "launchPreviousTask: ");
    // Get the first stack view
    List<TaskStackView> stackViews = getTaskStackViews();
    int stackCount = stackViews.size();
    for (int i = 0; i < stackCount; i++) {
      TaskStackView stackView = stackViews.get(i);
      TaskStack stack = stackView.getStack();
      ArrayList<Task> tasks = stack.getTasks();

      // Find the launch task in the stack
      if (!tasks.isEmpty()) {
        int taskCount = tasks.size();
        for (int j = 0; j < taskCount; j++) {
          if (tasks.get(j).isLaunchTarget) {
            Task task = tasks.get(j);
            TaskView tv = stackView.getChildViewForTask(task);
            onTaskViewClicked(stackView, tv, stack, task, false);
            return true;
          }
        }
      }
    }
    return false;
  }
コード例 #2
0
ファイル: RecentsView.java プロジェクト: xuwanjin/SystemUI
 /** Launches a given task. */
 public boolean launchTask(Task task) {
   Log.d(TAG, "launchTask: ");
   // Get the first stack view
   List<TaskStackView> stackViews = getTaskStackViews();
   int stackCount = stackViews.size();
   for (int i = 0; i < stackCount; i++) {
     TaskStackView stackView = stackViews.get(i);
     TaskStack stack = stackView.getStack();
     // Iterate the stack views and try and find the given task.
     List<TaskView> taskViews = stackView.getTaskViews();
     int taskViewCount = taskViews.size();
     for (int j = 0; j < taskViewCount; j++) {
       TaskView tv = taskViews.get(j);
       if (tv.getTask() == task) {
         onTaskViewClicked(stackView, tv, stack, task, false);
         return true;
       }
     }
   }
   return false;
 }