diff options
author | Andrew Lee <anwlee@google.com> | 2014-05-30 17:38:26 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-30 17:38:28 +0000 |
commit | 6b6fea2ce8c5e376d6e433e15f59d8a3013a34e1 (patch) | |
tree | 149539fd7310c965df4522636ddc8cba0c0ee690 | |
parent | 09a4b071d8efcccb5ec620602a9c0dd63836f46a (diff) | |
parent | 2423a2ff42989f7706f0da60961c1f79687db974 (diff) |
Merge "Move the FAB in the dialpad down 4dp, in Dialer." into lmp-preview-dev
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 27 |
2 files changed, 25 insertions, 3 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml index e388065f2..01ec9695d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -46,6 +46,7 @@ <dimen name="floating_action_button_margin_right">16dp</dimen> <!-- Bottom margin of the floating action button --> <dimen name="floating_action_button_margin_bottom">16dp</dimen> + <dimen name="floating_action_button_dialpad_margin_bottom">12dp</dimen> <!-- Dimensions for speed dial tiles --> <dimen name="contact_tile_divider_width">1dp</dimen> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index b7772c112..2d1e2a723 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.content.res.Resources; import android.content.res.TypedArray; import android.net.Uri; import android.os.Bundle; @@ -168,7 +169,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private View mFloatingActionButtonContainer; private ImageButton mFloatingActionButton; - private int mActionBarHeight; private boolean mInDialpadSearch; private boolean mInRegularSearch; private boolean mClearSearchOnPause; @@ -215,6 +215,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private DragDropController mDragDropController; private ActionBarController mActionBarController; + private int mActionBarHeight; + private int mFloatingActionButtonMarginBottom; + private int mFloatingActionButtonDialpadMarginBottom; + private class OptionsPopupMenu extends PopupMenu { public OptionsPopupMenu(Context context, View anchor) { super(context, anchor); @@ -325,6 +329,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O super.onCreate(savedInstanceState); mFirstLaunch = true; + final Resources resources = getResources(); + mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height); + mFloatingActionButtonMarginBottom = + resources.getDimensionPixelOffset(R.dimen.floating_action_button_margin_bottom); + mFloatingActionButtonDialpadMarginBottom = resources.getDimensionPixelOffset( + R.dimen.floating_action_button_dialpad_margin_bottom); + setContentView(R.layout.dialtacts_activity); getWindow().setBackgroundDrawable(null); @@ -357,8 +368,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O final OptionsPopupMenu optionsMenu = buildOptionsMenu(optionsMenuButton); optionsMenuButton.setOnTouchListener(optionsMenu.getDragToOpenListener()); - mActionBarHeight = getResources().getDimensionPixelSize(R.dimen.action_bar_height); - // Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState // is null. Otherwise the fragment manager takes care of recreating these fragments. if (savedInstanceState == null) { @@ -1106,6 +1115,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O (RelativeLayout.LayoutParams) mFloatingActionButtonContainer.getLayoutParams(); params.removeRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + updateFloatingActionButtonMargin(params); mFloatingActionButtonContainer.setLayoutParams(params); } @@ -1114,9 +1124,20 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O (RelativeLayout.LayoutParams) mFloatingActionButtonContainer.getLayoutParams(); params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.CENTER_HORIZONTAL); + updateFloatingActionButtonMargin(params); mFloatingActionButtonContainer.setLayoutParams(params); } + private void updateFloatingActionButtonMargin(RelativeLayout.LayoutParams params) { + params.setMarginsRelative( + params.getMarginStart(), + params.topMargin, + params.getMarginEnd(), + mIsDialpadShown ? + mFloatingActionButtonDialpadMarginBottom : + mFloatingActionButtonMarginBottom); + } + @Override public boolean isActionBarShowing() { return mActionBarController.isActionBarShowing(); |