// Path: app/src/main/java/com/jaus/albertogiunta/justintrain_oraritreni/utils/helpers/DatabaseHelper.java
// public class DatabaseHelper {
// 
//     public static List<String> getAll() {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAll())
//                 .map(Station::getNameFancy).collect(Collectors.toList());
//     }
// 
// 
//     public static List<String> getElementByNameFancy(String stationName) {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAllByNameFancy("" + stationName + "%", "%_" + stationName + "%"))
//                 .map(Station::getNameFancy).collect(Collectors.toList());
//     }
// 
//     public static List<String> getElementByNameShort(String stationName) {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAllByNameShort(stationName))
//                 .map(Station::getNameLong).collect(Collectors.toList());
//     }
// 
//     public static boolean isThisJourneyPreferred(PreferredStation departureStation, PreferredStation arrivalStation, Context context) {
//         return departureStation != null &&
//                 arrivalStation != null &&
//                 PreferredStationsPreferences.isJourneyAlreadyPreferred(
//                         context,
//                         departureStation,
//                         arrivalStation);
//     }
// 
//     public static boolean isStationNameValid(String stationName) {
//         return MyApplication.database.stationDao().isStationNameValid(stationName);
//     }
// 
//     public static Station getStation4DatabaseObject(String stationName) {
//         return MyApplication.database.stationDao().getByWhateverName(stationName);
//     }
// }


import com.google.firebase.crash.FirebaseCrash;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.jaus.albertogiunta.justintrain_oraritreni.R;
import com.jaus.albertogiunta.justintrain_oraritreni.utils.helpers.DatabaseHelper;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.jaus.albertogiunta.justintrain_oraritreni.journeySearch;







public class StationSearchActivity extends AppCompatActivity implements SearchedStationsAdapter.OnClickListener {

    @BindView(R.id.rv_searched_stations) RecyclerView rvSearchedStations;
    SearchedStationsAdapter adapter;
// Path: app/src/main/java/com/jaus/albertogiunta/justintrain_oraritreni/utils/helpers/DatabaseHelper.java
// public class DatabaseHelper {
// 
//     public static List<String> getAll() {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAll())
//                 .map(Station::getNameFancy).collect(Collectors.toList());
//     }
// 
// 
//     public static List<String> getElementByNameFancy(String stationName) {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAllByNameFancy("" + stationName + "%", "%_" + stationName + "%"))
//                 .map(Station::getNameFancy).collect(Collectors.toList());
//     }
// 
//     public static List<String> getElementByNameShort(String stationName) {
//         return Stream
//                 .of(MyApplication.database.stationDao().getAllByNameShort(stationName))
//                 .map(Station::getNameLong).collect(Collectors.toList());
//     }
// 
//     public static boolean isThisJourneyPreferred(PreferredStation departureStation, PreferredStation arrivalStation, Context context) {
//         return departureStation != null &&
//                 arrivalStation != null &&
//                 PreferredStationsPreferences.isJourneyAlreadyPreferred(
//                         context,
//                         departureStation,
//                         arrivalStation);
//     }
// 
//     public static boolean isStationNameValid(String stationName) {
//         return MyApplication.database.stationDao().isStationNameValid(stationName);
//     }
// 
//     public static Station getStation4DatabaseObject(String stationName) {
//         return MyApplication.database.stationDao().getByWhateverName(stationName);
//     }
// }


// Path: app/src/main/java/com/jaus/albertogiunta/justintrain_oraritreni/journeySearch/StationSearchActivity.java
import com.google.firebase.crash.FirebaseCrash;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.jaus.albertogiunta.justintrain_oraritreni.R;
import com.jaus.albertogiunta.justintrain_oraritreni.utils.helpers.DatabaseHelper;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;

package com.jaus.albertogiunta.justintrain_oraritreni.journeySearch;







public class StationSearchActivity extends AppCompatActivity implements SearchedStationsAdapter.OnClickListener {

    @BindView(R.id.rv_searched_stations) RecyclerView rvSearchedStations;
    SearchedStationsAdapter adapter;
    List<String> stationNames = new LinkedList<>(DatabaseHelper.getAll());