summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/new_dialpad_fragment.xml26
-rw-r--r--res/layout/new_phone_favorites_fragment.xml4
-rw-r--r--res/values/dimens.xml3
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/android/dialer/NewDialtactsActivity.java23
-rw-r--r--src/com/android/dialer/dialpad/NewDialpadFragment.java30
6 files changed, 66 insertions, 24 deletions
diff --git a/res/layout/new_dialpad_fragment.xml b/res/layout/new_dialpad_fragment.xml
index 4641e0091..2026781fe 100644
--- a/res/layout/new_dialpad_fragment.xml
+++ b/res/layout/new_dialpad_fragment.xml
@@ -73,26 +73,40 @@
<View style="@style/DialpadHorizontalSeparator"/>
- <!-- left and right paddings will be modified by the code. See DialpadFragment. -->
- <FrameLayout
+ <LinearLayout
android:id="@+id/dialButtonContainer"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="@integer/dialpad_layout_weight_additional_buttons"
android:layout_gravity="center_horizontal"
android:background="@color/dialpad_primary_text_color">
-
+ <ImageButton
+ android:id="@+id/call_history_on_dialpad_button"
+ android:layout_height="@dimen/fake_action_bar_height"
+ android:layout_width="@dimen/fake_menu_button_min_width"
+ android:layout_gravity="bottom|start"
+ android:background="?android:attr/selectableItemBackground"
+ android:contentDescription="@string/action_menu_call_history_description"
+ android:src="@drawable/ic_dialer_menu_history_dk"/>
<ImageButton
android:id="@+id/dialButton"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="1"
android:layout_height="match_parent"
android:layout_gravity="center"
android:state_enabled="false"
android:background="@drawable/btn_call"
android:contentDescription="@string/description_dial_button"
android:src="@drawable/ic_dial_action_call" />
-
- </FrameLayout>
+ <ImageButton
+ android:id="@+id/overflow_menu_on_dialpad"
+ android:layout_height="@dimen/fake_action_bar_height"
+ android:layout_width="@dimen/fake_menu_button_min_width"
+ android:layout_gravity="bottom|end"
+ android:background="?android:attr/selectableItemBackground"
+ android:src="@drawable/ic_menu_overflow_dark"
+ android:contentDescription="@string/action_menu_overflow_description" />
+ </LinearLayout>
<!-- "Dialpad chooser" UI, shown only when the user brings up the
Dialer while a call is already in progress.
diff --git a/res/layout/new_phone_favorites_fragment.xml b/res/layout/new_phone_favorites_fragment.xml
index 90d0aacd2..9974adf65 100644
--- a/res/layout/new_phone_favorites_fragment.xml
+++ b/res/layout/new_phone_favorites_fragment.xml
@@ -46,7 +46,7 @@
android:textAppearance="?android:attr/textAppearanceLarge"/>
</FrameLayout>
<FrameLayout
- android:layout_height="48dp"
+ android:layout_height="@dimen/fake_action_bar_height"
android:layout_width="match_parent"
android:id="@+id/fake_action_bar"
android:background="@color/actionbar_background_color">
@@ -56,7 +56,7 @@
android:layout_height="match_parent"
android:layout_gravity="bottom|start"
android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/description_search_button"
+ android:contentDescription="@string/action_menu_call_history_description"
android:src="@drawable/ic_dialer_menu_history_dk"/>
<ImageButton
android:id="@+id/dialpad_button"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0ab27c311..e9f2ce0ed 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -49,8 +49,9 @@
<integer name="dialpad_layout_weight_dialpad">65</integer>
<integer name="dialpad_layout_weight_additional_buttons">15</integer>
+ <dimen name="fake_action_bar_height">48dp</dimen>
<!-- Min with of fake menu buttons, which should be same as ActionBar's one -->
- <dimen name="fake_menu_button_min_width">56dip</dimen>
+ <dimen name="fake_menu_button_min_width">56dp</dimen>
<!-- Smart Dial -->
<dimen name="smartdial_suggestions_padding">4dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8b7d61a1a..c7e1b869d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -302,6 +302,10 @@
-->
<string name="description_digits_edittext">number to dial</string>
+ <!-- Content description for the fake action menu button that brings up the call history
+ activity -->
+ <string name="action_menu_call_history_description">Call History</string>
+
<!-- Content description for the fake action menu overflow button.
This should be same as the description for the real action menu
overflow button available in ActionBar.
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;
}