Support accessibility shorcut secondary action (1/n)

Create a new preference that could let users enable accessibility
shortcut and choose which shortcut type they prefer to use.

This CL only contains preference layout and functions interfaces.
Functions implementation will be added in next CL.

Bug: 142530063
Test: Maunal, make RunSettingsRoboTests
Change-Id: I69e832638547cd3f38da2192f22c7e219bbcc018
This commit is contained in:
Kevin Chang
2019-10-31 18:48:35 +08:00
parent fe5b2d9624
commit 92da08f7f2
5 changed files with 315 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2019 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.settings.accessibility;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.view.View;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
/** Tests for {@link ShortcutPreference} */
@RunWith(RobolectricTestRunner.class)
public class ShortcutPreferenceTest {
private ShortcutPreference mShortcutPreference;
private View.OnClickListener mSettingButtonListener;
private View.OnClickListener mCheckBoxListener;
@Before
public void setUp() {
final Context mContext = RuntimeEnvironment.application;
mShortcutPreference = new ShortcutPreference(mContext, null);
}
@Test
public void setOnClickListeners_shouldSetListeners() {
mShortcutPreference.setSettingButtonListener(mSettingButtonListener);
mShortcutPreference.setCheckBoxListener(mCheckBoxListener);
assertThat(mShortcutPreference.getCheckBoxListener()).isEqualTo(mCheckBoxListener);
assertThat(mShortcutPreference.getSettingButtonListener()).isEqualTo(
mSettingButtonListener);
}
}