summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-03-14 02:25:43 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-03-14 02:25:43 -0700
commitf68d68b0ba9cf4025fbaf6de273aa15f038bc4a0 (patch)
tree1daab36977642b3814d30becf5c5b5fd5e2be3dc
parent28922b9b34210808620fc90f5315dc0cf05fe08c (diff)
parent6c9dc49356cf962d2b1506b8c3e37a342ffec8cc (diff)
downloadandroid_packages_apps_ContactsCommon-f68d68b0ba9cf4025fbaf6de273aa15f038bc4a0.tar.gz
android_packages_apps_ContactsCommon-f68d68b0ba9cf4025fbaf6de273aa15f038bc4a0.tar.bz2
android_packages_apps_ContactsCommon-f68d68b0ba9cf4025fbaf6de273aa15f038bc4a0.zip
Merge "Modify Select Account Dialog to align with UI mocks."
-rw-r--r--res/layout/default_account_checkbox.xml16
-rw-r--r--res/layout/select_account_list_item.xml23
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java49
4 files changed, 69 insertions, 21 deletions
diff --git a/res/layout/default_account_checkbox.xml b/res/layout/default_account_checkbox.xml
index 15180761..9a1a4504 100644
--- a/res/layout/default_account_checkbox.xml
+++ b/res/layout/default_account_checkbox.xml
@@ -18,21 +18,19 @@
android:id="@+id/default_account_checkbox_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="8dip"
+ android:padding="4dp"
android:orientation="vertical">
- <!-- Dummy to enable right-justification of checkbox -->
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
<CheckBox
android:id="@+id/default_account_checkbox_view"
+ android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="20dip"
- android:layout_marginLeft="20dip"
+ android:paddingStart="15dip"
+ android:layout_marginLeft="13dip"
android:layout_marginBottom="20dip"
android:gravity="center"
- android:textSize="14sp"
android:textAlignment="viewStart"
- android:text="@string/set_default_account"/>
+ android:text="@string/set_default_account"
+ android:textColor="@color/dialtacts_secondary_text_color"
+ />
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/select_account_list_item.xml b/res/layout/select_account_list_item.xml
index 1999fced..39a5af05 100644
--- a/res/layout/select_account_list_item.xml
+++ b/res/layout/select_account_list_item.xml
@@ -20,7 +20,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="4dp" >
+ android:padding="8dp" >
<ImageView android:id="@+id/icon"
android:layout_width="48dp"
@@ -28,11 +28,26 @@
android:tint="@color/dialtacts_secondary_text_color"
android:scaleType="center" />
- <TextView android:id="@+id/text"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ <LinearLayout
+ android:id="@+id/text"
android:gravity="start|center_vertical"
android:layout_marginLeft="8dp"
android:layout_width="0dp"
android:layout_weight="1"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+ <TextView android:id="@+id/label"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/dialtacts_primary_text_color"
+ android:includeFontPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+ <TextView android:id="@+id/number"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:includeFontPadding="false"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+ </LinearLayout>
+
</view>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9e37ce40..296d5878 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -846,4 +846,6 @@ a ren't members of any other group. [CHAR LIMIT=25] -->
<!-- Label for the check box to toggle default sim card setting [CHAR LIMIT=35]-->
<string name="set_default_account">Always use this for calls</string>
+ <!-- Title for dialog to select Phone Account for outgoing call. [CHAR LIMIT=40] -->
+ <string name="select_phone_account_for_calls">Call with</string>
</resources>
diff --git a/src/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/src/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
index 9c92cea4..33eebcad 100644
--- a/src/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
+++ b/src/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.telecom.TelecomManager;
+import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -46,6 +47,7 @@ import java.util.List;
* the choice to set the phone account as default.
*/
public class SelectPhoneAccountDialogFragment extends DialogFragment {
+ private int mTitleResId;
private boolean mCanSetDefault;
private List<PhoneAccountHandle> mAccountHandles;
private boolean mIsSelected;
@@ -59,17 +61,39 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
*
* @param fragmentManager The fragment manager.
* @param accountHandles The {@code PhoneAccountHandle}s available to select from.
+ * @param listener The listener for the results of the account selection.
*/
- public static void showAccountDialog(FragmentManager fragmentManager, boolean canSetDefault,
+ public static void showAccountDialog(FragmentManager fragmentManager,
List<PhoneAccountHandle> accountHandles, SelectPhoneAccountListener listener) {
+ showAccountDialog(fragmentManager, R.string.select_account_dialog_title, false,
+ accountHandles, listener);
+ }
+
+ /**
+ * Shows the account selection dialog.
+ * This is the preferred way to show this dialog.
+ * This method also allows specifying a custom title and "set default" checkbox.
+ *
+ * @param fragmentManager The fragment manager.
+ * @param titleResId The resource ID for the string to use in the title of the dialog.
+ * @param canSetDefault {@code true} if the dialog should include an option to set the selection
+ * as the default. False otherwise.
+ * @param accountHandles The {@code PhoneAccountHandle}s available to select from.
+ * @param listener The listener for the results of the account selection.
+ */
+ public static void showAccountDialog(FragmentManager fragmentManager, int titleResId,
+ boolean canSetDefault, List<PhoneAccountHandle> accountHandles,
+ SelectPhoneAccountListener listener) {
SelectPhoneAccountDialogFragment fragment =
- new SelectPhoneAccountDialogFragment(canSetDefault, accountHandles, listener);
+ new SelectPhoneAccountDialogFragment(
+ titleResId, canSetDefault, accountHandles, listener);
fragment.show(fragmentManager, "selectAccount");
}
- public SelectPhoneAccountDialogFragment(boolean canSetDefault,
+ public SelectPhoneAccountDialogFragment(int titleResId, boolean canSetDefault,
List<PhoneAccountHandle> accountHandles, SelectPhoneAccountListener listener) {
super();
+ mTitleResId = titleResId;
mCanSetDefault = canSetDefault;
mAccountHandles = accountHandles;
mListener = listener;
@@ -111,7 +135,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
R.layout.select_account_list_item,
mAccountHandles);
- AlertDialog dialog = builder.setTitle(R.string.select_account_dialog_title)
+ AlertDialog dialog = builder.setTitle(mTitleResId)
.setAdapter(selectAccountListAdapter, selectionListener)
.create();
@@ -152,7 +176,8 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
// Cache views for faster scrolling
rowView = inflater.inflate(mResId, null);
holder = new ViewHolder();
- holder.textView = (TextView) rowView.findViewById(R.id.text);
+ holder.labelTextView = (TextView) rowView.findViewById(R.id.label);
+ holder.numberTextView = (TextView) rowView.findViewById(R.id.number);
holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
rowView.setTag(holder);
}
@@ -163,13 +188,21 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
PhoneAccountHandle accountHandle = getItem(position);
PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle);
- holder.textView.setText(account.getLabel());
+ holder.labelTextView.setText(account.getLabel());
+ if (account.getAddress() == null ||
+ TextUtils.isEmpty(account.getAddress().getSchemeSpecificPart())) {
+ holder.numberTextView.setVisibility(View.GONE);
+ } else {
+ holder.numberTextView.setVisibility(View.VISIBLE);
+ holder.numberTextView.setText(account.getAddress().getSchemeSpecificPart());
+ }
holder.imageView.setImageDrawable(account.getIcon(getContext()));
return rowView;
}
private class ViewHolder {
- TextView textView;
+ TextView labelTextView;
+ TextView numberTextView;
ImageView imageView;
}
}
@@ -181,4 +214,4 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
}
super.onPause();
}
-} \ No newline at end of file
+}