private void setAoudio() { mContactImageLayout.setBackgroundResource(R.drawable.skinclassic_color_list_top_bot); mContactImage.setBackgroundResource(R.drawable.yms_album_thumb); MmsSlideShowListActivity activity = (MmsSlideShowListActivity) mContext; mhandler = new Handler(); if (activity.getAudioState() == activity.MMS_SLIDE_AUDIO_IDLE || activity.getAudioState() == activity.MMS_SLIDE_AUDIO_PAUSE) { mContactImage.setImageResource(R.drawable.play); } else { mContactImage.setImageResource(R.drawable.pause); } mContactImage.setVisibility(View.VISIBLE); mContactImageLayout.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { MmsSlideShowListActivity activity = (MmsSlideShowListActivity) mContext; if (activity.getAudioState() == activity.MMS_SLIDE_AUDIO_PLAY) { activity.pauseAudio(); mContactImage.setImageResource(R.drawable.play); } else { activity.startAudio(mData.audioUri); mhandler.postDelayed(mRunnable, 300); mSampleStart = System.currentTimeMillis(); mContactImage.setImageResource(R.drawable.pause); } } }); mContactImageParent.setOnCreateContextMenuListener(mRecipientsMenuCreateListener); }
@Override public void run() { MmsSlideShowListActivity activity = (MmsSlideShowListActivity) mContext; long time = System.currentTimeMillis(); int playTime = (int) (time - mSampleStart); if (playTime >= activity.getAudioDuration()) { mhandler.removeCallbacks(mRunnable); activity.stopAudio(); mContactImage.setImageResource(R.drawable.play); } else { mhandler.postDelayed(this, 300); } }