本文整理汇总了Java中net.sourceforge.servestream.utils.MusicUtils类的典型用法代码示例。如果您正苦于以下问题:Java MusicUtils类的具体用法?Java MusicUtils怎么用?Java MusicUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MusicUtils类属于net.sourceforge.servestream.utils包,在下文中一共展示了MusicUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMusicRetrieverPrepared
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onMusicRetrieverPrepared(String action, UriBean uri, long[] list) {
dismissDialog(LOADING_DIALOG);
if (action.equals(DetermineActionTask.URL_ACTION_UNDETERMINED)) {
showUrlNotOpenedToast();
} else if (action.equals(DetermineActionTask.URL_ACTION_BROWSE)) {
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true)) {
mStreamdb.touchUri(uri);
}
mListener.browseToUri(uri.getScrubbedUri());
} else if (action.equals(DetermineActionTask.URL_ACTION_PLAY)) {
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true)) {
mStreamdb.touchUri(uri);
}
MusicUtils.playAll(getActivity(), list, 0);
}
}
示例2: onMusicRetrieverPrepared
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onMusicRetrieverPrepared(String action, UriBean uri, long[] list) {
if (action.equals(DetermineActionTask.URL_ACTION_UNDETERMINED)) {
dismissDialog(LOADING_DIALOG);
showUrlNotOpenedToast();
} else if (action.equals(DetermineActionTask.URL_ACTION_BROWSE)) {
mPreviousDirectory.put(mStepsBack, uri);
mStepsBack++;
mPreviousDirectory.put(mStepsBack, null);
mDirectory[mStepsBack] = uri;
refreshList();
} else if (action.equals(DetermineActionTask.URL_ACTION_PLAY)) {
dismissDialog(LOADING_DIALOG);
MusicUtils.playAll(BrowseFragment.this.getActivity(), list, 0);
}
}
示例3: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int imageThumbSize = getResources().getDimensionPixelSize(R.dimen.image_thumbnail_size);
ImageCache.ImageCacheParams cacheParams =
new ImageCache.ImageCacheParams(getActivity(), IMAGE_CACHE_DIR);
cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory
// The ImageFetcher takes care of loading images into our ImageView children asynchronously
mImageFetcher = new DatabaseImageResizer(getActivity(), imageThumbSize);
mImageFetcher.setLoadingImage(R.drawable.albumart_mp_unknown_list);
mImageFetcher.addImageCache(getActivity().getSupportFragmentManager(), cacheParams);
mToken = MusicUtils.bindToService(getActivity(), this);
}
示例4: onStart
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
mToken = MusicUtils.bindToService(getActivity(), osc);
if (mToken == null) {
// something went wrong
//mHandler.sendEmptyMessage(QUIT);
}
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.ART_CHANGED);
getActivity().registerReceiver(mStatusListener, new IntentFilter(f));
updateTrackInfo();
}
示例5: onStartCommand
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// No intent, tell the system not to restart us.
if (intent == null) {
stopSelf();
return START_NOT_STICKY;
}
final Alarm alarm = intent.getParcelableExtra(
Alarms.ALARM_INTENT_EXTRA);
if (alarm == null) {
Log.v(TAG, "AlarmKlaxon failed to parse the alarm from the intent");
stopSelf();
return START_NOT_STICKY;
}
if (mCurrentAlarm != null) {
sendKillBroadcast(mCurrentAlarm);
}
mAlarm = alarm;
mToken = MusicUtils.bindToService(this, this);
return START_STICKY;
}
示例6: handleMessage
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
MusicUtils.debugLog("mInitialMediaplayerHandler.handleMessage " + msg.what);
switch (msg.what) {
case PREPARED:
long seekpos = mPreferences.getLong("seekpos", 0);
seek(seekpos >= 0 && seekpos < duration() ? seekpos : 0);
Log.d(LOGTAG, "restored queue, currently at position "
+ position() + "/" + duration()
+ " (requested " + seekpos + ")");
Intent i = new Intent("android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION");
i.putExtra("android.media.extra.AUDIO_SESSION", getAudioSessionId());
i.putExtra("android.media.extra.PACKAGE_NAME", getPackageName());
sendBroadcast(i);
removeStickyBroadcast(new Intent(START_DIALOG));
sendBroadcast(new Intent(STOP_DIALOG));
notifyChange(PLAYSTATE_CHANGED);
break;
case ERROR:
break;
default:
break;
}
}
示例7: removePlaylistItem
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
private void removePlaylistItem(int which) {
View v = mList.getChildAt(which - mList.getFirstVisiblePosition());
if (v == null) {
Log.d(TAG, "No view when removing playlist item " + which);
return;
}
try {
if (MusicUtils.sService != null
&& which != MusicUtils.sService.getQueuePosition()) {
mDeletedOneRow = true;
}
} catch (RemoteException e) {
// Service died, so nothing playing.
mDeletedOneRow = true;
}
v.setVisibility(View.GONE);
mList.invalidateViews();
((NowPlayingCursor)mTrackCursor).removeItem(which);
v.setVisibility(View.VISIBLE);
mList.invalidateViews();
}
示例8: removeItem
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
private void removeItem() {
int curcount = mTrackCursor.getCount();
int curpos = mList.getSelectedItemPosition();
if (curcount == 0 || curpos < 0) {
return;
}
// remove track from queue
// Work around bug 902971. To get quick visual feedback
// of the deletion of the item, hide the selected view.
try {
if (curpos != MusicUtils.sService.getQueuePosition()) {
mDeletedOneRow = true;
}
} catch (RemoteException ex) {
}
View v = mList.getSelectedView();
v.setVisibility(View.GONE);
mList.invalidateViews();
((NowPlayingCursor)mTrackCursor).removeItem(curpos);
v.setVisibility(View.VISIBLE);
mList.invalidateViews();
}
示例9: getTrackCursor
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
private Cursor getTrackCursor(TrackListAdapter.TrackQueryHandler queryhandler, String filter,
boolean async) {
if (queryhandler == null) {
throw new IllegalArgumentException();
}
Cursor ret = null;
if (MusicUtils.sService != null) {
ret = new NowPlayingCursor(MusicUtils.sService, mCursorCols);
if (ret.getCount() == 0) {
finish();
}
} else {
// Nothing is playing.
}
// This special case is for the "nowplaying" cursor, which cannot be handled
// asynchronously using AsyncQueryHandler, so we do some extra initialization here.
if (ret != null && async) {
init(ret, false);
}
return ret;
}
示例10: doQuery
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
public Cursor doQuery(Uri uri, String[] projection,
String selection, String[] selectionArgs,
String orderBy, boolean async) {
if (async) {
// Get 100 results first, which is enough to allow the user to start scrolling,
// while still being very fast.
Uri limituri = uri.buildUpon().appendQueryParameter("limit", "100").build();
QueryArgs args = new QueryArgs();
args.uri = uri;
args.projection = projection;
args.selection = selection;
args.selectionArgs = selectionArgs;
args.orderBy = orderBy;
startQuery(0, args, limituri, projection, selection, selectionArgs, orderBy);
return null;
}
return MusicUtils.query(mActivity,
uri, projection, selection, selectionArgs, orderBy);
}
示例11: onMusicRetrieverPrepared
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
public void onMusicRetrieverPrepared(String action, UriBean uri, long[] list) {
dismissDialog(LOADING_DIALOG);
if (action.equals(DetermineActionTask.URL_ACTION_UNDETERMINED)) {
showUrlNotOpenedToast();
} else if (action.equals(DetermineActionTask.URL_ACTION_BROWSE)) {
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true)) {
mStreamdb.touchUri(uri);
}
mListener.browseToUri(uri.getScrubbedUri());
} else if (action.equals(DetermineActionTask.URL_ACTION_PLAY)) {
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true)) {
mStreamdb.touchUri(uri);
}
MusicUtils.playAll(getActivity(), list, 0);
}
}
示例12: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Bundle args = new Bundle();
args.putString(UrlListFragment.ARG_TARGET_URI, getUri());
mUrlListFragment = (UrlListFragment) Fragment.instantiate(this, UrlListFragment.class.getName(), args);
mBrowseFragment = (BrowseFragment) Fragment.instantiate(this, BrowseFragment.class.getName(), null);
// Create the adapter that will return a fragment for each of the three
// primary sections of the app.
mSectionsPagerAdapter = new SectionsPagerAdapter(
getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mSavedInstanceState = savedInstanceState;
mToken = MusicUtils.bindToService(this, this);
}
示例13: removePlaylistItem
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
private void removePlaylistItem(int which) {
View v = getListView().getChildAt(which - getListView().getFirstVisiblePosition());
if (v == null) {
Log.d(TAG, "No view when removing playlist item " + which);
return;
}
try {
if (MusicUtils.sService != null
&& which != MusicUtils.sService.getQueuePosition()) {
mDeletedOneRow = true;
}
} catch (RemoteException e) {
// Service died, so nothing playing.
mDeletedOneRow = true;
}
v.setVisibility(View.GONE);
getListView().invalidateViews();
((NowPlayingCursor)mTrackCursor).removeItem(which);
v.setVisibility(View.VISIBLE);
getListView().invalidateViews();
}
示例14: removeItem
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
private void removeItem() {
int curcount = mTrackCursor.getCount();
int curpos = getListView().getSelectedItemPosition();
if (curcount == 0 || curpos < 0) {
return;
}
// remove track from queue
// Work around bug 902971. To get quick visual feedback
// of the deletion of the item, hide the selected view.
try {
if (curpos != MusicUtils.sService.getQueuePosition()) {
mDeletedOneRow = true;
}
} catch (RemoteException ex) {
}
View v = getListView().getSelectedView();
v.setVisibility(View.GONE);
getListView().invalidateViews();
((NowPlayingCursor)mTrackCursor).removeItem(curpos);
v.setVisibility(View.VISIBLE);
getListView().invalidateViews();
}
示例15: onDestroy
import net.sourceforge.servestream.utils.MusicUtils; //导入依赖的package包/类
@Override
public void onDestroy() {
MusicUtils.unbindFromService(mToken);
mService = null;
super.onDestroy();
mImageFetcher.closeCache();
}