Example usage for android.net Uri EMPTY

List of usage examples for android.net Uri EMPTY

Introduction

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

Prototype

Uri EMPTY

To view the source code for android.net Uri EMPTY.

Click Source Link

Document

The empty URI, equivalent to "".

Usage

From source file:com.android.mail.ui.FolderListFragment.java

private Uri getCurrentAccountUri() {
    return mCurrentAccount == null ? Uri.EMPTY : mCurrentAccount.uri;
}

From source file:com.chen.mail.ui.AbstractActivityController.java

/**
 * {@inheritDoc} Subclasses must override this to listen to mode changes
 * from the ViewMode. Subclasses <b>must</b> call the parent's
 * onViewModeChanged since the parent will handle common state changes.
 */// w ww. jav a2s  . co  m
@Override
public void onViewModeChanged(int newMode) {
    // When we step away from the conversation mode, we don't have a current conversation
    // anymore. Let's blank it out so clients calling getCurrentConversation are not misled.
    if (!ViewMode.isConversationMode(newMode)) {
        setCurrentConversation(null);
    }

    // If the viewmode is not set, preserve existing icon.
    if (newMode != ViewMode.UNKNOWN) {
        resetActionBarIcon();
    }

    if (isDrawerEnabled()) {
        /** If the folder doesn't exist, or its parent URI is empty,
         * this is not a child folder */
        final boolean isTopLevel = (mFolder == null) || (mFolder.parent == Uri.EMPTY);
        mDrawerToggle.setDrawerIndicatorEnabled(getShouldShowDrawerIndicator(newMode, isTopLevel));
        mDrawerContainer.setDrawerLockMode(getShouldAllowDrawerPull(newMode) ? DrawerLayout.LOCK_MODE_UNLOCKED
                : DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        closeDrawerIfOpen();
    }
}

From source file:com.android.mail.compose.ComposeActivity.java

/**
 * Effectively discard the current message.
 *
 * This method is either invoked from the menu or from the dialog
 * once the user has confirmed that they want to discard the message.
 *//*from   w  ww. ja  va2  s . c  o  m*/
private void doDiscardWithoutConfirmation() {
    synchronized (mDraftLock) {
        if (mDraftId != UIProvider.INVALID_MESSAGE_ID) {
            ContentValues values = new ContentValues();
            values.put(BaseColumns._ID, mDraftId);
            if (!mAccount.expungeMessageUri.equals(Uri.EMPTY)) {
                getContentResolver().update(mAccount.expungeMessageUri, values, null, null);
            } else {
                getContentResolver().delete(mDraft.uri, null, null);
            }
            // This is not strictly necessary (since we should not try to
            // save the draft after calling this) but it ensures that if we
            // do save again for some reason we make a new draft rather than
            // trying to resave an expunged draft.
            mDraftId = UIProvider.INVALID_MESSAGE_ID;
        }
    }

    // Display a toast to let the user know
    Toast.makeText(this, R.string.message_discarded, Toast.LENGTH_SHORT).show();

    // This prevents the draft from being saved in onPause().
    discardChanges();
    mPerformedSendOrDiscard = true;
    finish();
}

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  w ww  .ja v a 2 s .  com*/
    }

    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 ww  .j a v a  2 s.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) {
            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);/*from  w  w  w. j ava 2  s. c om*/
    }

    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);/*  w  ww.  j  av a  2s. com*/
    }

    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);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.tct.mail.compose.ComposeActivity.java

/**
 * Effectively discard the current message.
 *
 * This method is either invoked from the menu or from the dialog
 * once the user has confirmed that they want to discard the message.
 *///ww w  .  j a va 2  s . c o  m
private void doDiscardWithoutConfirmation() {
    synchronized (mDraftLock) {
        if (mDraftId != UIProvider.INVALID_MESSAGE_ID) {
            ContentValues values = new ContentValues();
            values.put(BaseColumns._ID, mDraftId);
            if (!mAccount.expungeMessageUri.equals(Uri.EMPTY)) {
                getContentResolver().update(mAccount.expungeMessageUri, values, null, null);
            } else {
                getContentResolver().delete(mDraft.uri, null, null);
            }
            // This is not strictly necessary (since we should not try to
            // save the draft after calling this) but it ensures that if we
            // do save again for some reason we make a new draft rather than
            // trying to resave an expunged draft.
            mDraftId = UIProvider.INVALID_MESSAGE_ID;
        }
    }

    // Display a toast to let the user know
    //[BUGFIX]-MOD by SCDTABLET.shujing.jin@tcl.com,08/05/2016,2635083
    Utility.showShortToast(this, R.string.message_discarded);
    //Toast.makeText(this, R.string.message_discarded, Toast.LENGTH_SHORT).show();

    // This prevents the draft from being saved in onPause().
    discardChanges();
    mPerformedSendOrDiscard = true;
    finish();
}