Search in sources :

Example 1 with IconParser

use of com.jaku.parser.IconParser 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);
}
Also used : IconParser(com.jaku.parser.IconParser) RequestTask(wseemann.media.romote.tasks.RequestTask) Bitmap(android.graphics.Bitmap) RokuRequestTypes(wseemann.media.romote.utils.RokuRequestTypes) JakuRequest(com.jaku.core.JakuRequest) RequestCallback(wseemann.media.romote.tasks.RequestCallback) QueryIconRequest(com.jaku.request.QueryIconRequest)

Aggregations

Bitmap (android.graphics.Bitmap)1 JakuRequest (com.jaku.core.JakuRequest)1 IconParser (com.jaku.parser.IconParser)1 QueryIconRequest (com.jaku.request.QueryIconRequest)1 RequestCallback (wseemann.media.romote.tasks.RequestCallback)1 RequestTask (wseemann.media.romote.tasks.RequestTask)1 RokuRequestTypes (wseemann.media.romote.utils.RokuRequestTypes)1