<commit_before>package com.example.android.sunshine.app;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

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

public class ForecastFragment extends Fragment {
    static String LOG_TAG = ForecastFragment.class.getSimpleName();

    private static final Double LEMPALA_LAT = 61.31323;
    private static final Double LEMPALA_LON = 23.75497;
    private List<String> weatherData = new ArrayList<>();
    private ArrayAdapter<String> forecastAdaptor;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        setHasOptionsMenu(true);

        Context context = getActivity();

        forecastAdaptor = new ArrayAdapter<>(
                context,
                R.layout.list_item_forecast,
                R.id.list_item_forecast_textview,
                weatherData);

        ListView listViewForecast = rootView.findViewById(R.id.listview_forecast);
        listViewForecast.setAdapter(forecastAdaptor);

        // Trigger initial weather data fetch
        fetchWeatherData();

        return rootView;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.forecastfragment, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case R.id.action_refresh:
                fetchWeatherData();

                return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void fetchWeatherData() {
        WeatherFetchingTask weatherFetcher = new WeatherFetchingTask(forecastAdaptor);
        weatherFetcher.execute(LEMPALA_LAT, LEMPALA_LON);
    }
}
<commit_msg>Lesson 3.5: show clicked weather item<commit_after>package com.example.android.sunshine.app;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

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

public class ForecastFragment extends Fragment {
    static String LOG_TAG = ForecastFragment.class.getSimpleName();

    private static final Double LEMPALA_LAT = 61.31323;
    private static final Double LEMPALA_LON = 23.75497;
    private List<String> weatherData = new ArrayList<>();
    private ArrayAdapter<String> forecastAdaptor;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        setHasOptionsMenu(true);

        final Context context = getActivity();

        forecastAdaptor = new ArrayAdapter<>(
                context,
                R.layout.list_item_forecast,
                R.id.list_item_forecast_textview,
                weatherData);

        final ListView listViewForecast = rootView.findViewById(R.id.listview_forecast);
        listViewForecast.setAdapter(forecastAdaptor);
        listViewForecast.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                String item = forecastAdaptor.getItem(position);
                Toast.makeText(context, "Got clicked @ " + item, Toast.LENGTH_SHORT).show();
            }
        });

        // Trigger initial weather data fetch
        fetchWeatherData();

        return rootView;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.forecastfragment, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case R.id.action_refresh:
                fetchWeatherData();

                return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void fetchWeatherData() {
        WeatherFetchingTask weatherFetcher = new WeatherFetchingTask(forecastAdaptor);
        weatherFetcher.execute(LEMPALA_LAT, LEMPALA_LON);
    }
}

{'fraction_non_alphanumeric': 0.08213256484149856, 'fraction_numerical': 0.006587072869493619, 'mean_word_length': 2.982786885245902, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2406221', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1312, 'n_words': 284}