<commit_before>package com.mk.places.threads;

import android.app.Activity;
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;

import com.mk.places.R;
import com.mk.places.fragment.FragmentBookmarks;
import com.mk.places.fragment.FragmentPlaces;
import com.mk.places.models.Place;
import com.mk.places.models.Places;
import com.mk.places.utilities.JSONParser;

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

import java.util.ArrayList;

public class ParsePlacesJSON extends AsyncTask<Void, Void, Void> {

    private final static ArrayList<Place> places = new ArrayList<>();
    private long startTime;
    private Activity context;
    private static final String TAG = "ParsePlacesJSON";

    public ParsePlacesJSON(Activity context) {
        this.context = context;
    }

    @Override
    protected void onPreExecute() {
        Places.clearList();
        startTime = System.currentTimeMillis();
    }

    @Override
    protected Void doInBackground(Void... params) {

        JSONObject json = JSONParser.getJSONFromURL(context.getResources().getString(R.string.Places_JSON));

        if (json != null)
            try {
                JSONArray jsonarray = json.getJSONArray("places");

                for (int i = 0; i < jsonarray.length(); i++) {

                    json = jsonarray.getJSONObject(i);

                    places.add(new Place(
                                    json.getString("id"),
                                    json.getString("location"),
                                    json.getString("sight"),
                                    json.getString("continent"),
                                    json.getString("infoTitle"),
                                    json.getString("info"),
                                    json.getString("creditsTitle"),
                                    json.getString("creditsDesc"),
                                    json.getString("credits"),
                                    json.getString("description"),
                                    json.getString("url")
                    ));
                }

                Places.createPlaceList(places);

            } catch (JSONException ignored) {

            }

        return null;
    }

    @Override
    protected void onPostExecute(Void args) {
        Log.d(TAG, "Task took " + String.valueOf((System.currentTimeMillis() - startTime) / 1000) + " seconds");

        FragmentPlaces.updateLayout(false, null);

        if (FragmentPlaces.mRefreshLayout != null)
        FragmentPlaces.mRefreshLayout.setRefreshing(false);

        FragmentPlaces.mRecyclerView.setVisibility(View.VISIBLE);

        FragmentBookmarks.loadBookmarks(context);
    }



}


<commit_msg>Umbenennung. Von "location" zu "place". Gleiche Umbenennung wurde in der JSOn vorgenommen.<commit_after>package com.mk.places.threads;

import android.app.Activity;
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;

import com.mk.places.R;
import com.mk.places.fragment.FragmentBookmarks;
import com.mk.places.fragment.FragmentPlaces;
import com.mk.places.models.Place;
import com.mk.places.models.Places;
import com.mk.places.utilities.JSONParser;

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

import java.util.ArrayList;

public class ParsePlacesJSON extends AsyncTask<Void, Void, Void> {

    private final static ArrayList<Place> places = new ArrayList<>();
    private long startTime;
    private Activity context;
    private static final String TAG = "ParsePlacesJSON";

    public ParsePlacesJSON(Activity context) {
        this.context = context;
    }

    @Override
    protected void onPreExecute() {
        Places.clearList();
        startTime = System.currentTimeMillis();
    }

    @Override
    protected Void doInBackground(Void... params) {

        JSONObject json = JSONParser.getJSONFromURL(context.getResources().getString(R.string.Places_JSON));

        if (json != null)
            try {
                JSONArray jsonarray = json.getJSONArray("places");

                for (int i = 0; i < jsonarray.length(); i++) {

                    json = jsonarray.getJSONObject(i);

                    places.add(new Place(
                                    json.getString("id"),
                                    json.getString("place"),
                                    json.getString("sight"),
                                    json.getString("continent"),
                                    json.getString("infoTitle"),
                                    json.getString("info"),
                                    json.getString("creditsTitle"),
                                    json.getString("creditsDesc"),
                                    json.getString("credits"),
                                    json.getString("description"),
                                    json.getString("url")
                    ));
                }

                Places.createPlaceList(places);

            } catch (JSONException ignored) {

            }

        return null;
    }

    @Override
    protected void onPostExecute(Void args) {
        Log.d(TAG, "Task took " + String.valueOf((System.currentTimeMillis() - startTime) / 1000) + " seconds");

        FragmentPlaces.updateLayout(false, null);

        if (FragmentPlaces.mRefreshLayout != null)
        FragmentPlaces.mRefreshLayout.setRefreshing(false);

        FragmentPlaces.mRecyclerView.setVisibility(View.VISIBLE);

        FragmentBookmarks.loadBookmarks(context);
    }



}



{'fraction_non_alphanumeric': 0.10176991150442478, 'fraction_numerical': 0.0017699115044247787, 'mean_word_length': 1.8411261940673704, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415386', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1390, 'n_words': 273}