use of com.connectsdk.core.ProgramList in project butter-android by butterproject.
the class WebOSTVService method getProgramList.
private ServiceCommand<ResponseListener<Object>> getProgramList(boolean isSubscription, final ProgramListListener listener) {
ServiceCommand<ResponseListener<Object>> request;
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject) response;
JSONObject jsonChannel = (JSONObject) jsonObj.get("channel");
ChannelInfo channel = parseRawChannelData(jsonChannel);
JSONArray programList = (JSONArray) jsonObj.get("programList");
Util.postSuccess(listener, new ProgramList(channel, programList));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
if (isSubscription)
request = new URLServiceSubscription<ResponseListener<Object>>(this, PROGRAM, null, true, responseListener);
else
request = new ServiceCommand<ResponseListener<Object>>(this, PROGRAM, null, true, responseListener);
request.send();
return request;
}
Aggregations