Skip to content

Commit

Permalink
Add some help text when the service is started
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed May 14, 2024
1 parent eda2de1 commit 3b4e3cf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/org/cgutman/usbip/config/UsbIpConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class UsbIpConfig extends ComponentActivity {
private Button serviceButton;
private TextView serviceStatus;
private TextView serviceReadyText;

private boolean running;

Expand All @@ -37,10 +38,12 @@ private void updateStatus() {
if (running) {
serviceButton.setText("Stop Service");
serviceStatus.setText("USB/IP Service Running");
serviceReadyText.setText(R.string.ready_text);
}
else {
serviceButton.setText("Start Service");
serviceStatus.setText("USB/IP Service Stopped");
serviceReadyText.setText("");
}
}

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

serviceButton = (Button) findViewById(R.id.serviceButton);
serviceStatus = (TextView) findViewById(R.id.serviceStatus);
serviceButton = findViewById(R.id.serviceButton);
serviceStatus = findViewById(R.id.serviceStatus);
serviceReadyText = findViewById(R.id.serviceReadyText);

running = isMyServiceRunning(UsbIpService.class);

Expand Down
12 changes: 11 additions & 1 deletion app/src/main/res/layout/activity_usbip_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge" />

<Button
android:id="@+id/serviceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/serviceStatus"
android:layout_centerHorizontal="true" />


<TextView
android:id="@+id/serviceReadyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

<string name="app_name">USB/IP Server</string>
<string name="service_name">USB/IP Server Service</string>


<string name="ready_text">Claim a USB device from your USB/IP client to get started!</string>
</resources>

0 comments on commit 3b4e3cf

Please sign in to comment.