mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 17:18:50 -05:00
Notify the adapter from runOnUiThread() instead of using Handler
This commit is contained in:
parent
4f2412eacd
commit
16afff4dfc
@ -135,9 +135,8 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ChooseFolderHandler extends Handler {
|
class ChooseFolderHandler extends Handler {
|
||||||
private static final int MSG_PROGRESS = 2;
|
private static final int MSG_PROGRESS = 1;
|
||||||
private static final int MSG_DATA_CHANGED = 3;
|
private static final int MSG_SET_SELECTED_FOLDER = 2;
|
||||||
private static final int MSG_SET_SELECTED_FOLDER = 4;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(android.os.Message msg) {
|
public void handleMessage(android.os.Message msg) {
|
||||||
@ -146,17 +145,6 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
setProgressBarIndeterminateVisibility(msg.arg1 != 0);
|
setProgressBarIndeterminateVisibility(msg.arg1 != 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_DATA_CHANGED: {
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Only enable the text filter after the list has been
|
|
||||||
* populated to avoid possible race conditions because our
|
|
||||||
* FolderListFilter isn't really thread-safe.
|
|
||||||
*/
|
|
||||||
getListView().setTextFilterEnabled(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MSG_SET_SELECTED_FOLDER: {
|
case MSG_SET_SELECTED_FOLDER: {
|
||||||
getListView().setSelection(msg.arg1);
|
getListView().setSelection(msg.arg1);
|
||||||
break;
|
break;
|
||||||
@ -177,10 +165,6 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
msg.arg1 = position;
|
msg.arg1 = position;
|
||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dataChanged() {
|
|
||||||
sendEmptyMessage(MSG_DATA_CHANGED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -409,12 +393,19 @@ public class ChooseFolder extends K9ListActivity {
|
|||||||
for (String folderName: folderList) {
|
for (String folderName: folderList) {
|
||||||
mAdapter.add(folderName);
|
mAdapter.add(folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only enable the text filter after the list has been
|
||||||
|
* populated to avoid possible race conditions because our
|
||||||
|
* FolderListFilter isn't really thread-safe.
|
||||||
|
*/
|
||||||
|
getListView().setTextFilterEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler.dataChanged();
|
|
||||||
|
|
||||||
if (selectedFolder != -1) {
|
if (selectedFolder != -1) {
|
||||||
mHandler.setSelectedFolder(selectedFolder);
|
mHandler.setSelectedFolder(selectedFolder);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user