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 
17 package com.android.systemui.accessibility;
18 
19 import static com.android.systemui.accessibility.WindowMagnificationSettings.MagnificationSize;
20 
21 /**
22  * A callback to inform WindowMagnificationController about
23  * the setting value change or the user interaction.
24  */
25 public interface WindowMagnificationSettingsCallback {
26 
27     /**
28      * Called when change magnification size.
29      *
30      * @param index Magnification size index.
31      * 0 : MagnificationSize.NONE, 1 : MagnificationSize.SMALL,
32      * 2 : MagnificationSize.MEDIUM, 3: MagnificationSize.LARGE,
33      * 4 : MagnificationSize.FULLSCREEN
34      */
onSetMagnifierSize(@agnificationSize int index)35     void onSetMagnifierSize(@MagnificationSize int index);
36 
37     /**
38      * Called when set allow diagonal scrolling.
39      *
40      * @param enable Allow diagonal scrolling enable value.
41      */
onSetDiagonalScrolling(boolean enable)42     void onSetDiagonalScrolling(boolean enable);
43 
44     /**
45      * Called when change magnification size on free mode.
46      *
47      * @param enable Free mode enable value.
48      */
onEditMagnifierSizeMode(boolean enable)49     void onEditMagnifierSizeMode(boolean enable);
50 
51     /**
52      * Called when set magnification scale.
53      *
54      * @param scale Magnification scale value.
55      * @param updatePersistence whether the scale should be persisted
56      */
onMagnifierScale(float scale, boolean updatePersistence)57     void onMagnifierScale(float scale, boolean updatePersistence);
58 
59     /**
60      * Called when magnification mode changed.
61      *
62      * @param newMode Magnification mode
63      * 1 : ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN, 2 : ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW
64      */
onModeSwitch(int newMode)65     void onModeSwitch(int newMode);
66 
67     /**
68      * Called when the visibility of the magnification settings panel changed.
69      *
70      * @param shown The visibility of the magnification settings panel.
71      */
onSettingsPanelVisibilityChanged(boolean shown)72     void onSettingsPanelVisibilityChanged(boolean shown);
73 }
74