mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-07 18:38:48 +00:00
LineView: Show product and operator in line cheat sheet.
This commit is contained in:
parent
b189f07e02
commit
f740de9af0
1 changed files with 11 additions and 3 deletions
|
@ -28,6 +28,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import de.schildbach.oeffi.R;
|
import de.schildbach.oeffi.R;
|
||||||
import de.schildbach.oeffi.util.CheatSheet;
|
import de.schildbach.oeffi.util.CheatSheet;
|
||||||
import de.schildbach.pte.Standard;
|
import de.schildbach.pte.Standard;
|
||||||
|
@ -175,9 +178,14 @@ public class LineView extends TextView {
|
||||||
|
|
||||||
setText(text);
|
setText(text);
|
||||||
if (lines.size() == 1) {
|
if (lines.size() == 1) {
|
||||||
final String name = lines.iterator().next().name;
|
final Line line = lines.iterator().next();
|
||||||
if (name != null)
|
final Context context = getContext();
|
||||||
CheatSheet.setup(this, name);
|
final int productResId = getResources().getIdentifier(
|
||||||
|
"product_" + Character.toLowerCase(line.productCode()), "string", context.getPackageName());
|
||||||
|
final String sheet = Joiner.on('\n').skipNulls().join(line.name,
|
||||||
|
productResId != 0 ? context.getString(productResId) : null, line.network);
|
||||||
|
if (Strings.emptyToNull(sheet) != null)
|
||||||
|
CheatSheet.setup(this, sheet);
|
||||||
else
|
else
|
||||||
CheatSheet.remove(this);
|
CheatSheet.remove(this);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue