Merge "Fix overdraw and do some layout optimizations" into lmp-dev

This commit is contained in:
Fabrice Di Meglio
2014-07-18 23:59:32 +00:00
committed by Android (Google) Code Review
8 changed files with 45 additions and 21 deletions

View File

@@ -21,9 +21,7 @@
android:insetBottom="0dip"> android:insetBottom="0dip">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="@color/preference_background_color" />
<solid android:color="@color/preference_list_fragment_background_color" />
</shape> </shape>
</inset> </inset>

View File

@@ -36,8 +36,6 @@
android:scrollbarStyle="@*android:integer/preference_fragment_scrollbarStyle" android:scrollbarStyle="@*android:integer/preference_fragment_scrollbarStyle"
android:clipToPadding="false" android:clipToPadding="false"
android:drawSelectorOnTop="false" android:drawSelectorOnTop="false"
android:cacheColorHint="@android:color/white"
android:background="@drawable/preference_list_fragment_background"
android:elevation="@dimen/dashboard_category_elevation" android:elevation="@dimen/dashboard_category_elevation"
android:scrollbarAlwaysDrawVerticalTrack="true" /> android:scrollbarAlwaysDrawVerticalTrack="true" />
@@ -82,6 +80,8 @@
android:text="@*android:string/next_button_label" android:text="@*android:string/next_button_label"
/> />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2014, 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"
android:background="@color/dashboard_background_color"
/>

View File

@@ -20,8 +20,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:orientation="vertical"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent">
android:background="?attr/dashboardBackgroundColor">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
@@ -37,9 +36,10 @@
/> />
<FrameLayout <FrameLayout
android:id="@+id/prefs" android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/preferenceBackgroundColor"
/> />
</LinearLayout> </LinearLayout>

View File

@@ -101,5 +101,5 @@
<attr name="switchBarMarginStart" format="dimension" /> <attr name="switchBarMarginStart" format="dimension" />
<attr name="switchBarMarginEnd" format="dimension" /> <attr name="switchBarMarginEnd" format="dimension" />
<attr name="dashboardBackgroundColor" format="color" /> <attr name="preferenceBackgroundColor" format="color" />
</resources> </resources>

View File

@@ -66,7 +66,7 @@
<color name="switch_accent_color">#ff7fcac3</color> <color name="switch_accent_color">#ff7fcac3</color>
<color name="default_preference_background_color">@android:color/white</color> <color name="default_preference_background_color">@android:color/white</color>
<color name="preference_list_fragment_background_color">@color/default_preference_background_color</color> <color name="preference_background_color">@color/default_preference_background_color</color>
<color name="search_panel_list_background_color">@color/default_preference_background_color</color> <color name="search_panel_list_background_color">@color/default_preference_background_color</color>
<!-- Default avatar colors --> <!-- Default avatar colors -->

View File

@@ -33,7 +33,7 @@
<item name="ic_wps">@drawable/ic_wps_dark</item> <item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="setup_divider_color">@color/setup_divider_color_dark</item> <item name="setup_divider_color">@color/setup_divider_color_dark</item>
<item name="wifi_signal">@drawable/wifi_signal_dark</item> <item name="wifi_signal">@drawable/wifi_signal_dark</item>
<item name="dashboardBackgroundColor">@color/dashboard_background_color</item> <item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style> </style>
<style name="SetupWizardWifiTheme.Light" parent="android:Theme.Material.Light.NoActionBar"> <style name="SetupWizardWifiTheme.Light" parent="android:Theme.Material.Light.NoActionBar">
@@ -48,7 +48,7 @@
<item name="ic_wps">@drawable/ic_wps_light</item> <item name="ic_wps">@drawable/ic_wps_light</item>
<item name="setup_divider_color">@color/setup_divider_color_light</item> <item name="setup_divider_color">@color/setup_divider_color_light</item>
<item name="wifi_signal">@drawable/wifi_signal_light</item> <item name="wifi_signal">@drawable/wifi_signal_light</item>
<item name="dashboardBackgroundColor">@color/dashboard_background_color</item> <item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style> </style>
<style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert"> <style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert">
@@ -92,7 +92,7 @@
<item name="switchBarTheme">@style/Theme.SwitchBar.Settings</item> <item name="switchBarTheme">@style/Theme.SwitchBar.Settings</item>
<item name="dashboardBackgroundColor">@color/dashboard_background_color</item> <item name="preferenceBackgroundColor">@drawable/preference_background</item>
<!-- Redefine the ActionBar style for contentInsetStart --> <!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar</item> <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
@@ -146,7 +146,7 @@
<!-- Redefine the ActionBar style for contentInsetStart --> <!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar</item> <item name="android:actionBarStyle">@style/Theme.ActionBar</item>
<item name="dashboardBackgroundColor">@color/dashboard_background_color</item> <item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style> </style>
<style name="Theme.CryptKeeper" parent="@android:style/Theme.Material.NoActionBar"> <style name="Theme.CryptKeeper" parent="@android:style/Theme.Material.NoActionBar">
@@ -164,7 +164,7 @@
<item name="android:actionBarWidgetTheme">@null</item> <item name="android:actionBarWidgetTheme">@null</item>
<item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item> <item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
<item name="dashboardBackgroundColor">@color/dashboard_background_color</item> <item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style> </style>
<style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert"> <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
@@ -185,7 +185,7 @@
<item name="switchBarMarginStart">0dip</item> <item name="switchBarMarginStart">0dip</item>
<item name="switchBarMarginEnd">0dip</item> <item name="switchBarMarginEnd">0dip</item>
<item name="dashboardBackgroundColor">@android:color/transparent</item> <item name="preferenceBackgroundColor">@android:color/transparent</item>
</style> </style>
<style name="Theme.TimePicker" parent="@*android:style/Theme.Material.Light.Dialog.TimePicker"> <style name="Theme.TimePicker" parent="@*android:style/Theme.Material.Light.Dialog.TimePicker">

View File

@@ -489,9 +489,10 @@ public class SettingsActivity extends Activity
setTheme(R.style.Theme_SubSettings); setTheme(R.style.Theme_SubSettings);
} }
setContentView(R.layout.settings_main); setContentView(mIsShowingDashboard ?
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
mContent = (ViewGroup) findViewById(R.id.prefs); mContent = (ViewGroup) findViewById(R.id.main_content);
getFragmentManager().addOnBackStackChangedListener(this); getFragmentManager().addOnBackStackChangedListener(this);
@@ -830,7 +831,7 @@ public class SettingsActivity extends Activity
*/ */
public void startPreferenceFragment(Fragment fragment, boolean push) { public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.prefs, fragment); transaction.replace(R.id.main_content, fragment);
if (push) { if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS); transaction.addToBackStack(BACK_STACK_PREFS);
@@ -851,7 +852,7 @@ public class SettingsActivity extends Activity
} }
Fragment f = Fragment.instantiate(this, fragmentName, args); Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.prefs, f); transaction.replace(R.id.main_content, f);
if (withTransition) { if (withTransition) {
TransitionManager.beginDelayedTransition(mContent); TransitionManager.beginDelayedTransition(mContent);
} }
@@ -1239,7 +1240,7 @@ public class SettingsActivity extends Activity
if (mSearchResultsFragment != null) { if (mSearchResultsFragment != null) {
return; return;
} }
Fragment current = getFragmentManager().findFragmentById(R.id.prefs); Fragment current = getFragmentManager().findFragmentById(R.id.main_content);
if (current != null && current instanceof SearchResultsSummary) { if (current != null && current instanceof SearchResultsSummary) {
mSearchResultsFragment = (SearchResultsSummary) current; mSearchResultsFragment = (SearchResultsSummary) current;
} else { } else {