@Override public void onItemClick(AdapterView<?> parentView, View childView, int position, long id) { DownloadItem di = getDownloadItem(position); if (di == null) { Log.e(TAG, "NULL Download Item"); return; } if (di.getType() == DownloadItem.TYPE_CATEGORY) { openCategory(di); } else if (di.getType() == DownloadItem.TYPE_UP) { goBack(); } else if (di.getType() == DownloadItem.TYPE_DATABASE) { fetchDatabase(di); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); /* Reuse the filebrowser's resources */ v = li.inflate(R.layout.filebrowser_item, null); } DownloadItem item = getItem(position); if (item != null) { TextView tv = (TextView) v.findViewById(R.id.file_name); ImageView iv = (ImageView) v.findViewById(R.id.file_icon); if (item.getType() == DownloadItem.TYPE_CATEGORY) { iv.setImageResource(R.drawable.dir); } else if (item.getType() == DownloadItem.TYPE_UP) { iv.setImageResource(R.drawable.back); } else { iv.setImageResource(R.drawable.database); } tv.setText(item.getTitle()); } return v; }
public DownloadItem clone() { DownloadItem newItem = new DownloadItem(this.type, this.title, this.description, this.address); newItem.extras = (HashMap<String, String>) this.extras.clone(); return newItem; }