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         setIllustrationInternal(mFormatPrivate);
     42 
     43         if (mFormatPrivate) {
     44             setHeaderText(R.string.storage_wizard_format_confirm_title);
     45             setBodyText(R.string.storage_wizard_format_confirm_body,
     46                     mDisk.getDescription());
     47         } else {
     48             setHeaderText(R.string.storage_wizard_format_confirm_public_title);
     49             setBodyText(R.string.storage_wizard_format_confirm_public_body,
     50                     mDisk.getDescription());
     51         }
     52 
     53         getNextButton().setText(R.string.storage_wizard_format_confirm_next);
     54         getNextButton().setBackgroundTintList(getColorStateList(R.color.storage_wizard_button_red));
     55     }
     56 
     57     @Override
     58     public void onNavigateNext() {
     59         final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
     60         intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
     61         intent.putExtra(EXTRA_FORMAT_PRIVATE, mFormatPrivate);
     62         intent.putExtra(EXTRA_FORGET_UUID, getIntent().getStringExtra(EXTRA_FORGET_UUID));
     63         startActivity(intent);
     64         finishAffinity();
     65     }
     66 }
     67