package com.creedon.cordova.plugin.photobrowser;

import android.os.Bundle;

import com.creedon.androidphotobrowser.PhotoBrowserActivity;
import com.creedon.androidphotobrowser.PhotoBrowserBasicActivity;
import com.creedon.cordova.plugin.photobrowser.data.Demo;
import com.facebook.drawee.backends.pipeline.Fresco;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PhotoBrowserPluginActivity extends PhotoBrowserActivity implements PhotoBrowserBasicActivity.PhotoBrowserListener {
    private ArrayList<String> _previewUrls;
    private ArrayList<String> _thumbnailUrls;
    private ArrayList<String> _captions;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if(!Fresco.hasBeenInitialized()) {
            Fresco.initialize(this);
        }

        listener = this;



        String jsonString = Demo.getFlickrs();
        try {

            JSONArray array = new JSONArray(jsonString);
            _previewUrls = new ArrayList<String>();
            _thumbnailUrls = new ArrayList<String>();
            for (int i = 0; i < array.length(); i++) {
                _previewUrls.add(array.getJSONObject(i).getString("previewUrl"));
                _thumbnailUrls.add(array.getJSONObject(i).getString("thumbnailUrl"));
            }
//            rowListItem = thumbnailUrls;
//            posters = previewUrls.toArray(new String[0]);
            _captions = new ArrayList<String>(Arrays.asList(Demo.getDescriptions()));

        } catch (JSONException e) {
            e.printStackTrace();

        }
        super.onCreate(savedInstanceState);

    }
    @Override
    public List<String> photoBrowserPhotos(PhotoBrowserBasicActivity activity) {
        return _previewUrls;
    }

    @Override
    public List<String> photoBrowserThumbnails(PhotoBrowserBasicActivity activity) {
        return _thumbnailUrls;
    }

    @Override
    public String photoBrowserPhotoAtIndex(PhotoBrowserBasicActivity activity, int index) {
        return null;
    }

    @Override
    public List<String> photoBrowserPhotoCaptions(PhotoBrowserBasicActivity photoBrowserBasicActivity) {
        return _captions;
    }
    @Override
    public String getActionBarTitle() {
        return "Album";
    }
    @Override
    public String getSubtitle() {
        return "Subtitle";
    }
}

@@ -771,24 +771,117 @@
 anceState) %7B
+%0A%0A        super.onCreate(savedInstanceState);%0A%0A    %7D%0A    @Override%0A    protected void init()%7B
 %0A        if(
@@ -1738,39 +1738,16 @@
 per.
-onCreate(savedInstanceState
+init(
 );%0A
-%0A
     

Update child class