本文整理汇总了Java中net.sourceforge.servestream.utils.MusicUtils.bindToService方法的典型用法代码示例。如果您正苦于以下问题:Java MusicUtils.bindToService方法的具体用法?Java MusicUtils.bindToService怎么用?Java MusicUtils.bindToService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.servestream.utils.MusicUtils
的用法示例。
在下文中一共展示了MusicUtils.bindToService方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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();
}
示例3: 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;
}
示例4: 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);
}
示例5: onStart
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
paused = false;
if (mPreferences.getBoolean(PreferenceConstants.WAKELOCK, true)) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
mToken = MusicUtils.bindToService(this, osc);
if (mToken == null) {
// something went wrong
mHandler.sendEmptyMessage(QUIT);
}
mVolumeObserver = new VolumeObserver(new Handler());
getApplicationContext().getContentResolver().registerContentObserver(
android.provider.Settings.System.CONTENT_URI,
true,
mVolumeObserver);
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.PLAYSTATE_CHANGED);
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.START_DIALOG);
f.addAction(MediaPlaybackService.STOP_DIALOG);
registerReceiver(mStatusListener, new IntentFilter(f));
updateTrackInfo();
long next = refreshNow();
queueNextRefresh(next);
}
示例6: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
//setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
android.support.v7.app.ActionBarDrawerToggle toggle = new android.support.v7.app.ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
if (savedInstanceState == null) {
openUri(getUri());
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setCheckedItem(R.id.nav_urls);
//selectItem(0);
}
mToken = MusicUtils.bindToService(this, this);
requestPermission(this);
}
示例7: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
actionBar.addTab(actionBar.newTab()
.setText(mSectionsPagerAdapter.getPageTitle(0))
.setTabListener(this));
actionBar.addTab(actionBar.newTab()
.setText(mSectionsPagerAdapter.getPageTitle(1))
.setTabListener(this));
if (savedInstanceState != null) {
getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
}
mToken = MusicUtils.bindToService(this, this);
}
示例8: onStart
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
paused = false;
if (mPreferences.getBoolean(PreferenceConstants.WAKELOCK, true)) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
mToken = MusicUtils.bindToService(this, osc);
if (mToken == null) {
// something went wrong
mHandler.sendEmptyMessage(QUIT);
}
mVolumeObserver = new VolumeObserver(new Handler());
getApplicationContext().getContentResolver().registerContentObserver(
android.provider.Settings.System.CONTENT_URI,
true,
mVolumeObserver);
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.PLAYSTATE_CHANGED);
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.ART_CHANGED);
f.addAction(MediaPlaybackService.START_DIALOG);
f.addAction(MediaPlaybackService.STOP_DIALOG);
registerReceiver(mStatusListener, new IntentFilter(f));
updateTrackInfo();
long next = refreshNow();
queueNextRefresh(next);
}
示例9: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
setTheme(UserPreferences.getTheme());
super.onCreate(icicle);
setContentView(R.layout.activity_now_playing);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
int imageThumbSize = getResources().getDimensionPixelSize(R.dimen.image_thumbnail_size);
ImageCache.ImageCacheParams cacheParams =
new ImageCache.ImageCacheParams(this, 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(this, imageThumbSize);
mImageFetcher.setLoadingImage(R.drawable.albumart_mp_unknown_list);
mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mList = (DragSortListView) findViewById(android.R.id.list);
mList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
if (mTrackCursor.getCount() == 0) {
return;
}
// When selecting a track from the queue, just jump there instead of
// reloading the queue. This is both faster, and prevents accidentally
// dropping out of party shuffle.
if (MusicUtils.sService != null) {
try {
int queuePosition = MusicUtils.sService.getQueuePosition();
if (position == queuePosition) {
if (MusicUtils.sService.isPlaying()) {
MusicUtils.sService.pause();
} else {
MusicUtils.sService.play();
}
} else {
MusicUtils.sService.setQueuePosition(position);
}
} catch (RemoteException ex) {
}
}
}
});
DragSortController controller = new DragSortController(mList);
controller.setDragInitMode(DragSortController.ON_DRAG);
controller.setDragHandleId(R.id.drag);
mList.setOnTouchListener(controller);
mList.setOnCreateContextMenuListener(this);
mAdapter = (TrackListAdapter) getLastCustomNonConfigurationInstance();
if (mAdapter != null) {
mAdapter.setActivity(this);
mList.setAdapter(mAdapter);
}
mToken = MusicUtils.bindToService(this, this);
}
示例10: onCreate
import net.sourceforge.servestream.utils.MusicUtils; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_now_playing);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
DragSortListView list = (DragSortListView) getListView();
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
if (mTrackCursor.getCount() == 0) {
return;
}
// When selecting a track from the queue, just jump there instead of
// reloading the queue. This is both faster, and prevents accidentally
// dropping out of party shuffle.
if (MusicUtils.sService != null) {
try {
int queuePosition = MusicUtils.sService.getQueuePosition();
if (position == queuePosition) {
if (MusicUtils.sService.isPlaying()) {
MusicUtils.sService.pause();
} else {
MusicUtils.sService.play();
}
} else {
MusicUtils.sService.setQueuePosition(position);
}
} catch (RemoteException ex) {
}
}
}
});
DragSortController controller = new DragSortController(list);
controller.setDragInitMode(DragSortController.ON_DRAG);
controller.setRemoveMode(DragSortController.FLING_REMOVE);
controller.setRemoveEnabled(true);
controller.setDragHandleId(R.id.drag);
list.setOnTouchListener(controller);
list.setOnCreateContextMenuListener(this);
mAdapter = (TrackListAdapter) getLastNonConfigurationInstance();
if (mAdapter != null) {
mAdapter.setActivity(this);
setListAdapter(mAdapter);
}
mToken = MusicUtils.bindToService(this, this);
}