First commit of dynamic home page feature
- Add SettingsHomepageActivity - Add feature flag - Use com.google.android.material_material library Change-Id: I325be249f739d3b03dc2f0d722319f5771e2313b
This commit is contained in:
24
res/drawable/ic_list_24dp.xml
Normal file
24
res/drawable/ic_list_24dp.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
<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="?android:attr/colorAccent"
|
||||
android:pathData="M4,13L4,13c0.55,0 1,-0.45 1,-1v0c0,-0.55 -0.45,-1 -1,-1h0c-0.55,0 -1,0.45 -1,1v0C3,12.55 3.45,13 4,13zM4,17L4,17c0.55,0 1,-0.45 1,-1v0c0,-0.55 -0.45,-1 -1,-1h0c-0.55,0 -1,0.45 -1,1v0C3,16.55 3.45,17 4,17zM4,9L4,9c0.55,0 1,-0.45 1,-1v0c0,-0.55 -0.45,-1 -1,-1h0C3.45,7 3,7.45 3,8v0C3,8.55 3.45,9 4,9zM7,13h14v-2H7V13zM7,17h14v-2H7V17zM7,7v2h14V7H7z"/>
|
||||
</vector>
|
||||
50
res/layout/search_bar.xml
Normal file
50
res/layout/search_bar.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2018, 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.
|
||||
*/
|
||||
-->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/tools"
|
||||
android:id="@+id/search_bar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorPrimary">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/search_bar_margin"
|
||||
app:cardCornerRadius="@dimen/search_bar_corner_radius"
|
||||
app:cardBackgroundColor="?android:attr/colorBackground"
|
||||
app:cardElevation="@dimen/search_bar_card_elevation">
|
||||
<Toolbar
|
||||
android:id="@+id/search_action_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/search_bar_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
|
||||
android:navigationIcon="@drawable/ic_search_24dp"
|
||||
android:theme="?android:attr/actionBarTheme">
|
||||
<TextView
|
||||
android:id="@+id/search_action_bar_title"
|
||||
style="@style/TextAppearance.SearchBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search_menu"/>
|
||||
</Toolbar>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
77
res/layout/settings_homepage.xml
Normal file
77
res/layout/settings_homepage.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2018, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@id/main_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottom_sheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:minHeight="@dimen/homepage_bottomsheet_height"
|
||||
app:layout_behavior="@string/bottom_sheet_behavior"
|
||||
app:behavior_peekHeight="@dimen/homepage_bottomsheet_height">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/bottom_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/search_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_search_24dp"
|
||||
app:backgroundTint="@android:color/white"
|
||||
app:layout_anchor="@id/bar" />
|
||||
|
||||
<com.google.android.material.bottomappbar.BottomAppBar
|
||||
android:id="@+id/bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/homepage_bottombar_height"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="@dimen/homepage_bottombar_top_margin"
|
||||
android:clickable="true"
|
||||
app:fabAttached="true"
|
||||
app:fabAlignmentMode="end"
|
||||
app:fabCradleDiameter="@dimen/homepage_bottombar_fab_cradle"
|
||||
app:navigationIcon="@drawable/ic_list_24dp"
|
||||
style="@style/Widget.MaterialComponents.BottomAppBar" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<include layout="@layout/search_bar"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/bottom_sheet_fragment"
|
||||
android:layout_below="@id/bottom_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -23,36 +23,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<FrameLayout
|
||||
android:id="@+id/search_bar_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorPrimary">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/search_bar_margin"
|
||||
app:cardCornerRadius="@dimen/search_bar_corner_radius"
|
||||
app:cardBackgroundColor="?android:attr/colorBackground"
|
||||
app:cardElevation="2dp">
|
||||
<Toolbar
|
||||
android:id="@+id/search_action_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/search_bar_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentInsetStartWithNavigation="64dp"
|
||||
android:navigationIcon="@drawable/ic_search_24dp"
|
||||
android:theme="?android:attr/actionBarTheme">
|
||||
<TextView
|
||||
android:id="@+id/search_action_bar_title"
|
||||
style="@style/TextAppearance.SearchBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search_menu" />
|
||||
</Toolbar>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/search_bar" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -136,5 +136,9 @@
|
||||
<color name="battery_maybe_color_dark">#fdd835</color> <!-- Material Yellow 600 -->
|
||||
<color name="battery_bad_color_dark">#f44336</color> <!-- Material Red 500 -->
|
||||
|
||||
<!-- Dynamic home page -->
|
||||
<color name="homepage_status_bar">#F1F3F4</color>
|
||||
<color name="homepage_color_primary">#F8F9FA</color>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -128,6 +128,8 @@
|
||||
<dimen name="search_bar_height">48dp</dimen>
|
||||
<dimen name="search_bar_corner_radius">2dp</dimen>
|
||||
<dimen name="search_bar_text_size">16dp</dimen>
|
||||
<dimen name="search_bar_card_elevation">2dp</dimen>
|
||||
<dimen name="search_bar_content_inset">64dp</dimen>
|
||||
|
||||
<!-- Dimensions for Wifi Assistant Card -->
|
||||
<dimen name="wifi_assistant_padding_top_bottom">16dp</dimen>
|
||||
@@ -328,4 +330,10 @@
|
||||
<dimen name="reset_checkbox_title_text_size">18sp</dimen>
|
||||
<dimen name="reset_checkbox_summary_text_size">14sp</dimen>
|
||||
|
||||
<!-- Bottombar size and padding -->
|
||||
<dimen name="homepage_bottomsheet_height">90dp</dimen>
|
||||
<dimen name="homepage_bottombar_height">56dp</dimen>
|
||||
<dimen name="homepage_bottombar_top_margin">34dp</dimen>
|
||||
<dimen name="homepage_bottombar_fab_cradle">68dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -367,4 +367,9 @@
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Settings.Home" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimaryDark">@color/homepage_status_bar</item>
|
||||
<item name="android:colorPrimary">@color/homepage_color_primary</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user