1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
package org.tomdroid.ui;
import org.tomdroid.Note;
import org.tomdroid.NoteManager;
import org.tomdroid.Notebook;
import org.tomdroid.R;
import org.tomdroid.sync.SyncManager;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class Notebooks extends ListActivity {
// Logging info
private static final String TAG = "Notebooks";
// UI to data model glue
private TextView listEmptyView;
private ListAdapter adapter;
/** Called when the activity is created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notebooks);
// adapter that binds the ListView UI to the notebooks in the note manager
adapter = NoteManager.getListAdapterNotebook(this);
setListAdapter(adapter);
// all notebooks
final TextView allNotebooks = (TextView) findViewById(R.id.allNotebooks);
allNotebooks.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("notebook", null);
Intent i = new Intent(v.getContext(), Tomdroid.class);
i.putExtras(bundle);
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
public void onResume() {
super.onResume();
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Log.i(TAG,"onListItemClick");
Cursor item = (Cursor) adapter.getItem(position);
String notebook = item.getString(item.getColumnIndexOrThrow(Notebook.NAME));
Bundle bundle = new Bundle();
bundle.putString("notebook", notebook);
Intent i = new Intent(this.getApplicationContext(), Tomdroid.class);
i.putExtras(bundle);
startActivity(i);
//Intent i = new Intent(Intent.ACTION_VIEW,Tomdroid.CONTENT_URI, this, Tomdroid.class);
//startActivity(i);
}
}
|