开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2015-09-16
详细说明: package com.alva.vcd; import java.util.ArrayList; import java.util.List; import com.alva.vcd.adapter.RecorderAdapter; import com.alva.vcd.pojo.Recorder; import com.alva.vcd.view.AudioRecorderButton; import com.alva.vcd.view.AudioRecorderButton.AudioFinishRecorderListener; import com.alva.vcd.view.MediaManager; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.os.Bundle; import android.util .Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.FrameLayout; import android.widget.ListView; import android.widget.TextView; import android.os.Build; public class MainActivity extends Activity implements AudioFinishRecorderListener, OnItemClickListener { private ListView mListview; private AudioRecorderButton mAudioButton; private ArrayAdapter mAdapter; private List mDatas = new ArrayList();; private View mAnimView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); initViews(); initDatas(); initEvents(); } private void initViews() { mListview = (ListView) findViewById(R.id.listview_chat); mAudioButton = (AudioRecorderButton) findViewById(R.id.recorderButton); } private void initDatas() { mAudioButton.setAudioFinishRecorderListener(this); mAdapter = new RecorderAdapter(getApplicationContext(), mDatas); mListview.setAdapter(mAdapter); } private void initEvents() { mListview.setOnItemClickListener(this); } @Override public void onFinsh(float seconds, String filePath) { Recorder mRecorder = new Recorder(); mRecorder.setFilePath(filePath); mRecorder.setTime(seconds); mDatas.add(mRecorder); mAdapter.notifyDataSetChanged(); mListview.setSelection(mDatas.size() - 1); } @Override public void onItemClick(AdapterView> arg0, View arg1, int arg2, long arg3) { Log.e("MediaManager", mDatas.get(arg2).getFilePath() + "sssss"); if (mAnimView != null) { mAnimView.setBackgroundResource(R.drawable.adj); mAnimView = null; } // 播放动画 mAnimView = arg1.findViewById(R.id.id_view); mAnimView.setBackgroundResource(R.drawable.play_anim); AnimationDrawable anim = (AnimationDrawable) mAnimView.getBackground(); anim.start(); // 播放音频 MediaManager.playSound(mDatas.get(arg2).getFilePath(), new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer arg0) { mAnimView.setBackgroundResource(R.drawable.adj); } }); } @Override protected void onPause() { super.onPause(); MediaManager.pause(); } @Override protected void onResume() { super.onResume(); MediaManager.resume(); } @Override protected void onDestroy() { super.onDestroy(); MediaManager.release(); } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.