Skip to content

Commit

Permalink
Updated TextViews to show correct friendlyName #57
Browse files Browse the repository at this point in the history
  • Loading branch information
wmamos committed Feb 26, 2023
1 parent 5f7fa75 commit a96e2c8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public class DeviceActivity extends AppCompatActivity {
public ConnectionManager cm;
private Button delete;
private EditText ipAddress;

private TextView notificationsTextView;
private TextView clipboardTextView;
private TextView fileTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -42,6 +44,17 @@ protected void onCreate(Bundle savedInstanceState) {
String serverId = getIntent().getStringExtra("ID");
Server server = MainActivity.serverManager.getServer(UUID.fromString(serverId));

//Setting various TextViews based on the friendly name of the device connected.
String serverFriendlyName = getIntent().getStringExtra("FRIENDLY_NAME");
notificationsTextView = findViewById(R.id.notificationsTextView);
notificationsTextView.setText("Send notifications to " + serverFriendlyName + ".");

clipboardTextView = findViewById(R.id.clipboardTextView);
clipboardTextView.setText("Allow " + serverFriendlyName + " to read and write clipboard data.");

fileTextView = findViewById(R.id.fileTextView);
fileTextView.setText("Allow " + serverFriendlyName + " to send files.");

//Sets the EditText containing the IP address of the server to the correct IP Address.
ipAddress = findViewById(R.id.editIPAddress);
ipAddress.setText(server.ipAddress.getIPAddress());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ public void addNameLine(Server server) {
public void onClick(View view) {
Intent deviceActivity = new Intent(MainActivity.this, DeviceActivity.class);
String id = server.serverId.toString();
String friendlyName = server.friendlyName;
deviceActivity.putExtra("ID", id);
deviceActivity.putExtra("FRIENDLY_NAME", friendlyName);
startActivityForResult(deviceActivity, R.integer.LAUNCH_DEVICE_ACTIVITY);
//Will update above method, this was easier to understand/use for the time being.
//startActivity(deviceActivity);
Expand Down
14 changes: 7 additions & 7 deletions Client/Android/app/src/main/res/layout/activity_device.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
app:layout_constraintBottom_toTopOf="@+id/textView7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/fileTextView"
app:layout_constraintVertical_bias="1.0" />

<CheckBox
Expand All @@ -79,11 +79,11 @@
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView3"
android:id="@+id/notificationsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Send notifications to Desktop-24Sf4"
android:text=""
app:layout_constraintBottom_toTopOf="@+id/checkBox2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.279"
Expand All @@ -102,10 +102,10 @@
app:layout_constraintVertical_bias="0.291" />

<TextView
android:id="@+id/textView5"
android:id="@+id/clipboardTextView"
android:layout_width="254dp"
android:layout_height="43dp"
android:text="Allow Desktop-24Sf4 to read and write clipboard data"
android:text=""
app:layout_constraintBottom_toTopOf="@+id/checkBox3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.331"
Expand Down Expand Up @@ -137,10 +137,10 @@
tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />

<TextView
android:id="@+id/textView6"
android:id="@+id/fileTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Allow Desktop-24Sf4 to send files"
android:text=""
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.26"
app:layout_constraintStart_toStartOf="parent"
Expand Down

0 comments on commit a96e2c8

Please sign in to comment.