Example usage for android.os.storage VolumeInfo EXTRA_VOLUME_ID

List of usage examples for android.os.storage VolumeInfo EXTRA_VOLUME_ID

Introduction

In this page you can find the example usage for android.os.storage VolumeInfo EXTRA_VOLUME_ID.

Prototype

String EXTRA_VOLUME_ID

To view the source code for android.os.storage VolumeInfo EXTRA_VOLUME_ID.

Click Source Link

Usage

From source file:com.android.tv.settings.device.storage.UnmountActivity.java

public static Intent getIntent(Context context, String volumeId, String volumeDesc) {
    final Intent i = new Intent(context, UnmountActivity.class);
    i.putExtra(VolumeInfo.EXTRA_VOLUME_ID, volumeId);
    i.putExtra(EXTRA_VOLUME_DESC, volumeDesc);
    return i;/*from  www. j av a2  s. c o m*/
}

From source file:com.android.tv.settings.device.storage.SettingsStorageService.java

public static void unmount(Context context, String volumeId) {
    final Intent intent = new Intent(context, Impl.class);
    intent.setAction(ACTION_UNMOUNT);/*from  w  w  w .  java2  s. co m*/
    intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, volumeId);
    context.startService(intent);
}

From source file:com.android.tv.settings.device.storage.UnmountActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mUnmountVolumeId = getIntent().getStringExtra(VolumeInfo.EXTRA_VOLUME_ID);
    mUnmountVolumeDesc = getIntent().getStringExtra(EXTRA_VOLUME_DESC);

    LocalBroadcastManager.getInstance(this).registerReceiver(mUnmountReceiver,
            new IntentFilter(SettingsStorageService.ACTION_UNMOUNT));

    if (savedInstanceState == null) {
        final StorageManager storageManager = getSystemService(StorageManager.class);
        final VolumeInfo volumeInfo = storageManager.findVolumeById(mUnmountVolumeId);

        if (volumeInfo == null) {
            // Unmounted already, just bail
            finish();//from ww  w  .j a  va  2s. c om
            return;
        }

        if (volumeInfo.getType() == VolumeInfo.TYPE_PRIVATE) {
            final Fragment fragment = UnmountPrivateStepFragment.newInstance(mUnmountVolumeId);
            getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();
        } else {
            // Jump straight to unmounting
            onRequestUnmount();
        }
    }
}