Home | History | Annotate | Download | only in deviceinfo
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.settings.deviceinfo;
     18 
     19 import android.content.Intent;
     20 import android.os.Bundle;
     21 import android.os.storage.DiskInfo;
     22 
     23 import com.android.settings.R;
     24 
     25 public class StorageWizardFormatConfirm extends StorageWizardBase {
     26     public static final String EXTRA_FORMAT_PRIVATE = "format_private";
     27     public static final String EXTRA_FORGET_UUID = "forget_uuid";
     28 
     29     private boolean mFormatPrivate;
     30 
     31     @Override
     32     protected void onCreate(Bundle savedInstanceState) {
     33         super.onCreate(savedInstanceState);
     34         if (mDisk == null) {
     35             finish();
     36             return;
     37         }
     38         setContentView(R.layout.storage_wizard_generic);
     39 
     40         mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
     41         setIllustrationType(
     42                 mFormatPrivate ? ILLUSTRATION_INTERNAL : ILLUSTRATION_PORTABLE);
     43 
     44         if (mFormatPrivate) {
     45             setHeaderText(R.string.storage_wizard_format_confirm_title);
     46             setBodyText(R.string.storage_wizard_format_confirm_body,
     47                     mDisk.getDescription());
     48         } else {
     49             setHeaderText(R.string.storage_wizard_format_confirm_public_title);
     50             setBodyText(R.string.storage_wizard_format_confirm_public_body,
     51                     mDisk.getDescription());
     52         }
     53 
     54         getNextButton().setText(R.string.storage_wizard_format_confirm_next);
     55         getNextButton().setBackgroundTintList(getColorStateList(R.color.storage_wizard_button_red));
     56     }
     57 
     58     @Override
     59     public void onNavigateNext() {
     60         final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
     61         intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
     62         intent.putExtra(EXTRA_FORMAT_PRIVATE, mFormatPrivate);
     63         intent.putExtra(EXTRA_FORGET_UUID, getIntent().getStringExtra(EXTRA_FORGET_UUID));
     64         startActivity(intent);
     65         finishAffinity();
     66     }
     67 }
     68