Navigation voice changer app for Android
修订版 | e7beb68afe0dff6cb716187f1f9180e07b8d0cd3 (tree) |
---|---|
时间 | 2013-07-30 07:33:21 |
作者 | HMML <hmml3939@gmai...> |
Commiter | HMML |
Fix deletion and redraw list.
@@ -18,7 +18,6 @@ import android.view.ViewGroup.LayoutParams; | ||
18 | 18 | import android.widget.AdapterView; |
19 | 19 | import android.widget.AdapterView.AdapterContextMenuInfo; |
20 | 20 | import android.widget.BaseAdapter; |
21 | -import android.widget.ImageView; | |
22 | 21 | import android.widget.LinearLayout; |
23 | 22 | import android.widget.ListView; |
24 | 23 | import android.widget.RelativeLayout; |
@@ -50,6 +49,7 @@ public class InstallListActivity extends Activity { | ||
50 | 49 | |
51 | 50 | public void rescan() { |
52 | 51 | this.list = VoiceData.scanVoiceData(context); |
52 | + this.notifyDataSetChanged(); | |
53 | 53 | } |
54 | 54 | |
55 | 55 | @Override |
@@ -98,6 +98,7 @@ public class InstallListActivity extends Activity { | ||
98 | 98 | |
99 | 99 | } |
100 | 100 | |
101 | + protected ListView list_view; | |
101 | 102 | |
102 | 103 | @Override |
103 | 104 | protected void onCreate(Bundle savedInstanceState) { |
@@ -109,6 +110,7 @@ public class InstallListActivity extends Activity { | ||
109 | 110 | VoiceData.copyVoiceAssets(this); |
110 | 111 | |
111 | 112 | ListView lv = (ListView) findViewById(R.id.voice_list); |
113 | + this.list_view = lv; | |
112 | 114 | lv.setAdapter(new ListVoiceDataAdapter(this)); |
113 | 115 | lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
114 | 116 | @Override |
@@ -188,7 +190,7 @@ public class InstallListActivity extends Activity { | ||
188 | 190 | break; |
189 | 191 | case C_MENU_DELETE: |
190 | 192 | vd.delete(); |
191 | - // TODO: remove item from list. | |
193 | + ((ListVoiceDataAdapter) this.list_view.getAdapter()).rescan(); // TODO: slow... | |
192 | 194 | Toast.makeText(this, R.string.voice_deleted, Toast.LENGTH_SHORT).show(); |
193 | 195 | break; |
194 | 196 | case C_MENU_RATE: |