summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java26
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java19
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViews.java4
-rw-r--r--src/com/android/dialer/calllog/IntentProvider.java10
-rw-r--r--src/com/android/dialer/list/ViewPagerTabs.java3
-rw-r--r--src/com/android/dialer/settings/DialerSettingsActivity.java83
6 files changed, 108 insertions, 37 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 16be30871..e83144185 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -27,7 +27,7 @@ import android.os.Handler;
import android.os.Message;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.TelecommManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -592,7 +592,7 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
protected View newChildView(Context context, ViewGroup parent) {
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
// Get the views to bind to and cache them.
@@ -644,9 +644,9 @@ public class CallLogAdapter extends GroupingListAdapter
final long date = c.getLong(CallLogQuery.DATE);
final long duration = c.getLong(CallLogQuery.DURATION);
final int callType = c.getInt(CallLogQuery.CALL_TYPE);
- final PhoneAccount account = getAccount(c);
- final Drawable accountIcon = account == null ? null :
- TelecommManager.from(mContext).getPhoneAccountMetadata(account).getIcon(mContext);
+ final PhoneAccountHandle accountHandle = getAccountHandle(c);
+ final Drawable accountIcon = accountHandle == null ? null :
+ TelecommManager.from(mContext).getPhoneAccount(accountHandle).getIcon(mContext);
final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
final long rowId = c.getLong(CallLogQuery.ID);
views.rowId = rowId;
@@ -671,7 +671,7 @@ public class CallLogAdapter extends GroupingListAdapter
views.number = number;
views.numberPresentation = numberPresentation;
views.callType = callType;
- views.mAccount = account;
+ views.mAccountHandle = accountHandle;
views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
// Stash away the Ids of the calls so that we can support deleting a row in the call log.
views.callIds = getCallIds(c, count);
@@ -690,7 +690,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
// Sets the primary action to call the number.
views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number,
- account));
+ accountHandle));
} else {
// Number is not callable, so hide button.
views.primaryActionView.setTag(null);
@@ -894,7 +894,8 @@ public class CallLogAdapter extends GroupingListAdapter
views.actionsView.setVisibility(View.VISIBLE);
views.actionsView.setAlpha(1.0f);
views.callLogEntryView.setBackgroundColor(mExpandedBackgroundColor);
- callLogItem.setTranslationZ(mExpandedTranslationZ);
+ views.callLogEntryView.setTranslationZ(mExpandedTranslationZ);
+ callLogItem.setTranslationZ(mExpandedTranslationZ); // WAR
// Attempt to give accessibility focus to one of the action buttons.
// This ensures that a user realizes the expansion occurred.
@@ -913,7 +914,8 @@ public class CallLogAdapter extends GroupingListAdapter
}
views.callLogEntryView.setBackgroundColor(mCallLogBackgroundColor);
- callLogItem.setTranslationZ(0);
+ views.callLogEntryView.setTranslationZ(0);
+ callLogItem.setTranslationZ(0); // WAR
}
}
@@ -978,7 +980,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (canPlaceCallToNumber) {
// Sets the primary action to call the number.
views.callBackButtonView.setTag(
- IntentProvider.getReturnCallIntentProvider(views.number, views.mAccount));
+ IntentProvider.getReturnCallIntentProvider(views.number, views.mAccountHandle));
views.callBackButtonView.setVisibility(View.VISIBLE);
views.callBackButtonView.setOnClickListener(mActionListener);
} else {
@@ -991,7 +993,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (canPlaceCallToNumber && views.phoneCallDetailsViews.callTypeIcons.isVideoShown()) {
views.videoCallButtonView.setTag(
IntentProvider.getReturnVideoCallIntentProvider(views.number,
- views.mAccount));
+ views.mAccountHandle));
views.videoCallButtonView.setVisibility(View.VISIBLE);
views.videoCallButtonView.setOnClickListener(mActionListener);
} else {
@@ -1260,7 +1262,7 @@ public class CallLogAdapter extends GroupingListAdapter
return features;
}
- private PhoneAccount getAccount(Cursor c) {
+ private PhoneAccountHandle getAccountHandle(Cursor c) {
final String component_name = c.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
final String account_id = c.getString(CallLogQuery.ACCOUNT_ID);
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 5d09e7445..52375ed6c 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -575,21 +575,6 @@ public class CallLogFragment extends ListFragment
viewHolder.actionsView.setVisibility(View.VISIBLE);
}
- // If the day group header is shown, subtract the header from the outline of the
- // view. The outline is used for generating the shadow of the view, but we only want
- // a shadow on the call log list item and not the header. This is a slight hack, but
- // the hierarchy of the call log list items makes it hard to achieve the desired
- // shadow behavior otherwise.
- if (viewHolder.dayGroupHeader.isShown()) {
- Outline outline = new Outline();
- outline.setRect(
- 0 /* left */,
- viewHolder.dayGroupHeader.getHeight() /* top */,
- view.getWidth() /* right */,
- view.getHeight() /* bottom */);
- view.setOutline(outline);
- }
-
// Set up the fade effect for the action buttons.
if (isExpand) {
// Start the fade in after the expansion has partly completed, otherwise it
@@ -620,7 +605,9 @@ public class CallLogFragment extends ListFragment
// For each value from 0 to 1, animate the various parts of the layout.
view.getLayoutParams().height = (int) (value * distance + baseHeight);
- view.setTranslationZ(mExpandedItemTranslationZ * value);
+ float z = mExpandedItemTranslationZ * value;
+ viewHolder.callLogEntryView.setTranslationZ(z);
+ view.setTranslationZ(z); // WAR
view.requestLayout();
}
});
diff --git a/src/com/android/dialer/calllog/CallLogListItemViews.java b/src/com/android/dialer/calllog/CallLogListItemViews.java
index 70d545e89..21e0cb0cd 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViews.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViews.java
@@ -17,7 +17,7 @@
package com.android.dialer.calllog;
import android.content.Context;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.view.View;
import android.widget.QuickContactBadge;
import android.widget.TextView;
@@ -87,7 +87,7 @@ public final class CallLogListItemViews {
* The account for the current call log entry. Cached here as the call back
* intent is set only when the actions ViewStub is inflated.
*/
- public PhoneAccount mAccount;
+ public PhoneAccountHandle mAccountHandle;
/**
* If the call has an associated voicemail message, the URI of the voicemail message for
diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java
index c52dff87f..517d9e754 100644
--- a/src/com/android/dialer/calllog/IntentProvider.java
+++ b/src/com/android/dialer/calllog/IntentProvider.java
@@ -21,7 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.CallLog.Calls;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import com.android.contacts.common.CallUtil;
import com.android.dialer.CallDetailActivity;
@@ -38,21 +38,21 @@ public abstract class IntentProvider {
public abstract Intent getIntent(Context context);
public static IntentProvider getReturnCallIntentProvider(final String number,
- final PhoneAccount account) {
+ final PhoneAccountHandle accountHandle) {
return new IntentProvider() {
@Override
public Intent getIntent(Context context) {
- return CallUtil.getCallIntent(number, account);
+ return CallUtil.getCallIntent(number, accountHandle);
}
};
}
public static IntentProvider getReturnVideoCallIntentProvider(final String number,
- final PhoneAccount account) {
+ final PhoneAccountHandle accountHandle) {
return new IntentProvider() {
@Override
public Intent getIntent(Context context) {
- return CallUtil.getVideoCallIntent(number, account);
+ return CallUtil.getVideoCallIntent(number, accountHandle);
}
};
}
diff --git a/src/com/android/dialer/list/ViewPagerTabs.java b/src/com/android/dialer/list/ViewPagerTabs.java
index b6b9ab6d4..3717369a2 100644
--- a/src/com/android/dialer/list/ViewPagerTabs.java
+++ b/src/com/android/dialer/list/ViewPagerTabs.java
@@ -44,9 +44,8 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
private static final ViewOutlineProvider VIEW_BOUNDS_OUTLINE_PROVIDER =
new ViewOutlineProvider() {
@Override
- public boolean getOutline(View view, Outline outline) {
+ public void getOutline(View view, Outline outline) {
outline.setRect(0, 0, view.getWidth(), view.getHeight());
- return true;
}
};
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java
index 904be82b8..6d21db0db 100644
--- a/src/com/android/dialer/settings/DialerSettingsActivity.java
+++ b/src/com/android/dialer/settings/DialerSettingsActivity.java
@@ -1,11 +1,22 @@
package com.android.dialer.settings;
+import com.google.common.collect.Lists;
+
+import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceActivity.Header;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.TextView;
import com.android.contacts.common.preference.DisplayOptionsPreferenceFragment;
import com.android.dialer.DialtactsActivity;
@@ -16,11 +27,15 @@ import java.util.List;
public class DialerSettingsActivity extends PreferenceActivity {
protected SharedPreferences mPreferences;
+ private HeaderAdapter mHeaderAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ final int topPadding = getResources().getDimensionPixelSize(
+ R.dimen.preference_list_top_padding);
+ getListView().setPadding(0, topPadding, 0, 0);
}
@Override
@@ -51,4 +66,72 @@ public class DialerSettingsActivity extends PreferenceActivity {
protected boolean isValidFragment(String fragmentName) {
return true;
}
+
+ @Override
+ public void setListAdapter(ListAdapter adapter) {
+ if (adapter == null) {
+ super.setListAdapter(null);
+ } else {
+ // We don't have access to the hidden getHeaders() method, so grab the headers from
+ // the intended adapter and then replace it with our own.
+ int headerCount = adapter.getCount();
+ List<Header> headers = Lists.newArrayList();
+ for (int i = 0; i < headerCount; i++) {
+ headers.add((Header) adapter.getItem(i));
+ }
+ mHeaderAdapter = new HeaderAdapter(this, headers);
+ super.setListAdapter(mHeaderAdapter);
+ }
+ }
+
+ /**
+ * This custom {@code ArrayAdapter} is mostly identical to the equivalent one in
+ * {@code PreferenceActivity}, except with a local layout resource.
+ */
+ private static class HeaderAdapter extends ArrayAdapter<Header> {
+ static class HeaderViewHolder {
+ ImageView icon;
+ TextView title;
+ TextView summary;
+ }
+
+ private LayoutInflater mInflater;
+
+ public HeaderAdapter(Context context, List<Header> objects) {
+ super(context, 0, objects);
+ mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ HeaderViewHolder holder;
+ View view;
+
+ if (convertView == null) {
+ view = mInflater.inflate(R.layout.dialer_preferences, parent, false);
+ holder = new HeaderViewHolder();
+ holder.icon = (ImageView) view.findViewById(R.id.icon);
+ holder.title = (TextView) view.findViewById(R.id.title);
+ holder.summary = (TextView) view.findViewById(R.id.summary);
+ view.setTag(holder);
+ } else {
+ view = convertView;
+ holder = (HeaderViewHolder) view.getTag();
+ }
+
+ // All view fields must be updated every time, because the view may be recycled
+ Header header = getItem(position);
+ holder.icon.setImageResource(header.iconRes);
+ holder.title.setText(header.getTitle(getContext().getResources()));
+ CharSequence summary = header.getSummary(getContext().getResources());
+ if (!TextUtils.isEmpty(summary)) {
+ holder.summary.setVisibility(View.VISIBLE);
+ holder.summary.setText(summary);
+ } else {
+ holder.summary.setVisibility(View.GONE);
+ }
+
+ return view;
+ }
+ }
}