/**
   * Creates the view for this fragment.
   *
   * @param inflater The view inflated for this fragment.
   * @param container The ViewGroup this fragment is displayed in.
   * @param savedInstanceState The instance this fragment gets saved to.
   * @return the View inflater.
   */
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ArtCard.ITEMS.clear();
    View v = inflater.inflate(R.layout.fragment_card_list, container, false);
    mListView = (ListView) v.findViewById(R.id.card_list);
    setHasOptionsMenu(true);
    registerForContextMenu(mListView);
    FloatingActionButton addCardBtn = (FloatingActionButton) v.findViewById(R.id.add_card);
    addCardBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            AddCardFragment addCardFragment = new AddCardFragment();
            Bundle args = new Bundle();
            args.putBoolean("isEdit", false);
            addCardFragment.setArguments(args);
            getFragmentManager()
                .beginTransaction()
                .replace(R.id.fragment_container, addCardFragment)
                .addToBackStack(null)
                .commit();
          }
        });

    return v;
  }
    @Override
    protected void onPostExecute(String s) {
      super.onPostExecute(s);
      // Parse JSON
      try {
        mList.clear();
        ArtCard.ITEMS.clear();
        JSONArray jsonarray;
        if (!s.contains("emptyList!")) {
          jsonarray = new JSONArray(s);
          for (int i = 0; i < jsonarray.length(); i++) {
            JSONObject jsonObject = (JSONObject) jsonarray.get(i);
            String title = (String) jsonObject.get("title");
            String artist = (String) jsonObject.get("artist");
            String year = (String) jsonObject.get("year");
            String info = (String) jsonObject.get("info");
            String url = (String) jsonObject.get("url");
            title = URLDecoder.decode(title, "utf-8");
            artist = URLDecoder.decode(artist, "utf-8");
            year = URLDecoder.decode(year, "utf-8");
            info = URLDecoder.decode(info, "utf-8");
            url = URLDecoder.decode(url, "utf-8");
            title = title.replaceAll("@@", "'");
            year = year.replaceAll("@@", "'");
            info = info.replaceAll("@@", "'");
            url = url.replaceAll("@@", "'");
            artist = artist.replaceAll("@@", "'");

            ArtCard.ITEMS.add(new ArtCard.CardInfo(title, artist, year, info, url));
          }
        } else {
          Toast.makeText(getActivity(), "List is empty", Toast.LENGTH_SHORT).show();
        }
        mList = ArtCard.ITEMS;
        mListView.setAdapter(mAdapter);
      } catch (Exception e) {
        Log.d(MainActivity.APP_TAG, "Parsing JSON Exception " + e.getMessage());
      }
    }