diff options
author | John Reck <jreck@google.com> | 2011-01-14 11:01:05 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-01-14 17:37:01 -0800 |
commit | b3417f0a68a1efc64604ea354ae7f856ce79cb16 (patch) | |
tree | 455c87606f0f1a97c2c06c7338a5aa29715880e8 /src/com/android/browser/BreadCrumbView.java | |
parent | 231f751049febdb0877ead6364d33d130286cff1 (diff) | |
download | packages_apps_browser-b3417f0a68a1efc64604ea354ae7f856ce79cb16.zip packages_apps_browser-b3417f0a68a1efc64604ea354ae7f856ce79cb16.tar.gz packages_apps_browser-b3417f0a68a1efc64604ea354ae7f856ce79cb16.tar.bz2 |
Bookmark UI update
Change-Id: Ibdf7f93f7c5863d7108044dcd40d3866ff02518a
Diffstat (limited to 'src/com/android/browser/BreadCrumbView.java')
-rw-r--r-- | src/com/android/browser/BreadCrumbView.java | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/browser/BreadCrumbView.java b/src/com/android/browser/BreadCrumbView.java index 113d55b..b8409f0 100644 --- a/src/com/android/browser/BreadCrumbView.java +++ b/src/com/android/browser/BreadCrumbView.java @@ -17,6 +17,7 @@ package com.android.browser; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.AttributeSet; @@ -37,6 +38,7 @@ import java.util.List; * Use pushView, popView, clear, and getTopData to change/access the view stack */ public class BreadCrumbView extends LinearLayout implements OnClickListener { + private static final int DIVIDER_PADDING = 12; // dips interface Controller { public void onTop(int level, Object data); @@ -47,6 +49,7 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { private List<Crumb> mCrumbs; private boolean mUseBackButton; private Drawable mSeparatorDrawable; + private float mDividerPadding; private int mMaxVisible = -1; /** @@ -79,8 +82,10 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { private void init(Context ctx) { mUseBackButton = false; mCrumbs = new ArrayList<Crumb>(); - mSeparatorDrawable = ctx.getResources().getDrawable( - R.drawable.crumb_divider); + TypedArray a = ctx.obtainStyledAttributes(com.android.internal.R.styleable.Theme); + mSeparatorDrawable = a.getDrawable(com.android.internal.R.styleable.Theme_dividerVertical); + a.recycle(); + mDividerPadding = DIVIDER_PADDING * ctx.getResources().getDisplayMetrics().density; addBackButton(); } @@ -176,13 +181,26 @@ public class BreadCrumbView extends LinearLayout implements OnClickListener { } private void addSeparator() { - ImageView sep = new ImageView(mContext); - sep.setImageDrawable(mSeparatorDrawable); - sep.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, - LayoutParams.MATCH_PARENT)); + View sep = makeDividerView(); + sep.setLayoutParams(makeDividerLayoutParams()); addView(sep); } + private ImageView makeDividerView() { + ImageView result = new ImageView(mContext); + result.setImageDrawable(mSeparatorDrawable); + result.setScaleType(ImageView.ScaleType.FIT_XY); + return result; + } + + private LayoutParams makeDividerLayoutParams() { + LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.MATCH_PARENT); + params.topMargin = (int) mDividerPadding; + params.bottomMargin = (int) mDividerPadding; + return params; + } + private void pop(boolean notify) { int n = mCrumbs.size(); if (n > 0) { |