本文整理汇总了Java中net.sourceforge.servestream.transport.AbsTransport类的典型用法代码示例。如果您正苦于以下问题:Java AbsTransport类的具体用法?Java AbsTransport怎么用?Java AbsTransport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbsTransport类属于net.sourceforge.servestream.transport包,在下文中一共展示了AbsTransport类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private boolean processUri(String input) {
Uri uri = TransportFactory.getUri(input);
if (uri == null) {
return false;
}
UriBean uriBean = TransportFactory.findUri(mStreamdb, uri);
if (uriBean == null) {
uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true)) {
mStreamdb.saveUri(uriBean);
updateList();
}
}
showDialog(LOADING_DIALOG);
mDetermineActionTask = new DetermineActionTask(getActivity(), uriBean, this);
mDetermineActionTask.execute();
return true;
}
示例2: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private void processUri(StreamDatabase streamdb, String input) {
Uri uri = TransportFactory.getUri(input);
if (uri == null) {
return;
}
UriBean uriBean = TransportFactory.findUri(streamdb, uri);
if (uriBean == null) {
uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
streamdb.saveUri(uriBean);
}
}
示例3: doInBackground
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... arg0) {
long [] list = new long[0];
AbsTransport transport = TransportFactory.getTransport(mUri.getProtocol());
transport.setUri(mUri);
try {
transport.connect();
if (transport.getContentType() != null && !transport.getContentType().contains("text/html")) {
list = MusicUtils.getFilesInPlaylist(mContext, mUri.getScrubbedUri().toString(), transport.getContentType(), transport.getConnection());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
transport.close();
}
Message msg = new Message();
msg.obj = list;
mHandler.sendMessage(msg);
return null;
}
示例4: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private String processUri() {
UriBean uriBean = null;
AbsTransport transport = null;
String contentType = null;
try {
Uri uri = TransportFactory.getUri(mUri);
if (uri != null) {
uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
}
if (uriBean != null) {
transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
transport.connect();
contentType = transport.getContentType();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
transport.close();
}
return contentType;
}
示例5: doInBackground
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... arg0) {
long [] list = new long[0];
AbsTransport transport = TransportFactory.getTransport(mUri.getProtocol());
transport.setUri(mUri);
try {
transport.connect();
if (transport.getContentType() != null && !transport.getContentType().contains("text/html")) {
list = MusicUtils.getFilesInPlaylist(mContext, mUri.getScrubbedUri().toString(), transport.getContentType(), transport.getConnection());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
transport.close();
}
Message msg = new Message();
msg.obj = list;
mHandler.sendMessage(msg);
return null;
}
示例6: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private boolean processUri(String input) {
Uri uri = TransportFactory.getUri(input);
if (uri == null) {
return false;
}
UriBean uriBean = TransportFactory.findUri(mStreamdb, uri);
if (uriBean == null) {
uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
if (mPreferences.getBoolean(PreferenceConstants.AUTOSAVE, true) && transport.shouldSave()) {
mStreamdb.saveUri(uriBean);
updateList();
}
}
showDialog(LOADING_DIALOG);
mDetermineActionTask = new DetermineActionTask(this.getActivity(), uriBean, this);
mDetermineActionTask.execute();
return true;
}
示例7: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private void processUri() {
AbsTransport transport = TransportFactory.getTransport(getUri().getProtocol());
transport.setUri(getUri());
try {
transport.connect();
if (transport.getContentType() == null) {
mAction = URL_ACTION_UNDETERMINED;
} else if (transport.getContentType().contains("text/html")) {
mAction = URL_ACTION_BROWSE;
} else {
mAction = URL_ACTION_PLAY;
if (transport.isPotentialPlaylist()) {
mList = MusicUtils.getFilesInPlaylist(mContext, getUri().getScrubbedUri().toString(), transport.getContentType(), transport.getConnection());
} else {
mList = MusicUtils.storeFile(mContext, getUri().getScrubbedUri().toString());
}
}
} catch (Exception e) {
e.printStackTrace();
mAction = URL_ACTION_UNDETERMINED;
} finally {
transport.close();
}
}
示例8: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private void processUri() {
String input = mUrlEditText.getText().toString();
Uri uri = TransportFactory.getUri(input);
if (uri == null) {
mUrlEditText.setError(getString(R.string.error_url_label));
return;
}
StreamDatabase streamdb = new StreamDatabase(this);
UriBean uriBean = TransportFactory.findUri(streamdb, uri);
if (uriBean == null) {
uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
streamdb.saveUri(uriBean);
}
streamdb.close();
finish();
}
示例9: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private void processUri() {
AbsTransport transport = TransportFactory.getTransport(getUri().getProtocol());
transport.setUri(getUri());
try {
transport.connect();
if (transport.getContentType() == null) {
mAction = URL_ACTION_UNDETERMINED;
} else if (transport.getContentType().contains("text/html")) {
mAction = URL_ACTION_BROWSE;
} else {
mAction = URL_ACTION_PLAY;
if (transport.isPotentialPlaylist()) {
mList = MusicUtils.getFilesInPlaylist(mContext, getUri().getScrubbedUri().toString(), transport.getContentType(), transport.getConnection());
} else {
mList = MusicUtils.storeFile(mContext, getUri().getScrubbedUri().toString());
}
}
} catch (ProtocolException ex) {
// Ugly workaround to avoid HttpURLConnection issues in KitKat
if (ex.getMessage().equals("Unexpected status line: ICY 200 OK")) {
mAction = URL_ACTION_PLAY;
mList = MusicUtils.storeFile(mContext, getUri().getScrubbedUri().toString());
} else {
mAction = URL_ACTION_UNDETERMINED;
}
} catch (Exception e) {
e.printStackTrace();
mAction = URL_ACTION_UNDETERMINED;
} finally {
transport.close();
}
}
示例10: onClick
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
@Override
public void onClick(View v) {
Uri uri = TransportFactory.getUri("http://s6.voscast.com:7632");
UriBean uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
mDetermineActionTask = new DetermineActionTask(getActivity(), uriBean, this);
mDetermineActionTask.execute();
}
示例11: processUri
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
private void processUri() {
AbsTransport transport = TransportFactory.getTransport(getUri().getProtocol());
transport.setUri(getUri());
try {
transport.connect();
if (transport.getContentType() == null) {
mAction = URL_ACTION_UNDETERMINED;
} else if (transport.getContentType().contains("text/html")) {
mAction = URL_ACTION_BROWSE;
} else {
mAction = URL_ACTION_PLAY;
if (transport.isPotentialPlaylist()) {
Log.d("DETERMINESHIT", getUri().toString());
Log.d("DETERMINESHIT", getUri().getScrubbedUri().toString());
mList = MusicUtils.getFilesInPlaylist(mContext, getUri().getScrubbedUri().toString(), transport.getContentType(), transport.getConnection());
} else {
mList = MusicUtils.storeFile(mContext, getUri().getScrubbedUri().toString());
}
}
} catch (Exception e) {
e.printStackTrace();
mAction = URL_ACTION_UNDETERMINED;
} finally {
transport.close();
}
}
示例12: onStartCommand
import net.sourceforge.servestream.transport.AbsTransport; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
mServiceStartId = startId;
mDelayedStopHandler.removeCallbacksAndMessages(null);
if (intent != null) {
String action = intent.getAction();
String cmd = intent.getStringExtra("command");
if (CMDNEXT.equals(cmd) || NEXT_ACTION.equals(action)) {
gotoNext(true);
} else if (CMDPREVIOUS.equals(cmd) || PREVIOUS_ACTION.equals(action)) {
if (position() < 2000) {
prev();
} else {
seek(0);
play();
}
} else if (CMDTOGGLEPAUSE.equals(cmd) || TOGGLEPAUSE_ACTION.equals(action)) {
boolean remove_status_icon = (intent.getIntExtra(CMDNOTIF, 0) != 1);
if (isPlaying()) {
pause(remove_status_icon);
mPausedByTransientLossOfFocus = false;
} else {
play();
}
if (!remove_status_icon) {
updateNotification(true);
}
} else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) {
pause(true);
mPausedByTransientLossOfFocus = false;
} else if (CMDPLAY.equals(cmd)) {
play();
} else if (CMDSTOP.equals(cmd)) {
pause(true);
mPausedByTransientLossOfFocus = false;
seek(0);
} else if (BLUETOOTH_DEVICE_PAIRED.equals(action)) {
Uri uri = TransportFactory.getUri(intent.getStringExtra("uri"));
if (uri != null) {
UriBean uriBean = TransportFactory.getTransport(uri.getScheme()).createUri(uri);
AbsTransport transport = TransportFactory.getTransport(uriBean.getProtocol());
transport.setUri(uriBean);
new DetermineActionTask(this, uriBean, this).execute();
}
}
}
// make sure the service will shut down on its own if it was
// just started but not bound to and nothing is playing
mDelayedStopHandler.removeCallbacksAndMessages(null);
Message msg = mDelayedStopHandler.obtainMessage();
mDelayedStopHandler.sendMessageDelayed(msg, IDLE_DELAY);
return START_STICKY;
}