Пример #1
0
  @Override
  public View getView(int pos, View convertView, ViewGroup parent) {
    View row = convertView;
    if (row == null) {
      row = layoutInflater.inflate(R.layout.welcome_list_layout, null);
    }
    TextView name = (TextView) row.findViewById(R.id.list_item_name);
    TextView count = (TextView) row.findViewById(R.id.list_item_count);

    final Album album = this.albumList.get(pos);
    name.setText(album.getName());
    int cnt = album.getCount();
    if (cnt == 0) {
      count.setText("empty album");
    } else if (cnt == 1) {
      count.setText("contains 1 photo");
    } else {
      count.setText("contains " + cnt + " photos");
    }
    return row;
  }
Пример #2
0
 @Deprecated
 public static Album recoverAlbum(Context context) throws IOException {
   if (!storageReady()) {
     throw new IOException("Storage is not available");
   }
   File path = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
   File file = new File(path, ALBUM_FILE);
   if (file.exists()) {
     Album album = getAlbumFromFile(file);
     return album;
   } else {
     Album album = Album.getNewAlbum();
     saveAlbumToFile(album, file);
     return album;
   }
 }