summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java14
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java46
2 files changed, 48 insertions, 12 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 9ebf1121c..00b8281a7 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -206,6 +206,8 @@ public class DialpadFragment extends Fragment
private ToneGenerator mToneGenerator;
private final Object mToneGeneratorLock = new Object();
private View mDialpad;
+ private View mSpacer;
+
/**
* Set of dialpad keys that are currently being pressed
*/
@@ -428,6 +430,18 @@ public class DialpadFragment extends Fragment
mDelete.setOnLongClickListener(this);
}
+ mSpacer = fragmentView.findViewById(R.id.spacer);
+ mSpacer.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (isDigitsEmpty()) {
+ hideAndClearDialpad();
+ return true;
+ }
+ return false;
+ }
+ });
+
mDialpad = fragmentView.findViewById(R.id.dialpad); // This is null in landscape mode.
// In landscape we put the keyboard in phone mode.
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 73703a02c..34666ee99 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.SharedPreferences;
+import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Rect;
import android.net.Uri;
@@ -50,6 +51,7 @@ import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactTileLoaderFactory;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.list.ContactEntry;
+import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.ContactTileView;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
@@ -290,21 +292,12 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mShowAllContactsInEmptyViewButton = mParentView.findViewById(
R.id.show_all_contact_button_in_nofav);
- mShowAllContactsInEmptyViewButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- showAllContacts();
- }
- });
+ prepareAllContactsButton(mShowAllContactsInEmptyViewButton);
mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView,
false);
- mShowAllContactsButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- showAllContacts();
- }
- });
+
+ prepareAllContactsButton(mShowAllContactsButton);
mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);
@@ -638,4 +631,33 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
.apply();
fetchCalls();
}
+
+ /**
+ * Returns a view that is laid out and styled to look like a regular contact, with the correct
+ * click behavior (to launch the all contacts activity when it is clicked).
+ */
+ private View prepareAllContactsButton(View v) {
+ final ContactListItemView view = (ContactListItemView) v;
+ view.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showAllContacts();
+ }
+ });
+
+ view.setPhotoPosition(ContactListItemView.PhotoPosition.LEFT);
+ final Resources resources = getResources();
+ view.setBackgroundResource(R.drawable.contact_list_item_background);
+
+ view.setPaddingRelative(
+ resources.getDimensionPixelSize(R.dimen.favorites_row_start_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_end_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_top_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_bottom_padding));
+
+ view.setDisplayName(resources.getString(R.string.show_all_contacts_button_text));
+ view.setDrawableResource(R.drawable.list_item_avatar_bg,
+ R.drawable.ic_menu_all_contacts_dk);
+ return view;
+ }
}