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:org.secu3.android.ErrorsActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_errors_write:
        if (CeSavedError != null) {
            ((ProtoFieldInteger) CeSavedError.findField(R.string.ce_saved_err_data_title))
                    .setValue(getErrors());
            startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this,
                    Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                            CeSavedError));
        }/*from  w w  w .  ja  v  a2s.c  om*/
        return true;
    case R.id.menu_errors_read:
        if (OpCompNc != null) {
            ((ProtoFieldInteger) OpCompNc.findField(R.string.op_comp_nc_operation_title))
                    .setValue(Secu3Packet.OPCODE_CE_SAVE_ERRORS);
            startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET, Uri.EMPTY, this,
                    Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_SEND_PACKET_PARAM_PACKET,
                            OpCompNc));
        }
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.tct.email.activity.setup.EmailPreferenceActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    if (mFeedbackMenuItem != null) {
        // We only want to enable the feedback menu item, if there is a valid feedback uri
        mFeedbackMenuItem.setVisible(!Uri.EMPTY.equals(mFeedbackUri));
    }//from w  ww  .  ja v  a2s.  c  o  m
    return true;
}

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

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_dashboard:
        if (!AndEngine.isDeviceSupported(this)) {
            new AlertDialog.Builder(this).setTitle(R.string.dialog_device_not_supported_title)
                    .setMessage(R.string.dialog_device_not_supported_title)
                    .setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok, null)
                    .create().show();//from  w  ww.j  av  a  2 s  .com
        } else
            startActivity(new Intent(this, DashBoardActivity.class));
        return true;
    case R.id.menu_preferences:
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    case R.id.menu_params:
        startActivity(new Intent(this, ParamActivity.class));
        return true;
    case R.id.menu_errors:
        startActivity(new Intent(this, ErrorsActivity.class));
        return true;
    case R.id.menu_exit:
        Secu3Service.secu3Notification.notificationManager.cancelAll();
        startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_STOP, Uri.EMPTY, this, Secu3Service.class));
        return true;
    case R.id.menu_diagnostics:
        new AlertDialog.Builder(this).setTitle(android.R.string.dialog_alert_title)
                .setIcon(android.R.drawable.ic_dialog_alert).setMessage(R.string.menu_diagnostics_warning_title)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if ((fwOptions == Integer.MIN_VALUE)
                                || ((fwOptions & (1 << Secu3Packet.COPT_DIAGNOSTICS)) == 0)) {
                            Toast.makeText(getApplicationContext(), R.string.diagnostics_not_supported_title,
                                    Toast.LENGTH_LONG).show();
                        }
                        startActivity(new Intent(getApplicationContext(), DiagnosticsActivity.class));
                    }
                }).setNegativeButton(android.R.string.cancel, null).create().show();
        return true;
    case R.id.menu_raw_sensors:
        item.setChecked(rawSensors = !item.isChecked());
        setRawMode(rawSensors);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

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

@Override
public void resetActionBarIcon() {
    if (isDrawerEnabled()) {
        return;//from   ww  w . j  a  v a 2 s.  c  o  m
    }
    // On two-pane, the back button is only removed in the conversation list mode for top level
    // folders, and shown for every other condition.
    if ((mViewMode.isListMode() && (mFolder == null || mFolder.parent == null || mFolder.parent == Uri.EMPTY))
            || mViewMode.isWaitingForSync()) {
        mActionBarView.removeBackButton();
    } else {
        mActionBarView.setBackButton();
    }
}

From source file:android.net.ProxyInfo.java

/**
 * Implement the Parcelable interface./* w  w w  . j  a  va  2  s.c  o  m*/
 * @hide
 */
public void writeToParcel(Parcel dest, int flags) {
    if (!Uri.EMPTY.equals(mPacFileUrl)) {
        dest.writeByte((byte) 1);
        mPacFileUrl.writeToParcel(dest, 0);
        dest.writeInt(mPort);
        return;
    } else {
        dest.writeByte((byte) 0);
    }
    if (mHost != null) {
        dest.writeByte((byte) 1);
        dest.writeString(mHost);
        dest.writeInt(mPort);
    } else {
        dest.writeByte((byte) 0);
    }
    dest.writeString(mExclusionList);
    dest.writeStringArray(mParsedExclusionList);
}

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

@Override
protected void onResume() {
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.ce_saved_err_title));
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON, Uri.EMPTY, this,
            Secu3Service.class).putExtra(Secu3Service.ACTION_SECU3_SERVICE_OBTAIN_PACKET_SKELETON_PARAM,
                    R.string.op_comp_nc_title));
    registerReceiver(receiver, receiver.intentFilter);
    super.onResume();
}

From source file:de.arcus.playmusicexporter2.fragments.MusicTrackListFragment.java

/**
 * Select a track/*from   w  w  w  .  j a  v a2s  .c  o  m*/
 * @param musicTrack The track
 * @param view The view
 * @param state Selection state
 */
private void selectTrack(MusicTrack musicTrack, View view, TrackSelectionState state) {
    // Track is available
    if (musicTrack.isOfflineAvailable()) {

        // Gets the settings
        PlayMusicExporterSettings settings = new PlayMusicExporterSettings(getActivity());

        // Default structure
        String pathStructure = "{album-artist} - {title}.mp3";

        // Track is exported from a group (playlist or artist)
        if (!TextUtils.isEmpty(musicTrack.getContainerName())) {
            pathStructure = "{group}/{album-artist} - {title}.mp3";
        }

        // Build the path
        String path = MusicPathBuilder.Build(musicTrack, pathStructure);

        // Gets the root uri
        Uri uri = settings.getUri(PlayMusicExporterSettings.PREF_EXPORT_URI, Uri.EMPTY);

        // Prevent the closing
        SelectedTrackList.getInstance().setDoNotCloseActionMode(true);

        switch (state) {
        case Select:
            SelectedTrackList.getInstance().setSelected(new SelectedTrack(musicTrack.getId(), uri, path), true,
                    view);
            break;
        case Deselect:
            SelectedTrackList.getInstance().setSelected(new SelectedTrack(musicTrack.getId(), uri, path), false,
                    view);
            break;
        case Toggle:
            SelectedTrackList.getInstance().toggle(new SelectedTrack(musicTrack.getId(), uri, path), view);
            break;
        }

        SelectedTrackList.getInstance().setDoNotCloseActionMode(false);
    } else {
        if (state == TrackSelectionState.Toggle) {
            // Show an info message for offline tracks
            Toast toast = Toast.makeText(getActivity(), R.string.toast_error_track_not_offline,
                    Toast.LENGTH_LONG);
            toast.show();
        }
    }

    updateFloatingButton();
}

From source file:de.appplant.cordova.emailcomposer.EmailComposerImpl.java

/**
 * The URI for an asset.//from  ww w  .ja v  a2 s . c om
 *
 * @param path
 * The given asset path.
 * @param ctx
 * The application context.
 * @return
 * The URI pointing to the given path.
 */
@SuppressWarnings("ResultOfMethodCallIgnored")
private Uri getUriForAssetPath(String path, Context ctx) {
    String resPath = path.replaceFirst("file:/", "www");
    String fileName = resPath.substring(resPath.lastIndexOf('/') + 1);
    File dir = ctx.getExternalCacheDir();

    if (dir == null) {
        Log.e("EmailComposer", "Missing external cache dir");
        return Uri.EMPTY;
    }

    String storage = dir.toString() + ATTACHMENT_FOLDER;
    File file = new File(storage, fileName);

    new File(storage).mkdir();

    try {
        AssetManager assets = ctx.getAssets();

        FileOutputStream outStream = new FileOutputStream(file);
        InputStream inputStream = assets.open(resPath);

        copyFile(inputStream, outStream);
        outStream.flush();
        outStream.close();
    } catch (Exception e) {
        Log.e("EmailComposer", "File not found: assets/" + resPath);
        e.printStackTrace();
    }

    return Uri.fromFile(file);
}

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

@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

    mCurrentAlbumId = Long.valueOf(id).toString();

    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
    intent.setClass(getActivity(), TrackBrowserActivity.class);
    intent.putExtra("album", mCurrentAlbumId);
    Cursor c = (Cursor) mAdapter.getChild(groupPosition, childPosition);
    String album = c.getString(c.getColumnIndex(MediaStore.Audio.Albums.ALBUM));
    if (album == null || album.equals(MediaStore.UNKNOWN_STRING)) {
        // unknown album, so we should include the artist ID to limit the songs to songs only by that artist 
        mArtistCursor.moveToPosition(groupPosition);
        mCurrentArtistId = mArtistCursor.getString(mArtistCursor.getColumnIndex(MediaStore.Audio.Artists._ID));
        intent.putExtra("artist", mCurrentArtistId);
    }//  ww  w .ja  v a2  s . co m
    startActivity(intent);
    return true;
}

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

@Override
protected void onResume() {
    if (SettingsActivity.isKeepScreenAliveActive(this)) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {// w ww  .java2 s .c om
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
    if ((wakelock != null) && (SettingsActivity.isWakeLockEnabled(this))) {
        wakelock.acquire();
    } else if ((wakelock != null) && (wakelock.isHeld())) {
        wakelock.release();
    }
    registerReceiver(receiver, receiver.intentFilter);
    startService(new Intent(Secu3Service.ACTION_SECU3_SERVICE_START, Uri.EMPTY, this, Secu3Service.class));
    protocol_version = SettingsActivity.getProtocolVersion(getBaseContext());
    logButtonLayout.setVisibility(((protocol_version < SettingsActivity.PROTOCOL_26122013_WINTER_RELEASE)
            || (!SettingsActivity.isSensorLoggerEnabled(this))) ? View.GONE : View.VISIBLE);
    setRawMode(rawSensors);
    ActivityCompat.invalidateOptionsMenu(this);
    super.onResume();
}