kopia lustrzana https://github.com/ge0rg/aprsdroid
prefs: show values in activity
rodzic
ccb7b3b81e
commit
6709d6fbab
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_conn_afsk">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="digi_path"
|
||||
android:hint="hop1,hop2,.."
|
||||
android:defaultValue="WIDE1-1"
|
||||
|
@ -13,7 +13,7 @@
|
|||
android:summary="@string/p_aprs_path_summary"
|
||||
android:dialogTitle="@string/p_aprs_path_entry" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="afsk.prefix"
|
||||
android:inputType="number"
|
||||
android:defaultValue="1000"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
android:title="@string/p_bt_tnc_device"
|
||||
android:summary="@string/p_bt_tnc_device_summary"
|
||||
android:dialogTitle="@string/p_bt_tnc_device_entry" />
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="bt.channel"
|
||||
android:dependency="bt.client"
|
||||
android:inputType="number"
|
||||
|
@ -33,7 +33,7 @@
|
|||
android:targetClass="com.android.settings.bluetooth.BluetoothSettings" />
|
||||
</Preference>
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="digi_path"
|
||||
android:hint="hop1,hop2,.."
|
||||
android:defaultValue="WIDE1-1"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_conn_http">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="http.server"
|
||||
android:defaultValue="@string/aprs_server"
|
||||
android:hint="@string/p_host_hint"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_conn_tcp">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="tcp.server"
|
||||
android:inputType="textUri"
|
||||
android:title="@string/p_host"
|
||||
|
@ -14,7 +14,7 @@
|
|||
android:defaultValue="euro.aprs2.net"
|
||||
android:dialogTitle="@string/p_host_entry" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="tcp.filterdist"
|
||||
android:inputType="number"
|
||||
android:title="@string/p_filterdist"
|
||||
|
@ -22,7 +22,7 @@
|
|||
android:defaultValue="50"
|
||||
android:dialogTitle="@string/p_filterdist_entry" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="tcp.filter"
|
||||
android:title="@string/p_filter"
|
||||
android:summary="@string/p_filter_summary"
|
||||
|
@ -36,7 +36,7 @@
|
|||
<intent android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.aprs-is.net/javAPRSFilter.aspx" />
|
||||
</Preference>
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="tcp.sotimeout"
|
||||
android:inputType="number"
|
||||
android:title="@string/p_sotimeout"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_conn_udp">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="udp.server"
|
||||
android:defaultValue="@string/aprs_server"
|
||||
android:hint="@string/p_host_hint"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_source_manual">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="manual_lat"
|
||||
android:inputType="number|numberSigned|numberDecimal"
|
||||
android:defaultValue="0.000"
|
||||
|
@ -13,7 +13,7 @@
|
|||
android:summary=""
|
||||
android:dialogTitle="@string/p_source_lat" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="manual_lon"
|
||||
android:inputType="number|numberSigned|numberDecimal"
|
||||
android:defaultValue="0.000"
|
||||
|
@ -31,7 +31,7 @@
|
|||
android:targetClass="org.aprsdroid.app.LocationPrefs" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="interval"
|
||||
android:inputType="number"
|
||||
android:defaultValue="10"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p_source_periodic">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="interval"
|
||||
android:inputType="number"
|
||||
android:defaultValue="10"
|
||||
|
@ -13,7 +13,7 @@
|
|||
android:summary="@string/p_interval_summary"
|
||||
android:dialogTitle="@string/p_interval_entry" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="distance"
|
||||
android:inputType="number"
|
||||
android:defaultValue="10"
|
||||
|
@ -21,7 +21,7 @@
|
|||
android:summary="@string/p_distance_summary"
|
||||
android:dialogTitle="@string/p_distance_entry" />
|
||||
|
||||
<ListPreference
|
||||
<de.duenndns.ListPreferenceWithValue
|
||||
android:key="gps_activation"
|
||||
android:title="@string/p_gps"
|
||||
android:summary="@string/p_gps_summary"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p__aprs">
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="callsign"
|
||||
android:inputType="textCapCharacters"
|
||||
android:title="@string/p_callsign_nossid"
|
||||
|
@ -26,7 +26,7 @@
|
|||
android:data="@string/passcode_url" />
|
||||
</Preference>
|
||||
|
||||
<ListPreference
|
||||
<de.duenndns.ListPreferenceWithValue
|
||||
android:key="ssid"
|
||||
android:title="@string/p_ssid"
|
||||
android:summary="@string/p_ssid_summary"
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
<PreferenceCategory
|
||||
android:title="@string/p__position">
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="symbol"
|
||||
android:hint="@string/default_symbol"
|
||||
android:title="@string/p_symbol"
|
||||
|
@ -46,7 +46,7 @@
|
|||
android:defaultValue="@string/default_symbol"
|
||||
android:dialogTitle="@string/p_symbol_entry" />
|
||||
|
||||
<EditTextPreference
|
||||
<de.duenndns.EditTextPreferenceWithValue
|
||||
android:key="status"
|
||||
android:hint="@string/default_status"
|
||||
android:title="@string/p_status"
|
||||
|
@ -55,7 +55,7 @@
|
|||
android:dialogTitle="@string/p_status_entry" />
|
||||
|
||||
<!-- sub-screen "Position Reports" -->
|
||||
<ListPreference
|
||||
<de.duenndns.ListPreferenceWithValue
|
||||
android:key="loc_source"
|
||||
android:title="@string/p_locsource"
|
||||
android:summary="@string/p_locsource_summary"
|
||||
|
@ -78,7 +78,7 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/p__connection">
|
||||
|
||||
<ListPreference
|
||||
<de.duenndns.ListPreferenceWithValue
|
||||
android:key="backend"
|
||||
android:title="@string/p_conntype"
|
||||
android:summary="@string/p_conntype_summary"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package de.duenndns;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class EditTextPreferenceWithValue extends EditTextPreference {
|
||||
CharSequence mSummary;
|
||||
|
||||
public EditTextPreferenceWithValue(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public EditTextPreferenceWithValue(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private void setSummaryToText(String text) {
|
||||
if (mSummary == null)
|
||||
mSummary = getSummary();
|
||||
if (text == null || text.length() == 0)
|
||||
setSummary(mSummary);
|
||||
else
|
||||
setSummary(mSummary + ": " + text);
|
||||
}
|
||||
@Override
|
||||
protected void onBindView(View view) {
|
||||
super.onBindView(view);
|
||||
setSummaryToText(getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) {
|
||||
super.setText(text);
|
||||
setSummaryToText(text);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package de.duenndns;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.ListPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class ListPreferenceWithValue extends ListPreference {
|
||||
CharSequence mSummary;
|
||||
|
||||
public ListPreferenceWithValue(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public ListPreferenceWithValue(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private void setSummaryToText(CharSequence text) {
|
||||
if (mSummary == null)
|
||||
mSummary = getSummary();
|
||||
if (text == null || text.length() == 0)
|
||||
setSummary(mSummary);
|
||||
else
|
||||
setSummary(text);
|
||||
}
|
||||
@Override
|
||||
protected void onBindView(View view) {
|
||||
super.onBindView(view);
|
||||
setSummaryToText(getEntry());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String text) {
|
||||
super.setValue(text);
|
||||
setSummaryToText(getEntry());
|
||||
}
|
||||
|
||||
}
|
Ładowanie…
Reference in New Issue