Skip to content

Commit 3b4e3cf

Browse files
committed
Add some help text when the service is started
1 parent eda2de1 commit 3b4e3cf

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

app/src/main/java/org/cgutman/usbip/config/UsbIpConfig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
public class UsbIpConfig extends ComponentActivity {
2525
private Button serviceButton;
2626
private TextView serviceStatus;
27+
private TextView serviceReadyText;
2728

2829
private boolean running;
2930

@@ -37,10 +38,12 @@ private void updateStatus() {
3738
if (running) {
3839
serviceButton.setText("Stop Service");
3940
serviceStatus.setText("USB/IP Service Running");
41+
serviceReadyText.setText(R.string.ready_text);
4042
}
4143
else {
4244
serviceButton.setText("Start Service");
4345
serviceStatus.setText("USB/IP Service Stopped");
46+
serviceReadyText.setText("");
4447
}
4548
}
4649

@@ -60,8 +63,9 @@ protected void onCreate(Bundle savedInstanceState) {
6063
super.onCreate(savedInstanceState);
6164
setContentView(R.layout.activity_usbip_config);
6265

63-
serviceButton = (Button) findViewById(R.id.serviceButton);
64-
serviceStatus = (TextView) findViewById(R.id.serviceStatus);
66+
serviceButton = findViewById(R.id.serviceButton);
67+
serviceStatus = findViewById(R.id.serviceStatus);
68+
serviceReadyText = findViewById(R.id.serviceReadyText);
6569

6670
running = isMyServiceRunning(UsbIpService.class);
6771

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@
1212
android:layout_height="wrap_content"
1313
android:layout_centerHorizontal="true"
1414
android:textAppearance="?android:attr/textAppearanceLarge" />
15+
1516
<Button
1617
android:id="@+id/serviceButton"
1718
android:layout_width="wrap_content"
1819
android:layout_height="wrap_content"
1920
android:layout_below="@+id/serviceStatus"
2021
android:layout_centerHorizontal="true" />
21-
22+
23+
<TextView
24+
android:id="@+id/serviceReadyText"
25+
android:layout_width="wrap_content"
26+
android:layout_height="wrap_content"
27+
android:layout_centerVertical="true"
28+
android:layout_centerHorizontal="true"
29+
android:gravity="center"
30+
android:textAppearance="?android:attr/textAppearanceLarge" />
31+
2232
</RelativeLayout>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
<string name="app_name">USB/IP Server</string>
44
<string name="service_name">USB/IP Server Service</string>
5-
5+
6+
<string name="ready_text">Claim a USB device from your USB/IP client to get started!</string>
67
</resources>

0 commit comments

Comments
 (0)