<commit_before>package de.refugeehackathon.transit;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedIconOverlay;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;

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

import butterknife.Bind;
import butterknife.ButterKnife;
import de.refugeehackathon.transit.data.api.ApiModule;
import de.refugeehackathon.transit.data.api.PoiService;
import retrofit.Call;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;

public class MapFragment extends Fragment {

    @Bind(R.id.mapview)
    MapView mMapView;

    @Bind(R.id.poiTitle)
    TextView infoTitle;

    @Bind(R.id.poiDescription)
    TextView poiDescription;

    @Bind(R.id.poiInfoContainer)
    ViewGroup infoContainer;

    private PoiService mPoiService;
    public static final GeoPoint BERLIN = new GeoPoint(52.516667, 13.383333);

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.content_main, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        initPoiService();
        setupMapView();

        super.onActivityCreated(savedInstanceState);
    }

    private void addMarkers(List<POI> pois) {
        final DefaultResourceProxyImpl resourceProxy = new DefaultResourceProxyImpl(getActivity().getApplicationContext());
        final ArrayList<OverlayItem> items = new ArrayList<>();

        for (POI poi : pois) {
            double latitude = poi.geometry.getLatitude();
            double longitude = poi.geometry.getLongitude();
            final GeoPoint currentLocation = new GeoPoint(latitude, longitude);
            Properties properties = poi.properties;
            String title = "";
            String description = "";
            POIType poitype = POIType.UNKNOWN;
            if (properties != null) {
                title = properties.name;
                description = properties.description;
                poitype = properties.poitype;
            }
            final OverlayItem myLocationOverlayItem = new OverlayItem(title, description, currentLocation);

            final Drawable myCurrentLocationMarker = getResources().getDrawable(getDrawableForType(poitype));

            myLocationOverlayItem.setMarker(myCurrentLocationMarker);
            items.add(myLocationOverlayItem);
        }

        ItemizedIconOverlay currentLocationOverlay = new ItemizedIconOverlay<>(items,
                new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
                    public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
                        infoContainer.setVisibility(View.VISIBLE);
                        if (item.getTitle()!=null) {
                            infoTitle.setText(Html.fromHtml(item.getTitle()));
                        }
                        if (item.getSnippet()!=null) {
                            poiDescription.setText(Html.fromHtml(item.getSnippet()));
                        }
                        return true;
                    }

                    public boolean onItemLongPress(final int index, final OverlayItem item) {
                        return true;
                    }
                }, resourceProxy);

        mMapView.getOverlays().add(currentLocationOverlay);
        mMapView.getOverlays().add(new Overlay(getContext()) {
            @Override
            protected void draw(Canvas c, MapView osmv, boolean shadow) {

            }
<commit_msg>Hide text views in POI info container layout when no text is given.<commit_after>package de.refugeehackathon.transit;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ItemizedIconOverlay;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;

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

import butterknife.Bind;
import butterknife.ButterKnife;
import de.refugeehackathon.transit.data.api.ApiModule;
import de.refugeehackathon.transit.data.api.PoiService;
import retrofit.Call;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;

public class MapFragment extends Fragment {

    @Bind(R.id.mapview)
    MapView mMapView;

    @Bind(R.id.poiTitle)
    TextView infoTitle;

    @Bind(R.id.poiDescription)
    TextView poiDescription;

    @Bind(R.id.poiInfoContainer)
    ViewGroup infoContainer;

    private PoiService mPoiService;
    public static final GeoPoint BERLIN = new GeoPoint(52.516667, 13.383333);

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.content_main, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        initPoiService();
        setupMapView();

        super.onActivityCreated(savedInstanceState);
    }

    private void addMarkers(List<POI> pois) {
        final DefaultResourceProxyImpl resourceProxy = new DefaultResourceProxyImpl(getActivity().getApplicationContext());
        final ArrayList<OverlayItem> items = new ArrayList<>();

        for (POI poi : pois) {
            double latitude = poi.geometry.getLatitude();
            double longitude = poi.geometry.getLongitude();
            final GeoPoint currentLocation = new GeoPoint(latitude, longitude);
            Properties properties = poi.properties;
            String title = "";
            String description = "";
            POIType poitype = POIType.UNKNOWN;
            if (properties != null) {
                title = properties.name;
                description = properties.description;
                poitype = properties.poitype;
            }
            final OverlayItem myLocationOverlayItem = new OverlayItem(title, description, currentLocation);

            final Drawable myCurrentLocationMarker = getResources().getDrawable(getDrawableForType(poitype));

            myLocationOverlayItem.setMarker(myCurrentLocationMarker);
            items.add(myLocationOverlayItem);
        }

        ItemizedIconOverlay currentLocationOverlay = new ItemizedIconOverlay<>(items,
                new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
                    public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
                        infoContainer.setVisibility(View.VISIBLE);
                        String title = item.getTitle();
                        if (TextUtils.isEmpty(title)) {
                            infoTitle.setVisibility(View.GONE);

                        } else {
                            infoTitle.setText(Html.fromHtml(title));
                            infoTitle.setVisibility(View.VISIBLE);
                        }
                        String description = item.getSnippet();
                        if (TextUtils.isEmpty(description)) {
                            poiDescription.setVisibility(View.GONE);
                        } else {
                            poiDescription.setText(Html.fromHtml(description));
                            poiDescription.setVisibility(View.VISIBLE);
                        }
                        return true;
                    }

                    public boolean onItemLongPress(final int index, final OverlayItem item) {
                        return true;
                    }
                }, resourceProxy);

        mMapView.getOverlays().add(currentLocationOverlay);
        mMapView.getOverlays().add(new Overlay(getContext()) {
            @Override
            protected void draw(Canvas c, MapView osmv, boolean shadow) {

            }

{'fraction_non_alphanumeric': 0.08430296377607026, 'fraction_numerical': 0.0037321624588364435, 'mean_word_length': 2.541002720559658, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6887955', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2349, 'n_words': 472}