[+] Influx preferences
This commit is contained in:
@@ -2,7 +2,13 @@ package org.hydev.wearsync
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
class ActivitySettings : AppCompatActivity()
|
||||
{
|
||||
@@ -26,6 +32,11 @@ class ActivitySettings : AppCompatActivity()
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?)
|
||||
{
|
||||
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>
|
||||
|
||||
<!-- Preference Titles -->
|
||||
<string name="messages_header">Messages</string>
|
||||
<string name="sync_header">Sync</string>
|
||||
|
||||
<!-- Messages Preferences -->
|
||||
<string name="signature_title">Your signature</string>
|
||||
<string name="reply_title">Default reply action</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>
|
||||
<string name="pref_influx_head">InfluxDB Settings</string>
|
||||
<string name="pref_influx_url">URL</string>
|
||||
<string name="pref_influx_org">Organization</string>
|
||||
<string name="pref_influx_bucket">Bucket</string>
|
||||
<string name="pref_influx_token">Token</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>
|
||||
</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
|
||||
app:key="signature"
|
||||
app:title="@string/signature_title"
|
||||
app:defaultValue="https://influx.hydev.org"
|
||||
app:key="infUrl"
|
||||
app:title="@string/pref_influx_url"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="reply"
|
||||
app:entries="@array/reply_entries"
|
||||
app:entryValues="@array/reply_values"
|
||||
app:key="reply"
|
||||
app:title="@string/reply_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
app:key="infOrg"
|
||||
app:title="@string/pref_influx_org"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
android:defaultValue="hydev" />
|
||||
|
||||
</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
|
||||
app:key="sync"
|
||||
app:title="@string/sync_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:dependency="sync"
|
||||
app:key="attachment"
|
||||
app:summaryOff="@string/attachment_summary_off"
|
||||
app:summaryOn="@string/attachment_summary_on"
|
||||
app:title="@string/attachment_title" />
|
||||
<Preference
|
||||
android:key="infTestButton"
|
||||
app:title="@string/pref_influx_test"
|
||||
app:summary="@string/pref_influx_test_sub" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user