[+] Influx preferences
This commit is contained in:
@@ -2,7 +2,13 @@ package org.hydev.wearsync
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.SupervisorJob
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
||||||
class ActivitySettings : AppCompatActivity()
|
class ActivitySettings : AppCompatActivity()
|
||||||
{
|
{
|
||||||
@@ -26,6 +32,11 @@ class ActivitySettings : AppCompatActivity()
|
|||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?)
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?)
|
||||||
{
|
{
|
||||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||||
|
|
||||||
|
findPreference<Preference>("infTestButton")!!.setOnPreferenceClickListener {
|
||||||
|
println("Clicked")
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<!-- Reply Preference -->
|
|
||||||
<string-array name="reply_entries">
|
|
||||||
<item>Reply</item>
|
|
||||||
<item>Reply to all</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="reply_values">
|
|
||||||
<item>reply</item>
|
|
||||||
<item>reply_all</item>
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
|
||||||
@@ -4,18 +4,11 @@
|
|||||||
<string name="action_scan">Scan for Devices</string>
|
<string name="action_scan">Scan for Devices</string>
|
||||||
|
|
||||||
<!-- Preference Titles -->
|
<!-- Preference Titles -->
|
||||||
<string name="messages_header">Messages</string>
|
<string name="pref_influx_head">InfluxDB Settings</string>
|
||||||
<string name="sync_header">Sync</string>
|
<string name="pref_influx_url">URL</string>
|
||||||
|
<string name="pref_influx_org">Organization</string>
|
||||||
<!-- Messages Preferences -->
|
<string name="pref_influx_bucket">Bucket</string>
|
||||||
<string name="signature_title">Your signature</string>
|
<string name="pref_influx_token">Token</string>
|
||||||
<string name="reply_title">Default reply action</string>
|
<string name="pref_influx_test">Test connection</string>
|
||||||
|
<string name="pref_influx_test_sub">Click here to test your connection to the influxdb server.</string>
|
||||||
<!-- Sync Preferences -->
|
|
||||||
<string name="sync_title">Sync email periodically</string>
|
|
||||||
<string name="attachment_title">Download incoming attachments</string>
|
|
||||||
<string name="attachment_summary_on">Automatically download attachments for incoming emails
|
|
||||||
</string>
|
|
||||||
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
|
||||||
<string name="title_activity_settings">ActivitySettings</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,34 +1,36 @@
|
|||||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/messages_header">
|
<PreferenceCategory app:title="@string/pref_influx_head">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
app:key="signature"
|
app:defaultValue="https://influx.hydev.org"
|
||||||
app:title="@string/signature_title"
|
app:key="infUrl"
|
||||||
|
app:title="@string/pref_influx_url"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<ListPreference
|
<EditTextPreference
|
||||||
app:defaultValue="reply"
|
app:key="infOrg"
|
||||||
app:entries="@array/reply_entries"
|
app:title="@string/pref_influx_org"
|
||||||
app:entryValues="@array/reply_values"
|
app:useSimpleSummaryProvider="true"
|
||||||
app:key="reply"
|
android:defaultValue="hydev" />
|
||||||
app:title="@string/reply_title"
|
|
||||||
app:useSimpleSummaryProvider="true" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
<EditTextPreference
|
||||||
|
app:key="infBucket"
|
||||||
|
app:title="@string/pref_influx_bucket"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
android:defaultValue="hydev" />
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/sync_header">
|
<EditTextPreference
|
||||||
|
app:key="infToken"
|
||||||
|
app:title="@string/pref_influx_token"
|
||||||
|
app:useSimpleSummaryProvider="true"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<Preference
|
||||||
app:key="sync"
|
android:key="infTestButton"
|
||||||
app:title="@string/sync_title" />
|
app:title="@string/pref_influx_test"
|
||||||
|
app:summary="@string/pref_influx_test_sub" />
|
||||||
<SwitchPreferenceCompat
|
|
||||||
app:dependency="sync"
|
|
||||||
app:key="attachment"
|
|
||||||
app:summaryOff="@string/attachment_summary_off"
|
|
||||||
app:summaryOn="@string/attachment_summary_on"
|
|
||||||
app:title="@string/attachment_title" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user