summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/postcall
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-24 09:31:16 -0700
committerEric Erfanian <erfanian@google.com>2017-03-27 08:56:19 -0700
commit9050823ccf6f512e06ad65c8a741cb17cbc4a833 (patch)
treee454c9e0fa20b8384fa87d4e6309bb8b9e3aa2a4 /java/com/android/dialer/postcall
parentdd9d50805f1b49dff1fe3787740393d726124cdb (diff)
Update AOSP Dialer source from internal google3 repository at
cl/151128062 Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/150756069 (3/21/2017) to cl/151128062 (3/24/2017). Notable this release: - Explicitly enumerate host and target dependencies. - Update proguard flag references. This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Bug: 33210202 36511925 Addresses 33210202 - Proguard support 36511925 - Compiler warnings when building against platform sdk Change-Id: I448ec3b3f2358886859cf7a4ef76a8fcef3244ae
Diffstat (limited to 'java/com/android/dialer/postcall')
-rw-r--r--java/com/android/dialer/postcall/PostCall.java49
1 files changed, 31 insertions, 18 deletions
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java
index bd7f9c35f..bb60bcc86 100644
--- a/java/com/android/dialer/postcall/PostCall.java
+++ b/java/com/android/dialer/postcall/PostCall.java
@@ -43,6 +43,8 @@ public class PostCall {
private static final String KEY_POST_CALL_CALL_NUMBER = "post_call_call_number";
private static final String KEY_POST_CALL_MESSAGE_SENT = "post_call_message_sent";
+ private static Snackbar activeSnackbar;
+
public static void promptUserForMessageIfNecessary(Activity activity, View rootView) {
if (isEnabled(activity)) {
if (shouldPromptUserToViewSentMessage(activity)) {
@@ -53,6 +55,13 @@ public class PostCall {
}
}
+ public static void closePrompt() {
+ if (activeSnackbar != null && activeSnackbar.isShown()) {
+ activeSnackbar.dismiss();
+ activeSnackbar = null;
+ }
+ }
+
private static void promptUserToSendMessage(Activity activity, View rootView) {
LogUtil.i("PostCall.promptUserToSendMessage", "returned from call, showing post call SnackBar");
String message = activity.getString(R.string.post_call_message);
@@ -64,11 +73,14 @@ public class PostCall {
activity.startActivity(PostCallActivity.newIntent(activity, getPhoneNumber(activity)));
};
- Snackbar.make(rootView, message, Snackbar.LENGTH_INDEFINITE)
- .setAction(addMessage, onClickListener)
- .setActionTextColor(
- activity.getResources().getColor(R.color.dialer_snackbar_action_text_color))
- .show();
+ int durationMs =
+ (int) ConfigProviderBindings.get(activity).getLong("post_call_prompt_duration_ms", 8_000);
+ activeSnackbar =
+ Snackbar.make(rootView, message, durationMs)
+ .setAction(addMessage, onClickListener)
+ .setActionTextColor(
+ activity.getResources().getColor(R.color.dialer_snackbar_action_text_color));
+ activeSnackbar.show();
Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE);
PreferenceManager.getDefaultSharedPreferences(activity)
.edit()
@@ -91,19 +103,20 @@ public class PostCall {
DialerUtils.startActivityWithErrorToast(activity, intent);
};
- Snackbar.make(rootView, message, Snackbar.LENGTH_INDEFINITE)
- .setAction(addMessage, onClickListener)
- .setActionTextColor(
- activity.getResources().getColor(R.color.dialer_snackbar_action_text_color))
- .addCallback(
- new BaseCallback<Snackbar>() {
- @Override
- public void onDismissed(Snackbar snackbar, int i) {
- super.onDismissed(snackbar, i);
- clear(snackbar.getContext());
- }
- })
- .show();
+ activeSnackbar =
+ Snackbar.make(rootView, message, Snackbar.LENGTH_LONG)
+ .setAction(addMessage, onClickListener)
+ .setActionTextColor(
+ activity.getResources().getColor(R.color.dialer_snackbar_action_text_color))
+ .addCallback(
+ new BaseCallback<Snackbar>() {
+ @Override
+ public void onDismissed(Snackbar snackbar, int i) {
+ super.onDismissed(snackbar, i);
+ clear(snackbar.getContext());
+ }
+ });
+ activeSnackbar.show();
Logger.get(activity)
.logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE);
PreferenceManager.getDefaultSharedPreferences(activity)