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.TwoPaneController.java

/**
 * Up works as follows:/*from   w  ww  .j  a va 2 s . c om*/
 * 1) If the user is in a conversation and:
 *  a) the conversation list is hidden (portrait mode), shows the conv list and
 *  stays in conversation view mode.
 *  b) the conversation list is shown, goes back to conversation list mode.
 * 2) If the user is in search results, up exits search.
 * mode and returns the user to whatever view they were in when they began search.
 * 3) If the user is in conversation list mode, there is no up.
 */
@Override
public boolean handleUpPress() {
    int mode = mViewMode.getMode();
    if (mode == ViewMode.CONVERSATION || mViewMode.isAdMode()) {
        handleBackPress();
    } else if (mode == ViewMode.SEARCH_RESULTS_CONVERSATION) {
        if (mLayout.isConversationListCollapsed() || (ConversationListContext.isSearchResult(mConvListContext)
                && !Utils.showTwoPaneSearchResults(mActivity.getApplicationContext()))) {
            handleBackPress();
        } else {
            mActivity.finish();
        }
    } else if (mode == ViewMode.SEARCH_RESULTS_LIST) {
        mActivity.finish();
    } else if (mode == ViewMode.CONVERSATION_LIST || mode == ViewMode.WAITING_FOR_ACCOUNT_INITIALIZATION) {
        final boolean isTopLevel = (mFolder == null) || (mFolder.parent == Uri.EMPTY);

        if (isTopLevel) {
            // Show the drawer
            toggleDrawerState();
        } else {
            popView(true);
        }
    }
    return true;
}

From source file:com.android.music.AlbumBrowserActivity.java

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
    intent.putExtra("album", Long.valueOf(id).toString());
    intent.putExtra("artist", mArtistId);
    startActivity(intent);/* www .  ja  v  a  2 s. c  o m*/
}

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

/**
 * Up works as follows://  w  w w . j  a  v  a  2  s.com
 * 1) If the user is in a conversation list that is not the default account inbox,
 * a conversation, or the folder list, up follows the rules of back.
 * 2) If the user is in search results, up exits search
 * mode and returns the user to whatever view they were in when they began search.
 * 3) If the user is in the inbox, there is no up.
 */
@Override
public boolean handleUpPress() {
    final int mode = mViewMode.getMode();
    if (mode == ViewMode.SEARCH_RESULTS_LIST) {
        mActivity.finish();
        // Not needed, the activity is going away anyway.
    } else if (mode == ViewMode.CONVERSATION_LIST || mode == ViewMode.WAITING_FOR_ACCOUNT_INITIALIZATION) {
        final boolean isTopLevel = (mFolder == null) || (mFolder.parent == Uri.EMPTY);

        if (isTopLevel) {
            // Show the drawer.
            toggleDrawerState();
        } else {
            navigateUpFolderHierarchy();
        }
    } else if (mode == ViewMode.CONVERSATION || mode == ViewMode.SEARCH_RESULTS_CONVERSATION
            || mode == ViewMode.AD) {
        // Same as go back.
        handleBackPress();
    }
    return true;
}

From source file:org.secu3.android.DiagnosticsActivity.java

@Override
public void onParamItemChange(BaseParamItem item) {
    if (DiagOutDat != null) {
        ((ProtoFieldInteger) DiagOutDat.findField(R.string.diagout_dat_bitfield_title)).setValue(getOutputs());
        startService(/*from ww w .ja v  a  2s  .c  o  m*/
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET, DiagOutDat));
    }
}

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

/**
 * Pops the "view stack" to the last screen the user was viewing.
 *
 * @param preventClose Whether to prevent closing the app if the stack is empty.
 *//*w  w  w  .ja va 2  s. c  om*/
protected void popView(boolean preventClose) {
    // If the user is in search query entry mode, or the user is viewing
    // search results, exit
    // the mode.
    int mode = mViewMode.getMode();
    if (mode == ViewMode.SEARCH_RESULTS_LIST) {
        mActivity.finish();
    } else if (mode == ViewMode.CONVERSATION || mViewMode.isAdMode()) {
        // Go to conversation list.
        mViewMode.enterConversationListMode();
    } else if (mode == ViewMode.SEARCH_RESULTS_CONVERSATION) {
        mViewMode.enterSearchResultsListMode();
    } else {
        // The Folder List fragment can be null for monkeys where we get a back before the
        // folder list has had a chance to initialize.
        final FolderListFragment folderList = getFolderListFragment();
        if (mode == ViewMode.CONVERSATION_LIST && folderList != null && mFolder != null
                && mFolder.parent != Uri.EMPTY) {
            // If the user navigated via the left folders list into a child folder,
            // back should take the user up to the parent folder's conversation list.
            navigateUpFolderHierarchy();
            // Otherwise, if we are in the conversation list but not in the default
            // inbox and not on expansive layouts, we want to switch back to the default
            // inbox. This fixes b/9006969 so that on smaller tablets where we have this
            // hybrid one and two-pane mode, we will return to the inbox. On larger tablets,
            // we will instead exit the app.
        } else {
            // Don't think mLayout could be null but checking just in case
            if (mLayout == null) {
                LogUtils.wtf(LOG_TAG, new Throwable(), "mLayout is null");
            }
            // mFolder could be null if back is pressed while account is waiting for sync
            final boolean shouldLoadInbox = mode == ViewMode.CONVERSATION_LIST && mFolder != null
                    && !mFolder.folderUri.equals(mAccount.settings.defaultInbox) && mLayout != null
                    && !mLayout.isExpansiveLayout();
            if (shouldLoadInbox) {
                loadAccountInbox();
            } else if (!preventClose) {
                // There is nothing else to pop off the stack.
                mActivity.finish();
            }
        }
    }
}

From source file:com.google.samples.apps.iosched.videolibrary.VideoLibraryFilteredFragment.java

@Override
public Uri getDataUri(QueryEnum query) {
    if (query == VideoLibraryModel.VideoLibraryQueryEnum.VIDEOS
            || query == VideoLibraryModel.VideoLibraryQueryEnum.FILTERS) {
        return ScheduleContract.Videos.CONTENT_URI;
    } else if (query == VideoLibraryModel.VideoLibraryQueryEnum.MY_VIEWED_VIDEOS) {
        return ScheduleContract.MyViewedVideos.CONTENT_URI;
    }//from w w  w .  j  a v a  2  s.  c  o  m
    return Uri.EMPTY;
}

From source file:com.android.mail.providers.Attachment.java

/**
 * Returns a stable identifier URI for this attachment. TODO: make the uri
 * field stable, and put provider-specific opaque bits and bobs elsewhere
 *///from  w  ww  . j a v  a 2s  . com
public Uri getIdentifierUri() {
    if (Utils.isEmpty(mIdentifierUri)) {
        mIdentifierUri = Utils.isEmpty(uri) ? (Utils.isEmpty(contentUri) ? Uri.EMPTY : contentUri)
                : uri.buildUpon().clearQuery().build();
    }
    return mIdentifierUri;
}

From source file:org.secu3.android.ParamActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_params_download:
        progressBar.setIndeterminate(true);
        progressBar.setVisibility(ProgressBar.VISIBLE);
        paramsRead();/*www. j ava2 s .  c om*/
        return true;
    case R.id.menu_params_upload:
        paramsUpload();
        return true;
    case R.id.menu_params_save_eeprom:
        progressBar.setIndeterminate(true);
        progressBar.setVisibility(ProgressBar.VISIBLE);
        Secu3Packet packet = new Secu3Packet(Skeletons.get(R.string.op_comp_nc_title));
        ((ProtoFieldInteger) packet.findField(R.string.op_comp_nc_operation_title))
                .setValue(Secu3Packet.OPCODE_EEPROM_PARAM_SAVE);
        ((ProtoFieldInteger) packet.findField(R.string.op_comp_nc_operation_code_title)).setValue(0);
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET, packet));
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:org.secu3.android.ParamActivity.java

private void paramsUpload() {
    if (isValid) {
        progressBar.setIndeterminate(true);
        progressBar.setVisibility(ProgressBar.VISIBLE);
        startService(// www .  j  a  va2s.  c  o  m
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PROGRESS, PARAMS_NUMBER));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.starter_title), paramAdapter,
                                        R.string.starter_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.angles_title), paramAdapter,
                                        R.string.angles_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.idling_title), paramAdapter,
                                        R.string.idling_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.functions_title), paramAdapter,
                                        R.string.functions_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.temperature_title), paramAdapter,
                                        R.string.temperature_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.carburetor_title), paramAdapter,
                                        R.string.carburetor_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.adc_errors_title), paramAdapter,
                                        R.string.adc_errors_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.ckps_title), paramAdapter,
                                        R.string.ckps_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.miscellaneous_title),
                                        paramAdapter, R.string.miscellaneous_title)));
        startService(
                new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this, Secu3Service.class)
                        .putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                                packetUtils.buildPacket(Skeletons.get(R.string.choke_control_title),
                                        paramAdapter, R.string.choke_control_title)));
        if (protocol_version >= SettingsActivity.PROTOCOL_28082013_SUMMER_RELEASE) {
            startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this,
                    Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                            packetUtils.buildPacket(Skeletons.get(R.string.secur_par_title), paramAdapter,
                                    R.string.secur_par_title)));
        }
    }
}

From source file:com.android.music.AlbumBrowserFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
    intent.setClass(getActivity(), TrackBrowserActivity.class);
    intent.putExtra("album", Long.valueOf(id).toString());
    intent.putExtra("artist", mArtistId);
    startActivity(intent);//  w ww . j ava  2s  .c om

}