summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Martins <bgcngm@gmail.com>2022-02-15 09:26:10 +0000
committerTom Marshall <tdm.code@gmail.com>2022-02-18 07:32:05 -0800
commitcc6451deed1211381334492096a014066d39c67d (patch)
tree407af42965ca513326baf052e3c7cd9524bc20ef
parentbaefb0c3342b91bbfda33829be611e9e21f86749 (diff)
pro1: devicesettings: Migrate SuW page to setupdesign layoutr11.1
Since SuW was updated to use setupdesign layout and moved to the standard navigation method that the device-specific page became broken. Change-Id: Ia996b13ef9e6ac9f0aa9884e005e713757e872bf
-rw-r--r--devicesettings/Android.bp4
-rw-r--r--devicesettings/res/layout/bottom_row.xml47
-rw-r--r--devicesettings/res/layout/header_condensed.xml48
-rw-r--r--devicesettings/res/layout/setupwizard.xml128
-rw-r--r--devicesettings/res/values/colors.xml22
-rw-r--r--devicesettings/res/values/dimens.xml11
-rw-r--r--devicesettings/res/values/styles_setupwizard.xml45
-rw-r--r--devicesettings/src/org/lineageos/settings/device/SetupWizardBaseActivity.java56
8 files changed, 100 insertions, 261 deletions
diff --git a/devicesettings/Android.bp b/devicesettings/Android.bp
index f205b95..6423fb4 100644
--- a/devicesettings/Android.bp
+++ b/devicesettings/Android.bp
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2020-2021 The LineageOS Project
+// Copyright (C) 2020-2022 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
@@ -15,6 +15,8 @@ android_app {
static_libs: [
"com.aicp.settings.resources",
+ "SettingsLib",
+ "setupdesign",
],
optimize: {
diff --git a/devicesettings/res/layout/bottom_row.xml b/devicesettings/res/layout/bottom_row.xml
deleted file mode 100644
index 12bdf8e..0000000
--- a/devicesettings/res/layout/bottom_row.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/sud_navbar_height"
- android:baselineAligned="false"
- android:orientation="horizontal"
- style="@style/NavBarTheme">
-
- <Button
- android:id="@+id/btn_back"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:drawableStart="@drawable/ic_chevron_left"
- android:gravity="start|center_vertical"
- style="@style/NavBarButtonStyle"/>
-
- <View
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:visibility="invisible" />
-
- <Button
- android:id="@+id/btn_next"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:drawableEnd="@drawable/ic_chevron_right"
- android:gravity="end|center_vertical"
- android:text="@string/setupwizard_next"
- style="@style/NavBarButtonStyle"/>
-</LinearLayout>
diff --git a/devicesettings/res/layout/header_condensed.xml b/devicesettings/res/layout/header_condensed.xml
deleted file mode 100644
index 3275924..0000000
--- a/devicesettings/res/layout/header_condensed.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 The CyanogenMod Project
- Copyright (C) 2017 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.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/header"
- android:layout_width="match_parent"
- android:layout_height="@dimen/header_condensed_height"
- android:paddingTop="48dp"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/header_icon"
- android:layout_width="64dp"
- android:layout_height="wrap_content"
- android:paddingStart="8dp"
- android:paddingEnd="8dp"
- android:adjustViewBounds="true"
- android:scaleType="centerInside"
- android:visibility="visible"
- android:contentDescription="@null"
- android:src="@drawable/ic_keyboard_outline" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="64dp"
- android:layout_toEndOf="@id/header_icon"
- android:paddingEnd="8dp"
- android:typeface="monospace"
- android:gravity="center_vertical"
- android:maxLines="1"
- android:ellipsize="end"
- style="@style/PageTitle" />
-
-</RelativeLayout>
diff --git a/devicesettings/res/layout/setupwizard.xml b/devicesettings/res/layout/setupwizard.xml
index 2990a2c..c968fa6 100644
--- a/devicesettings/res/layout/setupwizard.xml
+++ b/devicesettings/res/layout/setupwizard.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2021 The LineageOS Project
+ Copyright (C) 2021-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.
@@ -14,78 +14,88 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
+<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:background="@color/primary">
+ android:layout_height="match_parent">
- <!-- Header; title and icon are being set in code -->
- <include layout="@layout/header_condensed" />
-
- <FrameLayout
- android:id="@+id/page"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ style="@style/SudContentFrame">
- <ScrollView
+ <FrameLayout
+ android:id="@+id/page"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
+ android:layout_height="0dp"
+ android:layout_weight="1">
- <LinearLayout
- android:orientation="vertical"
+ <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
- style="@style/PageContent">
-
- <!-- Add your own screen content here -->
+ android:fillViewport="true">
- <!-- Summary text -->
- <TextView
+ <LinearLayout
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/PageSummaryText"
- android:textSize="16sp"
- android:paddingLeft="@dimen/content_margin_left"
- android:layout_marginBottom="@dimen/summary_margin_bottom"
- android:paddingRight="@dimen/content_margin_right"
- android:text="@string/setupwizard_summary" />
-
- <!-- Spinner option -->
- <TwoLineListItem
- android:id="@+id/keylayout_item"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:mode="twoLine"
- android:background="?android:attr/selectableItemBackground"
- android:gravity="center_vertical">
+ android:layout_height="match_parent">
+ <!-- Add your own screen content here -->
+
+ <!-- Summary text -->
<TextView
- android:id="@+id/keylayout_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/keyboard_layout_title"
- style="@style/SpinnerItem" />
+ style="@style/SudItemTitle.GlifDescription"
+ android:text="@string/setupwizard_summary"/>
- <Spinner
- android:id="@+id/kbd_layout_list"
- android:layout_width="200dp"
+ <!-- Spinner option -->
+ <TwoLineListItem
+ android:id="@+id/keylayout_item"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:saveEnabled="false"/>
- </TwoLineListItem>
- </LinearLayout>/>
- </ScrollView>
- </FrameLayout>
-
- <!-- Navigation; Keep this! -->
- <include
- layout="@layout/bottom_row"
- style="@style/NavBarTheme"
- android:layout_width="match_parent"
- android:layout_height="@dimen/sud_navbar_height"/>
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:mode="twoLine"
+ android:background="?android:attr/selectableItemBackground"
+ android:gravity="center_vertical">
+
+ <TextView
+ android:id="@+id/keylayout_title"
+ android:layout_marginTop="24dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/keyboard_layout_title"
+ style="@style/SpinnerItem" />
+
+ <Spinner
+ android:id="@+id/kbd_layout_list"
+ android:layout_marginTop="48dp"
+ android:layout_width="200dp"
+ android:layout_height="wrap_content"
+ android:saveEnabled="false"/>
+ </TwoLineListItem>
+ </LinearLayout>
+ </ScrollView>
+ </FrameLayout>
+
+ <!-- Navigation; Keep this! -->
+ <RelativeLayout
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/btn_next"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:text="@string/setupwizard_next"
+ style="@style/SudGlifButton.Primary" />
+
+ </RelativeLayout>
-</LinearLayout>
+ </LinearLayout>
+</com.google.android.setupdesign.GlifLayout>
diff --git a/devicesettings/res/values/colors.xml b/devicesettings/res/values/colors.xml
deleted file mode 100644
index ed4d781..0000000
--- a/devicesettings/res/values/colors.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
--->
-<resources>
- <!-- from SuW -->
- <color name="page_background">#e4e7e9</color>
- <color name="primary">@color/page_background</color>
- <color name="black">#21272b</color>
-</resources>
diff --git a/devicesettings/res/values/dimens.xml b/devicesettings/res/values/dimens.xml
index 1845ea4..e921a55 100644
--- a/devicesettings/res/values/dimens.xml
+++ b/devicesettings/res/values/dimens.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2021 The LineageOS Project
+ Copyright (C) 2021-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.
@@ -15,16 +15,7 @@
limitations under the License.
-->
<resources>
- <dimen name="header_condensed_height">88dp</dimen>
<dimen name="content_margin_top">26dp</dimen>
<dimen name="content_margin_left">26dp</dimen>
<dimen name="content_margin_right">30dp</dimen>
- <dimen name="summary_margin_bottom">20dp</dimen>
- <dimen name="setup_line_spacing">3sp</dimen>
-
- <dimen name="sud_navbar_button_drawable_padding">6dp</dimen>
- <dimen name="sud_navbar_button_padding_sides">10dp</dimen>
- <dimen name="sud_navbar_text_size">16sp</dimen>
- <dimen name="sud_navbar_padding_sides">24dp</dimen>
- <dimen name="sud_navbar_height">56dp</dimen>
</resources>
diff --git a/devicesettings/res/values/styles_setupwizard.xml b/devicesettings/res/values/styles_setupwizard.xml
index f87a1e8..c1f5630 100644
--- a/devicesettings/res/values/styles_setupwizard.xml
+++ b/devicesettings/res/values/styles_setupwizard.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2021 The LineageOS Project
+ Copyright (C) 2021-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.
@@ -16,51 +16,10 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <style name="Theme.SetupWizard" parent="@android:style/Theme.Material.Light">
- <item name="android:windowActionBar">false</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowBackground">@android:color/transparent</item>
- <item name="android:colorPrimary">@color/primary</item>
- <item name="android:statusBarColor">@android:color/transparent</item>
- </style>
-
- <style name="PageTitle">
- <item name="android:id">@android:id/title</item>
- <item name="android:textSize">20sp</item>
- <item name="android:textColor">@color/black</item>
- </style>
-
- <style name="PageContent">
- <item name="android:background">@color/page_background</item>
- <item name="android:paddingTop">@dimen/content_margin_top</item>
- </style>
-
- <style name="PageSummaryText">
- <item name="android:id">@android:id/summary</item>
- <item name="android:lineSpacingExtra">@dimen/setup_line_spacing</item>
- </style>
+ <style name="Theme.SetupWizard" parent="@style/SudThemeGlifV3.Light"/>
<style name="SpinnerItem">
<item name="android:textSize">15sp</item>
<item name="android:paddingLeft">@dimen/content_margin_left</item>
</style>
-
- <style name="NavBarButtonStyle" parent="@android:style/Widget.Button">
- <item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
- <item name="android:drawablePadding">@dimen/sud_navbar_button_drawable_padding</item>
- <item name="android:fontFamily">sans-serif</item>
- <item name="android:minWidth">0dp</item>
- <item name="android:paddingLeft">@dimen/sud_navbar_button_padding_sides</item>
- <item name="android:paddingRight">@dimen/sud_navbar_button_padding_sides</item>
- <item name="android:textAllCaps">true</item>
- <item name="android:textSize">@dimen/sud_navbar_text_size</item>
- </style>
-
- <style name="NavBarTheme">
- <item name="android:orientation">horizontal</item>
- <item name="android:layout_alignParentBottom">true</item>
- <item name="android:background">@color/primary</item>
- <item name="android:paddingLeft">@dimen/sud_navbar_padding_sides</item>
- <item name="android:paddingRight">@dimen/sud_navbar_padding_sides</item>
- </style>
</resources>
diff --git a/devicesettings/src/org/lineageos/settings/device/SetupWizardBaseActivity.java b/devicesettings/src/org/lineageos/settings/device/SetupWizardBaseActivity.java
index fe32b77..292e056 100644
--- a/devicesettings/src/org/lineageos/settings/device/SetupWizardBaseActivity.java
+++ b/devicesettings/src/org/lineageos/settings/device/SetupWizardBaseActivity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The LineageOS Project
+ * Copyright (C) 2021-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.
@@ -17,29 +17,27 @@
package org.lineageos.settings.device;
import android.app.Activity;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
+
+import com.android.settingslib.Utils;
+
+import com.google.android.setupdesign.GlifLayout;
import org.lineageos.settings.device.R;
public class SetupWizardBaseActivity extends Activity implements View.OnClickListener {
- private static final int WINDOW_FLAGS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
-
- private Button mButtonBack;
- private Button mButtonNext;
+ private static final int WINDOW_FLAGS = View.STATUS_BAR_DISABLE_HOME
+ | View.STATUS_BAR_DISABLE_RECENT;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Make it fullscreen, hide the navbar
getWindow().getDecorView().setSystemUiVisibility(WINDOW_FLAGS);
initLayout();
@@ -47,17 +45,10 @@ public class SetupWizardBaseActivity extends Activity implements View.OnClickLis
@Override
public void onClick(View view) {
- switch (view.getId()) {
- // Keep these for navigating purposes
- case R.id.btn_back:
- setResult(RESULT_CANCELED, null);
- finish();
- break;
-
- case R.id.btn_next:
- setResult(RESULT_OK, null);
- finish();
- break;
+ // Keep this for navigating purposes
+ if (view.getId() == R.id.btn_next) {
+ setResult(RESULT_OK, null);
+ finish();
}
}
@@ -66,23 +57,26 @@ public class SetupWizardBaseActivity extends Activity implements View.OnClickLis
setContentView(getLayoutResId());
}
if (getTitleResId() != -1) {
- TextView title = (TextView) findViewById(android.R.id.title);
- title.setText(getTitleResId());
+ final CharSequence headerText = TextUtils.expandTemplate(getText(getTitleResId()));
+ getGlifLayout().setHeaderText(headerText);
}
if (getIconResId() != -1) {
- ImageView icon = (ImageView) findViewById(R.id.header_icon);
- icon.setImageResource(getIconResId());
- icon.setVisibility(View.VISIBLE);
+ final GlifLayout layout = getGlifLayout();
+ final Drawable icon = getDrawable(getIconResId()).mutate();
+ icon.setTintList(Utils.getColorAccent(layout.getContext()));
+ layout.setIcon(icon);
}
- mButtonBack = findViewById(R.id.btn_back);
- mButtonBack.setOnClickListener(this);
- mButtonNext = findViewById(R.id.btn_next);
- mButtonNext.setOnClickListener(this);
+ Button buttonNext = findViewById(R.id.btn_next);
+ buttonNext.setOnClickListener(this);
setupPage();
}
+ protected GlifLayout getGlifLayout() {
+ return requireViewById(R.id.setup_wizard_layout);
+ }
+
protected int getLayoutResId() {
return -1;
}