project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadListActivity.java
author Xeli
Mon, 14 Nov 2011 18:03:31 +0100
branchhedgeroid
changeset 6343 9df5a486f41e
child 6350 41b0a9955c47
permissions -rw-r--r--
first part of the new downloader implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6343
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     1
package org.hedgewars.hedgeroid.Downloader;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     2
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     3
import android.app.ListActivity;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     4
import android.os.Bundle;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     5
import android.view.View;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     6
import android.widget.AdapterView;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     7
import android.widget.AdapterView.OnItemClickListener;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     8
import android.widget.ArrayAdapter;
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
     9
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    10
public class DownloadListActivity extends ListActivity implements OnItemClickListener{
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    11
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    12
	
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    13
	public void onCreate(Bundle savedInstanceState){
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    14
		super.onCreate(savedInstanceState);
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    15
		
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    16
		DownloadTask[] tasks = new DownloadTask[3];
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    17
		tasks[0] = new DownloadTask("url1", "/home/path/1", 1, "entry 1");
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    18
		tasks[1] = new DownloadTask("url2", "/home/path/2", 1, "entry 2");
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    19
		tasks[2] = new DownloadTask("url3", "/home/path/3", 1, "entry 3");
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    20
		
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    21
		ArrayAdapter<DownloadTask> adapter = new ArrayAdapter<DownloadTask>(this, android.R.layout.simple_list_item_1, tasks);
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    22
		this.setListAdapter(adapter);
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    23
		this.getListView().setOnItemClickListener(this);
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    24
		
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    25
	}
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    26
	
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    27
	public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    28
		DownloadTask task = (DownloadTask)arg0.getAdapter().getItem(position);
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    29
	}
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    30
	
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    31
//	public static class Dialog extends DialogFragment{
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    32
		
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    33
//	}
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    34
	
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    35
}
9df5a486f41e first part of the new downloader implementation
Xeli
parents:
diff changeset
    36