@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Map<String, String> map = mLocalMusicAdapter.getItem(position); // 取得铃声名 String ringName = map.get(WeacConstants.RING_NAME); // 取得播放地址 String ringUrl = map.get(WeacConstants.RING_URL); // 更新当前铃声选中的位置 mLocalMusicAdapter.updateSelection(ringName); // 更新适配器刷新铃声列表显示 mLocalMusicAdapter.notifyDataSetChanged(); // 设置最后一次选中的铃声选择界面位置为本地音乐界面 RingSelectItem.getInstance().setRingPager(1); // 播放音频文件 AudioPlayer.getInstance(getActivity()).play(ringUrl, false, false); ViewPager pager = (ViewPager) getActivity().findViewById(R.id.fragment_ring_select_sort); PagerAdapter f = pager.getAdapter(); SystemRingFragment systemRingFragment = (SystemRingFragment) f.instantiateItem(pager, 0); RecorderFragment recorderFragment = (RecorderFragment) f.instantiateItem(pager, 2); // 取消系统铃声选中标记 if (systemRingFragment.mSystemRingAdapter != null) { systemRingFragment.mSystemRingAdapter.updateSelection(""); systemRingFragment.mSystemRingAdapter.notifyDataSetChanged(); } // 取消录音选中标记 if (recorderFragment.mRecorderAdapter != null) { recorderFragment.mRecorderAdapter.updateSelection(""); recorderFragment.mRecorderAdapter.notifyDataSetChanged(); } }
/** * A valid barcode has been found, so give an indication of success and show the results. * * @param rawResult The contents of the barcode. * @param bundle The extras */ public void handleDecode(Result rawResult, Bundle bundle) { inactivityTimer.onActivity(); if (rawResult == null) { Snackbar.make(scanContainer, getString(R.string.decode_null), Snackbar.LENGTH_SHORT).show(); return; } // beepManager.playBeepSoundAndVibrate(); AudioPlayer.getInstance(this).playRaw(R.raw.scan, false, false); // MyUtil.vibrate(this); operateResult(rawResult); }