|
|
@ -177,7 +177,7 @@ public class EmailProvider implements Parcelable {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static List<EmailProvider> loadProfiles(Context context) {
|
|
|
|
private static List<EmailProvider> loadProfiles(Context context) {
|
|
|
|
List<EmailProvider> result = null;
|
|
|
|
List<EmailProvider> result = null;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -297,7 +297,7 @@ public class EmailProvider implements Parcelable {
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
throw new IllegalAccessException(name);
|
|
|
|
throw new IllegalAccessException(name);
|
|
|
|
} else if (eventType == XmlPullParser.END_TAG) {
|
|
|
|
} else if (eventType == XmlPullParser.END_TAG) {
|
|
|
|
if ("provider".equals(xml.getName()) && provider.enabled) {
|
|
|
|
if ("provider".equals(xml.getName())) {
|
|
|
|
result.add(provider);
|
|
|
|
result.add(provider);
|
|
|
|
provider = null;
|
|
|
|
provider = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -312,12 +312,12 @@ public class EmailProvider implements Parcelable {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static boolean getAttributeBooleanValue(XmlPullParser parser, String name, boolean defaultValue) {
|
|
|
|
private static boolean getAttributeBooleanValue(XmlPullParser parser, String name, boolean defaultValue) {
|
|
|
|
String value = parser.getAttributeValue(null, name);
|
|
|
|
String value = parser.getAttributeValue(null, name);
|
|
|
|
return (value == null ? defaultValue : Boolean.parseBoolean(value));
|
|
|
|
return (value == null ? defaultValue : Boolean.parseBoolean(value));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int getAttributeIntValue(XmlPullParser parser, String name, int defaultValue) {
|
|
|
|
private static int getAttributeIntValue(XmlPullParser parser, String name, int defaultValue) {
|
|
|
|
String value = parser.getAttributeValue(null, name);
|
|
|
|
String value = parser.getAttributeValue(null, name);
|
|
|
|
return (value == null ? defaultValue : Integer.parseInt(value));
|
|
|
|
return (value == null ? defaultValue : Integer.parseInt(value));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -331,6 +331,14 @@ public class EmailProvider implements Parcelable {
|
|
|
|
throw new FileNotFoundException("provider id=" + id);
|
|
|
|
throw new FileNotFoundException("provider id=" + id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static List<EmailProvider> getProviders(Context context) {
|
|
|
|
|
|
|
|
List<EmailProvider> result = new ArrayList<>();
|
|
|
|
|
|
|
|
for (EmailProvider provider : loadProfiles(context))
|
|
|
|
|
|
|
|
if (provider.enabled)
|
|
|
|
|
|
|
|
result.add(provider);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
static List<EmailProvider> fromDomain(Context context, String domain, Discover discover) throws IOException {
|
|
|
|
static List<EmailProvider> fromDomain(Context context, String domain, Discover discover) throws IOException {
|
|
|
|
return fromEmail(context, domain, discover);
|
|
|
|
return fromEmail(context, domain, discover);
|
|
|
|