diff options
author | Yorke Lee <yorkelee@google.com> | 2013-07-27 00:11:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-27 00:11:40 +0000 |
commit | fca42086a510778d951fe1d5d80f35223f9d7a0d (patch) | |
tree | 0f0c3895743de46654ca64b2110288656631e5ca /src | |
parent | 5fe874fbdfe0010b5f2439cf6c13eaee46d406ea (diff) | |
parent | 714d6c7112626055d17ded8c58e76ee018f37bfe (diff) |
Merge "Add actionbar items on dialpad fragment to match redlines"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/NewDialtactsActivity.java | 23 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/NewDialpadFragment.java | 30 |
2 files changed, 38 insertions, 15 deletions
diff --git a/src/com/android/dialer/NewDialtactsActivity.java b/src/com/android/dialer/NewDialtactsActivity.java index 54e7df258..4b9a82d44 100644 --- a/src/com/android/dialer/NewDialtactsActivity.java +++ b/src/com/android/dialer/NewDialtactsActivity.java @@ -82,7 +82,8 @@ import com.android.internal.telephony.ITelephony; public class NewDialtactsActivity extends TransactionSafeActivity implements View.OnClickListener, NewDialpadFragment.OnDialpadQueryChangedListener, PopupMenu.OnMenuItemClickListener, OnListFragmentScrolledListener, - NewPhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener { + NewPhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener, + NewDialpadFragment.OnDialpadFragmentStartedListener { private static final String TAG = "DialtactsActivity"; public static final boolean DEBUG = false; @@ -335,6 +336,7 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie @Override public void onClick(View view) { switch (view.getId()) { + case R.id.overflow_menu_on_dialpad: case R.id.overflow_menu: { final PopupMenu popupMenu = new PopupMenu(NewDialtactsActivity.this, view); final Menu menu = popupMenu.getMenu(); @@ -346,6 +348,7 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie case R.id.dialpad_button: showDialpadFragment(); break; + case R.id.call_history_on_dialpad_button: case R.id.call_history_button: final Intent intent = new Intent(this, NewCallLogActivity.class); startActivity(intent); @@ -450,7 +453,7 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie } - public void setupFakeActionBarItems() { + public void setupFakeActionBarItemsForFavoritesFragment() { mMenuButton = findViewById(R.id.overflow_menu); if (mMenuButton != null) { // mMenuButton.setMinimumWidth(fakeMenuItemWidth); @@ -471,6 +474,13 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie mDialpadButton.setOnClickListener(this); } + public void setupFakeActionBarItemsForDialpadFragment() { + final View overflowButton = findViewById(R.id.overflow_menu_on_dialpad); + overflowButton.setOnClickListener(this); + final View callhistoryButton = findViewById(R.id.call_history_on_dialpad_button); + callhistoryButton.setOnClickListener(this); + } + @Override protected void onPause() { super.onPause(); @@ -747,6 +757,13 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie @Override public void onPhoneFavoriteFragmentStarted() { - setupFakeActionBarItems(); + setupFakeActionBarItemsForFavoritesFragment(); } + + @Override + public void onDialpadFragmentStarted() { + setupFakeActionBarItemsForDialpadFragment(); + } + + } diff --git a/src/com/android/dialer/dialpad/NewDialpadFragment.java b/src/com/android/dialer/dialpad/NewDialpadFragment.java index 46f5d06cb..d7bc3f9b4 100644 --- a/src/com/android/dialer/dialpad/NewDialpadFragment.java +++ b/src/com/android/dialer/dialpad/NewDialpadFragment.java @@ -101,6 +101,10 @@ public class NewDialpadFragment extends Fragment DialpadImageButton.OnPressedListener { private static final String TAG = NewDialpadFragment.class.getSimpleName(); + public interface OnDialpadFragmentStartedListener { + public void onDialpadFragmentStarted(); + } + /** * LinearLayout with getter and setter methods for the translationY property using floats, * for animation purposes. @@ -380,18 +384,6 @@ public class NewDialpadFragment extends Fragment setupKeypad(fragmentView); } - DisplayMetrics dm = getResources().getDisplayMetrics(); - int minCellSize = (int) (56 * dm.density); // 56dip == minimum size of menu buttons - int cellCount = dm.widthPixels / minCellSize; - int fakeMenuItemWidth = dm.widthPixels / cellCount; - mDialButtonContainer = fragmentView.findViewById(R.id.dialButtonContainer); - // If in portrait, add padding to the dial button since we need space for the - // search and menu/overflow buttons. - if (mDialButtonContainer != null && !OrientationUtil.isLandscape(this.getActivity())) { - mDialButtonContainer.setPadding( - fakeMenuItemWidth, mDialButtonContainer.getPaddingTop(), - fakeMenuItemWidth, mDialButtonContainer.getPaddingBottom()); - } mDialButton = fragmentView.findViewById(R.id.dialButton); if (r.getBoolean(R.bool.config_show_onscreen_dial_button)) { mDialButton.setOnClickListener(this); @@ -423,6 +415,20 @@ public class NewDialpadFragment extends Fragment return fragmentView; } + @Override + public void onStart() { + super.onStart(); + + final Activity activity = getActivity(); + + try { + ((OnDialpadFragmentStartedListener) activity).onDialpadFragmentStarted(); + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + + " must implement OnDialpadFragmentStartedListener"); + } + } + private boolean isLayoutReady() { return mDigits != null; } |