add settings

add permissions to access ssid, fix error in theme, add settings activity with shared preferences and support German and English
This commit is contained in:
2019-03-02 16:53:39 +01:00
parent 56195eb8f0
commit 026d5a27e1
10 changed files with 303 additions and 30 deletions

View File

@@ -14,6 +14,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"></WebView>
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingsActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutSsidLocal"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
app:hintAnimationEnabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<android.support.design.widget.TextInputEditText
android:id="@+id/editTextSsidLocal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="SSID"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutUrlLocal"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:hintAnimationEnabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInputLayoutSsidLocal">
<android.support.design.widget.TextInputEditText
android:id="@+id/editTextUrlLocal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Local URL"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutUrlGlobal"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:hintAnimationEnabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInputLayoutUrlLocal">
<android.support.design.widget.TextInputEditText
android:id="@+id/editTextUrlGlobal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Global URL"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/settings"
android:title="@string/settings"/>
//android:icon="@drawable/ic_new_game"
//android:showAsAction="ifRoom"
</menu>

View File

@@ -0,0 +1,5 @@
<resources>
<string name="app_name">WiFi-Wetter-Station</string>
<string name="settings">Einstellungen</string>
<string name="loading">Bitte warten, die Ansicht wird geladen...</string>
</resources>

View File

@@ -1,4 +1,8 @@
<resources>
<string name="app_name">WiFi Weather Station</string>
<string name="action_settings">Einstellungen</string>
<string name="settings">Settings</string>
<string name="loading">Please wait, the view is loading...</string>
<string name="ssid" translatable="false">NETGEAR26-5G-2</string>
<string name="url_local" translatable="false">http://192.168.1.5/site/wifi-weather-station/</string>
<string name="url_global" translatable="false">http://inetsrv.no-ip.org/site/wifi-weather-station/</string>
</resources>

View File

@@ -1,7 +1,8 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!--<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<style name="DarkTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>