Home | History | Annotate | Download | only in storage
      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.tv.settings.device.storage;
     18 
     19 import android.os.Bundle;
     20 import android.support.annotation.NonNull;
     21 import android.support.v17.leanback.app.GuidedStepFragment;
     22 import android.support.v17.leanback.widget.GuidanceStylist;
     23 import android.support.v17.leanback.widget.GuidedAction;
     24 
     25 import com.android.tv.settings.R;
     26 
     27 import java.util.List;
     28 
     29 public class SlowDriveStepFragment extends GuidedStepFragment {
     30 
     31     public interface Callback {
     32         void onSlowDriveWarningComplete();
     33     }
     34 
     35     public static SlowDriveStepFragment newInstance() {
     36         return new SlowDriveStepFragment();
     37     }
     38 
     39     @Override
     40     public @NonNull GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
     41         return new GuidanceStylist.Guidance(
     42                 getString(R.string.storage_wizard_format_slow_title),
     43                 getString(R.string.storage_wizard_format_slow_summary),
     44                 null,
     45                 getActivity().getDrawable(R.drawable.ic_error_132dp));
     46     }
     47 
     48     @Override
     49     public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
     50         actions.add(new GuidedAction.Builder(getContext())
     51                 .clickAction(GuidedAction.ACTION_ID_OK)
     52                 .build());
     53     }
     54 
     55     @Override
     56     public void onGuidedActionClicked(GuidedAction action) {
     57         ((Callback) getActivity()).onSlowDriveWarningComplete();
     58     }
     59 }
     60