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