use of wseemann.media.romote.tasks.RequestTask in project RoMote by wseemann.
the class NotificationService method sendStatusCommand.
private void sendStatusCommand() {
String url = CommandHelper.getDeviceURL(this);
QueryActiveAppRequest queryActiveAppRequest = new QueryActiveAppRequest(url);
JakuRequest request = new JakuRequest(queryActiveAppRequest, new AppsParser());
new RequestTask(request, new RequestCallback() {
@Override
public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
List<Channel> channels = (List<Channel>) result.mResultValue;
if (channels.size() > 0) {
mChannel = channels.get(0);
getAppIcon(mChannel.getId());
}
}
@Override
public void onErrorResponse(RequestTask.Result result) {
Log.d(TAG, "That didn't work!");
}
}).execute(RokuRequestTypes.query_active_app);
}
use of wseemann.media.romote.tasks.RequestTask in project RoMote by wseemann.
the class NotificationService method getAppIcon.
private void getAppIcon(String appId) {
String url = CommandHelper.getDeviceURL(this);
QueryIconRequest queryIconRequest = new QueryIconRequest(url, appId);
JakuRequest request = new JakuRequest(queryIconRequest, new IconParser());
new RequestTask(request, new RequestCallback() {
@Override
public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
try {
byte[] data = (byte[]) result.mResultValue;
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
mDevice = PreferenceUtils.getConnectedDevice(NotificationService.this);
notification = NotificationUtils.buildNotification(NotificationService.this, mDevice.getModelName(), mChannel.getTitle(), bitmap);
mNM.notify(NOTIFICATION, notification);
} catch (Exception ex) {
}
}
@Override
public void onErrorResponse(RequestTask.Result result) {
Log.d(TAG, "That didn't work!");
}
}).execute(RokuRequestTypes.query_icon);
}
use of wseemann.media.romote.tasks.RequestTask in project RoMote by wseemann.
the class RemoteFragment method onVolumeChanged.
@Override
public void onVolumeChanged(final KeypressKeyValues keypressKeyValue) {
String url = CommandHelper.getDeviceURL(getActivity());
KeypressRequest keypressRequest = new KeypressRequest(url, keypressKeyValue.getValue());
JakuRequest request = new JakuRequest(keypressRequest, null);
new RequestTask(request, new RequestCallback() {
@Override
public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
}
@Override
public void onErrorResponse(RequestTask.Result result) {
}
}).execute(RokuRequestTypes.keypress);
}
use of wseemann.media.romote.tasks.RequestTask in project RoMote by wseemann.
the class MainActivity method performSearch.
private void performSearch(String searchText) {
String url = CommandHelper.getDeviceURL(this);
SearchRequest searchRequest = new SearchRequest(url, searchText, null, null, null, null, null, null, null, null, null);
JakuRequest request = new JakuRequest(searchRequest, null);
new RequestTask(request, new RequestCallback() {
@Override
public void requestResult(RokuRequestTypes rokuRequestType, RequestTask.Result result) {
}
@Override
public void onErrorResponse(RequestTask.Result result) {
}
}).execute(RokuRequestTypes.search);
}
Aggregations