SUW: improve navigation on D-pad devices
* Set the initial focus on a usable view instead of a whole layout. * Set the next focus of the locale selector to next-button. Change-Id: I4a16127c24e87b52e38892882e44b3a8d24b779b
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
* Copyright (C) 2017-2021 The LineageOS Project
|
||||
* 2017-2022 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.
|
||||
@@ -247,6 +247,10 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga
|
||||
}
|
||||
}
|
||||
|
||||
public Button getNextButton() {
|
||||
return mNavigationBar.getNextButton();
|
||||
}
|
||||
|
||||
protected void setSkipText(int resId) {
|
||||
if (mNavigationBar != null) {
|
||||
mNavigationBar.getSkipButton().setText(resId);
|
||||
|
@@ -82,6 +82,7 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
|
||||
View metricsRow = findViewById(R.id.metrics);
|
||||
metricsRow.setOnClickListener(mMetricsClickListener);
|
||||
metricsRow.requestFocus();
|
||||
String metricsHelpImproveLineage =
|
||||
getString(R.string.services_help_improve_cm, os_name);
|
||||
String metricsSummary = getString(R.string.services_metrics_label,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
* Copyright (C) 2017-2021 The LineageOS Project
|
||||
* 2017-2022 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.
|
||||
@@ -81,6 +81,8 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
SystemBarHelper.setBackButtonVisible(getWindow(), true);
|
||||
setNextText(R.string.next);
|
||||
mLanguagePicker = (LocalePicker) findViewById(R.id.locale_list);
|
||||
mLanguagePicker.setNextRight(getNextButton().getId());
|
||||
mLanguagePicker.requestFocus();
|
||||
loadLanguages();
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* 2022 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.
|
||||
@@ -56,6 +57,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.Scroller;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
|
||||
import org.lineageos.setupwizard.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -1175,6 +1178,14 @@ public class LocalePicker extends LinearLayout {
|
||||
setValueInternal(value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the next focused item for a remote D-pad key right.
|
||||
* @param id The ID of the next view.
|
||||
*/
|
||||
public void setNextRight(@IdRes int id) {
|
||||
setNextFocusRightId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the soft input for its input text.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user