blob: 97d9ece38e72eef8fd84d9cfb706d1160582ac5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tv.tuner.setup;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
import android.support.v17.leanback.widget.GuidedAction;
import com.android.tv.common.ui.setup.SetupGuidedStepFragment;
import com.android.tv.common.ui.setup.SetupMultiPaneFragment;
import com.android.tv.tuner.R;
import java.util.List;
import java.util.TimeZone;
/**
* A fragment for connection type selection.
*/
public class ConnectionTypeFragment extends SetupMultiPaneFragment {
public static final String ACTION_CATEGORY =
"com.android.tv.tuner.setup.ConnectionTypeFragment";
@Override
protected SetupGuidedStepFragment onCreateContentFragment() {
return new ContentFragment();
}
@Override
protected String getActionCategory() {
return ACTION_CATEGORY;
}
@Override
protected boolean needsDoneButton() {
return false;
}
public static class ContentFragment extends SetupGuidedStepFragment {
@NonNull
@Override
public Guidance onCreateGuidance(Bundle savedInstanceState) {
return new Guidance(getString(R.string.ut_connection_title),
getString(R.string.ut_connection_description),
getString(R.string.ut_setup_breadcrumb), null);
}
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions,
Bundle savedInstanceState) {
String[] choices = getResources().getStringArray(R.array.ut_connection_choices);
int length = choices.length - 1;
int startOffset = 0;
for (int i = 0; i < length; ++i) {
actions.add(new GuidedAction.Builder(getActivity())
.id(startOffset + i)
.title(choices[i])
.build());
}
}
@Override
protected String getActionCategory() {
return ACTION_CATEGORY;
}
}
}
|