summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinus_lee <llee@cyngn.com>2015-01-05 12:45:34 -0800
committerLinus Lee <llee@cyngn.com>2015-01-06 01:32:33 +0000
commit0aa14c90ab580d1f7185235d2613238235f2ce70 (patch)
tree1f1c9a0560d372cc4a6c097f674b7ea7d77e3034
parent5406f450138cd7e2f355fe6aed6f6df5dab737f1 (diff)
downloadandroid_packages_apps_Dialer-0aa14c90ab580d1f7185235d2613238235f2ce70.tar.gz
android_packages_apps_Dialer-0aa14c90ab580d1f7185235d2613238235f2ce70.tar.bz2
android_packages_apps_Dialer-0aa14c90ab580d1f7185235d2613238235f2ce70.zip
Separate blacklist from missed filter in history/stats
Change-Id: I50e2467b7ac8568c6956c2dbc085985fd2f34d99 (cherry picked from commit 2f4890478123a3b6a9ba0a8b23f9a290f6c4ec73)
-rw-r--r--res/layout/call_stats_detail_info.xml36
-rw-r--r--res/layout/call_stats_list_item.xml3
-rw-r--r--res/values/attrs.xml1
-rw-r--r--res/values/cm_strings.xml2
-rw-r--r--res/values/colors.xml1
-rw-r--r--res/values/strings.xml3
-rwxr-xr-xsrc/com/android/dialer/calllog/CallLogQueryHandler.java50
-rw-r--r--src/com/android/dialer/calllog/SpinnerContent.java9
-rw-r--r--src/com/android/dialer/callstats/CallStatsDetailActivity.java20
-rw-r--r--src/com/android/dialer/callstats/CallStatsDetailHelper.java15
-rw-r--r--src/com/android/dialer/callstats/CallStatsDetails.java15
-rw-r--r--src/com/android/dialer/widget/LinearColorBar.java22
12 files changed, 117 insertions, 60 deletions
diff --git a/res/layout/call_stats_detail_info.xml b/res/layout/call_stats_detail_info.xml
index 7dcd06dfe..e279ad73e 100644
--- a/res/layout/call_stats_detail_info.xml
+++ b/res/layout/call_stats_detail_info.xml
@@ -210,6 +210,42 @@
</LinearLayout>
+ <LinearLayout
+ android:id="@+id/blacklist_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/call_log_icon_margin"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <com.android.dialer.calllog.CallTypeIconsView
+ android:id="@+id/blacklist_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+
+ <TextView
+ android:id="@+id/blacklist_summary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/call_log_icon_margin"
+ android:textColor="?attr/call_log_primary_text_color"
+ android:textSize="@dimen/call_log_primary_text_size" />
+
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/blacklist_count"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="?attr/call_log_secondary_text_color"
+ android:textSize="@dimen/call_log_secondary_text_size" />
+
+ </LinearLayout>
+
</LinearLayout>
</RelativeLayout>
diff --git a/res/layout/call_stats_list_item.xml b/res/layout/call_stats_list_item.xml
index 828436520..152e585fd 100644
--- a/res/layout/call_stats_list_item.xml
+++ b/res/layout/call_stats_list_item.xml
@@ -70,7 +70,8 @@
ex:backgroundColor="@color/call_stats_bar_background"
ex:blueColor="@color/call_stats_incoming"
ex:greenColor="@color/call_stats_outgoing"
- ex:redColor="@color/call_stats_missed" />
+ ex:redColor="@color/call_stats_missed"
+ ex:orangeColor="@color/call_stats_blacklist"/>
<TextView
android:id="@+id/number"
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index ea03b32d4..240ed10cb 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -43,6 +43,7 @@
<attr name="redColor" format="color" />
<attr name="greenColor" format="color" />
<attr name="blueColor" format="color" />
+ <attr name="orangeColor" format="color" />
<attr name="backgroundColor" format="color" />
</declare-styleable>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index ba9a5cc34..71011f3e0 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -54,6 +54,8 @@
<string name="call_stats_outgoing">Outgoing: <xliff:g id="percent">%d</xliff:g>%%</string>
<string name="call_stats_missed">Missed</string>
<string name="call_stats_missed_percent">Missed: <xliff:g id="percent">%d</xliff:g>%%</string>
+ <string name="call_stats_blacklist">Blacklist</string>
+ <string name="call_stats_blacklist_percent">Blacklist: <xliff:g id="percent">%d</xliff:g>%%</string>
<string name="call_stats_header_total">Total: <xliff:g id="call_count">%s</xliff:g>, <xliff:g id="duration">%s</xliff:g></string>
<string name="call_stats_header_total_callsonly">Total: <xliff:g id="call_count">%s</xliff:g></string>
<string name="call_stats_filter_from">Start date</string>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index dc4c1daec..a2b1971a6 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -107,5 +107,6 @@
<color name="call_stats_incoming">#33b5e5</color>
<color name="call_stats_outgoing">#99cc00</color>
<color name="call_stats_missed">#eb1313</color>
+ <color name="call_stats_blacklist">#ebaf0d</color>
<color name="call_stats_bar_background">#88888888</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index beb7fe209..ccf78e054 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -133,6 +133,9 @@
<!-- The header to show that call log is only showing missed calls. [CHAR LIMIT=40] -->
<string name="call_log_missed_header">Missed calls only</string>
+ <!-- The header to show that call log is only showing missed calls. [CHAR LIMIT=40] -->
+ <string name="call_log_blacklist_header">Blacklist calls only</string>
+
<!-- Voicemail status message shown at the top of call log to notify the user that no new
voicemails are currently available. This can happen when both notification as well as data
connection to the voicemail server is lost. [CHAR LIMIT=64] -->
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 293c21e7c..b2399b9ea 100755
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -159,49 +159,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
/** Fetches the list of calls in the call log. */
private void fetchCalls(int token, int callType, boolean newOnly, long newerThan) {
- // We need to check for NULL explicitly otherwise entries with where READ is NULL
- // may not match either the query or its negation.
- // We consider the calls that are not yet consumed (i.e. IS_READ = 0) as "new".
- StringBuilder where = new StringBuilder();
- List<String> selectionArgs = Lists.newArrayList();
-
- if (newOnly) {
- where.append(Calls.NEW);
- where.append(" = 1");
- }
-
- if (callType > CALL_TYPE_ALL) {
- if (where.length() > 0) {
- where.append(" AND ");
- }
- // Add a clause to fetch only items of type voicemail.
- where.append(String.format("(%s = ?)", Calls.TYPE));
- // Add a clause to fetch only items newer than the requested date
- selectionArgs.add(Integer.toString(callType));
- if (callType == Calls.MISSED_TYPE) {
- // also query for blacklisted calls as they are 'missed'
- where.append(" OR ");
- where.append(String.format("(%s = ?)", Calls.TYPE));
- selectionArgs.add(Integer.toString(Calls.BLACKLIST_TYPE));
- }
- }
-
- if (newerThan > 0) {
- if (where.length() > 0) {
- where.append(" AND ");
- }
- where.append(String.format("(%s > ?)", Calls.DATE));
- selectionArgs.add(Long.toString(newerThan));
- }
-
- final int limit = (mLogLimit == -1) ? NUM_LOGS_TO_DISPLAY : mLogLimit;
- final String selection = where.length() > 0 ? where.toString() : null;
- Uri uri = Calls.CONTENT_URI_WITH_VOICEMAIL.buildUpon()
- .appendQueryParameter(Calls.LIMIT_PARAM_KEY, Integer.toString(limit))
- .build();
- startQuery(token, null, uri,
- CallLogQuery._PROJECTION, selection, selectionArgs.toArray(EMPTY_STRING_ARRAY),
- Calls.DEFAULT_SORT_ORDER);
+ fetchCalls(token, callType, newOnly, newerThan, CALL_SUB_ALL);
}
private void fetchCalls(int token, int callType, boolean newOnly,
@@ -225,12 +183,6 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler {
where.append(String.format("(%s = ?)", Calls.TYPE));
// Add a clause to fetch only items newer than the requested date
selectionArgs.add(Integer.toString(callType));
- if (callType == Calls.MISSED_TYPE) {
- // also query for blacklisted calls as they are 'missed'
- where.append(" OR ");
- where.append(String.format("(%s = ?)", Calls.TYPE));
- selectionArgs.add(Integer.toString(Calls.BLACKLIST_TYPE));
- }
}
if (slotId > CALL_SUB_ALL) {
diff --git a/src/com/android/dialer/calllog/SpinnerContent.java b/src/com/android/dialer/calllog/SpinnerContent.java
index 614b594db..9679dd5db 100644
--- a/src/com/android/dialer/calllog/SpinnerContent.java
+++ b/src/com/android/dialer/calllog/SpinnerContent.java
@@ -42,7 +42,8 @@ public class SpinnerContent {
private static final int INDEX_CALL_TYPE_INCOMING = 1;
private static final int INDEX_CALL_TYPE_OUTGOING = 2;
private static final int INDEX_CALL_TYPE_MISSED = 3;
- private static final int INDEX_CALL_TYPE_VOICEMAIL = 4;
+ private static final int INDEX_CALL_TYPE_BLACKLIST = 4;
+ private static final int INDEX_CALL_TYPE_VOICEMAIL = 5;
public static void setSpinnerContentValue(Spinner spinner, int value) {
for (int i = 0, count = spinner.getCount(); i < count; i++) {
@@ -93,7 +94,7 @@ public class SpinnerContent {
public static List<SpinnerContent> setupStatusFilterContent(Context context,
boolean voicemailAvailable) {
// Didn't show the voice mail item if not available.
- int statusCount = voicemailAvailable ? 5 : 4;
+ int statusCount = voicemailAvailable ? 6 : 5;
ArrayList<SpinnerContent> values = new ArrayList<SpinnerContent>(statusCount);
for (int i = 0; i < statusCount; i++) {
int value = CallLogQueryHandler.CALL_TYPE_ALL;
@@ -115,6 +116,10 @@ public class SpinnerContent {
value = CallLog.Calls.MISSED_TYPE;
label = context.getString(R.string.call_log_missed_header);
break;
+ case INDEX_CALL_TYPE_BLACKLIST:
+ value = CallLog.Calls.BLACKLIST_TYPE;
+ label = context.getString(R.string.call_log_blacklist_header);
+ break;
case INDEX_CALL_TYPE_VOICEMAIL:
value = CallLog.Calls.VOICEMAIL_TYPE;
label = context.getString(R.string.call_log_voicemail_header);
diff --git a/src/com/android/dialer/callstats/CallStatsDetailActivity.java b/src/com/android/dialer/callstats/CallStatsDetailActivity.java
index 2c3bcba91..c2bfad3bd 100644
--- a/src/com/android/dialer/callstats/CallStatsDetailActivity.java
+++ b/src/com/android/dialer/callstats/CallStatsDetailActivity.java
@@ -70,6 +70,8 @@ public class CallStatsDetailActivity extends Activity {
private TextView mOutDuration;
private TextView mMissedSummary;
private TextView mMissedCount;
+ private TextView mBlacklistSummary;
+ private TextView mBlacklistCount;
private PieChartView mPieChart;
private CallStatsDetails mData;
@@ -112,11 +114,14 @@ public class CallStatsDetailActivity extends Activity {
mOutDuration = (TextView) findViewById(R.id.out_duration);
mMissedSummary = (TextView) findViewById(R.id.missed_summary);
mMissedCount = (TextView) findViewById(R.id.missed_count);
+ mBlacklistSummary = (TextView) findViewById(R.id.blacklist_summary);
+ mBlacklistCount = (TextView) findViewById(R.id.blacklist_count);
mPieChart = (PieChartView) findViewById(R.id.pie_chart);
setCallType(R.id.in_icon, Calls.INCOMING_TYPE);
setCallType(R.id.out_icon, Calls.OUTGOING_TYPE);
setCallType(R.id.missed_icon, Calls.MISSED_TYPE);
+ setCallType(R.id.blacklist_icon, Calls.BLACKLIST_TYPE);
configureActionBar();
Intent launchIntent = getIntent();
@@ -221,6 +226,21 @@ public class CallStatsDetailActivity extends Activity {
findViewById(R.id.missed_container).setVisibility(View.GONE);
}
+ if (shouldDisplay(Calls.BLACKLIST_TYPE, false)) {
+ if (byDuration) {
+ mBlacklistSummary.setText(getString(R.string.call_stats_blacklist));
+ } else {
+ mBlacklistSummary.setText(getString(R.string.call_stats_blacklist_percent,
+ mData.getCountPercentage(Calls.BLACKLIST_TYPE)));
+ mPieChart.addSlice(mData.blacklistCount,
+ mResources.getColor(R.color.call_stats_blacklist));
+ }
+ mBlacklistCount.setText(CallStatsDetailHelper.getCallCountString(
+ mResources, mData.blacklistCount));
+ } else {
+ findViewById(R.id.blacklist_container).setVisibility(View.GONE);
+ }
+
mPieChart.generatePath();
findViewById(R.id.call_stats_detail).setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/dialer/callstats/CallStatsDetailHelper.java b/src/com/android/dialer/callstats/CallStatsDetailHelper.java
index b6acc92c9..72440c972 100644
--- a/src/com/android/dialer/callstats/CallStatsDetailHelper.java
+++ b/src/com/android/dialer/callstats/CallStatsDetailHelper.java
@@ -78,7 +78,7 @@ public class CallStatsDetailHelper {
labelText = numberFormattedLabel;
}
- float in = 0, out = 0, missed = 0;
+ float in = 0, out = 0, missed = 0, blacklist = 0;
float ratio = getDetailValue(details, type, byDuration) /
getDetailValue(first, type, byDuration);
@@ -88,6 +88,7 @@ public class CallStatsDetailHelper {
out = getDetailValue(details, Calls.OUTGOING_TYPE, byDuration) * ratio / full;
if (!byDuration) {
missed = getDetailValue(details, Calls.MISSED_TYPE, byDuration) * ratio / full;
+ blacklist = getDetailValue(details, Calls.BLACKLIST_TYPE, byDuration) * ratio / full;
}
} else if (type == Calls.INCOMING_TYPE) {
in = ratio;
@@ -95,16 +96,22 @@ public class CallStatsDetailHelper {
out = ratio;
} else if (type == Calls.MISSED_TYPE) {
missed = ratio;
+ } else if (type == Calls.BLACKLIST_TYPE) {
+ blacklist = ratio;
}
- views.barView.setRatios(in, out, missed);
+ views.barView.setRatios(in, out, missed, blacklist);
views.nameView.setText(nameText);
views.numberView.setText(numberText);
views.labelView.setText(labelText);
views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE);
- if (byDuration && type == Calls.MISSED_TYPE) {
- views.percentView.setText(getCallCountString(mResources, details.missedCount));
+ if (byDuration) {
+ if (type == Calls.MISSED_TYPE) {
+ views.percentView.setText(getCallCountString(mResources, details.missedCount));
+ } else if (type == Calls.BLACKLIST_TYPE) {
+ views.percentView.setText(getCallCountString(mResources, details.blacklistCount));
+ }
} else {
float percent = getDetailValue(details, type, byDuration) * 100F /
getDetailValue(total, type, byDuration);
diff --git a/src/com/android/dialer/callstats/CallStatsDetails.java b/src/com/android/dialer/callstats/CallStatsDetails.java
index 80c36ac65..8184be04a 100644
--- a/src/com/android/dialer/callstats/CallStatsDetails.java
+++ b/src/com/android/dialer/callstats/CallStatsDetails.java
@@ -47,6 +47,7 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
public int incomingCount;
public int outgoingCount;
public int missedCount;
+ public int blacklistCount;
public CallStatsDetails(CharSequence number, int numberPresentation,
ContactInfo info, String countryIso, String geocode, long date) {
@@ -121,7 +122,7 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
}
public int getTotalCount() {
- return incomingCount + outgoingCount + missedCount;
+ return incomingCount + outgoingCount + missedCount + blacklistCount;
}
public void addTimeOrMissed(int type, long time) {
@@ -137,6 +138,9 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
case Calls.MISSED_TYPE:
missedCount++;
break;
+ case Calls.BLACKLIST_TYPE:
+ blacklistCount++;
+ break;
}
}
@@ -158,6 +162,8 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
return outDuration;
case Calls.MISSED_TYPE:
return (long) missedCount;
+ case Calls.BLACKLIST_TYPE:
+ return (long) blacklistCount;
default:
return getFullDuration();
}
@@ -171,6 +177,8 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
return outgoingCount;
case Calls.MISSED_TYPE:
return missedCount;
+ case Calls.BLACKLIST_TYPE:
+ return blacklistCount;
default:
return getTotalCount();
}
@@ -182,11 +190,12 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
this.incomingCount += other.incomingCount;
this.outgoingCount += other.outgoingCount;
this.missedCount += other.missedCount;
+ this.blacklistCount += other.blacklistCount;
}
public void reset() {
this.inDuration = this.outDuration = 0;
- this.incomingCount = this.outgoingCount = this.missedCount = 0;
+ this.incomingCount = this.outgoingCount = this.missedCount = this.blacklistCount = 0;
}
/* Parcelable interface */
@@ -215,6 +224,7 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
out.writeInt(incomingCount);
out.writeInt(outgoingCount);
out.writeInt(missedCount);
+ out.writeInt(blacklistCount);
}
public static final Parcelable.Creator<CallStatsDetails> CREATOR =
@@ -246,5 +256,6 @@ public class CallStatsDetails implements CallDetailHeader.Data, Parcelable {
incomingCount = in.readInt();
outgoingCount = in.readInt();
missedCount = in.readInt();
+ blacklistCount = in.readInt();
}
}
diff --git a/src/com/android/dialer/widget/LinearColorBar.java b/src/com/android/dialer/widget/LinearColorBar.java
index 0b824af55..5ccfccef8 100644
--- a/src/com/android/dialer/widget/LinearColorBar.java
+++ b/src/com/android/dialer/widget/LinearColorBar.java
@@ -35,11 +35,13 @@ public class LinearColorBar extends LinearLayout {
private float mFirstRatio;
private float mSecondRatio;
private float mThirdRatio;
+ private float mFourthRatio;
private int mBackgroundColor;
private int mBlueColor;
private int mGreenColor;
private int mRedColor;
+ private int mOrangeColor;
final Rect mRect = new Rect();
final Paint mPaint = new Paint();
@@ -76,6 +78,9 @@ public class LinearColorBar extends LinearLayout {
case R.styleable.LinearColorBar_blueColor:
mBlueColor = a.getInt(attr, 0);
break;
+ case R.styleable.LinearColorBar_orangeColor:
+ mOrangeColor = a.getInt(attr, 0);
+ break;
}
}
@@ -91,10 +96,11 @@ public class LinearColorBar extends LinearLayout {
mEdgeGradientPaint.setAntiAlias(true);
}
- public void setRatios(float blue, float green, float red) {
+ public void setRatios(float blue, float green, float red, float orange) {
mFirstRatio = blue;
mSecondRatio = green;
mThirdRatio = red;
+ mFourthRatio = orange;
invalidate();
}
@@ -129,8 +135,9 @@ public class LinearColorBar extends LinearLayout {
int right = left + (int) (width * mFirstRatio);
int right2 = right + (int) (width * mSecondRatio);
int right3 = right2 + (int) (width * mThirdRatio);
+ int right4 = right3 + (int) (width * mFourthRatio);
- int indicatorLeft = right3;
+ int indicatorLeft = right4;
int indicatorRight = width;
if (mLastInterestingLeft != indicatorLeft || mLastInterestingRight != indicatorRight) {
@@ -199,6 +206,17 @@ public class LinearColorBar extends LinearLayout {
left = right;
}
+ right = right4;
+
+ if (left < right) {
+ mRect.left = left;
+ mRect.right = right;
+ mPaint.setColor(mOrangeColor);
+ canvas.drawRect(mRect, mPaint);
+ width -= (right - left);
+ left = right;
+ }
+
right = left + width;
if (left < right) {
mRect.left = left;