private void reloadBoardList(boolean no_cache, boolean force_reload) { if (!is_active_) return; if (!onBeginReload()) return; boolean cached = getAgent() .fetchBoardList( no_cache, force_reload, new BoardListAgent.BoardListFetchedCallback() { @Override public void onBoardListFetched( final ArrayList<String> board_groups, final ArrayList<ArrayList<BoardData>> board_list, final NSimpleExpandableListActivity.StatData board_list_stat) { runOnUiThread( new Runnable() { @Override public void run() { if (!is_active_) return; ((BoardListAdapter) list_adapter_) .setDataList(board_groups, board_list); progress_dialog_.hide(); setResumePosition(board_list_stat); onEndReload(); } }); } @Override public void onBoardListConnectionFailed() { runOnUiThread( new Runnable() { @Override public void run() { if (!is_active_) return; ManagedToast.raiseToast( BoardListActivity.this, R.string.toast_reload_board_list_failed); progress_dialog_.hide(); onEndReload(); } }); } @Override public void onConnectionOffline() { runOnUiThread( new Runnable() { @Override public void run() { if (!is_active_) return; ManagedToast.raiseToast( BoardListActivity.this, R.string.toast_network_is_offline); progress_dialog_.hide(); onEndReload(); } }); } }); if (!cached) { progress_dialog_.show( this, R.string.dialog_loading_progress, new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (is_active_) finish(); } }); } }
@Override protected void onPause() { progress_dialog_.hide(); super.onPause(); }