diff options
Diffstat (limited to 'java/com/android/dialer/app')
5 files changed, 74 insertions, 8 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index fd685816e..e093aa9b7 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -74,6 +74,7 @@ import com.android.dialer.app.calllog.CallLogActivity; import com.android.dialer.app.calllog.CallLogAdapter; import com.android.dialer.app.calllog.CallLogFragment; import com.android.dialer.app.calllog.CallLogNotificationsService; +import com.android.dialer.app.calllog.IntentProvider; import com.android.dialer.app.dialpad.DialpadFragment; import com.android.dialer.app.list.DialtactsPagerAdapter; import com.android.dialer.app.list.DialtactsPagerAdapter.TabIndex; @@ -90,6 +91,7 @@ import com.android.dialer.app.settings.DialerSettingsActivity; import com.android.dialer.app.widget.ActionBarController; import com.android.dialer.app.widget.SearchEditTextLayout; import com.android.dialer.callcomposer.CallComposerActivity; +import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; @@ -173,6 +175,7 @@ public class DialtactsActivity extends TransactionSafeActivity private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1; public static final int ACTIVITY_REQUEST_CODE_CALL_COMPOSE = 2; public static final int ACTIVITY_REQUEST_CODE_LIGHTBRINGER = 3; + public static final int ACTIVITY_REQUEST_CODE_CALL_DETAILS = 4; private static final int FAB_SCALE_IN_DELAY_MS = 300; @@ -789,6 +792,19 @@ public class DialtactsActivity extends TransactionSafeActivity } else { LogUtil.i("DialtactsActivity.onActivityResult", "returned from call composer, no error"); } + } else if (requestCode == 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); + int snackbarDurationMillis = 5_000; + Snackbar.make(mParentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis) + .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/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(); + } } diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml index e02c6fb30..5549881c3 100644 --- a/java/com/android/dialer/app/res/values/strings.xml +++ b/java/com/android/dialer/app/res/values/strings.xml @@ -930,4 +930,14 @@ <!-- Label for setting that shows more information about the Phone app [CHAR LIMIT=30] --> <string name="about_phone_label">About</string> + <!-- Button text to prompt a user to open an sms conversation [CHAR LIMIT=NONE] --> + <string name="view_conversation">View</string> + + <!-- If a user deletes a call that has attachments (photo, message, ect) bundled with it, they need + to be told that they need to go to the SMS app to delete the attachments. [CHAR LIMIT=NONE] --> + <string name="ec_data_deleted">Call deleted. View and delete attachments shared during this call in Messages.</string> + + <!-- If a user deletes a call that has attachments (photo, message, ect) bundled with it, they need + to be told that they need to go to the SMS app to delete the attachments. [CHAR LIMIT=NONE] --> + <string name="multiple_ec_data_deleted">Calls deleted. View and delete attachments shared during calls in Messages.</string> </resources> |