示例#1
0
  /**
   * リスト初期化
   *
   * @return List<ListItem>
   */
  private List<ListItem> initList() {

    List<ListItem> items = new ArrayList<ListItem>();

    for (int i = 0; i < 11; i++) {
      items.add(new ListItem());

      if (i == 0) {
        ListItem header = new ListItem();

        header.setRank("順位");
        header.setCount("手数");
        header.setStage("ステージ");
        header.setDate("プレイ時刻");

        items.set(0, header);
      } else {
        ListItem item = new ListItem();

        item.setRank(String.valueOf(i));
        item.setCount("");
        item.setStage("");
        item.setDate("");

        items.set(i, item);
      }
    }

    return items;
  }
示例#2
0
 /**
  * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
  *
  * @param o the object to add.
  * @return true if adding the object succeeded
  */
 public boolean add(Object o) {
   if (o instanceof ListItem) {
     ListItem item = (ListItem) o;
     if (numbered || lettered) {
       Chunk chunk;
       if (lettered) chunk = new Chunk(nextLetter(), symbol.font());
       else chunk = new Chunk(String.valueOf(first + list.size()), symbol.font());
       chunk.append(".");
       item.setListSymbol(chunk);
     } else {
       item.setListSymbol(symbol);
     }
     item.setIndentationLeft(symbolIndent);
     item.setIndentationRight(0);
     list.add(item);
   } else if (o instanceof List) {
     List nested = (List) o;
     nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
     first--;
     return list.add(nested);
   } else if (o instanceof String) {
     return this.add(new ListItem((String) o));
   }
   return false;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    ViewHolder holder;

    if (convertView == null) {
      view = inflater.inflate(R.layout.grid_list_layout, null);
      holder = new ViewHolder();
      holder.adIcon = (ImageView) view.findViewById(R.id.adIcon);
      holder.adType = (TextView) view.findViewById(R.id.adType);
      holder.adSize = (TextView) view.findViewById(R.id.adSize);
      holder.adClientId = (TextView) view.findViewById(R.id.adClientId);
      view.setTag(holder);
    } else {
      holder = (ViewHolder) view.getTag();
    }

    ListItem listItem = this.getItem(position);
    holder.adIcon.setImageResource(listItem.getAdIcon());
    holder.adType.setText(listItem.getAdType());
    holder.adSize.setText(listItem.getAdSize());
    holder.adClientId.setText(listItem.getAdClientId());

    return view;
  }
 public void selectInVector(Vector<String> vec) {
   for (ListItem<T> item : items) {
     if (vec.contains(item.dataItem)) {
       item.selected = true;
     } else item.selected = false;
   }
 }
示例#5
0
 /**
  * Gets the leading of the first listitem.
  *
  * @return a <CODE>leading</CODE>
  */
 public float leading() {
   if (list.size() < 1) {
     return -1;
   }
   ListItem item = (ListItem) list.get(0);
   return item.leading();
 }
  public WndJournal() {

    super();
    resize(WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P);

    txtTitle = PixelScene.createText(TXT_TITLE, 9);
    txtTitle.hardlight(Window.TITLE_COLOR);
    txtTitle.measure();
    txtTitle.x = PixelScene.align(PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2);
    add(txtTitle);

    Component content = new Component();

    Collections.sort(Journal.records);

    float pos = 0;
    for (Journal.Record rec : Journal.records) {
      ListItem item = new ListItem(rec.feature, rec.depth);
      item.setRect(0, pos, WIDTH, ITEM_HEIGHT);
      content.add(item);

      pos += item.height();
    }

    content.setSize(WIDTH, pos);

    list = new ScrollPane(content);
    add(list);

    list.setRect(0, txtTitle.height(), WIDTH, height - txtTitle.height());
  }
  private void handleHyperlinkKeyModifierModified() {
    String modifiers = fHyperlinkKeyModifierText.getText();

    int stateMask = computeStateMask(modifiers);

    if (fHyperlinksEnabledCheckBox.getSelection()
        && (stateMask == -1 || (stateMask & SWT.SHIFT) != 0)) {
      if (stateMask == -1)
        fHyperlinkKeyModifierStatus =
            new StatusInfo(
                IStatus.ERROR,
                NLSUtility.format(
                    TextEditorMessages.HyperlinkKeyModifier_error_modifierIsNotValid, modifiers));
      else
        fHyperlinkKeyModifierStatus =
            new StatusInfo(
                IStatus.ERROR, TextEditorMessages.HyperlinkKeyModifier_error_shiftIsDisabled);
      applyToStatusLine(getHyperlinkKeyModifierStatus());
      fPreferencePage.setValid(getHyperlinkKeyModifierStatus().isOK());
    } else {
      ListItem item = getSelectedItem();
      if (item != null) {
        if (item.modifierKeys != null
            || !modifiers.equalsIgnoreCase(fHyperlinkDefaultKeyModifierText.getText()))
          item.modifierKeys = modifiers;
        fHyperlinkDetectorsViewer.refresh(getSelectedItem());
        fStore.setValue(item.id + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX, stateMask);
      }
      fHyperlinkKeyModifierStatus = new StatusInfo();
      fPreferencePage.setValid(true);
      applyToStatusLine(fHyperlinkKeyModifierStatus);
    }
  }
示例#8
0
 @Override
 public void createRenderedListComponents(SRList<T> listPanel, List<ListItem<T>> listItems) {
   for (ListItem<T> listItem : listItems) {
     DefaultListItem defaultListItem = new DefaultListItem();
     listItem.setRenderableComponent(defaultListItem);
     listItem.setComponent(defaultListItem.create(listItem));
   }
 }
示例#9
0
  /** コンストラクタ */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 画面の初期化
    requestWindowFeature(Window.FEATURE_NO_TITLE); // アプリ名非表示
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // 画面レイアウト
    setContentView(R.layout.ranking);
    list = (ListView) this.findViewById(R.id.list);

    // ボタンイベント定義
    ImageButton button = (ImageButton) findViewById(R.id.backButton1);
    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // ボタンがクリックされた時に呼び出されます
            finish();
          }
        });

    // DB接続
    sqliteHelper = new SQLite(getApplicationContext());
    puzzleDB = sqliteHelper.getWritableDatabase();
    Cursor cursor =
        puzzleDB.query(
            "result",
            new String[] {"move_count", "stage", "update_time"},
            null,
            null,
            null,
            null,
            "move_count",
            "10");

    // リスト表示
    List<ListItem> items = initList();

    if (cursor.moveToFirst()) {
      for (int row = 1; row <= cursor.getCount(); row++) {
        ListItem item = items.get(row);

        item.setCount(String.valueOf(cursor.getInt(0)));
        item.setStage(String.valueOf(cursor.getInt(1)));
        item.setDate(cursor.getString(2));

        items.set(row, item);
        cursor.moveToNext();
      }
    }

    ListAdapter adapter = new ListAdapter(getApplicationContext(), items);
    list.setAdapter(adapter);

    cursor.close();
  }
示例#10
0
  @UiChild(tagname = "sidebaritem")
  public void addWidgetSideNav(final Widget item) {
    ListItem listItem = new ListItem(item);
    if (item instanceof MaterialCollapsible) {
      listItem.getElement().getStyle().setBackgroundColor("transparent");
    }

    mobileNav.add(listItem);
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final ListItem listItem = getItem(position);

    if (convertView == null) {
      return listItem.build(getContext());
    } else {
      return listItem.updateView(getContext(), convertView);
    }
  }
示例#12
0
  /** @see org.apache.wicket.markup.repeater.AbstractRepeater#onPopulate() */
  @SuppressWarnings("unchecked")
  @Override
  protected final void onPopulate() {
    // Get number of items to be displayed
    final int size = getViewSize();
    if (size > 0) {
      if (getReuseItems()) {
        // Remove all ListItems no longer required
        final int maxIndex = firstIndex + size;
        for (final Iterator<Component> iterator = iterator(); iterator.hasNext(); ) {
          // Get next child component
          final ListItem<?> child = (ListItem<?>) iterator.next();
          if (child != null) {
            final int index = child.getIndex();
            if (index < firstIndex || index >= maxIndex) {
              iterator.remove();
            }
          }
        }
      } else {
        // Automatically rebuild all ListItems before rendering the
        // list view
        removeAll();
      }

      boolean hasChildren = size() != 0;
      // Loop through the markup in this container for each item
      for (int i = 0; i < size; i++) {
        // Get index
        final int index = firstIndex + i;

        ListItem<T> item = null;
        if (hasChildren) {
          // If this component does not already exist, populate it
          item = (ListItem<T>) get(Integer.toString(index));
        }
        if (item == null) {
          // Create item for index
          item = newItem(index, getListItemModel(getModel(), index));

          // Add list item
          add(item);

          // Populate the list item
          onBeginPopulateItem(item);
          populateItem(item);
        }
      }
    } else {
      removeAll();
    }
  }
示例#13
0
 private void refreshAccount() {
   mAccountItem.setSummary(R.string.retrieving_status);
   ThreadingRunnable.background(
       new ThreadingRunnable() {
         @Override
         public void run() {
           try {
             final HttpGet get = new HttpGet(ServiceHelper.STATUS_URL);
             final JSONObject payload =
                 ServiceHelper.retryExecuteAsJSONObject(
                     MainActivity.this, mSettings.getString("account"), get);
             final long expiration = payload.getLong("subscription_expiration");
             foreground(
                 new Runnable() {
                   @Override
                   public void run() {
                     refreshAccount(expiration);
                   }
                 });
           } catch (Exception ex) {
             foreground(
                 new Runnable() {
                   @Override
                   public void run() {
                     mAccountItem.setSummary(R.string.status_error);
                   }
                 });
             ex.printStackTrace();
           }
         }
       });
 }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View rowView = null;
      convertView = null;
      if (convertView == null) {
        // Not recycled, inflate a new view
        LayoutInflater li = (LayoutInflater) _c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = li.inflate(R.layout.profile_listitems, null);
        //                rowView = getLayoutInflater().inflate(R.layout.profile_listitems, null);

        rowView.setTag(holder);
      }
      holder.textView = (TextView) rowView.findViewById(R.id.labels);
      holder.editText = (EditText) rowView.findViewById(R.id.values1);
      ViewHolder holder = (ViewHolder) rowView.getTag();
      // Remove any existing TextWatcher that will be keyed to the wrong ListItem
      if (holder.textWatcher != null) holder.editText.removeTextChangedListener(holder.textWatcher);

      final ListItem listItem = groupItem.get(position);

      // Keep a reference to the TextWatcher so that we can remove it later
      holder.textWatcher =
          new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
              listItem.value = s.toString();
              System.out.println(listItem.value + "" + groupItem.get(position));
            }

            @Override
            public void afterTextChanged(Editable s) {}
          };
      holder.editText.addTextChangedListener(holder.textWatcher);

      holder.editText.setText(listItem.value);

      holder.textView.setText(listItem.getLabel().toString());
      //              holder.editText.setEnabled(false);

      if (clickCount == 0) {
        actv(false);
      }
      return rowView;
    }
  @Override
  public View getGroupView(
      int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    ListItem header = (ListItem) getGroup(groupPosition);
    if (convertView == null) {
      LayoutInflater infalInflater =
          (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = infalInflater.inflate(R.layout.list_group, null);
    }

    TextView lblListHeader = (TextView) convertView.findViewById(R.id.lblListHeader);
    lblListHeader.setText(header.getTitle());
    TextView lblListHeaderValue = (TextView) convertView.findViewById(R.id.lblListHeaderValue);
    lblListHeaderValue.setText(header.getDescription());

    return convertView;
  }
示例#16
0
  public View getView(int i, View view, ViewGroup vg) {
    ListItem item = lista.get(i);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v;
    if (comImagem) {
      v = inflater.inflate(R.layout.list_item_image, null);
      ImageView img = (ImageView) v.findViewById(R.item.img);
      img.setImageResource(item.getIcone());

    } else {
      v = inflater.inflate(R.layout.list_item, null);
    }
    TextView textNome = (TextView) v.findViewById(R.item.nome);
    textNome.setText(item.getNome());
    return v;
  }
  protected static ListItem toListItem(Status tweet) {
    ListItem item1 = new ListItem();

    item1.image = defaultImage;
    item1.id = tweet.getId();

    item1.screenName = tweet.getUser().getScreenName();
    item1.name = tweet.getUser().getName();
    item1.comment = tweet.getText();

    item1.geoLocation = tweet.getGeoLocation();
    item1.profileImageURL = tweet.getUser().getProfileImageURL().toString();
    item1.date = diffDate(tweet.getCreatedAt());

    //
    item1.source = tweet.getSource();

    return item1;
  }
示例#18
0
  private void refreshAccount(long expiration) {
    String account = mSettings.getString("account");
    if (Helper.isJavaScriptNullOrEmpty(account)) {
      finish();
      return;
    }

    long daysLeft = (expiration - System.currentTimeMillis()) / 1000L / 60L / 60L / 24L;
    daysLeft = Math.max(0, daysLeft);
    mAccountItem.setSummary(getString(R.string.days_left, String.valueOf(daysLeft)));
  }
示例#19
0
    public View getView(final int position, View convertView, ViewGroup parent) {

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.list, null);
      }
      final ListItem item = this.getItem(position);
      if (item != null) {
        mRank = (TextView) convertView.findViewById(R.id.rank);
        mRank.setText(item.getRank());

        mCount = (TextView) convertView.findViewById(R.id.count);
        mCount.setText(item.getCount());

        mStage = (TextView) convertView.findViewById(R.id.stage);
        mStage.setText(item.getStage());

        mDate = (TextView) convertView.findViewById(R.id.date);
        mDate.setText(item.getDate());
      }
      return convertView;
    }
示例#20
0
  public void removeItem(ListItem<T> item) {
    int idx = item.getIndex();
    for (int i = idx + 1; i < item.getParent().size(); i++) {
      ListItem<?> itemReIndex = (ListItem<?>) item.getParent().get(i);
      itemReIndex.setIndex(itemReIndex.getIndex() - 1);
    }

    items.remove(item.getIndex());
    remove(item);
  }
 // リストアイテムをタッチしたとき
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   // TODO 自動生成されたメソッド・スタブ
   ListView listView = (ListView) parent;
   ListItem item = (ListItem) listView.getItemAtPosition(position);
   // タスク名が無いアイテムをタッチすると新規作成
   if (item.getTask().length() < 1) {
     editText = new EditText(this);
     editText.setInputType(InputType.TYPE_CLASS_TEXT);
     showYesDialog(ListActivity.this, "新規作成", "新しいタスク名を入力してください", editText, this, 0);
     // タスク名があるアイテムをタッチするとその情報をmain渡して自身のアクティビティは閉じる
   } else {
     Intent intent = new Intent(this, net.xypenguin.everydaytask.MainActivity.class);
     intent.putExtra("task", item.getTask());
     intent.putExtra("totalTime", item.getTotalTime());
     intent.putExtra("count", item.getCount());
     intent.putExtra("number", position);
     SharedPreferences pref = getSharedPreferences("task" + position, MODE_PRIVATE);
     intent.putExtra("date", pref.getString("date", ""));
     setResult(Activity.RESULT_OK, intent);
     finish();
   }
 }
示例#22
0
 public void draw() {
   clearBox();
   int length = (itemsLista.size() < super.inHeight ? itemsLista.size() : super.inHeight);
   for (int i = 0; i < length; i++) {
     ListItem item = (ListItem) itemsLista.elementAt(i);
     si.print(inPosition.x, inPosition.y + i, item.getIndex(), item.getIndexColor());
     if (item.getRow().length() > inWidth)
       si.print(
           inPosition.x + 2, inPosition.y + i, item.getRow().substring(0, inWidth), foreColor);
     else si.print(inPosition.x + 2, inPosition.y + i, item.getRow(), foreColor);
   }
 }
示例#23
0
 public ListItem addItem(String href, Object text) {
   ListItem item = addItem();
   item.setHref(href);
   item.addText(text);
   return item;
 }
  @SuppressLint("NewApi")
  private void listRoots() {
    currentDir = null;
    items.clear();

    HashSet<String> paths = new HashSet<>();
    String defaultPath = Environment.getExternalStorageDirectory().getPath();
    boolean isDefaultPathRemovable =
        Build.VERSION.SDK_INT >= 9 && Environment.isExternalStorageRemovable();
    String defaultPathState = Environment.getExternalStorageState();
    if (defaultPathState.equals(Environment.MEDIA_MOUNTED)
        || defaultPathState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
      ListItem ext = new ListItem();
      if (Build.VERSION.SDK_INT < 9 || Environment.isExternalStorageRemovable()) {
        ext.title = LocaleController.getString("SdCard", R.string.SdCard);
        ext.icon = R.drawable.ic_external_storage;
      } else {
        ext.title = LocaleController.getString("InternalStorage", R.string.InternalStorage);
        ext.icon = R.drawable.ic_storage;
      }
      ext.subtitle = getRootSubtitle(defaultPath);
      ext.file = Environment.getExternalStorageDirectory();
      items.add(ext);
      paths.add(defaultPath);
    }

    BufferedReader bufferedReader = null;
    try {
      bufferedReader = new BufferedReader(new FileReader("/proc/mounts"));
      String line;
      while ((line = bufferedReader.readLine()) != null) {
        if (line.contains("vfat") || line.contains("/mnt")) {
          FileLog.e("tmessages", line);
          StringTokenizer tokens = new StringTokenizer(line, " ");
          String unused = tokens.nextToken();
          String path = tokens.nextToken();
          if (paths.contains(path)) {
            continue;
          }
          if (line.contains("/dev/block/vold")) {
            if (!line.contains("/mnt/secure")
                && !line.contains("/mnt/asec")
                && !line.contains("/mnt/obb")
                && !line.contains("/dev/mapper")
                && !line.contains("tmpfs")) {
              if (!new File(path).isDirectory()) {
                int index = path.lastIndexOf('/');
                if (index != -1) {
                  String newPath = "/storage/" + path.substring(index + 1);
                  if (new File(newPath).isDirectory()) {
                    path = newPath;
                  }
                }
              }
              paths.add(path);
              try {
                ListItem item = new ListItem();
                if (path.toLowerCase().contains("sd")) {
                  item.title = LocaleController.getString("SdCard", R.string.SdCard);
                } else {
                  item.title =
                      LocaleController.getString("ExternalStorage", R.string.ExternalStorage);
                }
                item.icon = R.drawable.ic_external_storage;
                item.subtitle = getRootSubtitle(path);
                item.file = new File(path);
                items.add(item);
              } catch (Exception e) {
                FileLog.e("tmessages", e);
              }
            }
          }
        }
      }
    } catch (Exception e) {
      FileLog.e("tmessages", e);
    } finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (Exception e) {
          FileLog.e("tmessages", e);
        }
      }
    }
    ListItem fs = new ListItem();
    fs.title = "/";
    fs.subtitle = LocaleController.getString("SystemRoot", R.string.SystemRoot);
    fs.icon = R.drawable.ic_directory;
    fs.file = new File("/");
    items.add(fs);

    try {
      File telegramPath = new File(Environment.getExternalStorageDirectory(), "Telegram");
      if (telegramPath.exists()) {
        fs = new ListItem();
        fs.title = "Telegram";
        fs.subtitle = telegramPath.toString();
        fs.icon = R.drawable.ic_directory;
        fs.file = telegramPath;
        items.add(fs);
      }
    } catch (Exception e) {
      FileLog.e("tmessages", e);
    }

    fs = new ListItem();
    fs.title = LocaleController.getString("Gallery", R.string.Gallery);
    fs.subtitle = LocaleController.getString("GalleryInfo", R.string.GalleryInfo);
    fs.icon = R.drawable.ic_storage_gallery;
    fs.file = null;
    items.add(fs);

    AndroidUtilities.clearDrawableAnimation(listView);
    scrolling = true;
    listAdapter.notifyDataSetChanged();
  }
 private boolean listFiles(File dir) {
   if (!dir.canRead()) {
     if (dir.getAbsolutePath().startsWith(Environment.getExternalStorageDirectory().toString())
         || dir.getAbsolutePath().startsWith("/sdcard")
         || dir.getAbsolutePath().startsWith("/mnt/sdcard")) {
       if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)
           && !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
         currentDir = dir;
         items.clear();
         String state = Environment.getExternalStorageState();
         if (Environment.MEDIA_SHARED.equals(state)) {
           emptyView.setText(LocaleController.getString("UsbActive", R.string.UsbActive));
         } else {
           emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted));
         }
         AndroidUtilities.clearDrawableAnimation(listView);
         scrolling = true;
         listAdapter.notifyDataSetChanged();
         return true;
       }
     }
     showErrorBox(LocaleController.getString("AccessError", R.string.AccessError));
     return false;
   }
   emptyView.setText(LocaleController.getString("NoFiles", R.string.NoFiles));
   File[] files;
   try {
     files = dir.listFiles();
   } catch (Exception e) {
     showErrorBox(e.getLocalizedMessage());
     return false;
   }
   if (files == null) {
     showErrorBox(LocaleController.getString("UnknownError", R.string.UnknownError));
     return false;
   }
   currentDir = dir;
   items.clear();
   Arrays.sort(
       files,
       new Comparator<File>() {
         @Override
         public int compare(File lhs, File rhs) {
           if (lhs.isDirectory() != rhs.isDirectory()) {
             return lhs.isDirectory() ? -1 : 1;
           }
           return lhs.getName().compareToIgnoreCase(rhs.getName());
           /*long lm = lhs.lastModified();
           long rm = lhs.lastModified();
           if (lm == rm) {
               return 0;
           } else if (lm > rm) {
               return -1;
           } else {
               return 1;
           }*/
         }
       });
   for (File file : files) {
     if (file.getName().startsWith(".")) {
       continue;
     }
     ListItem item = new ListItem();
     item.title = file.getName();
     item.file = file;
     if (file.isDirectory()) {
       item.icon = R.drawable.ic_directory;
       item.subtitle = LocaleController.getString("Folder", R.string.Folder);
     } else {
       String fname = file.getName();
       String[] sp = fname.split("\\.");
       item.ext = sp.length > 1 ? sp[sp.length - 1] : "?";
       item.subtitle = AndroidUtilities.formatFileSize(file.length());
       fname = fname.toLowerCase();
       if (fname.endsWith(".jpg")
           || fname.endsWith(".png")
           || fname.endsWith(".gif")
           || fname.endsWith(".jpeg")) {
         item.thumb = file.getAbsolutePath();
       }
     }
     items.add(item);
   }
   ListItem item = new ListItem();
   item.title = "..";
   if (history.size() > 0) {
     HistoryEntry entry = history.get(history.size() - 1);
     if (entry.dir == null) {
       item.subtitle = LocaleController.getString("Folder", R.string.Folder);
     } else {
       item.subtitle = entry.dir.toString();
     }
   } else {
     item.subtitle = LocaleController.getString("Folder", R.string.Folder);
   }
   item.icon = R.drawable.ic_directory;
   item.file = null;
   items.add(0, item);
   AndroidUtilities.clearDrawableAnimation(listView);
   scrolling = true;
   listAdapter.notifyDataSetChanged();
   return true;
 }
示例#26
0
 public int compareTo(ComparableVersion o) {
   return items.compareTo(o.items);
 }
示例#27
0
  public final void parseVersion(String version) {
    this.value = version;

    items = new ListItem();

    version = version.toLowerCase(Locale.ENGLISH);

    ListItem list = items;

    Stack<Item> stack = new Stack<Item>();
    stack.push(list);

    boolean isDigit = false;

    int startIndex = 0;

    for (int i = 0; i < version.length(); i++) {
      char c = version.charAt(i);

      if (c == '.') {
        if (i == startIndex) {
          list.add(IntegerItem.ZERO);
        } else {
          list.add(parseItem(isDigit, version.substring(startIndex, i)));
        }
        startIndex = i + 1;
      } else if (c == '-') {
        if (i == startIndex) {
          list.add(IntegerItem.ZERO);
        } else {
          list.add(parseItem(isDigit, version.substring(startIndex, i)));
        }
        startIndex = i + 1;

        if (isDigit) {
          list.normalize(); // 1.0-* = 1-*

          if ((i + 1 < version.length()) && Character.isDigit(version.charAt(i + 1))) {
            // new ListItem only if previous were digits and new char is a digit,
            // ie need to differentiate only 1.1 from 1-1
            list.add(list = new ListItem());

            stack.push(list);
          }
        }
      } else if (Character.isDigit(c)) {
        if (!isDigit && i > startIndex) {
          list.add(new StringItem(version.substring(startIndex, i), true));
          startIndex = i;
        }

        isDigit = true;
      } else {
        if (isDigit && i > startIndex) {
          list.add(parseItem(true, version.substring(startIndex, i)));
          startIndex = i;
        }

        isDigit = false;
      }
    }

    if (version.length() > startIndex) {
      list.add(parseItem(isDigit, version.substring(startIndex)));
    }

    while (!stack.isEmpty()) {
      list = (ListItem) stack.pop();
      list.normalize();
    }

    canonical = items.toString();
  }
  private ListItem cursorToItem(Cursor cursor) {
    ListItem item = new ListItem();
    item.id = cursor.getInt(0);
    item.name = cursor.getString(1);
    item.priority = cursor.getInt(2);
    item.quantity = cursor.getInt(3);
    item.unit = cursor.getString(4);
    item.price = cursor.getInt(5);
    item.money = cursor.getString(6);
    item.place = cursor.getString(10);
    item.due_date = cursor.getString(7);
    item.alarm = cursor.getString(8);
    item.status = cursor.getInt(9);
    item.doneDate = cursor.getLong(11);

    return item;
  }
示例#29
0
 public int compare(ListItem item1, ListItem item2) {
   int pos1 = itemOrder.indexOf(item1.getId() + ',');
   int pos2 = itemOrder.indexOf(item2.getId() + ',');
   return pos1 - pos2;
 }
示例#30
0
 @Override
 public void updateRenderedListComponents(SRList<T> listPanel, List<ListItem<T>> listItems) {
   for (ListItem<T> listItem : listItems) listItem.getRenderableComponent().update(listItem);
 }