Skip to content

Instantly share code, notes, and snippets.

@vmax
Created July 21, 2016 09:27
Show Gist options
  • Save vmax/fa9dea7e5ee6b92fef9971ee79b546df to your computer and use it in GitHub Desktop.
Save vmax/fa9dea7e5ee6b92fef9971ee79b546df to your computer and use it in GitHub Desktop.
Class that helps converting Moscow Subway line names (in Russian) to their colors
import java.util.HashMap;
import android.graphics.Color;
import android.support.annotation.ColorInt;
/**
* Class that helps converting Moscow Subway line names (in Russian) to their colors
* Based on https://en.wikipedia.org/wiki/Moscow_Metro#Lines
*/
public class MoscowSubwayLineUtil {
static HashMap<String, Integer> colors;
static
{
colors = new HashMap<>();
colors.put("Сокольническая", Color.parseColor("#ED1B35"));
colors.put("Замоскворецкая", Color.parseColor("#44B85C"));
colors.put("Арбатско-Покровская",Color.parseColor("#0078BF"));
colors.put("Филевская",Color.parseColor("#19C1F3"));
colors.put("Кольцевая",Color.parseColor("#894E35"));
colors.put("Калужско-Рижская",Color.parseColor("#F58631"));
colors.put("Таганско-Краснопресненская",Color.parseColor("#8E479C"));
colors.put("Калининско-Солнцевская",Color.parseColor("#FFCB31"));
colors.put("Серпуховско-Тимирязевская",Color.parseColor("#A1A2A3"));
colors.put("Люблинско-Дмитровская",Color.parseColor("#B3D445"));
colors.put("Каховская",Color.parseColor("#79CDCD"));
colors.put("Бутовская",Color.parseColor("#ACBFE1"));
colors.put("Монорельс",Color.parseColor("#2C87C5"));
}
/**
* Get the line's color on scheme
* @param lineName Subway line name in Russian
* @return color of the line
*/
@ColorInt
public static int lineToColor(String lineName)
{
return colors.get(lineName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment