1 /*
2  * Copyright (C) 2018 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.shortcut;
18 
19 import static com.android.settings.search.actionbar.SearchMenuController.NEED_SEARCH_ICON_IN_ACTION_BAR;
20 
21 import android.app.settings.SettingsEnums;
22 import android.content.Context;
23 import android.os.Bundle;
24 
25 import com.android.settings.R;
26 import com.android.settings.dashboard.DashboardFragment;
27 
28 /**
29  * UI for create widget/shortcut screen.
30  */
31 public class CreateShortcut extends DashboardFragment {
32 
33     private static final String TAG = "CreateShortcut";
34 
35     @Override
onCreate(Bundle icicle)36     public void onCreate(Bundle icicle) {
37         super.onCreate(icicle);
38         Bundle args = getArguments();
39         if (args == null) {
40             args = new Bundle();
41             setArguments(args);
42         }
43         args.putBoolean(NEED_SEARCH_ICON_IN_ACTION_BAR, false);
44     }
45 
46     @Override
onAttach(Context context)47     public void onAttach(Context context) {
48         super.onAttach(context);
49         use(CreateShortcutPreferenceController.class).setActivity(getActivity());
50     }
51 
52     @Override
getPreferenceScreenResId()53     protected int getPreferenceScreenResId() {
54         return R.xml.create_shortcut;
55     }
56 
57     @Override
getLogTag()58     protected String getLogTag() {
59         return TAG;
60     }
61 
62     @Override
getMetricsCategory()63     public int getMetricsCategory() {
64         return SettingsEnums.SETTINGS_CREATE_SHORTCUT;
65     }
66 
67     @Override
getHelpResource()68     public int getHelpResource() {
69         return 0;
70     }
71 }
72