Pending changes

This commit is contained in:
Adrian Rumpold
2017-12-21 09:48:11 +01:00
parent d428d46f8d
commit 0f3ce17384
7 changed files with 24 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.1" buildToolsVersion "27.0.2"
defaultConfig { defaultConfig {
applicationId "de.rumpold.androiddsky" applicationId "de.rumpold.androiddsky"

View File

@@ -90,7 +90,7 @@ public class AgcPacket {
return dataCode; return dataCode;
} }
public int getIoPort() { public int getIoChannel() {
return ioPort; return ioPort;
} }

View File

@@ -13,9 +13,10 @@ import de.rumpold.androiddsky.DSKY;
/** /**
* Created by Adriano on 17.05.2016. * Created by Adriano on 17.05.2016.
*/ */
@SuppressWarnings("OctalInteger")
public class YaAgcClient { public class YaAgcClient {
private static final String YAAGC_HOST = "192.168.178.67"; private static final String YAAGC_HOST = "192.168.178.29";
private static final int YAAGC_SERVER_PORT = 19698; private static final int YAAGC_SERVER_PORT = 19697;
private static final String TAG = YaAgcClient.class.getSimpleName(); private static final String TAG = YaAgcClient.class.getSimpleName();
private static final int KEYBOARD_CHANNEL = 015; private static final int KEYBOARD_CHANNEL = 015;
@@ -69,11 +70,14 @@ public class YaAgcClient {
public void connect() throws IOException { public void connect() throws IOException {
agcChannel = SocketChannel.open(); agcChannel = SocketChannel.open();
agcChannel.connect(new InetSocketAddress(YAAGC_HOST, YAAGC_SERVER_PORT)); boolean success = agcChannel.connect(new InetSocketAddress(YAAGC_HOST, YAAGC_SERVER_PORT));
if (success) {
Log.i(TAG, "connect: Successfully connected, starting DSKY I/O handler");
handler = new Thread(new DSKYHandler(), "DSKY I/O Handler"); handler = new Thread(new DSKYHandler(), "DSKY I/O Handler");
handler.start(); handler.start();
} }
}
public void disconnect() throws IOException { public void disconnect() throws IOException {
if (handler != null) { if (handler != null) {
@@ -150,7 +154,7 @@ public class YaAgcClient {
return; return;
} }
switch (packet.getIoPort()) { switch (packet.getIoChannel()) {
case 010: case 010:
handleChannel10(packet); handleChannel10(packet);
break; break;
@@ -158,6 +162,9 @@ public class YaAgcClient {
case 011: case 011:
handleChannel11(packet); handleChannel11(packet);
break; break;
default:
return;
} }
// Update register sign indicator displays // Update register sign indicator displays

View File

@@ -29,6 +29,7 @@ public class DSKYActivity extends AppCompatActivity {
private int rightActiveColor; private int rightActiveColor;
private int activeColor; private int activeColor;
private int passiveColor; private int passiveColor;
private int compActyColor;
public void updateIndicator(@IdRes final int id, final boolean state) { public void updateIndicator(@IdRes final int id, final boolean state) {
mViewHandler.post(new Runnable() { mViewHandler.post(new Runnable() {
@@ -43,6 +44,8 @@ public class DSKYActivity extends AppCompatActivity {
final int color; final int color;
if ("right".equals(indicator.getTag())) { if ("right".equals(indicator.getTag())) {
color = rightActiveColor; color = rightActiveColor;
} else if ("comp acty".equals(indicator.getTag())) {
color = compActyColor;
} else { } else {
color = activeColor; color = activeColor;
} }
@@ -74,6 +77,7 @@ public class DSKYActivity extends AppCompatActivity {
rightActiveColor = getResources().getColor(R.color.indicatorRightActive); rightActiveColor = getResources().getColor(R.color.indicatorRightActive);
activeColor = getResources().getColor(R.color.indicatorActive); activeColor = getResources().getColor(R.color.indicatorActive);
passiveColor = getResources().getColor(R.color.indicatorPassive); passiveColor = getResources().getColor(R.color.indicatorPassive);
compActyColor = getResources().getColor(R.color.compActy);
createButtonListeners(); createButtonListeners();
} }

View File

@@ -14,6 +14,7 @@
android:width="96dp" android:width="96dp"
android:height="96dp" android:height="96dp"
android:text="@string/comp_acty" android:text="@string/comp_acty"
android:tag="comp acty"
android:textAppearance="?android:attr/textAppearanceLarge" /> android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout <LinearLayout

View File

@@ -4,8 +4,10 @@
<color name="colorPrimaryDark">#303F9F</color> <color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color> <color name="colorAccent">#FF4081</color>
<color name="segmentActive">#78e143</color>
<color name="compActy">@color/segmentActive</color>
<color name="indicatorPassive">#e0e0e0</color> <color name="indicatorPassive">#e0e0e0</color>
<color name="indicatorActive">#78e143</color> <color name="indicatorActive">#ffffff</color>
<color name="indicatorRightActive">#ffd35c</color> <color name="indicatorRightActive">#ffd35c</color>
<color name="black_overlay">#66000000</color> <color name="black_overlay">#66000000</color>

View File

@@ -68,7 +68,7 @@
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:fontFamily">monospace</item> <item name="android:fontFamily">monospace</item>
<item name="android:textSize">64sp</item> <item name="android:textSize">64sp</item>
<item name="android:textColor">@color/indicatorActive</item> <item name="android:textColor">@color/segmentActive</item>
<item name="android:layout_gravity">center_horizontal</item> <item name="android:layout_gravity">center_horizontal</item>
</style> </style>
</resources> </resources>