List of usage examples for android.os RemoteException printStackTrace
public void printStackTrace()
From source file:org.yammp.app.MusicPlaybackActivity.java
@Override public void onServiceConnected(ComponentName classname, IBinder obj) { mService = IMusicPlaybackService.Stub.asInterface(obj); try {/*w ww. j a v a2s . c o m*/ if (mService.getAudioId() >= 0 || mService.isPlaying() || mService.getPath() != null) { updateTrackInfo(false); long next = refreshNow(); queueNextRefresh(next); setPauseButtonImage(); invalidateOptionsMenu(); mVisualizer = VisualizerWrapper.getInstance(mService.getAudioSessionId(), 50); mDisplayVisualizer = mPrefs.getBooleanState(KEY_DISPLAY_VISUALIZER, false); boolean mFftEnabled = String.valueOf(VISUALIZER_TYPE_FFT_SPECTRUM) .equals(mPrefs.getStringPref(KEY_VISUALIZER_TYPE, "1")); boolean mWaveEnabled = String.valueOf(VISUALIZER_TYPE_WAVE_FORM) .equals(mPrefs.getStringPref(KEY_VISUALIZER_TYPE, "1")); mVisualizerView.removeAllViews(); if (mFftEnabled) { mVisualizerView.addView(mVisualizerViewFftSpectrum); } if (mWaveEnabled) { mVisualizerView.addView(mVisualizerViewWaveForm); } mVisualizer.setFftEnabled(mFftEnabled); mVisualizer.setWaveFormEnabled(mWaveEnabled); mVisualizer.setOnDataChangedListener(mDataChangedListener); setVisualizerView(); } else { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(getApplicationContext(), MusicBrowserActivity.class); startActivity(intent); finish(); } } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
private void toggleFavorite() { if (mService == null) return;//from w w w .j a v a 2 s.c o m try { mService.toggleFavorite(); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
private void setVisualizerView() { try {// w ww . j a v a 2 s .c o m if (mService != null && mService.isPlaying() && mDisplayVisualizer) { enableVisualizer(); } else { disableVisualizer(false); } } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
private void setFavoriteButton() { if (mService == null) return;//from w ww. ja v a 2 s . co m try { getActionBarCompat().setStarActionItemState(mService.isFavorite(mService.getAudioId())); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.videolan.vlc.PlaybackService.java
private synchronized void loadLastPlaylist() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String currentMedia = prefs.getString("current_media", ""); if (currentMedia.equals("")) return;//from w w w .j a va 2 s .c o m String[] locations = prefs.getString("media_list", "").split(" "); List<String> mediaPathList = new ArrayList<String>(locations.length); for (int i = 0; i < locations.length; ++i) mediaPathList.add(Uri.decode(locations[i])); mShuffling = prefs.getBoolean("shuffling", false); mRepeating = RepeatType.values()[prefs.getInt("repeating", RepeatType.None.ordinal())]; int position = prefs.getInt("position_in_list", Math.max(0, mediaPathList.indexOf(currentMedia))); long time = prefs.getLong("position_in_song", -1); // load playlist try { mInterface.loadLocations(mediaPathList, position); if (time > 0) mInterface.setTime(time); } catch (RemoteException e) { e.printStackTrace(); } finally { SharedPreferences.Editor editor = prefs.edit(); editor.putInt("position_in_list", 0); editor.putLong("position_in_song", 0); Util.commitPreferences(editor); } }
From source file:org.yammp.app.MusicPlaybackActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { int repcnt = event.getRepeatCount(); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: if (!useDpadMusicControl()) { break; }/*from ww w . ja va 2 s. com*/ if (!mPrevButton.hasFocus()) { mPrevButton.requestFocus(); } scanBackward(repcnt, event.getEventTime() - event.getDownTime()); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: if (!useDpadMusicControl()) { break; } if (!mNextButton.hasFocus()) { mNextButton.requestFocus(); } scanForward(repcnt, event.getEventTime() - event.getDownTime()); return true; // case KeyEvent.KEYCODE_R: // toggleRepeat(); // return true; // // case KeyEvent.KEYCODE_S: // toggleShuffle(); // return true; case KeyEvent.KEYCODE_N: if (mService != null) { try { mService.next(); return true; } catch (RemoteException e) { e.printStackTrace(); } } else return false; case KeyEvent.KEYCODE_P: if (mService != null) { try { mService.prev(); return true; } catch (RemoteException e) { e.printStackTrace(); } } else return false; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_SPACE: doPauseResume(); return true; } return super.onKeyDown(keyCode, event); }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
private void updateTrackInfo(boolean animation) { if (mService == null) { finish();//w ww . j a va 2s .co m return; } try { mTrackName.setText(mService.getTrackName()); if (mService.getArtistName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getArtistName())) { mTrackDetail.setText(mService.getArtistName()); } else if (mService.getAlbumName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getAlbumName())) { mTrackDetail.setText(mService.getAlbumName()); } else { mTrackDetail.setText(R.string.unknown_artist); } if (mColorAnalyser != null) mColorAnalyser.cancel(true); mColorAnalyser = new AsyncColorAnalyser(); mColorAnalyser.execute(); mDuration = mService.duration(); mTotalTime.setText(MusicUtils.makeTimeString(this, mDuration / 1000)); } catch (RemoteException e) { e.printStackTrace(); finish(); } }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
private long refreshNow() { if (mService == null) return 500; try {//ww w . java 2 s . co m long pos = mPosOverride < 0 ? mService.position() : mPosOverride; long remaining = 1000 - (pos % 1000); if ((pos >= 0) && (mDuration > 0)) { mCurrentTime.setText(MusicUtils.makeTimeString(this, pos / 1000)); if (mService.isPlaying()) { mCurrentTime.setVisibility(View.VISIBLE); } else { // blink the counter // If the progress bar is still been dragged, then we do not want to blink the // currentTime. It would cause flickering due to change in the visibility. if (mFromTouch) { mCurrentTime.setVisibility(View.VISIBLE); } else { int vis = mCurrentTime.getVisibility(); mCurrentTime.setVisibility(vis == View.INVISIBLE ? View.VISIBLE : View.INVISIBLE); } remaining = 500; } mProgress.setProgress((int) (1000 * pos / mDuration)); } else { mCurrentTime.setText("--:--"); mProgress.setProgress(1000); } // return the number of milliseconds until the next full second, so // the counter can be updated at just the right time return remaining; } catch (RemoteException e) { e.printStackTrace(); } return 500; }
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
@Override public void onServiceConnected(ComponentName classname, IBinder obj) { mService = IMusicPlaybackService.Stub.asInterface(obj); try {//from w w w. j a v a2s .com if (mService.getAudioId() >= 0 || mService.isPlaying() || mService.getPath() != null) { updateTrackInfo(false); long next = refreshNow(); queueNextRefresh(next); setPauseButtonImage(); setFavoriteButton(); mVisualizer = VisualizerWrapper.getInstance(mService.getAudioSessionId(), 50); mDisplayVisualizer = mPrefs.getBooleanState(KEY_DISPLAY_VISUALIZER, true); boolean mFftEnabled = String.valueOf(VISUALIZER_TYPE_FFT_SPECTRUM) .equals(mPrefs.getStringPref(KEY_VISUALIZER_TYPE, "1")); boolean mWaveEnabled = String.valueOf(VISUALIZER_TYPE_WAVE_FORM) .equals(mPrefs.getStringPref(KEY_VISUALIZER_TYPE, "1")); mVisualizerView.removeAllViews(); if (mFftEnabled) mVisualizerView.addView(mVisualizerViewFftSpectrum); if (mWaveEnabled) mVisualizerView.addView(mVisualizerViewWaveForm); mVisualizer.setFftEnabled(mFftEnabled); mVisualizer.setWaveFormEnabled(mWaveEnabled); mVisualizer.setOnDataChangedListener(mDataChangedListener); setVisualizerView(); } else { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(getApplicationContext(), MusicBrowserActivity.class); startActivity(intent); finish(); } } catch (RemoteException e) { e.printStackTrace(); } }
From source file:com.dzt.musicplay.player.AudioService.java
private void executeUpdateProgress() { for (IAudioServiceCallback callback : mCallback.keySet()) { try {/*from w ww . j ava 2 s . c o m*/ callback.updateProgress(); } catch (RemoteException e) { e.printStackTrace(); } } }