blob: 43830fbe6a1eac064bac6b81ad7fa43cec4df26f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
package com.livio.sdl.enums;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
/**
* Used in the Show command, the text alignment input tells the head-unit how
* to align the text that is being updated in the Show command.
*
* @see TextAlignment
*
* @author Mike Burke
*
*/
public enum SdlTextAlignment {
/**
* No change in alignment.
*/
NO_SELECTION("No selection"),
/**
* Text aligned left.
*/
LEFT_ALIGNED("Left-align"),
/**
* Text aligned right.
*/
RIGHT_ALIGNED("Right-align"),
/**
* Text aligned centered.
*/
CENTERED("Center"),
;
private final String READABLE_NAME;
private SdlTextAlignment(String readableName){
this.READABLE_NAME = readableName;
}
/**
* Translates the input TextAlignment object into an SdlTextAlignment object.
*
* @param input The TextAlignment object to translate
* @return The associated SdlTextAlignment object
*/
public static SdlTextAlignment translateFromLegacy(TextAlignment input){
switch(input){
case LEFT_ALIGNED:
return LEFT_ALIGNED;
case RIGHT_ALIGNED:
return RIGHT_ALIGNED;
case CENTERED:
return CENTERED;
default:
return null;
}
}
/**
* Translates the input SdlTextAlignment object into a TextAlignment object.
*
* @param input The SdlTextAlignment object to translate
* @return The associated TextAlignment object
*/
public static TextAlignment translateToLegacy(SdlTextAlignment input){
switch(input){
case LEFT_ALIGNED:
return TextAlignment.LEFT_ALIGNED;
case RIGHT_ALIGNED:
return TextAlignment.RIGHT_ALIGNED;
case CENTERED:
return TextAlignment.CENTERED;
default:
return null;
}
}
@Override
public String toString(){
return this.READABLE_NAME;
}
}
|