<commit_before>package fi.salminen.tomy.peak.fragment.tracking;


import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.MapStyleOptions;
import com.raizlabs.android.dbflow.runtime.FlowContentObserver;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import fi.salminen.tomy.peak.R;
import fi.salminen.tomy.peak.app.PeakApplication;
import fi.salminen.tomy.peak.core.BaseFragment;
import fi.salminen.tomy.peak.inject.fragment.BaseFragmentModule;
import fi.salminen.tomy.peak.inject.fragment.ForFragment;
import fi.salminen.tomy.peak.util.JsonValidator;
import fi.salminen.tomy.peak.util.MarkerManager;
import fi.salminen.tomy.peak.util.icons.MarkerIconModule;
import fi.salminen.tomy.peak.viewmodels.MarkerTag;


public class TrackingFragment extends BaseFragment<TrackingFragmentComponent> implements OnMapReadyCallback {
    @BindView(R.id.mapView)
    MapView mMapView;

    @BindView(R.id.mapFragmentRoot)
    View root;

    @Inject
    @ForFragment
    Context context;

    @Inject
    JsonValidator validator;

    @Inject
    FlowContentObserver fco;

    @Inject
    MarkerManager mMarkerManager;

    private GoogleMap mMap;
    private Unbinder mUnbinder;
    private String mMapStyleJson;

    public TrackingFragment() {
        // Required empty public constructor
    }

    @Override
    public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
        super.onInflate(context, attrs, savedInstanceState);
        TypedArray mAttrs = context.obtainStyledAttributes(attrs, R.styleable.TrackingFragment);
        mMapStyleJson = mAttrs.getString(R.styleable.TrackingFragment_map_style);
        mAttrs.recycle();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View layout = inflater.inflate(R.layout.fragment_map, container, false);
        mUnbinder = ButterKnife.bind(this, layout);
        mMapView.onCreate(savedInstanceState);
        mMapView.onResume(); // To display map instantly
        mMapView.getMapAsync(this);
        return layout;
    }


    @NonNull
    @Override
    protected TrackingFragmentComponent createComponent() {
        return DaggerTrackingFragmentComponent.builder()
                .baseFragmentModule(new BaseFragmentModule(this))
                .markerIconModule(new MarkerIconModule())
                .peakApplicationComponent(PeakApplication.getApplication(getActivity()).component())
                .build();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mUnbinder.unbind();
        mMarkerManager.dispose();
    }

    @Override
    public void inject() {
        component().inject(this);
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        // TODO Disable bottom right controls
        this.mMap = googleMap;
        mMarkerManager.manage(mMap);
        styleMap(mMap, mMapStyleJson);
        mMap.setOnMarkerClickListener(marker -> {
            String text = ((MarkerTag) marker.getTag()).getInfoText();
            Snackbar.make(root, text, Snackbar.LENGTH_INDEFINITE).show();
            // Return false so default behaviour may occur
            return false;
        });
    }<commit_msg>Changed snackbar display time from indefinete to long<commit_after>package fi.salminen.tomy.peak.fragment.tracking;


import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.MapStyleOptions;
import com.raizlabs.android.dbflow.runtime.FlowContentObserver;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import fi.salminen.tomy.peak.R;
import fi.salminen.tomy.peak.app.PeakApplication;
import fi.salminen.tomy.peak.core.BaseFragment;
import fi.salminen.tomy.peak.inject.fragment.BaseFragmentModule;
import fi.salminen.tomy.peak.inject.fragment.ForFragment;
import fi.salminen.tomy.peak.util.JsonValidator;
import fi.salminen.tomy.peak.util.MarkerManager;
import fi.salminen.tomy.peak.util.icons.MarkerIconModule;
import fi.salminen.tomy.peak.viewmodels.MarkerTag;


public class TrackingFragment extends BaseFragment<TrackingFragmentComponent> implements OnMapReadyCallback {
    @BindView(R.id.mapView)
    MapView mMapView;

    @BindView(R.id.mapFragmentRoot)
    View root;

    @Inject
    @ForFragment
    Context context;

    @Inject
    JsonValidator validator;

    @Inject
    FlowContentObserver fco;

    @Inject
    MarkerManager mMarkerManager;

    private GoogleMap mMap;
    private Unbinder mUnbinder;
    private String mMapStyleJson;

    public TrackingFragment() {
        // Required empty public constructor
    }

    @Override
    public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
        super.onInflate(context, attrs, savedInstanceState);
        TypedArray mAttrs = context.obtainStyledAttributes(attrs, R.styleable.TrackingFragment);
        mMapStyleJson = mAttrs.getString(R.styleable.TrackingFragment_map_style);
        mAttrs.recycle();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View layout = inflater.inflate(R.layout.fragment_map, container, false);
        mUnbinder = ButterKnife.bind(this, layout);
        mMapView.onCreate(savedInstanceState);
        mMapView.onResume(); // To display map instantly
        mMapView.getMapAsync(this);
        return layout;
    }


    @NonNull
    @Override
    protected TrackingFragmentComponent createComponent() {
        return DaggerTrackingFragmentComponent.builder()
                .baseFragmentModule(new BaseFragmentModule(this))
                .markerIconModule(new MarkerIconModule())
                .peakApplicationComponent(PeakApplication.getApplication(getActivity()).component())
                .build();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mUnbinder.unbind();
        mMarkerManager.dispose();
    }

    @Override
    public void inject() {
        component().inject(this);
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        // TODO Disable bottom right controls
        this.mMap = googleMap;
        mMarkerManager.manage(mMap);
        styleMap(mMap, mMapStyleJson);
        mMap.setOnMarkerClickListener(marker -> {
            String text = ((MarkerTag) marker.getTag()).getInfoText();
            Snackbar.make(root, text, Snackbar.LENGTH_LONG).show();
            // Return false so default behaviour may occur
            return false;
        });
    }
{'fraction_non_alphanumeric': 0.09285714285714286, 'fraction_numerical': 0.0, 'mean_word_length': 3.5059594755661503, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5714199', 'n_tokens_mistral': 2254, 'n_tokens_neox': 2171, 'n_words': 405}