diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/SettingsActivity.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/SettingsActivity.java
index 7995f33..02ead71 100644
--- a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/SettingsActivity.java
+++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/SettingsActivity.java
@@ -1,11 +1,12 @@
package dev.nuculabs.nucuhub;
import android.os.Bundle;
+import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-import androidx.preference.PreferenceFragmentCompat;
+import dev.nuculabs.nucuhub.ui.settings.SettingsFragment;
public class SettingsActivity extends AppCompatActivity {
@@ -28,8 +29,16 @@ public class SettingsActivity extends AppCompatActivity {
}
}
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // TODO: Add settings menu
+ // getMenuInflater().inflate(R.menu.settings_actions, menu);
+ return true;
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
+ // back button click
if (item.getItemId()==android.R.id.home) {
finish();
return true;
@@ -37,11 +46,4 @@ public class SettingsActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
-
- public static class SettingsFragment extends PreferenceFragmentCompat {
- @Override
- public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
- setPreferencesFromResource(R.xml.root_preferences, rootKey);
- }
- }
}
\ No newline at end of file
diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/DeviceListPreference.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/DeviceListPreference.java
new file mode 100644
index 0000000..dbe82af
--- /dev/null
+++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/DeviceListPreference.java
@@ -0,0 +1,24 @@
+package dev.nuculabs.nucuhub.ui.settings;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import androidx.preference.ListPreference;
+
+public class DeviceListPreference extends ListPreference {
+ public DeviceListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public DeviceListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public DeviceListPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public DeviceListPreference(Context context) {
+ super(context);
+ }
+ // TODO: Create custom dialog, override onClick.
+}
diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java
new file mode 100644
index 0000000..10ed022
--- /dev/null
+++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/SettingsFragment.java
@@ -0,0 +1,21 @@
+package dev.nuculabs.nucuhub.ui.settings;
+
+import android.os.Bundle;
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceFragmentCompat;
+import dev.nuculabs.nucuhub.R;
+
+public class SettingsFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ // To get preferences use this in main activity:
+ // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
+
+ setPreferencesFromResource(R.xml.root_preferences, rootKey);
+ ListPreference devicesList = findPreference("device_list");
+
+ // TODO: Override dialog in order to add a search devices button.
+ //
+ // set default value
+ }
+}
diff --git a/NucuHub.Android/app/src/main/res/layout/fragment_environment_sensor.xml b/NucuHub.Android/app/src/main/res/layout/fragment_environment_sensor.xml
index 44ad213..0c7f954 100644
--- a/NucuHub.Android/app/src/main/res/layout/fragment_environment_sensor.xml
+++ b/NucuHub.Android/app/src/main/res/layout/fragment_environment_sensor.xml
@@ -211,7 +211,7 @@
tools:text="100.11"
/>
diff --git a/NucuHub.Android/app/src/main/res/layout/settings_activity.xml b/NucuHub.Android/app/src/main/res/layout/settings_activity.xml
index 7325e26..db7883d 100644
--- a/NucuHub.Android/app/src/main/res/layout/settings_activity.xml
+++ b/NucuHub.Android/app/src/main/res/layout/settings_activity.xml
@@ -7,25 +7,24 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- Reply
diff --git a/NucuHub.Android/app/src/main/res/values/strings.xml b/NucuHub.Android/app/src/main/res/values/strings.xml
index 9aa8508..b1966eb 100644
--- a/NucuHub.Android/app/src/main/res/values/strings.xml
+++ b/NucuHub.Android/app/src/main/res/values/strings.xml
@@ -1,17 +1,22 @@
NucuHub
- Temperature sensor status
Open navigation drawer
Close navigation drawer
NucuHub
denis@nuculabs.dev
Navigation header
- Settings
Gallery
Slideshow
+
+ Settings
+
+
+ Settings Activity
+
Environment Sensor
+ Temperature sensor status
humidity image
temperature icon
barometer icon
@@ -19,12 +24,16 @@
Rh%
Celsius
hPa
- VOC kΩ
- SettingsActivity
+ VOC kΩ
Messages
Sync
+ Devices
+
+
+ Your current device
+
Your signature
diff --git a/NucuHub.Android/app/src/main/res/xml/root_preferences.xml b/NucuHub.Android/app/src/main/res/xml/root_preferences.xml
index b288089..a82880c 100644
--- a/NucuHub.Android/app/src/main/res/xml/root_preferences.xml
+++ b/NucuHub.Android/app/src/main/res/xml/root_preferences.xml
@@ -1,37 +1,49 @@
-
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app:title="@string/devices_header">
-
-
-
+