summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/dashboard
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-06-19 20:16:20 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2014-06-23 13:23:47 -0700
commit47a25e76409aec1ae29b983779addf39722377f6 (patch)
tree82deb74d751e703b1733962ef7bfcf9e1e7685a8 /src/com/android/settings/dashboard
parent8b2655cfbb77ef696ad4cec0f8861889a2015917 (diff)
downloadpackages_apps_Settings-47a25e76409aec1ae29b983779addf39722377f6.zip
packages_apps_Settings-47a25e76409aec1ae29b983779addf39722377f6.tar.gz
packages_apps_Settings-47a25e76409aec1ae29b983779addf39722377f6.tar.bz2
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
Diffstat (limited to 'src/com/android/settings/dashboard')
-rw-r--r--src/com/android/settings/dashboard/DashboardContainerView.java26
-rw-r--r--src/com/android/settings/dashboard/DashboardSummary.java4
-rw-r--r--src/com/android/settings/dashboard/DashboardTileView.java6
-rw-r--r--src/com/android/settings/dashboard/SearchResultsSummary.java6
4 files changed, 28 insertions, 14 deletions
diff --git a/src/com/android/settings/dashboard/DashboardContainerView.java b/src/com/android/settings/dashboard/DashboardContainerView.java
index d4512e6..f009891 100644
--- a/src/com/android/settings/dashboard/DashboardContainerView.java
+++ b/src/com/android/settings/dashboard/DashboardContainerView.java
@@ -25,14 +25,18 @@ import com.android.settings.R;
public class DashboardContainerView extends ViewGroup {
+ private float mCellGapX;
+ private float mCellGapY;
+
+ private int mNumRows;
private int mNumColumns;
- private float mCellGap;
public DashboardContainerView(Context context, AttributeSet attrs) {
super(context, attrs);
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);
}
@@ -40,7 +44,7 @@ public class DashboardContainerView extends ViewGroup {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int availableWidth = (int) (width - getPaddingLeft() - getPaddingRight() -
- (mNumColumns - 1) * mCellGap);
+ (mNumColumns - 1) * mCellGapX);
float cellWidth = (float) Math.ceil(((float) availableWidth) / mNumColumns);
final int N = getChildCount();
@@ -55,7 +59,7 @@ public class DashboardContainerView extends ViewGroup {
ViewGroup.LayoutParams lp = v.getLayoutParams();
int colSpan = v.getColumnSpan();
- lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGap);
+ lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGapX);
// Measure the child
int newWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width);
@@ -72,8 +76,8 @@ public class DashboardContainerView extends ViewGroup {
cursor += colSpan;
}
- final int numRows = (int) Math.ceil((float) cursor / mNumColumns);
- final int newHeight = (int) ((numRows * cellHeight) + ((numRows - 1) * mCellGap)) +
+ mNumRows = (int) Math.ceil((float) cursor / mNumColumns);
+ final int newHeight = (int) ((mNumRows * cellHeight) + ((mNumRows - 1) * mCellGapY)) +
getPaddingTop() + getPaddingBottom();
setMeasuredDimension(width, newHeight);
@@ -104,10 +108,14 @@ public class DashboardContainerView extends ViewGroup {
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
if ((col + colSpan) > mNumColumns) {
x = getPaddingStart();
- y += childHeight + mCellGap;
+ y += childHeight + mCellGapY;
row++;
}
@@ -124,10 +132,10 @@ public class DashboardContainerView extends ViewGroup {
// reach the end of the row
cursor += child.getColumnSpan();
if (cursor < (((row + 1) * mNumColumns))) {
- x += childWidth + mCellGap;
+ x += childWidth + mCellGapX;
} else {
x = getPaddingStart();
- y += childHeight + mCellGap;
+ y += childHeight + mCellGapY;
}
}
}
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 4aee7be..ece32f6 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -44,7 +44,6 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
private static final String LOG_TAG = "DashboardSummary";
private LayoutInflater mLayoutInflater;
- private ViewGroup mContainer;
private ViewGroup mDashboard;
private AuthenticatorHelper mAuthHelper;
private boolean mAccountListenerAdded;
@@ -69,7 +68,6 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
final Context context = getActivity();
mLayoutInflater = inflater;
- mContainer = container;
final View rootView = inflater.inflate(R.layout.dashboard, container, false);
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++) {
DashboardCategory category = categories.get(n);
- View categoryView = mLayoutInflater.inflate(R.layout.dashboard_category, mContainer,
+ View categoryView = mLayoutInflater.inflate(R.layout.dashboard_category, mDashboard,
false);
TextView categoryLabel = (TextView) categoryView.findViewById(R.id.category_title);
diff --git a/src/com/android/settings/dashboard/DashboardTileView.java b/src/com/android/settings/dashboard/DashboardTileView.java
index 099459c..a54217b 100644
--- a/src/com/android/settings/dashboard/DashboardTileView.java
+++ b/src/com/android/settings/dashboard/DashboardTileView.java
@@ -34,6 +34,7 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
private ImageView mImageView;
private TextView mTitleTextView;
private TextView mStatusTextView;
+ private View mDivider;
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);
mTitleTextView = (TextView) view.findViewById(R.id.title);
mStatusTextView = (TextView) view.findViewById(R.id.status);
+ mDivider = view.findViewById(R.id.tile_divider);
setOnClickListener(this);
setBackgroundResource(R.drawable.dashboard_tile_background);
@@ -73,6 +75,10 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
mTile = tile;
}
+ public void setDividerVisibility(boolean visible) {
+ mDivider.setVisibility(visible ? View.VISIBLE : View.GONE);
+ }
+
void setColumnSpan(int span) {
mColSpan = span;
}
diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java
index 5f23671..5af602e 100644
--- a/src/com/android/settings/dashboard/SearchResultsSummary.java
+++ b/src/com/android/settings/dashboard/SearchResultsSummary.java
@@ -207,7 +207,8 @@ public class SearchResultsSummary extends Fragment {
});
mResultsListView.addHeaderView(
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.setAdapter(mSuggestionsAdapter);
@@ -231,7 +232,8 @@ public class SearchResultsSummary extends Fragment {
});
mSuggestionsListView.addHeaderView(
LayoutInflater.from(getActivity()).inflate(
- R.layout.search_panel_suggestions_header, mSuggestionsListView, false));
+ R.layout.search_panel_suggestions_header, mSuggestionsListView, false),
+ null, false);
return view;
}