@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_playing_music); try { initViews(); initDatas(); mHandler.sendEmptyMessage(HANDLER_GET_STATE_VOLUME); getstate(); progress = new MyProgressDialog(this); progress.setMessage(getString(R.string.ba_update_date)); progress.setCanceledOnTouchOutside(false); } catch (OutOfMemoryError e) { finish(); } }
/** * *** 判断字符串中有没有英文 * * @param text * @return */ @Override protected void onDestroy() { super.onDestroy(); if (progress != null && !isFinishing()) { progress.dismiss(); } progress = null; playerMainLayout.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); if (bgTempbm != null && !bgTempbm.isRecycled()) bgTempbm.recycle(); bgTempbm = null; }
private void badMusic() { progress.show(); mWifiCRUDForMusic.badMusic( new ResultForMusicListener() { public void onResult(String errorCode, List<WifiMusicInfo> infos) { mHandler.post(dismissDialog); if (!WifiCRUDUtil.isSuccessAll(errorCode)) { ToastUtils.show(getApplicationContext(), "操作失败"); } } }); }
private void goodMusicOrCancel() { progress.show(); if (currMusicInfo != null && currMusicInfo.is_isCollected()) { mWifiCRUDForMusic.delete( currMusicInfo.getMusicId() + "", new ResultForMusicListener() { public void onResult(String errorCode, List<WifiMusicInfo> infos) { mHandler.post(dismissDialog); if (!WifiCRUDUtil.isSuccessAll(errorCode)) { ToastUtils.show(context, R.string.ba_config_box_info_error_toast); } else { runOnUiThread( new Runnable() { public void run() { collectTime = System.currentTimeMillis(); goodMusicBtn.setImageResource(R.drawable.player_good_music_selector); } }); } } }); } else { mWifiCRUDForMusic.goodMusic( new ResultForMusicListener() { public void onResult(String errorCode, List<WifiMusicInfo> infos) { mHandler.post(dismissDialog); if (!WifiCRUDUtil.isSuccessAll(errorCode)) { ToastUtils.show(context, R.string.ba_config_box_info_error_toast); } else { runOnUiThread( new Runnable() { @Override public void run() { collectTime = System.currentTimeMillis(); goodMusicBtn.setImageResource(R.drawable.player_good_music_pressed); } }); } } }); } }
public void run() { if (progress != null && !isFinishing()) { progress.dismiss(); } }
public void showDialog() { if (progress == null) return; progress.show(); }