// can use UI thread here protected void onPreExecute() { try { this.dialog.setMessage("Загрузка истории репутации..."); this.dialog.show(); } catch (Exception ex) { Log.e(null, ex); } }
@Override protected Boolean doInBackground(String... params) { try { return Client.INSTANCE.logout(); } catch (Exception e) { Log.e(mContext, e); ex = e; return false; } }
// can use UI thread here protected void onPostExecute(final Boolean success) { if (this.dialog.isShowing()) { this.dialog.dismiss(); } doOnUserChangedListener(m_Login, success); if (success) { Toast.makeText(mContext, "Выход выполнен", Toast.LENGTH_SHORT).show(); } else { if (ex != null) Log.i(mContext, ex); } }
// can use UI thread here protected void onPostExecute(final Boolean success) { try { if (this.dialog.isShowing()) { this.dialog.dismiss(); } } catch (Exception ex) { Log.e(null, ex); } if (success) { m_Adapter.notifyDataSetChanged(); } else { if (ex != null) Log.e(ReputationActivity.this, ex); else Toast.makeText(mContext, "Неизвестная ошибка", Toast.LENGTH_SHORT).show(); } txtLoadMoreThemes.setText("Всего: " + m_Reputations.getMaxCount()); int loadMoreVisibility = m_Reputations.getMaxCount() > m_Reputations.size() ? View.VISIBLE : View.GONE; txtPullToLoadMore.setVisibility(loadMoreVisibility); imgPullToLoadMore.setVisibility(loadMoreVisibility); txtFroum.setText(m_Reputations.description); listView.onRefreshComplete(); }
// can use UI thread here protected void onPostExecute(final Boolean success) { if (this.dialog.isShowing()) { this.dialog.dismiss(); } doOnUserChangedListener(m_Login, success); Client.INSTANCE.doOnUserChangedListener(m_Login, success); if (success) { Toast.makeText(mContext, "Вход выполнен", Toast.LENGTH_SHORT).show(); } else { if (ex != null) Log.e(mContext, ex); else new AlertDialog.Builder(mContext) .setIcon(R.drawable.icon) .setTitle("Ошибка") .setMessage(Client.INSTANCE.getLoginFailedReason()) .setPositiveButton(android.R.string.ok, null) .create() .show(); } }