Show ILD rate information if present
If Dialer populates ILD (international / long distance) rate information,
populate a field above the dialed digits.
Bug: 13334252
Change-Id: Ia366148ef1318a2dacc4971d51a3bd34ec3c39de
diff --git a/res/layout/dialpad_view.xml b/res/layout/dialpad_view.xml
index a6ff7aa..8ac4cf2 100644
--- a/res/layout/dialpad_view.xml
+++ b/res/layout/dialpad_view.xml
@@ -24,6 +24,39 @@
android:background="@color/background_dialpad"
android:clickable="true" >
+ <!-- Text field where call rate is displayed for ILD calls. -->
+ <RelativeLayout
+ android:id="@+id/rate_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:visibility="gone">
+
+ <TextView android:id="@+id/ild_country"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginStart="@dimen/dialpad_digits_padding" />
+
+ <TextView android:id="@+id/ild_rate"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textStyle="bold"
+ android:layout_marginStart="4dp"
+ android:layout_toEndOf="@id/ild_country" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="#e3e3e3"
+ android:layout_marginTop="8dp"
+ android:layout_below="@id/ild_country"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentEnd="true" />
+
+ </RelativeLayout>
+
<!-- Text field and possibly soft menu button above the keypad where
the digits are displayed. -->
<LinearLayout
diff --git a/src/com/android/phone/common/dialpad/DialpadView.java b/src/com/android/phone/common/dialpad/DialpadView.java
index 3cdc30e..fdce6f7 100644
--- a/src/com/android/phone/common/dialpad/DialpadView.java
+++ b/src/com/android/phone/common/dialpad/DialpadView.java
@@ -28,6 +28,7 @@
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.widget.EditText;
import android.widget.ImageButton;
@@ -63,6 +64,10 @@
private View mOverflowMenuButton;
private ColorStateList mRippleColor;
+ private ViewGroup mRateContainer;
+ private TextView mIldCountry;
+ private TextView mIldRate;
+
private boolean mCanDigitsBeEdited;
private final int[] mButtonIds = new int[] {R.id.zero, R.id.one, R.id.two, R.id.three,
@@ -104,6 +109,9 @@
mDigits = (EditText) findViewById(R.id.digits);
mDelete = (ImageButton) findViewById(R.id.deleteButton);
mOverflowMenuButton = findViewById(R.id.dialpad_overflow);
+ mRateContainer = (ViewGroup) findViewById(R.id.rate_container);
+ mIldCountry = (TextView) mRateContainer.findViewById(R.id.ild_country);
+ mIldRate = (TextView) mRateContainer.findViewById(R.id.ild_rate);
}
private void setupKeypad() {
@@ -184,6 +192,16 @@
mCanDigitsBeEdited = canBeEdited;
}
+ public void setCallRateInformation(String countryName, String displayRate) {
+ if (TextUtils.isEmpty(countryName) && TextUtils.isEmpty(displayRate)) {
+ mRateContainer.setVisibility(View.GONE);
+ return;
+ }
+ mRateContainer.setVisibility(View.VISIBLE);
+ mIldCountry.setText(countryName);
+ mIldRate.setText(displayRate);
+ }
+
public boolean canDigitsBeEdited() {
return mCanDigitsBeEdited;
}