Merge "Add RecyclerView for contextual settings homepage."
This commit is contained in:
committed by
Android (Google) Code Review
commit
dcfb96ac06
@@ -21,10 +21,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<FrameLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@id/main_content"
|
android:id="@+id/card_container"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent" />
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/bottom_sheet"
|
android:id="@+id/bottom_sheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_search_floating_24dp"
|
android:src="@drawable/ic_search_floating_24dp"
|
||||||
app:backgroundTint="@android:color/white"
|
app:backgroundTint="@android:color/white"
|
||||||
app:layout_anchor="@id/bar" />
|
app:layout_anchor="@id/bar"/>
|
||||||
|
|
||||||
<com.google.android.material.bottomappbar.BottomAppBar
|
<com.google.android.material.bottomappbar.BottomAppBar
|
||||||
android:id="@+id/bar"
|
android:id="@+id/bar"
|
||||||
@@ -58,17 +59,17 @@
|
|||||||
app:fabAlignmentMode="end"
|
app:fabAlignmentMode="end"
|
||||||
app:fabCradleDiameter="@dimen/homepage_bottombar_fab_cradle"
|
app:fabCradleDiameter="@dimen/homepage_bottombar_fab_cradle"
|
||||||
app:navigationIcon="@drawable/ic_list_24dp"
|
app:navigationIcon="@drawable/ic_list_24dp"
|
||||||
style="@style/Widget.MaterialComponents.BottomAppBar" />
|
style="@style/Widget.MaterialComponents.BottomAppBar"/>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
<include layout="@layout/search_bar"
|
<include layout="@layout/search_bar"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/bottom_sheet_fragment"
|
android:id="@+id/bottom_sheet_fragment"
|
||||||
android:layout_below="@id/bottom_area"
|
android:layout_below="@id/bottom_area"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
22
res/layout/settings_homepage_container.xml
Normal file
22
res/layout/settings_homepage_container.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@id/main_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="match_parent"/>
|
@@ -21,14 +21,14 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import com.android.settings.core.FeatureFlags;
|
|
||||||
import com.android.settings.core.SettingsBaseActivity;
|
|
||||||
import com.android.settings.homepage.HomepageFragment;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import com.android.settings.core.FeatureFlags;
|
||||||
|
import com.android.settings.core.SettingsBaseActivity;
|
||||||
|
import com.android.settings.homepage.HomepageFragment;
|
||||||
|
|
||||||
public class SettingsHomepageActivity extends SettingsBaseActivity {
|
public class SettingsHomepageActivity extends SettingsBaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -42,7 +42,7 @@ public class SettingsHomepageActivity extends SettingsBaseActivity {
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setContentView(R.layout.settings_homepage);
|
setContentView(R.layout.settings_homepage_container);
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
switchToFragment(this, R.id.main_content, HomepageFragment.class.getName());
|
switchToFragment(this, R.id.main_content, HomepageFragment.class.getName());
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,8 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -45,6 +47,9 @@ public class HomepageFragment extends InstrumentedFragment {
|
|||||||
private static final String SAVE_BOTTOMBAR_STATE = "bottombar_state";
|
private static final String SAVE_BOTTOMBAR_STATE = "bottombar_state";
|
||||||
private static final String SAVE_BOTTOM_FRAGMENT_LOADED = "bottom_fragment_loaded";
|
private static final String SAVE_BOTTOM_FRAGMENT_LOADED = "bottom_fragment_loaded";
|
||||||
|
|
||||||
|
private RecyclerView mCardsContainer;
|
||||||
|
private LinearLayoutManager mLayoutManager;
|
||||||
|
|
||||||
private FloatingActionButton mSearchButton;
|
private FloatingActionButton mSearchButton;
|
||||||
private BottomSheetBehavior mBottomSheetBehavior;
|
private BottomSheetBehavior mBottomSheetBehavior;
|
||||||
private View mBottomBar;
|
private View mBottomBar;
|
||||||
@@ -54,7 +59,13 @@ public class HomepageFragment extends InstrumentedFragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
final View rootView = inflater.inflate(R.layout.dashboard, container, false);
|
final View rootView = inflater.inflate(R.layout.settings_homepage,
|
||||||
|
container, false);
|
||||||
|
mCardsContainer = (RecyclerView) rootView.findViewById(R.id.card_container);
|
||||||
|
//TODO(b/111822407): May have to swap to GridLayoutManager
|
||||||
|
mLayoutManager = new LinearLayoutManager(getActivity());
|
||||||
|
mCardsContainer.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user