diff options
author | calderwoodra <calderwoodra@google.com> | 2017-06-20 16:29:03 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-06-21 13:47:52 -0700 |
commit | d06625785de67bf27ba9ad4ff02dfd20011edb74 (patch) | |
tree | 8f1652e22db88064b58bfee4769f275b9cb0f9c1 /java/com/android/dialer/app/calllog | |
parent | be6b69a2ec388bbcff2f129dcf0c7c1476315664 (diff) |
Added privacty snackbar for deleting calls with EC data.
When a user deletes a call from the call log, it might not be clear that they
aren't deleting the attachments they made with the call. So we present them
with a snackbar letting them know to open android messages to delete
attachments.
screenshot: http://screen/TSoWmNhjcn4
screenshot: http://screen/vUXShdYpXem
PiperOrigin-RevId: 159631807
Change-Id: Iaad903258160dc789e0c6a524adba56299523636
Diffstat (limited to 'java/com/android/dialer/app/calllog')
3 files changed, 48 insertions, 8 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java index 6433af9a6..35e05bc39 100644 --- a/java/com/android/dialer/app/calllog/CallLogActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogActivity.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.os.Bundle; import android.provider.CallLog; import android.provider.CallLog.Calls; +import android.support.design.widget.Snackbar; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; @@ -31,7 +32,10 @@ import android.view.ViewGroup; import com.android.contacts.common.list.ViewPagerTabs; import com.android.dialer.app.DialtactsActivity; import com.android.dialer.app.R; +import com.android.dialer.app.calllog.ClearCallLogDialog.Listener; +import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.database.CallLogQueryHandler; +import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.logging.UiAction; @@ -42,7 +46,7 @@ import com.android.dialer.util.ViewUtil; /** Activity for viewing call history. */ public class CallLogActivity extends TransactionSafeActivity - implements ViewPager.OnPageChangeListener { + implements ViewPager.OnPageChangeListener, Listener { private static final int TAB_INDEX_ALL = 0; private static final int TAB_INDEX_MISSED = 1; @@ -144,7 +148,7 @@ public class CallLogActivity extends TransactionSafeActivity startActivity(intent); return true; } else if (item.getItemId() == R.id.delete_all) { - ClearCallLogDialog.show(getFragmentManager()); + ClearCallLogDialog.show(getFragmentManager(), this); return true; } return super.onOptionsItemSelected(item); @@ -180,6 +184,15 @@ public class CallLogActivity extends TransactionSafeActivity } @Override + public void callHistoryDeleted() { + if (EnrichedCallComponent.get(this).getEnrichedCallManager().hasStoredData()) { + Snackbar.make( + findViewById(R.id.calllog_frame), getString(R.string.multiple_ec_data_deleted), 5_000) + .show(); + } + } + + @Override public void onBackPressed() { PerformanceReport.recordClick(UiAction.Type.PRESS_ANDROID_BACK_BUTTON); super.onBackPressed(); @@ -229,4 +242,22 @@ public class CallLogActivity extends TransactionSafeActivity return TAB_INDEX_COUNT; } } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == DialtactsActivity.ACTIVITY_REQUEST_CODE_CALL_DETAILS) { + if (resultCode == RESULT_OK + && data != null + && data.getBooleanExtra(CallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) { + String number = data.getStringExtra(CallDetailsActivity.EXTRA_PHONE_NUMBER); + Snackbar.make(findViewById(R.id.calllog_frame), getString(R.string.ec_data_deleted), 5_000) + .setAction( + R.string.view_conversation, + v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) + .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) + .show(); + } + } + super.onActivityResult(requestCode, resultCode, data); + } } diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index c59f0dd61..79c00e483 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -879,12 +879,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder String packageName = intent.getPackage(); if (getLightbringer().getPackageName().equals(packageName)) { startLightbringerActivity(intent); + } else if (CallDetailsActivity.isLaunchIntent(intent)) { + PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); + ((Activity) mContext) + .startActivityForResult(intent, DialtactsActivity.ACTIVITY_REQUEST_CODE_CALL_DETAILS); } else { - if (intent.getComponent() != null - && CallDetailsActivity.class.getName().equals(intent.getComponent().getClassName())) { - // We are going to open call detail - PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); - } DialerUtils.startActivityWithErrorToast(mContext, intent); } } diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index 155a91618..5c3d4d9fa 100644 --- a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java +++ b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java @@ -29,16 +29,21 @@ import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.os.Bundle; import android.provider.CallLog.Calls; +import android.support.annotation.NonNull; import com.android.dialer.app.R; +import com.android.dialer.common.Assert; import com.android.dialer.phonenumbercache.CachedNumberLookupService; import com.android.dialer.phonenumbercache.PhoneNumberCache; /** Dialog that clears the call log after confirming with the user */ public class ClearCallLogDialog extends DialogFragment { + private Listener listener; + /** Preferred way to show this dialog */ - public static void show(FragmentManager fragmentManager) { + public static void show(FragmentManager fragmentManager, @NonNull Listener listener) { ClearCallLogDialog dialog = new ClearCallLogDialog(); + dialog.listener = Assert.isNotNull(listener); dialog.show(fragmentManager, "deleteCallLog"); } @@ -76,6 +81,7 @@ public class ClearCallLogDialog extends DialogFragment { return; } + listener.callHistoryDeleted(); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } @@ -96,4 +102,8 @@ public class ClearCallLogDialog extends DialogFragment { .setCancelable(true) .create(); } + + interface Listener { + void callHistoryDeleted(); + } } |