diff options
| author | Timi Rautamäki <timi.rautamaki@gmail.com> | 2021-08-24 19:19:25 +0000 |
|---|---|---|
| committer | George Zacharia <george.zcharia@gmail.com> | 2021-09-26 11:34:24 +0530 |
| commit | 0c6de9d786ba92e0df57f990ee3bc8ea9503e138 (patch) | |
| tree | 63338c711325d884d39233a726d15652a30044d7 | |
| parent | e4b4849ea3d95fb2e6185c06bd737b16bb89b8ea (diff) | |
SUW: add accessibility settings to welcome page
Added icon is from https://materialdesignicons.com/.
Change-Id: I21daa20c59f3deb7ef862fdbe7f7ce9262094c9a
| -rw-r--r-- | res/drawable/ic_eye.xml | 26 | ||||
| -rw-r--r-- | res/layout/welcome_activity.xml | 28 | ||||
| -rw-r--r-- | res/values/strings.xml | 1 | ||||
| -rw-r--r-- | src/com/aicp/setupwizard/BaseSetupWizardActivity.java | 16 | ||||
| -rw-r--r-- | src/com/aicp/setupwizard/SetupWizardApp.java | 2 | ||||
| -rw-r--r-- | src/com/aicp/setupwizard/WelcomeActivity.java | 2 |
6 files changed, 67 insertions, 8 deletions
diff --git a/res/drawable/ic_eye.xml b/res/drawable/ic_eye.xml new file mode 100644 index 0000000..805c1c6 --- /dev/null +++ b/res/drawable/ic_eye.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2021 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="@color/black" + android:pathData="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /> +</vector> diff --git a/res/layout/welcome_activity.xml b/res/layout/welcome_activity.xml index eab732b..205ec0d 100644 --- a/res/layout/welcome_activity.xml +++ b/res/layout/welcome_activity.xml @@ -55,14 +55,28 @@ </LinearLayout> - <Button - android:id="@+id/emerg_dialer" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center" - android:drawableTop="@drawable/ic_dialer" - android:text="@string/emergency_call" - style="@style/SudGlifButton.Secondary" /> + android:orientation="horizontal" + android:gravity="center"> + + <Button + android:id="@+id/emerg_dialer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableTop="@drawable/ic_dialer" + android:text="@string/emergency_call" + style="@style/SudGlifButton.Secondary" /> + <Button + android:id="@+id/launch_accessibility" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableTop="@drawable/ic_eye" + android:text="@string/accessibility_settings" + style="@style/SudGlifButton.Secondary" /> + + </LinearLayout> </LinearLayout> </com.google.android.setupdesign.GlifLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index e0d132f..e18ba13 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -66,6 +66,7 @@ <string name="data_sim_name">SIM <xliff:g id="sub">%1$d</xliff:g> - <xliff:g id="name">%2$s</xliff:g></string> <string name="emergency_call">Emergency call</string> + <string name="accessibility_settings">Accessibility settings</string> <string name="setup_services">AICP features</string> <string name="services_explanation" product="tablet">These services work for you to extend the capabilities of your tablet. Data will be used in accordance with AICP\'s <xliff:g id="name" example="Privacy Policy">%s</xliff:g>.</string> diff --git a/src/com/aicp/setupwizard/BaseSetupWizardActivity.java b/src/com/aicp/setupwizard/BaseSetupWizardActivity.java index 8c9815c..2924c7f 100644 --- a/src/com/aicp/setupwizard/BaseSetupWizardActivity.java +++ b/src/com/aicp/setupwizard/BaseSetupWizardActivity.java @@ -22,6 +22,7 @@ import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NO import static com.google.android.setupcompat.util.ResultCodes.RESULT_RETRY; import static com.google.android.setupcompat.util.ResultCodes.RESULT_SKIP; +import static com.aicp.setupwizard.SetupWizardApp.ACTION_ACCESSIBILITY_SETTINGS; import static com.aicp.setupwizard.SetupWizardApp.ACTION_EMERGENCY_DIAL; import static com.aicp.setupwizard.SetupWizardApp.ACTION_NEXT; import static com.aicp.setupwizard.SetupWizardApp.ACTION_SETUP_COMPLETE; @@ -74,6 +75,7 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga protected static final int NEXT_REQUEST = 10000; protected static final int EMERGENCY_DIAL_ACTIVITY_REQUEST = 10038; + protected static final int ACCESSIBILITY_SETTINGS_ACTIVITY_REQUEST = 10039; protected static final int WIFI_ACTIVITY_REQUEST = 10004; protected static final int BLUETOOTH_ACTIVITY_REQUEST = 10100; protected static final int BIOMETRIC_ACTIVITY_REQUEST = 10101; @@ -294,6 +296,17 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga } } + protected void startAccessibilitySettings() { + try { + startFirstRunActivityForResult(new Intent(ACTION_ACCESSIBILITY_SETTINGS), + ACCESSIBILITY_SETTINGS_ACTIVITY_REQUEST); + applyForwardTransition(TRANSITION_ID_DEFAULT); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "Can't find the accessibility settings: " + + "android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW"); + } + } + protected void onSetupStart() { SetupWizardUtils.disableCaptivePortalDetection(getApplicationContext()); tryEnablingWifi(); @@ -329,7 +342,8 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga } mIsGoingBack = true; if (requestCode != NEXT_REQUEST || resultCode != RESULT_CANCELED) { - if (requestCode == EMERGENCY_DIAL_ACTIVITY_REQUEST) { + if (requestCode == EMERGENCY_DIAL_ACTIVITY_REQUEST | + requestCode == ACCESSIBILITY_SETTINGS_ACTIVITY_REQUEST) { applyBackwardTransition(TRANSITION_ID_DEFAULT); return; } diff --git a/src/com/aicp/setupwizard/SetupWizardApp.java b/src/com/aicp/setupwizard/SetupWizardApp.java index 8230450..a0f4968 100644 --- a/src/com/aicp/setupwizard/SetupWizardApp.java +++ b/src/com/aicp/setupwizard/SetupWizardApp.java @@ -36,6 +36,8 @@ public class SetupWizardApp extends Application { /* Verbose Logging */ public static final boolean LOGV = Log.isLoggable(TAG, Log.VERBOSE); + public static final String ACTION_ACCESSIBILITY_SETTINGS = + "android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW"; public static final String ACTION_SETUP_COMPLETE = "com.aicp.setupwizard.AICP_SETUP_COMPLETE"; public static final String ACTION_FINISHED = "com.aicp.setupwizard.SETUP_FINISHED"; public static final String ACTION_SETUP_WIFI = "android.net.wifi.PICK_WIFI_NETWORK"; diff --git a/src/com/aicp/setupwizard/WelcomeActivity.java b/src/com/aicp/setupwizard/WelcomeActivity.java index 338d783..d7459b5 100644 --- a/src/com/aicp/setupwizard/WelcomeActivity.java +++ b/src/com/aicp/setupwizard/WelcomeActivity.java @@ -50,6 +50,8 @@ public class WelcomeActivity extends BaseSetupWizardActivity { findViewById(R.id.start).setOnClickListener(view -> onNextPressed()); findViewById(R.id.emerg_dialer) .setOnClickListener(view -> startEmergencyDialer()); + findViewById(R.id.launch_accessibility) + .setOnClickListener(view -> startAccessibilitySettings()); mEnableAccessibilityController = EnableAccessibilityController.getInstance(getApplicationContext()); mGestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { |
