Search in sources :

Example 1 with BaseCallback

use of android.support.design.widget.BaseTransientBottomBar.BaseCallback in project android_packages_apps_Dialer by LineageOS.

the class PostCall method promptUserToViewSentMessage.

private static void promptUserToViewSentMessage(Activity activity, View rootView) {
    LogUtil.i("PostCall.promptUserToViewSentMessage", "returned from sending a post call message, message sent.");
    String message = activity.getString(R.string.post_call_message_sent);
    String addMessage = activity.getString(R.string.view);
    String number = Assert.isNotNull(getPhoneNumber(activity));
    OnClickListener onClickListener = v -> {
        Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE_CLICKED);
        Intent intent = IntentUtil.getSendSmsIntent(number);
        DialerUtils.startActivityWithErrorToast(activity, intent);
    };
    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);
    DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity).edit().remove(KEY_POST_CALL_MESSAGE_SENT).apply();
}
Also used : Assert(com.android.dialer.common.Assert) Context(android.content.Context) LogUtil(com.android.dialer.common.LogUtil) DialerImpression(com.android.dialer.logging.DialerImpression) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) Intent(android.content.Intent) ConfigProvider(com.android.dialer.configprovider.ConfigProvider) EnrichedCallComponent(com.android.dialer.enrichedcall.EnrichedCallComponent) PerformanceReport(com.android.dialer.performancereport.PerformanceReport) SharedPreferences(android.content.SharedPreferences) TelephonyManager(android.telephony.TelephonyManager) View(android.view.View) ConfigProviderBindings(com.android.dialer.configprovider.ConfigProviderBindings) Logger(com.android.dialer.logging.Logger) IntentUtil(com.android.dialer.util.IntentUtil) DialerUtils(com.android.dialer.util.DialerUtils) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) Activity(android.app.Activity) EnrichedCallCapabilities(com.android.dialer.enrichedcall.EnrichedCallCapabilities) BaseCallback(android.support.design.widget.BaseTransientBottomBar.BaseCallback) OnClickListener(android.view.View.OnClickListener) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) BaseCallback(android.support.design.widget.BaseTransientBottomBar.BaseCallback) Snackbar(android.support.design.widget.Snackbar)

Aggregations

Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Nullable (android.support.annotation.Nullable)1 BaseCallback (android.support.design.widget.BaseTransientBottomBar.BaseCallback)1 Snackbar (android.support.design.widget.Snackbar)1 TelephonyManager (android.telephony.TelephonyManager)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 Assert (com.android.dialer.common.Assert)1 LogUtil (com.android.dialer.common.LogUtil)1 ConfigProvider (com.android.dialer.configprovider.ConfigProvider)1 ConfigProviderBindings (com.android.dialer.configprovider.ConfigProviderBindings)1 EnrichedCallCapabilities (com.android.dialer.enrichedcall.EnrichedCallCapabilities)1 EnrichedCallComponent (com.android.dialer.enrichedcall.EnrichedCallComponent)1 EnrichedCallManager (com.android.dialer.enrichedcall.EnrichedCallManager)1 DialerImpression (com.android.dialer.logging.DialerImpression)1 Logger (com.android.dialer.logging.Logger)1 PerformanceReport (com.android.dialer.performancereport.PerformanceReport)1