Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit 801c1b6

Browse files
committed
v3.19 with 28 function buttons
1 parent 42b3dd3 commit 801c1b6

File tree

8 files changed

+111
-8
lines changed

8 files changed

+111
-8
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.ecos.train"
99
minSdkVersion 24
1010
targetSdkVersion 25
11-
versionCode 546
12-
versionName "3.18"
11+
versionCode 557
12+
versionName "3.19"
1313
}
1414

1515

@@ -32,5 +32,5 @@ android {
3232
}
3333

3434
dependencies {
35-
compile 'com.android.support:appcompat-v7:25.2.0'
35+
compile 'com.android.support:appcompat-v7:25.3.1'
3636
}

app/src/main/java/com/ecos/train/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class Settings {
2020
public static final int SPEED_MIN = 0;
2121
public static final int SPEED_MAX = 127;
2222
public static final int SPEED_STEP = 10;
23-
public static final int FUNCTION_BUTTONS = 24;
23+
public static final int FUNCTION_BUTTONS = 28;
2424

2525
public static boolean sortById = false;
2626
public static String protocolVersion = "0.2";

app/src/main/java/com/ecos/train/TCPWrite.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ public void stopClient(){
5252

5353
public void run() {
5454
mRun = true;
55+
String m;
5556
while (mRun) {
5657

5758
synchronized(lstMessage) {
5859
while(!lstMessage.isEmpty()) {
59-
String m = (String) lstMessage.poll();
60+
m = (String) lstMessage.poll();
6061
if (m != null) {
6162
sendTCP(m);
6263
}
@@ -121,6 +122,10 @@ public void getTrainButtonStateF16F23(int id) {
121122
sendMessage("get("+id+",func[16],func[17],func[18],func[19]," +
122123
"func[20],func[21],func[22],func[23])");
123124
}
125+
126+
public void getTrainButtonStateF24F27(int id) {
127+
sendMessage("get("+id+",func[24],func[25],func[26],func[27])");
128+
}
124129

125130
public void setButton(int id, int i, boolean enabled) {
126131
int value = (enabled) ? 1 : 0;
@@ -169,6 +174,11 @@ public void getButtonNameF16F23(int id) {
169174
sendMessage("get("+id+", funcexists[16], " +
170175
"funcexists[17], funcexists[18], funcexists[19], funcexists[20], funcexists[21], funcexists[22], funcexists[23])");
171176
}
177+
178+
public void getButtonNameF24F27(int id) {
179+
sendMessage("get("+id+", funcexists[24], " +
180+
"funcexists[25], funcexists[26], funcexists[27])");
181+
}
172182

173183
public void delete(int id) {
174184
sendMessage("delete("+id+")");

app/src/main/java/com/ecos/train/activity/MainActivity.java

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public void onCreate(Bundle savedInstanceState) {
174174

175175
((TextView) findViewById(R.id.tvF8_F15)).setOnClickListener(this);
176176
((TextView) findViewById(R.id.tvF16_F23)).setOnClickListener(this);
177+
((TextView) findViewById(R.id.tvF24_F27)).setOnClickListener(this);
177178

178179
pref = PreferenceManager.getDefaultSharedPreferences(this);
179180
Settings.fullVersion = true; //checkSig(this);
@@ -206,6 +207,7 @@ public void onCreate(Bundle savedInstanceState) {
206207

207208
displayArrow(R.id.tvF8_F15, "down");
208209
displayArrow(R.id.tvF16_F23, "down");
210+
displayArrow(R.id.tvF24_F27, "down");
209211

210212
activity = this;
211213

@@ -320,6 +322,24 @@ else if(v.getId() == R.id.tvF16_F23) {
320322
mTcpWrite.getTrainButtonStateF16F23(Settings.getCurrentTrain().getId());
321323
}
322324
}
325+
//click on F24-F27 banner
326+
else if(v.getId() == R.id.tvF24_F27) {
327+
LinearLayout l = (LinearLayout) findViewById(R.id.llF24_F27);
328+
if(l.getVisibility() == LinearLayout.VISIBLE) {
329+
l.setVisibility(LinearLayout.GONE);
330+
displayArrow(R.id.tvF24_F27, "down");
331+
}
332+
else {
333+
if(!connected) {
334+
return;
335+
}
336+
337+
l.setVisibility(LinearLayout.VISIBLE);
338+
displayArrow(R.id.tvF24_F27, "up");
339+
340+
mTcpWrite.getTrainButtonStateF24F27(Settings.getCurrentTrain().getId());
341+
}
342+
}
323343
//click on reverse button
324344
else if(v.getId() == R.id.cbReverse) {
325345
mTcpWrite.setDir(Settings.getCurrentTrain().getId(),((ToggleButton) v).isChecked()?1:0);
@@ -437,7 +457,7 @@ public void onClick(DialogInterface dialog, int which) {
437457

438458
try {
439459
PackageInfo manager = getPackageManager().getPackageInfo(getPackageName(), 0);
440-
ecosVersion.setText(manager.versionName);
460+
ecosVersion.setText(manager.versionName + " - build " + manager.versionCode);
441461
} catch (Exception e) { }
442462

443463
return true;
@@ -592,10 +612,11 @@ public void setStateList(boolean state) {
592612

593613
public void readSocket() {
594614

615+
String m;
595616

596617
synchronized (lstMessage) {
597618
while (!lstMessage.isEmpty()) {
598-
String m = (String) lstMessage.poll();
619+
m = (String) lstMessage.poll();
599620
if (m != null) {
600621
readMessage(m);
601622
}
@@ -716,6 +737,12 @@ else if(respLine[0].equals("<REPLY get("+Settings.getCurrentTrain().getId()+", f
716737
"funcexists[17], funcexists[18], funcexists[19], funcexists[20], funcexists[21], funcexists[22], funcexists[23])>")){
717738
parseButtonSymbol(respLine);
718739
}
740+
//train buttons name response 24-27
741+
else if(respLine[0].equals("<REPLY get("+Settings.getCurrentTrain().getId()+", funcexists[24], " +
742+
"funcexists[25], funcexists[26], funcexists[27])>")){
743+
parseButtonSymbol(respLine);
744+
}
745+
719746
//train buttons response 8-15
720747
else if(respLine[0].equals("<REPLY get("+Settings.getCurrentTrain().getId()+",func[8],func[9],func[10],func[11]," +
721748
"func[12],func[13],func[14],func[15])>")) {
@@ -736,6 +763,16 @@ else if(respLine[0].equals("<REPLY get("+Settings.getCurrentTrain().getId()+",fu
736763
mTcpWrite.getButtonNameF16F23(Settings.getCurrentTrain().getId());
737764
}
738765
}
766+
//train buttons response 24-27
767+
else if(respLine[0].equals("<REPLY get("+Settings.getCurrentTrain().getId()+",func[24],func[25],func[26],func[27])>")) {
768+
769+
parseButtons(respLine);
770+
771+
if(!Settings.protocolVersion.equals("0.1")) {
772+
mTcpWrite.getButtonNameF24F27(Settings.getCurrentTrain().getId());
773+
}
774+
}
775+
739776
//a switching object response
740777
else {
741778
parseTrainsSymbol(respLine);

app/src/main/res/layout/main.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,60 @@
408408
android:state_enabled="false" />
409409
</LinearLayout>
410410
</LinearLayout>
411+
412+
<TextView
413+
android:id="@+id/tvF24_F27"
414+
android:layout_width="wrap_content"
415+
android:layout_height="wrap_content"
416+
android:layout_margin="5dp"
417+
android:layout_weight="1"
418+
android:background="#444242"
419+
android:padding="5dp"
420+
android:text="@string/tv_f24_f27" />
421+
422+
<LinearLayout
423+
android:id="@+id/llF24_F27"
424+
android:layout_width="match_parent"
425+
android:layout_height="wrap_content"
426+
android:layout_weight="1"
427+
android:orientation="vertical"
428+
android:visibility="gone">
429+
430+
<LinearLayout
431+
android:id="@+id/llButtons7"
432+
android:layout_width="match_parent"
433+
android:layout_height="wrap_content"
434+
android:layout_weight="1">
435+
436+
<ToggleButton
437+
android:id="@+id/btnF24"
438+
android:layout_width="0dp"
439+
android:layout_height="wrap_content"
440+
android:layout_weight="1"
441+
android:state_enabled="false" />
442+
443+
<ToggleButton
444+
android:id="@+id/btnF25"
445+
android:layout_width="0dp"
446+
android:layout_height="wrap_content"
447+
android:layout_weight="1"
448+
android:state_enabled="false" />
449+
450+
<ToggleButton
451+
android:id="@+id/btnF26"
452+
android:layout_width="0dp"
453+
android:layout_height="wrap_content"
454+
android:layout_weight="1"
455+
android:state_enabled="false" />
456+
457+
<ToggleButton
458+
android:id="@+id/btnF27"
459+
android:layout_width="0dp"
460+
android:layout_height="wrap_content"
461+
android:layout_weight="1"
462+
android:state_enabled="false" />
463+
</LinearLayout>
464+
</LinearLayout>
411465
</LinearLayout>
412466

413467
<LinearLayout

app/src/main/res/values-fr/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<string name="btn_emergency">Urgence</string>
2323
<string name="tv_f8_f15">F8...F15</string>
2424
<string name="tv_f16_f23">F16...F23</string>
25+
<string name="tv_f24_f27">F24...F27</string>
2526
<string name="btn_pack">Acheter Unlock</string>
2627
<string name="btn_edit">Modifier</string>
2728
<string name="tv_save">Sauvegarder</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<string name="btn_emergency">Emergency</string>
2323
<string name="tv_f8_f15">F8...F15</string>
2424
<string name="tv_f16_f23">F16...F23</string>
25+
<string name="tv_f24_f27">F24...F27</string>
2526
<string name="btn_pack">Buy Unlock</string>
2627
<string name="btn_edit">Edit</string>
2728
<string name="tv_save">Save</string>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.3.0'
7+
classpath 'com.android.tools.build:gradle:2.3.1'
88
}
99
}
1010

0 commit comments

Comments
 (0)