3b432fcadedb919b7cad062958544f386b2fc890
1 package eu
.alefzero
.owncloud
;
3 import java
.security
.Provider
;
5 import eu
.alefzero
.owncloud
.db
.ProviderMeta
;
6 import eu
.alefzero
.owncloud
.db
.ProviderMeta
.ProviderTableMeta
;
8 import android
.content
.Context
;
9 import android
.database
.Cursor
;
10 import android
.database
.DataSetObserver
;
11 import android
.util
.Log
;
12 import android
.view
.LayoutInflater
;
13 import android
.view
.View
;
14 import android
.view
.ViewGroup
;
15 import android
.view
.View
.OnLongClickListener
;
16 import android
.widget
.AdapterView
;
17 import android
.widget
.ImageView
;
18 import android
.widget
.ListAdapter
;
19 import android
.widget
.TextView
;
20 import android
.widget
.AdapterView
.OnItemClickListener
;
22 public class FileListListAdapter
implements ListAdapter
{
24 private Cursor mCursor
;
25 private Context mContext
;
27 public FileListListAdapter(Cursor c
, Context context
) {
32 public boolean areAllItemsEnabled() {
36 public boolean isEnabled(int position
) {
37 // TODO Auto-generated method stub
41 public int getCount() {
42 // TODO Auto-generated method stub
43 return mCursor
.getCount();
46 public Object
getItem(int position
) {
47 // TODO Auto-generated method stub
51 public long getItemId(int position
) {
52 // TODO Auto-generated method stub
56 public int getItemViewType(int position
) {
57 // TODO Auto-generated method stub
61 public View
getView(int position
, View convertView
, ViewGroup parent
) {
64 LayoutInflater vi
= (LayoutInflater
) mContext
.getSystemService(Context
.LAYOUT_INFLATER_SERVICE
);
65 v
= vi
.inflate(R
.layout
.list_layout
, null
);
67 if (mCursor
.moveToPosition(position
)) {
68 TextView tv
= (TextView
) v
.findViewById(R
.id
.Filename
);
69 tv
.setText(DisplayUtils
.HtmlDecode(mCursor
.getString(mCursor
.getColumnIndex(ProviderMeta
.ProviderTableMeta
.FILE_NAME
))));
70 if (!mCursor
.getString(mCursor
.getColumnIndex(ProviderTableMeta
.FILE_CONTENT_TYPE
)).equals("DIR")) {
71 ImageView iv
= (ImageView
) v
.findViewById(R
.id
.imageView1
);
72 iv
.setImageResource(R
.drawable
.file
);
79 public int getViewTypeCount() {
80 // TODO Auto-generated method stub
84 public boolean hasStableIds() {
85 // TODO Auto-generated method stub
89 public boolean isEmpty() {
90 // TODO Auto-generated method stub
94 public void registerDataSetObserver(DataSetObserver observer
) {
95 // TODO Auto-generated method stub
99 public void unregisterDataSetObserver(DataSetObserver observer
) {
100 // TODO Auto-generated method stub