1
0
mirror of https://github.com/etesync/android synced 2024-11-29 03:18:12 +00:00

Make use of RFC6868 optional

* make use of RFC6868 for VCards optional because some defect servers don't accept it
* minor UI improvements (thanks biociahi)
This commit is contained in:
Ricki Hirner 2016-06-11 08:53:29 +02:00
parent 34bc27fa79
commit 317144630c
8 changed files with 49 additions and 9 deletions

View File

@ -59,6 +59,12 @@ public class AccountSettings {
KEY_WIFI_ONLY = "wifi_only", // sync on WiFi only (default: false)
KEY_WIFI_ONLY_SSID = "wifi_only_ssid"; // restrict sync to specific WiFi SSID
/** Whether to use RFC 6868 for VCards
* value = null (not existing) use RFC6868-style encoding (default value)
* "0" don't use RFC 6868-style encoding
*/
private final static String KEY_VCARD_RFC6868 = "vcard_rfc6868";
/** Time range limitation to the past [in days]
value = null default value (DEFAULT_TIME_RANGE_PAST_DAYS)
< 0 (-1) no limit
@ -182,6 +188,17 @@ public class AccountSettings {
}
// CardDAV settings
public boolean getVCardRFC6868() {
return accountManager.getUserData(account, KEY_VCARD_RFC6868) == null;
}
public void setVCardRFC6868(boolean use) {
accountManager.setUserData(account, KEY_VCARD_RFC6868, use ? null : "0");
}
// CalDAV settings
public Integer getTimeRangePastDays() {

View File

@ -137,7 +137,7 @@ public class ContactsSyncManager extends SyncManager {
App.log.log(Level.FINE, "Preparing upload of contact " + local.getFileName(), local.getContact());
ByteArrayOutputStream os = new ByteArrayOutputStream();
local.getContact().write(hasVCard4 ? VCardVersion.V4_0 : VCardVersion.V3_0, os);
local.getContact().write(hasVCard4 ? VCardVersion.V4_0 : VCardVersion.V3_0, settings.getVCardRFC6868(), os);
return RequestBody.create(
hasVCard4 ? DavAddressBook.MIME_VCARD4 : DavAddressBook.MIME_VCARD3_UTF8,

View File

@ -208,8 +208,19 @@ public class AccountSettingsActivity extends AppCompatActivity {
}
});
// category: CardDAV
final SwitchPreferenceCompat prefRFC6868 = (SwitchPreferenceCompat)findPreference("vcard_rfc6868");
prefRFC6868.setChecked(settings.getVCardRFC6868());
prefRFC6868.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
settings.setVCardRFC6868((Boolean)o);
refresh(); return false;
}
});
// category: CalDAV
final EditTextPreference prefTimeRangePastDays = (EditTextPreference)findPreference("caldav_time_range_past_days");
final EditTextPreference prefTimeRangePastDays = (EditTextPreference)findPreference("time_range_past_days");
Integer pastDays = settings.getTimeRangePastDays();
if (pastDays != null) {
prefTimeRangePastDays.setText(pastDays.toString());

View File

@ -13,7 +13,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="at.bitfire.davdroid.ui.AccountsActivity">
<android.support.design.widget.AppBarLayout

View File

@ -14,12 +14,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/accounts_content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/accounts_content"/>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"

View File

@ -179,6 +179,10 @@
<string name="settings_sync_wifi_only_ssid_on">Will only synchronize over %s</string>
<string name="settings_sync_wifi_only_ssid_off">All WiFi connections may be used</string>
<string name="settings_sync_wifi_only_ssid_message">Enter the name of a WiFi network (SSID) to restrict synchronization to this network, or leave blank for all WiFi connections.</string>
<string name="settings_carddav">CardDAV</string>
<string name="settings_rfc6868_for_vcards">Use RFC6868 for VCards</string>
<string name="settings_rfc6868_for_vcards_on">Double quotes can be used in parameter values</string>
<string name="settings_rfc6868_for_vcards_off">Double quotes can\'t be used in parameter values</string>
<string name="settings_caldav">CalDAV</string>
<string name="settings_sync_time_range_past">Past event time limit</string>
<string name="settings_sync_time_range_past_none">All events will be synchronized</string>

View File

@ -74,10 +74,21 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_carddav">
<SwitchPreferenceCompat
android:key="vcard_rfc6868"
android:persistent="false"
android:title="@string/settings_rfc6868_for_vcards"
android:summaryOn="@string/settings_rfc6868_for_vcards_on"
android:summaryOff="@string/settings_rfc6868_for_vcards_off"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_caldav">
<EditTextPreference
android:key="caldav_time_range_past_days"
android:key="time_range_past_days"
android:persistent="false"
android:title="@string/settings_sync_time_range_past"
android:dialogMessage="@string/settings_sync_time_range_past_message"

@ -1 +1 @@
Subproject commit 33cc8fbf59a114dbcaadfa3cc0fbba5fa01589d2
Subproject commit 2ba66e6498ee8fdb37b13f4ffec94311e1c50c99