Update Dashboard layout again
- follow UX spec - update also the Search Panels (suggestions / results) to follow the same specs See bug: #15384992 Setting Dashboard - padding updates Change-Id: I3d27a3b3d9779644f8ea123990a0c7bed8d4ba74
This commit is contained in:
74
res/layout-land/dashboard_tile.xml
Normal file
74
res/layout-land/dashboard_tile.xml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="@dimen/dashboard_tile_minimum_height">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="@dimen/dashboard_tile_image_size"
|
||||||
|
android:layout_height="@dimen/dashboard_tile_image_size"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
|
||||||
|
android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.TileTitle"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:fadingEdge="horizontal" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:layout_alignStart="@android:id/title"
|
||||||
|
android:textAppearance="@style/TextAppearance.Small"
|
||||||
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View android:id="@+id/tile_divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:attr/dividerVertical" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -18,9 +18,6 @@
|
|||||||
android:id="@+id/dashboard"
|
android:id="@+id/dashboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingStart="@dimen/dashboard_padding_start"
|
|
||||||
android:paddingEnd="@dimen/dashboard_padding_end"
|
|
||||||
android:paddingBottom="@dimen/dashboard_padding_bottom"
|
|
||||||
android:scrollbarStyle="outsideOverlay"
|
android:scrollbarStyle="outsideOverlay"
|
||||||
android:background="@color/dashboard_background_color">
|
android:background="@color/dashboard_background_color">
|
||||||
|
|
||||||
@@ -28,6 +25,10 @@
|
|||||||
android:id="@+id/dashboard_container"
|
android:id="@+id/dashboard_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:paddingStart="@dimen/dashboard_padding_start"
|
||||||
|
android:paddingEnd="@dimen/dashboard_padding_end"
|
||||||
|
android:paddingTop="@dimen/dashboard_padding_top"
|
||||||
|
android:paddingBottom="@dimen/dashboard_padding_bottom"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
/>
|
/>
|
||||||
|
@@ -18,12 +18,15 @@
|
|||||||
android:id="@+id/category"
|
android:id="@+id/category"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:layout_marginBottom="8dip"
|
||||||
|
android:elevation="@dimen/dashboard_category_elevation">
|
||||||
|
|
||||||
<TextView android:id="@+id/category_title"
|
<TextView android:id="@+id/category_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dashboard_category_title_height"
|
android:layout_height="@dimen/dashboard_category_title_height"
|
||||||
android:layout_marginStart="@dimen/dashboard_category_title_margin_start"
|
android:paddingStart="@dimen/dashboard_category_title_margin_start"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:minHeight="@dimen/dashboard_tile_minimum_height">
|
android:minHeight="@dimen/dashboard_tile_minimum_height">
|
||||||
|
|
||||||
@@ -27,31 +27,49 @@
|
|||||||
android:layout_height="@dimen/dashboard_tile_image_size"
|
android:layout_height="@dimen/dashboard_tile_image_size"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
|
android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
|
||||||
android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"
|
android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
|
||||||
/>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1" >
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView android:id="@+id/title"
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dip"
|
||||||
android:singleLine="true"
|
android:orientation="vertical"
|
||||||
android:textAppearance="@style/TextAppearance.TileTitle"
|
android:gravity="center_vertical"
|
||||||
android:ellipsize="marquee"
|
android:layout_weight="1">
|
||||||
android:fadingEdge="horizontal" />
|
|
||||||
|
|
||||||
<TextView android:id="@+id/status"
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_below="@android:id/title"
|
|
||||||
android:layout_alignStart="@android:id/title"
|
|
||||||
android:textAppearance="@style/TextAppearance.Small"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
<TextView android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.TileTitle"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:fadingEdge="horizontal" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:layout_alignStart="@android:id/title"
|
||||||
|
android:textAppearance="@style/TextAppearance.Small"
|
||||||
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View android:id="@+id/tile_divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:attr/dividerVertical" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@@ -18,8 +18,8 @@
|
|||||||
android:id="@+id/dashboard"
|
android:id="@+id/dashboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingStart="@dimen/search_results_padding_start"
|
android:paddingStart="@dimen/search_panel_padding_start"
|
||||||
android:paddingEnd="@dimen/search_results_padding_end"
|
android:paddingEnd="@dimen/search_panel_padding_end"
|
||||||
android:background="@color/dashboard_background_color">
|
android:background="@color/dashboard_background_color">
|
||||||
|
|
||||||
<LinearLayout android:layout_width="match_parent"
|
<LinearLayout android:layout_width="match_parent"
|
||||||
@@ -31,11 +31,14 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:elevation="@dimen/search_panel_elevation">
|
||||||
|
|
||||||
<ListView android:id="@+id/list_suggestions"
|
<ListView android:id="@+id/list_suggestions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:headerDividersEnabled="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -50,6 +53,8 @@
|
|||||||
<ListView android:id="@+id/list_results"
|
<ListView android:id="@+id/list_results"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:headerDividersEnabled="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dashboard_category_title_height"
|
android:layout_height="@dimen/dashboard_category_title_height"
|
||||||
android:paddingStart="@dimen/search_title_padding_start"
|
android:paddingStart="@dimen/search_title_padding_start"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dashboard_category_title_height"
|
android:layout_height="@dimen/dashboard_category_title_height"
|
||||||
android:paddingStart="@dimen/search_title_padding_start"
|
android:paddingStart="@dimen/search_title_padding_start"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
<TextView android:id="@+id/title"
|
<TextView android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="@dimen/search_title_padding_start"
|
android:layout_marginStart="@dimen/search_title_padding_start"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
|
@@ -32,7 +32,8 @@
|
|||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/switchbar_background"
|
android:background="@drawable/switchbar_background"
|
||||||
android:theme="@android:style/Theme.Material" />
|
android:theme="@android:style/Theme.Material"
|
||||||
|
/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/prefs"
|
android:id="@+id/prefs"
|
||||||
@@ -76,7 +77,9 @@
|
|||||||
android:layout_margin="5dip"
|
android:layout_margin="5dip"
|
||||||
android:text="@*android:string/next_button_label"
|
android:text="@*android:string/next_button_label"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -25,7 +25,27 @@
|
|||||||
|
|
||||||
<dimen name="captioning_preview_height">100dp</dimen>
|
<dimen name="captioning_preview_height">100dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dashboard margins between each tiles within the layout -->
|
||||||
|
<dimen name="dashboard_cell_gap_x">8dp</dimen>
|
||||||
|
<dimen name="dashboard_cell_gap_y">0dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dashboard padding in its container -->
|
||||||
|
<dimen name="dashboard_padding_start">4dp</dimen>
|
||||||
|
<dimen name="dashboard_padding_end">4dp</dimen>
|
||||||
|
<dimen name="dashboard_padding_top">4dp</dimen>
|
||||||
|
<dimen name="dashboard_padding_bottom">0dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dashboard category title margin start -->
|
||||||
|
<dimen name="dashboard_category_title_margin_start">12dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard tile minimum height -->
|
<!-- Dashboard tile minimum height -->
|
||||||
<dimen name="dashboard_tile_minimum_height">64dp</dimen>
|
<dimen name="dashboard_tile_minimum_height">64dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dashboard tile image margin start / end -->
|
||||||
|
<dimen name="dashboard_tile_image_margin_start">12dp</dimen>
|
||||||
|
|
||||||
|
<!-- Search Results padding in its container -->
|
||||||
|
<dimen name="search_panel_padding_start">4dp</dimen>
|
||||||
|
<dimen name="search_panel_padding_end">4dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -94,19 +94,24 @@
|
|||||||
<dimen name="actionbar_contentInsetStart">16dp</dimen>
|
<dimen name="actionbar_contentInsetStart">16dp</dimen>
|
||||||
<dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen>
|
<dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard padding between each tiles within the layout -->
|
<!-- Dashboard margins between each tiles within the layout -->
|
||||||
<dimen name="dashboard_cell_gap">1dp</dimen>
|
<dimen name="dashboard_cell_gap_x">0dp</dimen>
|
||||||
|
<dimen name="dashboard_cell_gap_y">0dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard padding in its container -->
|
<!-- Dashboard padding in its container -->
|
||||||
<dimen name="dashboard_padding_start">1dp</dimen>
|
<dimen name="dashboard_padding_start">4dp</dimen>
|
||||||
<dimen name="dashboard_padding_end">1dp</dimen>
|
<dimen name="dashboard_padding_end">4dp</dimen>
|
||||||
<dimen name="dashboard_padding_bottom">1dp</dimen>
|
<dimen name="dashboard_padding_top">4dp</dimen>
|
||||||
|
<dimen name="dashboard_padding_bottom">0dp</dimen>
|
||||||
|
|
||||||
|
<!-- Dashboard category panel elevation -->
|
||||||
|
<dimen name="dashboard_category_elevation">4dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard category title layout height -->
|
<!-- Dashboard category title layout height -->
|
||||||
<dimen name="dashboard_category_title_height">48dp</dimen>
|
<dimen name="dashboard_category_title_height">48dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard category title margin start -->
|
<!-- Dashboard category title margin start -->
|
||||||
<dimen name="dashboard_category_title_margin_start">15dp</dimen>
|
<dimen name="dashboard_category_title_margin_start">12dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard tile minimum height -->
|
<!-- Dashboard tile minimum height -->
|
||||||
<dimen name="dashboard_tile_minimum_height">72dp</dimen>
|
<dimen name="dashboard_tile_minimum_height">72dp</dimen>
|
||||||
@@ -115,7 +120,7 @@
|
|||||||
<dimen name="dashboard_tile_image_size">24dp</dimen>
|
<dimen name="dashboard_tile_image_size">24dp</dimen>
|
||||||
|
|
||||||
<!-- Dashboard tile image margin start / end -->
|
<!-- Dashboard tile image margin start / end -->
|
||||||
<dimen name="dashboard_tile_image_margin_start">16dp</dimen>
|
<dimen name="dashboard_tile_image_margin_start">12dp</dimen>
|
||||||
<dimen name="dashboard_tile_image_margin_end">32dp</dimen>
|
<dimen name="dashboard_tile_image_margin_end">32dp</dimen>
|
||||||
|
|
||||||
<!-- SwitchBar margin start / end -->
|
<!-- SwitchBar margin start / end -->
|
||||||
@@ -126,18 +131,21 @@
|
|||||||
<dimen name="switchbar_subsettings_margin_start">72dp</dimen>
|
<dimen name="switchbar_subsettings_margin_start">72dp</dimen>
|
||||||
<dimen name="switchbar_subsettings_margin_end">16dp</dimen>
|
<dimen name="switchbar_subsettings_margin_end">16dp</dimen>
|
||||||
|
|
||||||
<!-- Search Results padding in its container -->
|
<!-- Search Panel elevation -->
|
||||||
<dimen name="search_results_padding_start">1dp</dimen>
|
<dimen name="search_panel_elevation">4dp</dimen>
|
||||||
<dimen name="search_results_padding_end">1dp</dimen>
|
|
||||||
|
<!-- Search Panel padding in its container -->
|
||||||
|
<dimen name="search_panel_padding_start">4dp</dimen>
|
||||||
|
<dimen name="search_panel_padding_end">4dp</dimen>
|
||||||
|
|
||||||
<!-- Search title (recent / results) padding start -->
|
<!-- Search title (recent / results) padding start -->
|
||||||
<dimen name="search_title_padding_start">16dp</dimen>
|
<dimen name="search_title_padding_start">12dp</dimen>
|
||||||
|
|
||||||
<!-- Result item image size -->
|
<!-- Result item image size -->
|
||||||
<dimen name="search_result_item_image_size">24dp</dimen>
|
<dimen name="search_result_item_image_size">24dp</dimen>
|
||||||
|
|
||||||
<!-- Result item image margin start / end -->
|
<!-- Result item image margin start / end -->
|
||||||
<dimen name="search_result_item_image_margin_start">16dp</dimen>
|
<dimen name="search_result_item_image_margin_start">12dp</dimen>
|
||||||
<dimen name="search_result_item_image_margin_end">32dp</dimen>
|
<dimen name="search_result_item_image_margin_end">32dp</dimen>
|
||||||
|
|
||||||
<!-- Suggestion item image size -->
|
<!-- Suggestion item image size -->
|
||||||
|
@@ -266,6 +266,7 @@
|
|||||||
|
|
||||||
<style name="TextAppearance.CategoryTitle" parent="@android:style/TextAppearance.Material.Small">
|
<style name="TextAppearance.CategoryTitle" parent="@android:style/TextAppearance.Material.Small">
|
||||||
<item name="android:textColor">@color/theme_accent</item>
|
<item name="android:textColor">@color/theme_accent</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Medium">
|
<style name="TextAppearance.TileTitle" parent="@android:style/TextAppearance.Material.Medium">
|
||||||
|
@@ -25,14 +25,18 @@ import com.android.settings.R;
|
|||||||
|
|
||||||
public class DashboardContainerView extends ViewGroup {
|
public class DashboardContainerView extends ViewGroup {
|
||||||
|
|
||||||
|
private float mCellGapX;
|
||||||
|
private float mCellGapY;
|
||||||
|
|
||||||
|
private int mNumRows;
|
||||||
private int mNumColumns;
|
private int mNumColumns;
|
||||||
private float mCellGap;
|
|
||||||
|
|
||||||
public DashboardContainerView(Context context, AttributeSet attrs) {
|
public DashboardContainerView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
mCellGap = res.getDimension(R.dimen.dashboard_cell_gap);
|
mCellGapX = res.getDimension(R.dimen.dashboard_cell_gap_x);
|
||||||
|
mCellGapY = res.getDimension(R.dimen.dashboard_cell_gap_y);
|
||||||
mNumColumns = res.getInteger(R.integer.dashboard_num_columns);
|
mNumColumns = res.getInteger(R.integer.dashboard_num_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ public class DashboardContainerView extends ViewGroup {
|
|||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
final int width = MeasureSpec.getSize(widthMeasureSpec);
|
final int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
final int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() -
|
final int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() -
|
||||||
(mNumColumns - 1) * mCellGap);
|
(mNumColumns - 1) * mCellGapX);
|
||||||
float cellWidth = (float) Math.ceil(((float) availableWidth) / mNumColumns);
|
float cellWidth = (float) Math.ceil(((float) availableWidth) / mNumColumns);
|
||||||
final int N = getChildCount();
|
final int N = getChildCount();
|
||||||
|
|
||||||
@@ -55,7 +59,7 @@ public class DashboardContainerView extends ViewGroup {
|
|||||||
|
|
||||||
ViewGroup.LayoutParams lp = v.getLayoutParams();
|
ViewGroup.LayoutParams lp = v.getLayoutParams();
|
||||||
int colSpan = v.getColumnSpan();
|
int colSpan = v.getColumnSpan();
|
||||||
lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGap);
|
lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGapX);
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
int newWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width);
|
int newWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width);
|
||||||
@@ -72,8 +76,8 @@ public class DashboardContainerView extends ViewGroup {
|
|||||||
cursor += colSpan;
|
cursor += colSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int numRows = (int) Math.ceil((float) cursor / mNumColumns);
|
mNumRows = (int) Math.ceil((float) cursor / mNumColumns);
|
||||||
final int newHeight = (int) ((numRows * cellHeight) + ((numRows - 1) * mCellGap)) +
|
final int newHeight = (int) ((mNumRows * cellHeight) + ((mNumRows - 1) * mCellGapY)) +
|
||||||
getPaddingTop() + getPaddingBottom();
|
getPaddingTop() + getPaddingBottom();
|
||||||
|
|
||||||
setMeasuredDimension(width, newHeight);
|
setMeasuredDimension(width, newHeight);
|
||||||
@@ -104,10 +108,14 @@ public class DashboardContainerView extends ViewGroup {
|
|||||||
|
|
||||||
int row = cursor / mNumColumns;
|
int row = cursor / mNumColumns;
|
||||||
|
|
||||||
|
if (row == mNumRows - 1) {
|
||||||
|
child.setDividerVisibility(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Push the item to the next row if it can't fit on this one
|
// Push the item to the next row if it can't fit on this one
|
||||||
if ((col + colSpan) > mNumColumns) {
|
if ((col + colSpan) > mNumColumns) {
|
||||||
x = getPaddingStart();
|
x = getPaddingStart();
|
||||||
y += childHeight + mCellGap;
|
y += childHeight + mCellGapY;
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +132,10 @@ public class DashboardContainerView extends ViewGroup {
|
|||||||
// reach the end of the row
|
// reach the end of the row
|
||||||
cursor += child.getColumnSpan();
|
cursor += child.getColumnSpan();
|
||||||
if (cursor < (((row + 1) * mNumColumns))) {
|
if (cursor < (((row + 1) * mNumColumns))) {
|
||||||
x += childWidth + mCellGap;
|
x += childWidth + mCellGapX;
|
||||||
} else {
|
} else {
|
||||||
x = getPaddingStart();
|
x = getPaddingStart();
|
||||||
y += childHeight + mCellGap;
|
y += childHeight + mCellGapY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,6 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
|
|||||||
private static final String LOG_TAG = "DashboardSummary";
|
private static final String LOG_TAG = "DashboardSummary";
|
||||||
|
|
||||||
private LayoutInflater mLayoutInflater;
|
private LayoutInflater mLayoutInflater;
|
||||||
private ViewGroup mContainer;
|
|
||||||
private ViewGroup mDashboard;
|
private ViewGroup mDashboard;
|
||||||
private AuthenticatorHelper mAuthHelper;
|
private AuthenticatorHelper mAuthHelper;
|
||||||
private boolean mAccountListenerAdded;
|
private boolean mAccountListenerAdded;
|
||||||
@@ -69,7 +68,6 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
|
|||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
mLayoutInflater = inflater;
|
mLayoutInflater = inflater;
|
||||||
mContainer = container;
|
|
||||||
|
|
||||||
final View rootView = inflater.inflate(R.layout.dashboard, container, false);
|
final View rootView = inflater.inflate(R.layout.dashboard, container, false);
|
||||||
mDashboard = (ViewGroup) rootView.findViewById(R.id.dashboard_container);
|
mDashboard = (ViewGroup) rootView.findViewById(R.id.dashboard_container);
|
||||||
@@ -98,7 +96,7 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
|
|||||||
for (int n = 0; n < count; n++) {
|
for (int n = 0; n < count; n++) {
|
||||||
DashboardCategory category = categories.get(n);
|
DashboardCategory category = categories.get(n);
|
||||||
|
|
||||||
View categoryView = mLayoutInflater.inflate(R.layout.dashboard_category, mContainer,
|
View categoryView = mLayoutInflater.inflate(R.layout.dashboard_category, mDashboard,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
TextView categoryLabel = (TextView) categoryView.findViewById(R.id.category_title);
|
TextView categoryLabel = (TextView) categoryView.findViewById(R.id.category_title);
|
||||||
|
@@ -34,6 +34,7 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
|
|||||||
private ImageView mImageView;
|
private ImageView mImageView;
|
||||||
private TextView mTitleTextView;
|
private TextView mTitleTextView;
|
||||||
private TextView mStatusTextView;
|
private TextView mStatusTextView;
|
||||||
|
private View mDivider;
|
||||||
|
|
||||||
private int mColSpan = DEFAULT_COL_SPAN;
|
private int mColSpan = DEFAULT_COL_SPAN;
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
|
|||||||
mImageView = (ImageView) view.findViewById(R.id.icon);
|
mImageView = (ImageView) view.findViewById(R.id.icon);
|
||||||
mTitleTextView = (TextView) view.findViewById(R.id.title);
|
mTitleTextView = (TextView) view.findViewById(R.id.title);
|
||||||
mStatusTextView = (TextView) view.findViewById(R.id.status);
|
mStatusTextView = (TextView) view.findViewById(R.id.status);
|
||||||
|
mDivider = view.findViewById(R.id.tile_divider);
|
||||||
|
|
||||||
setOnClickListener(this);
|
setOnClickListener(this);
|
||||||
setBackgroundResource(R.drawable.dashboard_tile_background);
|
setBackgroundResource(R.drawable.dashboard_tile_background);
|
||||||
@@ -73,6 +75,10 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
|
|||||||
mTile = tile;
|
mTile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDividerVisibility(boolean visible) {
|
||||||
|
mDivider.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
void setColumnSpan(int span) {
|
void setColumnSpan(int span) {
|
||||||
mColSpan = span;
|
mColSpan = span;
|
||||||
}
|
}
|
||||||
|
@@ -207,7 +207,8 @@ public class SearchResultsSummary extends Fragment {
|
|||||||
});
|
});
|
||||||
mResultsListView.addHeaderView(
|
mResultsListView.addHeaderView(
|
||||||
LayoutInflater.from(getActivity()).inflate(
|
LayoutInflater.from(getActivity()).inflate(
|
||||||
R.layout.search_panel_results_header, mResultsListView, false));
|
R.layout.search_panel_results_header, mResultsListView, false),
|
||||||
|
null, false);
|
||||||
|
|
||||||
mSuggestionsListView = (ListView) view.findViewById(R.id.list_suggestions);
|
mSuggestionsListView = (ListView) view.findViewById(R.id.list_suggestions);
|
||||||
mSuggestionsListView.setAdapter(mSuggestionsAdapter);
|
mSuggestionsListView.setAdapter(mSuggestionsAdapter);
|
||||||
@@ -231,7 +232,8 @@ public class SearchResultsSummary extends Fragment {
|
|||||||
});
|
});
|
||||||
mSuggestionsListView.addHeaderView(
|
mSuggestionsListView.addHeaderView(
|
||||||
LayoutInflater.from(getActivity()).inflate(
|
LayoutInflater.from(getActivity()).inflate(
|
||||||
R.layout.search_panel_suggestions_header, mSuggestionsListView, false));
|
R.layout.search_panel_suggestions_header, mSuggestionsListView, false),
|
||||||
|
null, false);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user