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:
Raff Tsai
2018-06-19 17:25:31 +08:00
parent 0861b53474
commit 3515bc7259
12 changed files with 392 additions and 31 deletions

50
res/layout/search_bar.xml Normal file
View 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>

View 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>

View File

@@ -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"