mirror of
https://github.com/etesync/android
synced 2024-11-22 16:08:13 +00:00
Various improvements
* ContactsSyncManager: gracefully handle photo URLs without host name * MainActivity: cache installer package name * dav4android: use java.util.ServiceLoader to load DAV property factories
This commit is contained in:
parent
241e15404f
commit
20ee4e03f3
@ -264,7 +264,14 @@ public class ContactsSyncManager extends SyncManager {
|
|||||||
@Override
|
@Override
|
||||||
public byte[] download(String url, String accepts) {
|
public byte[] download(String url, String accepts) {
|
||||||
HttpUrl httpUrl = HttpUrl.parse(url);
|
HttpUrl httpUrl = HttpUrl.parse(url);
|
||||||
HttpClient resourceClient = new HttpClient(log, httpClient, httpUrl.host());
|
|
||||||
|
String host = httpUrl.host();
|
||||||
|
if (host == null) {
|
||||||
|
log.error("External resource URL doesn't specify a host name");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpClient resourceClient = new HttpClient(log, httpClient, host);
|
||||||
try {
|
try {
|
||||||
Response response = resourceClient.newCall(new Request.Builder()
|
Response response = resourceClient.newCall(new Request.Builder()
|
||||||
.get()
|
.get()
|
||||||
|
@ -25,6 +25,7 @@ import at.bitfire.davdroid.Constants;
|
|||||||
import at.bitfire.davdroid.R;
|
import at.bitfire.davdroid.R;
|
||||||
import at.bitfire.davdroid.ui.settings.SettingsActivity;
|
import at.bitfire.davdroid.ui.settings.SettingsActivity;
|
||||||
import at.bitfire.davdroid.ui.setup.AddAccountActivity;
|
import at.bitfire.davdroid.ui.setup.AddAccountActivity;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
|
|
||||||
@ -43,12 +44,18 @@ public class MainActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.main_activity);
|
setContentView(R.layout.main_activity);
|
||||||
|
|
||||||
TextView tv = (TextView)findViewById(R.id.text_store_specific);
|
TextView tv = (TextView)findViewById(R.id.text_store_specific);
|
||||||
if (installedFrom("org.fdroid.fdroid"))
|
final String installedFrom = installedFrom();
|
||||||
setHtmlText(R.id.text_store_specific, R.string.main_fdroid_donation_html);
|
if (installedFrom != null)
|
||||||
else if (installedFrom("com.android.vending"))
|
switch (installedFrom) {
|
||||||
setHtmlText(R.id.text_store_specific, R.string.main_play_workaround_html);
|
case "com.android.vending":
|
||||||
|
setHtmlText(R.id.text_store_specific, R.string.main_play_workaround_html);
|
||||||
|
break;
|
||||||
|
case "org.fdroid.fdroid":
|
||||||
|
setHtmlText(R.id.text_store_specific, R.string.main_fdroid_donation_html);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
setPlainText(R.id.text_welcome, R.string.main_welcome, BuildConfig.VERSION_NAME);
|
setPlainText(R.id.text_welcome, R.string.main_welcome, BuildConfig.VERSION_NAME);
|
||||||
setHtmlText(R.id.text_what_is_davdroid, R.string.main_what_is_davdroid_html);
|
setHtmlText(R.id.text_what_is_davdroid, R.string.main_what_is_davdroid_html);
|
||||||
@ -120,11 +127,11 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean installedFrom(String packageName) {
|
private String installedFrom() {
|
||||||
try {
|
try {
|
||||||
return packageName.equals(getPackageManager().getInstallerPackageName("at.bitfire.davdroid"));
|
return getPackageManager().getInstallerPackageName("at.bitfire.davdroid");
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f254b6e0faf10dc74d7849b77281cffcacb7774d
|
Subproject commit 94b582ddea6c3e0568158fa0d177ea20dee3782a
|
Loading…
Reference in New Issue
Block a user