use of com.kevinshen.beyondupnp.core.SystemManager in project BeyondUPnP by kevinshine.
the class ContentContainerActivity method loadContent.
private void loadContent() {
SystemManager systemManager = SystemManager.getInstance();
Device device = null;
try {
device = systemManager.getRegistry().getDevice(new UDN(mIdentifierString), false);
} catch (NullPointerException e) {
Log.e(TAG, "Get device error.");
}
if (device != null) {
//Get cds to browse children directories.
Service contentDeviceService = device.findService(SystemManager.CONTENT_DIRECTORY_SERVICE);
//Execute Browse action and init list view
systemManager.getControlPoint().execute(new Browse(contentDeviceService, mObjectId, BrowseFlag.DIRECT_CHILDREN, "*", 0, null, new SortCriterion(true, "dc:title")) {
@Override
public void received(ActionInvocation actionInvocation, DIDLContent didl) {
Message msg = Message.obtain(handler, ADD_OBJECTS, didl);
msg.sendToTarget();
}
@Override
public void updateStatus(Status status) {
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
}
});
}
}
use of com.kevinshen.beyondupnp.core.SystemManager in project BeyondUPnP by kevinshine.
the class MainActivity method onKeyDown.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
SystemManager systemManager = SystemManager.getInstance();
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
int volume = systemManager.getDeviceVolume();
volume += 5;
if (volume > 100)
volume = 100;
sendBroadcast(new Intent(Intents.ACTION_SET_VOLUME).putExtra("currentVolume", volume));
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
int volume = systemManager.getDeviceVolume();
volume -= 5;
if (volume < 0)
volume = 0;
sendBroadcast(new Intent(Intents.ACTION_SET_VOLUME).putExtra("currentVolume", volume));
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
Aggregations