Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions sensorhub-android-app/res/layout/activity_edit_server_profile.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/md_theme_background"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/edit_profile_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/edit_profile_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/toolbar_bg"
app:titleTextColor="@color/toolbar_title"
app:navigationIcon="@drawable/ic_arrow_back" />

</com.google.android.material.appbar.AppBarLayout>
android:layout_height="?attr/actionBarSize"
android:background="@color/toolbar_bg"
app:titleTextColor="@color/toolbar_title"
app:navigationIcon="@drawable/ic_arrow_back" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -381,4 +376,4 @@

</ScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected void onCreate(Bundle savedInstanceState) {
setupListeners();
if (isEdit) populateFields();
updateSslVisibility();
updateEndpointAutofill();

MaterialButton saveButton = findViewById(R.id.btn_save);
saveButton.setOnClickListener(v -> saveProfile());
Expand Down Expand Up @@ -101,6 +102,17 @@ private void updateSslVisibility() {
}
}


private void updateEndpointAutofill() {
profileTypeToggle.addOnButtonCheckedListener((group, checkedId, isChecked) -> {
if (!isChecked) return;
if (checkedId == R.id.btn_type_consys) {
endpointInput.setText("/sensorhub/api");
} else if (checkedId == R.id.btn_type_sos) {
endpointInput.setText("/sensorhub/sos");
}
});
}
private void populateFields() {
nameInput.setText(profile.name);
hostInput.setText(profile.host);
Expand Down
Loading