From 19ebc13c024defb13c68e4111673f963df01dfa5 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Sun, 16 Aug 2015 22:18:49 +0000 Subject: [PATCH] Add SVG icon file --- app/src/main/java/net/jacekk/bridge/android/BridgeInputExceptionMapper.java | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/jacekk/bridge/android/BridgeInputExceptionMapper.java b/app/src/main/java/net/jacekk/bridge/android/BridgeInputExceptionMapper.java index 7f929c0..d225598 100644 --- a/app/src/main/java/net/jacekk/bridge/android/BridgeInputExceptionMapper.java +++ b/app/src/main/java/net/jacekk/bridge/android/BridgeInputExceptionMapper.java @@ -1,7 +1,25 @@ package net.jacekk.bridge.android; -/** - * Created by jacek on 18.01.15. - */ +import net.jacekk.bridge.BridgeInputException; +import net.jacekk.bridge.R; + +import java.util.HashMap; +import java.util.Map; + public class BridgeInputExceptionMapper { + public static final Map<BridgeInputException.Error, Integer> errorMap; + + static { + errorMap = new HashMap<>(); + errorMap.put(BridgeInputException.Error.CONTRACT_LEVEL_INVALID, R.string.invalid_level); + errorMap.put(BridgeInputException.Error.CONTRACT_SUIT_INVALID, R.string.invalid_color); + errorMap.put(BridgeInputException.Error.CONTRACT_DOUBLE_INVALID, R.string.invalid_contract); + errorMap.put(BridgeInputException.Error.PC_INVALID, R.string.invalid_pc); + errorMap.put(BridgeInputException.Error.TRICKS_INVALID, R.string.invalid_tricks); + errorMap.put(BridgeInputException.Error.PASSES_INVALID, R.string.invalid_passes); + } + + public static int map(BridgeInputException e) { + return errorMap.get(e.getError()); + } } -- Gitblit v1.9.1