當前位置: 首頁>>代碼示例>>Java>>正文


Java IntentFilter.countDataPaths方法代碼示例

本文整理匯總了Java中android.content.IntentFilter.countDataPaths方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentFilter.countDataPaths方法的具體用法?Java IntentFilter.countDataPaths怎麽用?Java IntentFilter.countDataPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.IntentFilter的用法示例。


在下文中一共展示了IntentFilter.countDataPaths方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 * @param intent The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.size() == 0) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException e) {
        Log.e(TAG, "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:Vavassor,項目名稱:Tusky,代碼行數:27,代碼來源:CustomTabsHelper.java

示例2: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 * @param intent The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.size() == 0) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException ignored) {
        Log.e(TAG, "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:27,代碼來源:CustomTabsHelper.java

示例3: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 *
 * @param intent The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
  try {
    PackageManager pm = context.getPackageManager();
    List<ResolveInfo> handlers = pm.queryIntentActivities(
        intent,
        PackageManager.GET_RESOLVED_FILTER);
    if (handlers == null || handlers.size() == 0) {
      return false;
    }
    for (ResolveInfo resolveInfo : handlers) {
      IntentFilter filter = resolveInfo.filter;
      if (filter == null) continue;
      if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
      if (resolveInfo.activityInfo == null) continue;
      return true;
    }
  } catch (RuntimeException e) {
    Log.e(TAG, "Runtime exception while getting specialized handlers");
  }
  return false;
}
 
開發者ID:tomoya92,項目名稱:android-apps,代碼行數:28,代碼來源:CustomTabsHelper.java

示例4: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 *
 * @param intent
 *         The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.size() == 0) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException e) {
        Log.e(TAG, "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:29,代碼來源:CustomTabsHelper.java

示例5: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 * @param intent The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.isEmpty()) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException e) {
        Log.e(TAG, "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:27,代碼來源:CustomTabsHelper.java

示例6: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.size() == 0) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException e) {
        Log.e("Error", "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:theblixguy,項目名稱:AutoScrollr,代碼行數:22,代碼來源:ChromePackageHelper.java

示例7: hasSpecializedHandlerIntents

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Used to check whether there is a specialized handler for a given intent.
 *
 * @param intent The intent to check with.
 * @return Whether there is a specialized handler for the given intent.
 */
private static boolean hasSpecializedHandlerIntents(final Context context, final Intent intent) {
    try {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> handlers = pm.queryIntentActivities(
                intent,
                PackageManager.GET_RESOLVED_FILTER);
        if (handlers == null || handlers.size() == 0) {
            return false;
        }
        for (ResolveInfo resolveInfo : handlers) {
            IntentFilter filter = resolveInfo.filter;
            if (filter == null) continue;
            if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0)
                continue;
            if (resolveInfo.activityInfo == null) continue;
            return true;
        }
    } catch (RuntimeException e) {
        Log.e(TAG, "Runtime exception while getting specialized handlers");
    }
    return false;
}
 
開發者ID:saschpe,項目名稱:android-customtabs,代碼行數:29,代碼來源:CustomTabsPackageHelper.java

示例8: isSpecializedHandlerAvailable

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Search for intent handlers that are specific to this URL aka, specialized
 * apps like google maps or youtube
 */
private boolean isSpecializedHandlerAvailable(Intent intent) {
	PackageManager pm = mActivity.getPackageManager();
	List<ResolveInfo> handlers = pm.queryIntentActivities(intent,
			PackageManager.GET_RESOLVED_FILTER);
	if (handlers == null || handlers.isEmpty()) {
		return false;
	}
	for (ResolveInfo resolveInfo : handlers) {
		IntentFilter filter = resolveInfo.filter;
		if (filter == null) {
			// No intent filter matches this intent?
			// Error on the side of staying in the browser, ignore
			continue;
		}
		// NOTICE: Use of && instead of || will cause the browser
		// to launch a new intent for every URL, using OR only
		// launches a new one if there is a non-browser app that
		// can handle it.
		if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) {
			// Generic handler, skip
			continue;
		}
		return true;
	}
	return false;
}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:31,代碼來源:IntentUtils.java

示例9: getSpecializedHandlersWithFilter

import android.content.IntentFilter; //導入方法依賴的package包/類
@VisibleForTesting
static ArrayList<String> getSpecializedHandlersWithFilter(
        List<ResolveInfo> infos, String filterPackageName) {
    ArrayList<String> result = new ArrayList<>();
    if (infos == null) {
        return result;
    }

    for (ResolveInfo info : infos) {
        IntentFilter filter = info.filter;
        if (filter == null) {
            // Error on the side of classifying ResolveInfo as generic.
            continue;
        }
        if (filter.countDataAuthorities() == 0 && filter.countDataPaths() == 0) {
            // Don't count generic handlers.
            continue;
        }

        if (!TextUtils.isEmpty(filterPackageName)
                && (info.activityInfo == null
                           || !info.activityInfo.packageName.equals(filterPackageName))) {
            continue;
        }

        if (info.activityInfo != null) {
            if (EPHEMERAL_INSTALLER_CLASS.equals(info.activityInfo.name)) {
                // Don't consider the Instant Apps resolver a specialized application.
                continue;
            }

            result.add(info.activityInfo.packageName);
        } else {
            result.add("");
        }
    }
    return result;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:39,代碼來源:ExternalNavigationDelegateImpl.java

示例10: 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());
}
 
開發者ID:if710,項目名稱:2017.2-codigo,代碼行數:54,代碼來源:PrefActivitiesActivity.java

示例11: 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;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:56,代碼來源:IntentResolver.java

示例12: 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;
}
 
開發者ID:TaRGroup,項目名稱:IFWManager,代碼行數:74,代碼來源:IntentResolver.java


注:本文中的android.content.IntentFilter.countDataPaths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。