Added issue tracker link and version name in settings.

This commit is contained in:
Felix Ableitner 2015-02-25 22:17:26 +01:00
parent 6a546d97a3
commit 41686b6fc3
3 changed files with 31 additions and 3 deletions

View file

@ -62,10 +62,21 @@
<!-- Preference title -->
<string name="scan_interval_seconds">Scan Interval (seconds)</string>
<!-- Preference title (debug only)-->
<string name="max_connections">Maximum Number of Connections</string>
<!-- Preference title -->
<string name="report_issue">Report Issue</string>
<!-- Preference summary -->
<string name="report_issue_summary">Open the EnsiChat issue tracker</string>
<string name="issue_tracker_url" translatable="false">https://github.com/Nutomic/ensichat/issues</string>
<!-- Preference title -->
<string name="version">Version</string>
<!-- ChatService -->

View file

@ -12,7 +12,7 @@
android:defaultValue="@string/default_scan_interval"
android:inputType="number"
android:numeric="integer" />
<EditTextPreference
android:title="@string/max_connections"
android:key="max_connections"
@ -20,4 +20,16 @@
android:inputType="number"
android:numeric="integer" />
</PreferenceScreen>
<Preference
android:title="@string/report_issue"
android:summary="@string/report_issue_summary" >
<intent
android:action="android.intent.action.VIEW"
android:data="@string/issue_tracker_url" />
</Preference>
<Preference
android:title="@string/version"
android:key="version" />
</PreferenceScreen>

View file

@ -16,6 +16,8 @@ object SettingsFragment {
val MaxConnections = "max_connections"
val Version = "version"
}
/**
@ -30,9 +32,12 @@ class SettingsFragment extends PreferenceFragment with OnPreferenceChangeListene
val name = findPreference(KeyUserName)
val scanInterval = findPreference(KeyScanInterval)
val maxConnections = findPreference(MaxConnections)
val version = findPreference(Version)
name.setOnPreferenceChangeListener(this)
scanInterval.setOnPreferenceChangeListener(this)
maxConnections.setOnPreferenceChangeListener(this)
version.setSummary(getActivity.getPackageManager.getPackageInfo(
getActivity.getPackageName, 0).versionName)
val pm = PreferenceManager.getDefaultSharedPreferences(getActivity)
name.setSummary(pm.getString(KeyUserName, ""))