コード例 #1
0
 @Override
 public Command getBackCommand() {
   Command backCommand = null;
   List<Command> commands = source.getCommands();
   if (commands != null) {
     for (int i = 0; i < commands.size(); i++) {
       Command command = commands.get(i);
       if (command.getStyle() == Command.CommandStyle.Back) {
         backCommand = command;
         break;
       }
     }
   }
   return backCommand;
 }
コード例 #2
0
 @Override
 public boolean shouldShowMoreOption() {
   int count = 0;
   boolean hasMoreOnly = false;
   List<Command> commands = source.getCommands();
   for (int i = 0; i < commands.size(); i++) {
     Command command = commands.get(i);
     Command.CommandStyle commandStyle = command.getStyle();
     if (!(commandStyle == Command.CommandStyle.Secret
         || commandStyle == Command.CommandStyle.Back)) {
       count++;
       if (commandStyle == Command.CommandStyle.MoreOnly) {
         hasMoreOnly = true;
         break;
       }
     }
   }
   return (count >= maxBarButtons || hasMoreOnly);
 }
コード例 #3
0
 private List<Command> getCommands(Integer max, boolean includeBack, boolean includeSecret) {
   List<Command> commands = source.getCommands();
   ArrayList<Command> result;
   if (commands != null) {
     result = new ArrayList<Command>(commands.size());
     for (int i = 0; i < commands.size(); i++) {
       Command command = commands.get(i);
       if ((command.getStyle() != Command.CommandStyle.Back || includeBack)
           && (command.getStyle() != Command.CommandStyle.Secret
                   && command.getStyle() != Command.CommandStyle.MoreOnly
               || includeSecret)) {
         result.add(command);
         if (max != null && result.size() >= max) {
           break;
         }
       }
     }
   } else {
     result = null;
   }
   return result;
 }
コード例 #4
0
 @Override
 public String getTitle() {
   return source.getTitle();
 }