diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-03-31 01:57:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-31 01:57:22 +0000 |
commit | e93d24de56deaae4c7ef5d30b2a3593b3c17ec24 (patch) | |
tree | fef38ad919265f8179b14ae01fdb6023e6024429 /java | |
parent | d2c13e28ca4da3425409c5c106157882ac3a963f (diff) | |
parent | 07206e2c106eec909fd38c16a66957a5e00372de (diff) |
Merge "Use IS_READ instead of NEW in new call log."
Diffstat (limited to 'java')
5 files changed, 36 insertions, 34 deletions
diff --git a/java/com/android/dialer/calllog/ClearMissedCalls.java b/java/com/android/dialer/calllog/ClearMissedCalls.java index d216e7b88..78eb80294 100644 --- a/java/com/android/dialer/calllog/ClearMissedCalls.java +++ b/java/com/android/dialer/calllog/ClearMissedCalls.java @@ -38,8 +38,8 @@ import java.util.Collection; import javax.inject.Inject; /** - * Clears missed calls. This includes cancelling notifications and updating the "NEW" status in the - * system call log. + * Clears missed calls. This includes cancelling notifications and updating the "IS_READ" status in + * the system call log. */ public final class ClearMissedCalls { @@ -58,11 +58,11 @@ public final class ClearMissedCalls { } /** - * Cancels all missed call notifications and marks all "new" missed calls in the system call log - * as "not new". + * Cancels all missed call notifications and marks all "unread" missed calls in the system call + * log as "read". */ public ListenableFuture<Void> clearAll() { - ListenableFuture<Void> markNewFuture = markNotNew(ImmutableSet.of()); + ListenableFuture<Void> markReadFuture = markRead(ImmutableSet.of()); ListenableFuture<Void> cancelNotificationsFuture = uiThreadExecutor.submit( () -> { @@ -73,11 +73,11 @@ public final class ClearMissedCalls { // Note on this usage of whenAllComplete: // -The returned future completes when all sub-futures complete (whether they fail or not) // -The returned future fails if any sub-future fails - return Futures.whenAllComplete(markNewFuture, cancelNotificationsFuture) + return Futures.whenAllComplete(markReadFuture, cancelNotificationsFuture) .call( () -> { // Calling get() is necessary to propagate failures. - markNewFuture.get(); + markReadFuture.get(); cancelNotificationsFuture.get(); return null; }, @@ -86,12 +86,12 @@ public final class ClearMissedCalls { /** * For the provided set of IDs from the system call log, cancels their missed call notifications - * and marks them "not new". + * and marks them "read". * * @param ids IDs from the system call log (see {@link Calls#_ID}}. */ public ListenableFuture<Void> clearBySystemCallLogId(Collection<Long> ids) { - ListenableFuture<Void> markNewFuture = markNotNew(ids); + ListenableFuture<Void> markReadFuture = markRead(ids); ListenableFuture<Void> cancelNotificationsFuture = uiThreadExecutor.submit( () -> { @@ -105,11 +105,11 @@ public final class ClearMissedCalls { // Note on this usage of whenAllComplete: // -The returned future completes when all sub-futures complete (whether they fail or not) // -The returned future fails if any sub-future fails - return Futures.whenAllComplete(markNewFuture, cancelNotificationsFuture) + return Futures.whenAllComplete(markReadFuture, cancelNotificationsFuture) .call( () -> { // Calling get() is necessary to propagate failures. - markNewFuture.get(); + markReadFuture.get(); cancelNotificationsFuture.get(); return null; }, @@ -117,28 +117,28 @@ public final class ClearMissedCalls { } /** - * Marks all provided system call log IDs as not new, or if the provided collection is empty, - * marks all calls as not new. + * Marks all provided system call log IDs as read, or if the provided collection is empty, marks + * all calls as read. */ @SuppressLint("MissingPermission") - private ListenableFuture<Void> markNotNew(Collection<Long> ids) { + private ListenableFuture<Void> markRead(Collection<Long> ids) { return backgroundExecutor.submit( () -> { if (!UserManagerCompat.isUserUnlocked(appContext)) { - LogUtil.e("ClearMissedCalls.markNotNew", "locked"); + LogUtil.e("ClearMissedCalls.markRead", "locked"); return null; } if (!PermissionsUtil.hasCallLogWritePermissions(appContext)) { - LogUtil.e("ClearMissedCalls.markNotNew", "no permission"); + LogUtil.e("ClearMissedCalls.markRead", "no permission"); return null; } ContentValues values = new ContentValues(); - values.put(Calls.NEW, 0); + values.put(Calls.IS_READ, 1); Selection.Builder selectionBuilder = Selection.builder() - .and(Selection.column(Calls.NEW).is("=", 1)) + .and(Selection.column(Calls.IS_READ).is("=", 0)) .and(Selection.column(Calls.TYPE).is("=", Calls.MISSED_TYPE)); if (!ids.isEmpty()) { selectionBuilder.and(Selection.column(Calls._ID).in(toStrings(ids))); diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java index 8362a81ac..aa4260cba 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -225,6 +225,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { return new RowCombiner(individualRowsSortedByTimestampDesc) .useMostRecentLong(AnnotatedCallLog.TIMESTAMP) .useMostRecentLong(AnnotatedCallLog.NEW) + .useMostRecentLong(AnnotatedCallLog.IS_READ) // Two different DialerPhoneNumbers could be combined if they are different but considered // to be an "exact match" by libphonenumber; in this case we arbitrarily select the most // recent one. diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 1f84ebfdf..217208d17 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -109,11 +109,11 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { primaryTextView.setText(CallLogEntryText.buildPrimaryText(context, row)); secondaryTextView.setText(CallLogEntryText.buildSecondaryTextForEntries(context, clock, row)); - if (isNewMissedCall(row)) { - primaryTextView.setTextAppearance(R.style.primary_textview_new_call); - callCountTextView.setTextAppearance(R.style.primary_textview_new_call); - secondaryTextView.setTextAppearance(R.style.secondary_textview_new_call); - phoneAccountView.setTextAppearance(R.style.phoneaccount_textview_new_call); + if (isUnreadMissedCall(row)) { + primaryTextView.setTextAppearance(R.style.primary_textview_unread_call); + callCountTextView.setTextAppearance(R.style.primary_textview_unread_call); + secondaryTextView.setTextAppearance(R.style.secondary_textview_unread_call); + phoneAccountView.setTextAppearance(R.style.phoneaccount_textview_unread_call); } else { primaryTextView.setTextAppearance(R.style.primary_textview); callCountTextView.setTextAppearance(R.style.primary_textview); @@ -140,10 +140,11 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } } - private boolean isNewMissedCall(CoalescedRow row) { + private boolean isUnreadMissedCall(CoalescedRow row) { // Show missed call styling if the most recent call in the group was missed and it is still - // marked as NEW. It is not clear what IS_READ should be used for and it is currently not used. - return row.getCallType() == Calls.MISSED_TYPE && row.getIsNew(); + // marked as not read. The "NEW" column is presumably used for notifications and voicemails + // only. + return row.getCallType() == Calls.MISSED_TYPE && !row.getIsRead(); } private void setPhoto(CoalescedRow row) { @@ -159,7 +160,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { ColorStateList colorStateList = ColorStateList.valueOf( context.getColor( - isNewMissedCall(row) + isUnreadMissedCall(row) ? R.color.feature_icon_unread_color : R.color.feature_icon_read_color)); @@ -217,7 +218,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } callTypeIcon.setImageResource(resId); - if (isNewMissedCall(row)) { + if (isUnreadMissedCall(row)) { callTypeIcon.setImageTintList( ColorStateList.valueOf(context.getColor(R.color.call_type_icon_unread_color))); } else { diff --git a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java index dabb9bbe4..3869e78c3 100644 --- a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java +++ b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java @@ -35,9 +35,9 @@ public final class NewCallLogMenu { HistoryItemActionBottomSheet.show( context, BottomSheetHeader.fromRow(context, row), Modules.fromRow(context, row)); - // If the user opens the bottom sheet for a new call, clear the notifications and make the row - // not bold immediately. To do this, mark all of the calls in group as not new. - if (row.getIsNew() && row.getCallType() == Calls.MISSED_TYPE) { + // If the user opens the bottom sheet for an unread call, clear the notifications and make the + // row not bold immediately. To do this, mark all of the calls in group as read. + if (!row.getIsRead() && row.getCallType() == Calls.MISSED_TYPE) { Futures.addCallback( CallLogComponent.get(context) .getClearMissedCalls() diff --git a/java/com/android/dialer/calllog/ui/res/values/styles.xml b/java/com/android/dialer/calllog/ui/res/values/styles.xml index d521feed4..047f1dace 100644 --- a/java/com/android/dialer/calllog/ui/res/values/styles.xml +++ b/java/com/android/dialer/calllog/ui/res/values/styles.xml @@ -21,7 +21,7 @@ <item name="android:fontFamily">sans-serif</item> </style> - <style name="primary_textview_new_call"> + <style name="primary_textview_unread_call"> <item name="android:textColor">@color/primary_text_color</item> <item name="android:fontFamily">sans-serif-medium</item> </style> @@ -35,12 +35,12 @@ <item name="android:fontFamily">sans-serif</item> </style> - <style name="secondary_textview_new_call"> + <style name="secondary_textview_unread_call"> <item name="android:textColor">@color/missed_call</item> <item name="android:fontFamily">sans-serif-medium</item> </style> - <style name="phoneaccount_textview_new_call"> + <style name="phoneaccount_textview_unread_call"> <item name="android:fontFamily">sans-serif-medium</item> </style> |