本文整理汇总了Java中android.content.IntentFilter.countDataSchemes方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.countDataSchemes方法的具体用法?Java IntentFilter.countDataSchemes怎么用?Java IntentFilter.countDataSchemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.IntentFilter
的用法示例。
在下文中一共展示了IntentFilter.countDataSchemes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFilters
import android.content.IntentFilter; //导入方法依赖的package包/类
public ArrayList<F> findFilters(IntentFilter matching) {
if (matching.countDataSchemes() == 1) {
// Fast case.
return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching);
} else if (matching.countDataTypes() != 0 && matching.countActions() == 1) {
// Another fast case.
return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching);
} else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0 && matching.countActions() == 1) {
// Last fast case.
return collectFilters(mActionToFilter.get(matching.getAction(0)), matching);
} else {
ArrayList<F> res = null;
for (F cur : mFilters) {
if (filterEquals(cur.filter, matching)) {
if (res == null) {
res = new ArrayList<>();
}
res.add(cur);
}
}
return res;
}
}
示例2: findFilters
import android.content.IntentFilter; //导入方法依赖的package包/类
public ArrayList<F> findFilters(IntentFilter matching) {
if (matching.countDataSchemes() == 1) {
// Fast case.
return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching);
} else if (matching.countDataTypes() != 0 && matching.countActions() == 1) {
// Another fast case.
return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching);
} else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0
&& matching.countActions() == 1) {
// Last fast case.
return collectFilters(mActionToFilter.get(matching.getAction(0)), matching);
} else {
ArrayList<F> res = null;
for (F cur : mFilters) {
if (filterEquals(cur, matching)) {
if (res == null) {
res = new ArrayList<>();
}
res.add(cur);
}
}
return res;
}
}
示例3: findFilters
import android.content.IntentFilter; //导入方法依赖的package包/类
public ArrayList<F> findFilters(IntentFilter matching) {
if (matching.countDataSchemes() == 1) {
// Fast case.
return collectFilters(mSchemeToFilter.get(matching.getDataScheme(0)), matching);
} else if (matching.countDataTypes() != 0 && matching.countActions() == 1) {
// Another fast case.
return collectFilters(mTypedActionToFilter.get(matching.getAction(0)), matching);
} else if (matching.countDataTypes() == 0 && matching.countDataSchemes() == 0 && matching.countActions() == 1) {
// Last fast case.
return collectFilters(mActionToFilter.get(matching.getAction(0)), matching);
} else {
ArrayList<F> res = null;
for (F cur : mFilters) {
if (filterEquals(cur, matching)) {
if (res == null) {
res = new ArrayList<>();
}
res.add(cur);
}
}
return res;
}
}
示例4: buildTitle
import android.content.IntentFilter; //导入方法依赖的package包/类
String buildTitle(IntentFilter filter) {
StringBuilder buf=new StringBuilder();
boolean first=true;
if (filter.countActions() > 0) {
for (String action : in(filter.actionsIterator())) {
if (first) {
first=false;
}
else {
buf.append('/');
}
buf.append(action.replaceAll("android.intent.action.", ""));
}
}
if (filter.countDataTypes() > 0) {
first=true;
for (String type : in(filter.typesIterator())) {
if (first) {
buf.append(" : ");
first=false;
}
else {
buf.append('|');
}
buf.append(type);
}
}
if (filter.countDataSchemes() > 0) {
buf.append(" : ");
buf.append(filter.getDataScheme(0));
if (filter.countDataSchemes() > 1) {
buf.append(" (other schemes)");
}
}
if (filter.countDataPaths() > 0) {
buf.append(" : ");
buf.append(filter.getDataPath(0));
if (filter.countDataPaths() > 1) {
buf.append(" (other paths)");
}
}
return(buf.toString());
}
示例5: filterEquals
import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean filterEquals(IntentFilter f1, IntentFilter f2) {
int s1 = f1.countActions();
int s2 = f2.countActions();
if (s1 != s2) {
return false;
}
for (int i = 0; i < s1; i++) {
if (!f2.hasAction(f1.getAction(i))) {
return false;
}
}
s1 = f1.countCategories();
s2 = f2.countCategories();
if (s1 != s2) {
return false;
}
for (int i = 0; i < s1; i++) {
if (!f2.hasCategory(f1.getCategory(i))) {
return false;
}
}
s1 = f1.countDataTypes();
s2 = f2.countDataTypes();
if (s1 != s2) {
return false;
}
s1 = f1.countDataSchemes();
s2 = f2.countDataSchemes();
if (s1 != s2) {
return false;
}
for (int i = 0; i < s1; i++) {
if (!f2.hasDataScheme(f1.getDataScheme(i))) {
return false;
}
}
s1 = f1.countDataAuthorities();
s2 = f2.countDataAuthorities();
if (s1 != s2) {
return false;
}
s1 = f1.countDataPaths();
s2 = f2.countDataPaths();
if (s1 != s2) {
return false;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
s1 = f1.countDataSchemeSpecificParts();
s2 = f2.countDataSchemeSpecificParts();
if (s1 != s2) {
return false;
}
}
return true;
}
示例6: filterEquals
import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean filterEquals(IntentFilter f1, IntentFilter f2) {
int s1 = f1.countActions();
int s2 = f2.countActions();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasAction(f1.getAction(i))) {
return false;
}
}
s1 = f1.countCategories();
s2 = f2.countCategories();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasCategory(f1.getCategory(i))) {
return false;
}
}
s1 = f1.countDataTypes();
s2 = f2.countDataTypes();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasExactDataType(f1.getDataType(i))) {
return false;
}
}
s1 = f1.countDataSchemes();
s2 = f2.countDataSchemes();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasDataScheme(f1.getDataScheme(i))) {
return false;
}
}
s1 = f1.countDataAuthorities();
s2 = f2.countDataAuthorities();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasDataAuthority(f1.getDataAuthority(i))) {
return false;
}
}
s1 = f1.countDataPaths();
s2 = f2.countDataPaths();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasDataPath(f1.getDataPath(i))) {
return false;
}
}
s1 = f1.countDataSchemeSpecificParts();
s2 = f2.countDataSchemeSpecificParts();
if (s1 != s2) {
return false;
}
for (int i=0; i<s1; i++) {
if (!f2.hasDataSchemeSpecificPart(f1.getDataSchemeSpecificPart(i))) {
return false;
}
}
return true;
}