diff --git a/app/build.gradle b/app/build.gradle
index 990abce..dd03c35 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -81,6 +81,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.fragment:fragment:1.4.1'
+ implementation 'androidx.preference:preference:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5c7aab0..01b92f1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,10 +11,19 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
+
+
+
+
+ android:exported="true" />
{
- chooseThemeDialog()
- true
- }
- R.id.action_language -> {
- chooseLanguageDialog()
- true
- }
- R.id.action_screenOn -> {
- item.isChecked = !item.isChecked
- keepScreenOn(item.isChecked)
+ R.id.settings -> {
+ val i = Intent(this, SettingsActivity::class.java)
+ startActivity(i)
true
}
+ //R.id.action_theme -> {
+ // chooseThemeDialog()
+ // true
+ //}
+ //R.id.action_language -> {
+ // chooseLanguageDialog()
+ // true
+ //}
+ //R.id.action_screenOn -> {
+ // item.isChecked = !item.isChecked
+ // keepScreenOn(item.isChecked)
+ // true
+ //}
else -> super.onOptionsItemSelected(item)
}
}
diff --git a/app/src/main/java/me/zobrist/tichucounter/SettingsActivity.kt b/app/src/main/java/me/zobrist/tichucounter/SettingsActivity.kt
new file mode 100644
index 0000000..09fdb6e
--- /dev/null
+++ b/app/src/main/java/me/zobrist/tichucounter/SettingsActivity.kt
@@ -0,0 +1,61 @@
+package me.zobrist.tichucounter
+
+import android.app.AlertDialog
+import android.content.Intent
+import android.os.Bundle
+import android.view.Menu
+import android.view.MenuItem
+import androidx.activity.OnBackPressedCallback
+import androidx.appcompat.app.AppCompatActivity
+import androidx.preference.PreferenceFragmentCompat
+import dagger.hilt.android.AndroidEntryPoint
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import me.zobrist.tichucounter.databinding.SettingsActivityBinding
+
+
+@AndroidEntryPoint
+class SettingsActivity : AppCompatActivity() {
+
+ private lateinit var binding: SettingsActivityBinding
+
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ binding = SettingsActivityBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ if (savedInstanceState == null) {
+ supportFragmentManager
+ .beginTransaction()
+ .replace(R.id.settings, SettingsFragment())
+ .commit()
+ }
+
+ setSupportActionBar(binding.toolbar)
+ supportActionBar?.setDisplayHomeAsUpEnabled(true)
+ supportActionBar?.setHomeButtonEnabled(true)
+ supportActionBar?.title = resources.getString(R.string.settings)
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ return when (item.itemId) {
+ android.R.id.home -> {
+ val i = Intent(this, MainActivity::class.java)
+ navigateUpTo(i)
+ true
+ }
+ else -> super.onOptionsItemSelected(item)
+ }
+ }
+
+
+ class SettingsFragment : PreferenceFragmentCompat() {
+ override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
+ setPreferencesFromResource(R.xml.root_preferences, rootKey)
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_baseline_add_24.xml b/app/src/main/res/drawable/ic_baseline_add_24.xml
new file mode 100644
index 0000000..06b5d2d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_add_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_undo_24.xml b/app/src/main/res/drawable/ic_baseline_undo_24.xml
new file mode 100644
index 0000000..79b6347
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_undo_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/settings_activity.xml b/app/src/main/res/layout/settings_activity.xml
new file mode 100644
index 0000000..cf972ee
--- /dev/null
+++ b/app/src/main/res/layout/settings_activity.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index e534389..98bff63 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -4,26 +4,21 @@
tools:context="me.zobrist.tichucounter.MainActivity">
+ android:title="@string/undo"
+ app:showAsAction="ifRoom"/>
+
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 06e21fc..516462b 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -14,4 +14,5 @@
Detusch
Hell
Dunkel
+ Einstellungen
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..f653604
--- /dev/null
+++ b/app/src/main/res/values/arrays.xml
@@ -0,0 +1,25 @@
+
+
+
+ - @string/dark
+ - @string/light
+ - @string/android_default_text
+
+
+
+ - dark
+ - light
+ - default
+
+
+
+
+ - @string/german
+ - @string/english
+
+
+
+ - german
+ - english
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f00f5be..c85fc17 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -18,4 +18,21 @@
German
Light
Dark
+ SettingsActivity
+
+
+ Messages
+ Sync
+
+
+ Your signature
+ Theme
+
+
+ Sync email periodically
+ Download incoming attachments
+ Automatically download attachments for incoming emails
+
+ Only download attachments when manually requested
+ Settings
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 752e91f..74c4ce7 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,6 +1,6 @@
-
diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml
new file mode 100644
index 0000000..ccd87d8
--- /dev/null
+++ b/app/src/main/res/xml/root_preferences.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file