Example usage for android.net Uri equals

List of usage examples for android.net Uri equals

Introduction

In this page you can find the example usage for android.net Uri equals.

Prototype

public boolean equals(Object o) 

Source Link

Document

Compares this Uri to another object for equality.

Usage

From source file:cc.flydev.launcher.Workspace.java

void getUniqueIntents(CellLayout cl, ArrayList<ComponentName> uniqueIntents,
        ArrayList<ComponentName> duplicates, boolean stripDuplicates) {
    int count = cl.getShortcutsAndWidgets().getChildCount();

    ArrayList<View> children = new ArrayList<View>();
    for (int i = 0; i < count; i++) {
        View v = cl.getShortcutsAndWidgets().getChildAt(i);
        children.add(v);//from   www .  j a v  a2  s  . c o  m
    }

    for (int i = 0; i < count; i++) {
        View v = children.get(i);
        ItemInfo info = (ItemInfo) v.getTag();
        // Null check required as the AllApps button doesn't have an item info
        if (info instanceof ShortcutInfo) {
            ShortcutInfo si = (ShortcutInfo) info;
            ComponentName cn = si.intent.getComponent();

            Uri dataUri = si.intent.getData();
            // If dataUri is not null / empty or if this component isn't one that would
            // have previously showed up in the AllApps list, then this is a widget-type
            // shortcut, so ignore it.
            if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                continue;
            }

            if (!uniqueIntents.contains(cn)) {
                uniqueIntents.add(cn);
            } else {
                if (stripDuplicates) {
                    cl.removeViewInLayout(v);
                    LauncherModel.deleteItemFromDatabase(mLauncher, si);
                }
                if (duplicates != null) {
                    duplicates.add(cn);
                }
            }
        }
        if (v instanceof FolderIcon) {
            FolderIcon fi = (FolderIcon) v;
            ArrayList<View> items = fi.getFolder().getItemsInReadingOrder();
            for (int j = 0; j < items.size(); j++) {
                if (items.get(j).getTag() instanceof ShortcutInfo) {
                    ShortcutInfo si = (ShortcutInfo) items.get(j).getTag();
                    ComponentName cn = si.intent.getComponent();

                    Uri dataUri = si.intent.getData();
                    // If dataUri is not null / empty or if this component isn't one that would
                    // have previously showed up in the AllApps list, then this is a widget-type
                    // shortcut, so ignore it.
                    if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                        continue;
                    }

                    if (!uniqueIntents.contains(cn)) {
                        uniqueIntents.add(cn);
                    } else {
                        if (stripDuplicates) {
                            fi.getFolderInfo().remove(si);
                            LauncherModel.deleteItemFromDatabase(mLauncher, si);
                        }
                        if (duplicates != null) {
                            duplicates.add(cn);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.example.launcher3.Workspace.java

void getUniqueIntents(CellLayout cl, ArrayList<ComponentName> uniqueIntents,
        ArrayList<ComponentName> duplicates, boolean stripDuplicates) {
    int count = cl.getShortcutsAndWidgets().getChildCount();

    ArrayList<View> children = new ArrayList<View>();
    for (int i = 0; i < count; i++) {
        View v = cl.getShortcutsAndWidgets().getChildAt(i);
        children.add(v);/* w w w  . j  a  v  a 2s.  c o m*/
    }

    for (int i = 0; i < count; i++) {
        View v = children.get(i);
        ItemInfo info = (ItemInfo) v.getTag();
        // Null check required as the AllApps button doesn't have an item
        // info
        if (info instanceof ShortcutInfo) {
            ShortcutInfo si = (ShortcutInfo) info;
            ComponentName cn = si.intent.getComponent();

            Uri dataUri = si.intent.getData();
            // If dataUri is not null / empty or if this component isn't one
            // that would
            // have previously showed up in the AllApps list, then this is a
            // widget-type
            // shortcut, so ignore it.
            if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                continue;
            }

            if (!uniqueIntents.contains(cn)) {
                uniqueIntents.add(cn);
            } else {
                if (stripDuplicates) {
                    cl.removeViewInLayout(v);
                    LauncherModel.deleteItemFromDatabase(mLauncher, si);
                }
                if (duplicates != null) {
                    duplicates.add(cn);
                }
            }
        }
        if (v instanceof FolderIcon) {
            FolderIcon fi = (FolderIcon) v;
            ArrayList<View> items = fi.getFolder().getItemsInReadingOrder();
            for (int j = 0; j < items.size(); j++) {
                if (items.get(j).getTag() instanceof ShortcutInfo) {
                    ShortcutInfo si = (ShortcutInfo) items.get(j).getTag();
                    ComponentName cn = si.intent.getComponent();

                    Uri dataUri = si.intent.getData();
                    // If dataUri is not null / empty or if this component
                    // isn't one that would
                    // have previously showed up in the AllApps list, then
                    // this is a widget-type
                    // shortcut, so ignore it.
                    if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                        continue;
                    }

                    if (!uniqueIntents.contains(cn)) {
                        uniqueIntents.add(cn);
                    } else {
                        if (stripDuplicates) {
                            fi.getFolderInfo().remove(si);
                            LauncherModel.deleteItemFromDatabase(mLauncher, si);
                        }
                        if (duplicates != null) {
                            duplicates.add(cn);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.aidy.launcher3.ui.workspace.Workspace.java

public void getUniqueIntents(CellLayout cl, ArrayList<ComponentName> uniqueIntents,
        ArrayList<ComponentName> duplicates, boolean stripDuplicates) {
    int count = cl.getShortcutsAndWidgets().getChildCount();

    ArrayList<View> children = new ArrayList<View>();
    for (int i = 0; i < count; i++) {
        View v = cl.getShortcutsAndWidgets().getChildAt(i);
        children.add(v);/*w ww  . ja  va  2 s  .  c  o  m*/
    }

    for (int i = 0; i < count; i++) {
        View v = children.get(i);
        ItemInfoBean info = (ItemInfoBean) v.getTag();
        // Null check required as the AllApps button doesn't have an item
        // info
        if (info instanceof ShortcutInfo) {
            ShortcutInfo si = (ShortcutInfo) info;
            ComponentName cn = si.intent.getComponent();

            Uri dataUri = si.intent.getData();
            // If dataUri is not null / empty or if this component isn't one
            // that would
            // have previously showed up in the AllApps list, then this is a
            // widget-type
            // shortcut, so ignore it.
            if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                continue;
            }

            if (!uniqueIntents.contains(cn)) {
                uniqueIntents.add(cn);
            } else {
                if (stripDuplicates) {
                    cl.removeViewInLayout(v);
                    LauncherModel.deleteItemFromDatabase(mLauncher, si);
                }
                if (duplicates != null) {
                    duplicates.add(cn);
                }
            }
        }
        if (v instanceof FolderIcon) {
            FolderIcon fi = (FolderIcon) v;
            ArrayList<View> items = fi.getFolder().getItemsInReadingOrder();
            for (int j = 0; j < items.size(); j++) {
                if (items.get(j).getTag() instanceof ShortcutInfo) {
                    ShortcutInfo si = (ShortcutInfo) items.get(j).getTag();
                    ComponentName cn = si.intent.getComponent();

                    Uri dataUri = si.intent.getData();
                    // If dataUri is not null / empty or if this component
                    // isn't one that would
                    // have previously showed up in the AllApps list, then
                    // this is a widget-type
                    // shortcut, so ignore it.
                    if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                        continue;
                    }

                    if (!uniqueIntents.contains(cn)) {
                        uniqueIntents.add(cn);
                    } else {
                        if (stripDuplicates) {
                            fi.getFolderInfo().remove(si);
                            LauncherModel.deleteItemFromDatabase(mLauncher, si);
                        }
                        if (duplicates != null) {
                            duplicates.add(cn);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.phonemetra.turbo.launcher.Workspace.java

void getUniqueIntents(CellLayout cl, ArrayList<ComponentName> uniqueIntents,
        ArrayList<ComponentName> duplicates, boolean stripDuplicates) {
    int count = cl.getShortcutsAndWidgets().getChildCount();

    ArrayList<View> children = new ArrayList<View>();
    for (int i = 0; i < count; i++) {
        View v = cl.getShortcutsAndWidgets().getChildAt(i);
        children.add(v);/*from ww  w  .j ava  2s .c om*/
    }

    for (int i = 0; i < count; i++) {
        View v = children.get(i);
        ItemInfo info = (ItemInfo) v.getTag();
        // Null check required as the AllApps button doesn't have an item info
        if (info instanceof ShortcutInfo && info.itemType != LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS) {
            ShortcutInfo si = (ShortcutInfo) info;
            ComponentName cn = si.intent.getComponent();

            Uri dataUri = si.intent.getData();
            // If dataUri is not null / empty or if this component isn't one that would
            // have previously showed up in the AllApps list, then this is a widget-type
            // shortcut, so ignore it.
            if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                continue;
            }

            if (!uniqueIntents.contains(cn)) {
                uniqueIntents.add(cn);
            } else {
                if (stripDuplicates) {
                    cl.removeViewInLayout(v);
                    LauncherModel.deleteItemFromDatabase(mLauncher, si);
                }
                if (duplicates != null) {
                    duplicates.add(cn);
                }
            }
        }
        if (v instanceof FolderIcon) {
            FolderIcon fi = (FolderIcon) v;
            ArrayList<View> items = fi.getFolder().getItemsInReadingOrder();
            for (int j = 0; j < items.size(); j++) {
                if (items.get(j).getTag() instanceof ShortcutInfo) {
                    ShortcutInfo si = (ShortcutInfo) items.get(j).getTag();
                    ComponentName cn = si.intent.getComponent();

                    Uri dataUri = si.intent.getData();
                    // If dataUri is not null / empty or if this component isn't one that would
                    // have previously showed up in the AllApps list, then this is a widget-type
                    // shortcut, so ignore it.
                    if (dataUri != null && !dataUri.equals(Uri.EMPTY)) {
                        continue;
                    }

                    if (!uniqueIntents.contains(cn)) {
                        uniqueIntents.add(cn);
                    } else {
                        if (stripDuplicates) {
                            fi.getFolderInfo().remove(si);
                            LauncherModel.deleteItemFromDatabase(mLauncher, si);
                        }
                        if (duplicates != null) {
                            duplicates.add(cn);
                        }
                    }
                }
            }
        }
    }
}