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


Java IntentFilter.countActions方法代碼示例

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


在下文中一共展示了IntentFilter.countActions方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
	}
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:24,代碼來源:IntentResolver.java

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

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

示例4: unregisterReceiver

import android.content.IntentFilter; //導入方法依賴的package包/類
public void unregisterReceiver(BroadcastReceiver receiver) {
    synchronized (this.mReceivers) {
        ArrayList<IntentFilter> filters = (ArrayList) this.mReceivers.remove(receiver);
        if (filters == null) {
            return;
        }
        for (int i = 0; i < filters.size(); i++) {
            IntentFilter filter = (IntentFilter) filters.get(i);
            for (int j = 0; j < filter.countActions(); j++) {
                String action = filter.getAction(j);
                ArrayList<ReceiverRecord> receivers = (ArrayList) this.mActions.get(action);
                if (receivers != null) {
                    int k = 0;
                    while (k < receivers.size()) {
                        if (((ReceiverRecord) receivers.get(k)).receiver == receiver) {
                            receivers.remove(k);
                            k--;
                        }
                        k++;
                    }
                    if (receivers.size() <= 0) {
                        this.mActions.remove(action);
                    }
                }
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:29,代碼來源:LocalBroadcastManager.java

示例5: registerReceiver

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Register a receive for any local broadcasts that match the given IntentFilter.
 *
 * @param receiver The BroadcastReceiver to handle the broadcast.
 * @param filter Selects the Intent broadcasts to be received.
 *
 * @see #unregisterReceiver
 */
public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
    if (RePluginFramework.mHostInitialized) {
        try {
            ProxyLocalBroadcastManagerVar.registerReceiver.call(sOrigInstance, receiver, filter);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return;
    }
    synchronized (mReceivers) {
        ReceiverRecord entry = new ReceiverRecord(filter, receiver);
        ArrayList<IntentFilter> filters = mReceivers.get(receiver);
        if (filters == null) {
            filters = new ArrayList<IntentFilter>(1);
            mReceivers.put(receiver, filters);
        }
        filters.add(filter);
        for (int i=0; i<filter.countActions(); i++) {
            String action = filter.getAction(i);
            ArrayList<ReceiverRecord> entries = mActions.get(action);
            if (entries == null) {
                entries = new ArrayList<ReceiverRecord>(1);
                mActions.put(action, entries);
            }
            entries.add(entry);
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:37,代碼來源:PluginLocalBroadcastManager.java

示例6: unregisterReceiver

import android.content.IntentFilter; //導入方法依賴的package包/類
/**
 * Unregister a previously registered BroadcastReceiver.  <em>All</em>
 * filters that have been registered for this BroadcastReceiver will be
 * removed.
 *
 * @param receiver The BroadcastReceiver to unregister.
 *
 * @see #registerReceiver
 */
public void unregisterReceiver(BroadcastReceiver receiver) {
    if (RePluginFramework.mHostInitialized) {
        try {
            ProxyLocalBroadcastManagerVar.unregisterReceiver.call(sOrigInstance, receiver);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return;
    }
    synchronized (mReceivers) {
        ArrayList<IntentFilter> filters = mReceivers.remove(receiver);
        if (filters == null) {
            return;
        }
        for (int i=0; i<filters.size(); i++) {
            IntentFilter filter = filters.get(i);
            for (int j=0; j<filter.countActions(); j++) {
                String action = filter.getAction(j);
                ArrayList<ReceiverRecord> receivers = mActions.get(action);
                if (receivers != null) {
                    for (int k=0; k<receivers.size(); k++) {
                        if (receivers.get(k).receiver == receiver) {
                            receivers.remove(k);
                            k--;
                        }
                    }
                    if (receivers.size() <= 0) {
                        mActions.remove(action);
                    }
                }
            }
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:44,代碼來源:PluginLocalBroadcastManager.java

示例7: regReceiver

import android.content.IntentFilter; //導入方法依賴的package包/類
@Override
public void regReceiver(String plugin, Map rcvFilMap) throws RemoteException {
    PluginInfo pi = RePluginOS.getPlugin(plugin, false);
    if (pi == null || pi.getFrameworkVersion() < 4) {
        return;
    }

    HashMap<String, List<IntentFilter>> receiverFilterMap = (HashMap<String, List<IntentFilter>>) rcvFilMap;

    // 遍曆此插件中所有靜態聲明的 Receiver
    for (HashMap.Entry<String, List<IntentFilter>> entry : receiverFilterMap.entrySet()) {
        if (mReceiverProxy == null) {
            mReceiverProxy = new PluginReceiverProxy();
            mReceiverProxy.setActionPluginMap(mActionPluginComponents);
        }

        /* 保存 action-plugin-receiver 的關係 */
        String receiver = entry.getKey();
        List<IntentFilter> filters = entry.getValue();

        if (filters != null) {
            for (IntentFilter filter : filters) {
                int actionCount = filter.countActions();
                while (actionCount >= 1) {
                    saveAction(filter.getAction(actionCount - 1), plugin, receiver);
                    actionCount--;
                }

                // 注冊 Receiver
                mContext.registerReceiver(mReceiverProxy, filter);
            }
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:35,代碼來源:PmHostSvc.java

示例8: unregisterReceiver

import android.content.IntentFilter; //導入方法依賴的package包/類
public void unregisterReceiver(BroadcastReceiver receiver) {
    HashMap var2 = this.mReceivers;
    synchronized (this.mReceivers) {
        ArrayList filters = (ArrayList) this.mReceivers.remove(receiver);
        if (filters != null) {
            for (int i = 0; i < filters.size(); ++i) {
                IntentFilter filter = (IntentFilter) filters.get(i);

                for (int j = 0; j < filter.countActions(); ++j) {
                    String action = filter.getAction(j);
                    ArrayList receivers = (ArrayList) this.mActions.get(action);
                    if (receivers != null) {
                        for (int k = 0; k < receivers.size(); ++k) {
                            if (((LocalBroadcastManager.ReceiverRecord) receivers.get(k)).receiver == receiver) {
                                receivers.remove(k);
                                --k;
                            }
                        }

                        if (receivers.size() <= 0) {
                            this.mActions.remove(action);
                        }
                    }
                }
            }

        }
    }
}
 
開發者ID:AnyRTC,項目名稱:anyRTC-P2P-Android,代碼行數:30,代碼來源:LocalBroadcastManager.java

示例9: 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

示例10: 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

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