Example usage for org.apache.cordova.plugin Constant img_url

List of usage examples for org.apache.cordova.plugin Constant img_url

Introduction

In this page you can find the example usage for org.apache.cordova.plugin Constant img_url.

Prototype

String img_url

To view the source code for org.apache.cordova.plugin Constant img_url.

Click Source Link

Usage

From source file:com.netcompss.ffmpeg4android_client.BaseVideo.java

public void uploadtoserver() {
    try {//from w w  w.j  a  v  a  2  s .  com
        JSONArray arry = new JSONArray(jsondata);
        RequestParams params = new RequestParams();
        JSONObject obj = arry.getJSONObject(2);

        if (obj.has("button_id")) {
            Log.d("buttonid", String.valueOf(obj.getInt("button_id")));
            params.put("button_id", String.valueOf(obj.getInt("button_id")));
        }

        if (obj.has("id")) {
            Log.d("id", obj.getString("id"));
            params.put("id", obj.getString("id"));
        }

        if (obj.has("title")) {
            Log.d("title", obj.getString("title"));
            params.put("title", obj.getString("title").toString());
        }

        if (obj.has("text")) {
            Log.d("text", obj.getString("text"));
            String txt = obj.getString("text").toString().replace("<p>", "").replace("</p>", "");
            params.put("text", txt);
            // Toast.makeText(context, txt, Toast.LENGTH_LONG).show();
        }
        // Html.fromHtml(obj.getString("description")).toString());
        if (obj.has("description")) {
            Log.d("description", obj.getString("description"));
            params.put("description", obj.getString("description").toString());
        }

        if (obj.has("api_key")) {
            Log.d("api_key", obj.getString("api_key"));
            params.put("api_key", obj.getString("api_key"));
        }

        if (obj.has("video")) {
            Log.d("video", "/sdcard/videokit/final.mp4");
            params.put("video", new File("/sdcard/videokit/final.mp4"));
        }

        if (Constant.img_url != null) {
            Log.d("video_thumbnail_url", Constant.img_url);
            params.put("video_thumbnail_url", Constant.img_url);
        } else {
            // video_thumbnail
            if (obj.has("video_thumbnail")) {
                String image = obj.getString("video_thumbnail");
                if (image != null) {
                    Log.d("video_thumbnail", image);
                    if (image.contains("content") || image.contains("file")) {
                        String getString = getFileNameByUri(context, Uri.parse(image));
                        String thumb = reporteds(getString);
                        params.put("video_thumbnail", new File(thumb));
                    } else {
                        String thumb = reporteds(image);
                        params.put("video_thumbnail", new File(thumb));
                    }
                } else {
                    String thumb = reporteds(video_thumbpath.getAbsolutePath());
                    params.put("video_thumbnail", new File(thumb));
                    Log.d("image path32", video_thumbpath.getAbsolutePath());
                }
            } else {
                String thumb = reporteds(video_thumbpath.getAbsolutePath());
                params.put("video_thumbnail", new File(thumb));
                Log.d("image path33", video_thumbpath.getAbsolutePath());
            }
        }

        if (obj.has("video_frame")) {
            String images = obj.getString("video_frame");
            if (images != null) {
                Log.d("video_frame_url", images);
                if (images.contentEquals("null")) {

                } else if (images.contains("http") || images.contains("https")) {
                    params.put("video_frame_url", images);

                } else if (Constant.frm_url != null) {
                    params.put("video_frame_url", Constant.frm_url);
                }
            }
        }

        posted(arry, params);

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}