1 /*
2  * Copyright (C) 2022 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 package com.android.launcher3.widget.picker;
17 
18 import android.content.Context;
19 import android.graphics.Rect;
20 import android.util.AttributeSet;
21 
22 import com.android.launcher3.PagedView;
23 import com.android.launcher3.workprofile.PersonalWorkPagedView;
24 
25 /**
26  * A {@link PagedView} for showing different widgets for the personal and work profile.
27  */
28 public class WidgetPagedView extends PersonalWorkPagedView {
29 
WidgetPagedView(Context context)30     public WidgetPagedView(Context context) {
31         this(context, null);
32     }
33 
WidgetPagedView(Context context, AttributeSet attrs)34     public WidgetPagedView(Context context, AttributeSet attrs) {
35         this(context, attrs, 0);
36     }
37 
WidgetPagedView(Context context, AttributeSet attrs, int defStyle)38     public WidgetPagedView(Context context, AttributeSet attrs, int defStyle) {
39         super(context, attrs, defStyle);
40         setPageSpacing(getPaddingLeft());
41     }
42 
43     @Override
getDrawingRect(Rect outRect)44     public void getDrawingRect(Rect outRect) {
45         super.getDrawingRect(outRect);
46         outRect.left += getPaddingLeft();
47         outRect.right -= getPaddingRight();
48     }
49 }
50