Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3a0a18f authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Display operation hours when support is closed." into nyc-mr1-dev

parents 2373aaaf 0bc42ab6
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -7506,16 +7506,21 @@
    <string name="support_escalation_24_7_title">We\'re here for you 24/7</string>
    <!-- Title text when customer support is closed [CHAR LIMIT=80]-->
    <string name="support_escalation_closed_title">Live support closed</string>
    <string name="support_escalation_closed_title">Support closed</string>
    <!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
    <string name="support_escalation_summary">Our support team is here to address any issues as soon as we can.</string>
    <string name="support_escalation_summary">Our support team is here to address any issues</string>
    <!-- Summary text for connecting to 24/7 customer support [CHAR LIMIT=NONE]-->
    <string name="support_escalation_24_7_summary">Our support team is here all day, every day.</string>
    <string name="support_escalation_24_7_summary">Our support team is here all day, every day</string>
    <!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]-->
    <string name="support_escalation_closed_summary">Come back again during support hours.</string>
    <string name="support_escalation_closed_summary">Call us during support hours (local time)&lt;br&gt;&lt;b&gt;<xliff:g id="operation_hours">%s</xliff:g>&lt;/b&gt;</string>
    <!-- Template for formatting support hours eg Mon - Fri, 8:00 AM - 19:30 PM. [CHAR LIMIT=NONE]-->
    <string name="support_hour_format" translatable="false">
        <xliff:g id="start_day">%s</xliff:g> - <xliff:g id="end_day">%s</xliff:g>, <xliff:g id="start_time">%s</xliff:g> - <xliff:g id="end_time">%s</xliff:g>&lt;br&gt;
    </string>
    <!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]-->
    <string name="support_offline_title">You\'re offline</string>
@@ -7524,13 +7529,10 @@
    <string name="support_offline_summary">To reach support, first connect to Wi-Fi or data.</string>
    <!-- Button label for contacting customer support by phone [CHAR LIMIT=20]-->
    <string name="support_escalation_by_phone">Support call</string>
    <!-- Button label for contacting customer support by email [CHAR LIMIT=20]-->
    <string name="support_escalation_by_email">Support email</string>
    <string name="support_escalation_by_phone">Phone</string>
    <!-- Button label for contacting customer support by chat [CHAR LIMIT=20]-->
    <string name="support_escalation_by_chat">Support chat</string>
    <string name="support_escalation_by_chat">Chat</string>
    <!-- Button label for visiting the tips & tricks site [CHAR LIMIT=60]-->
    <string name="support_tips_and_tricks_title">Tips &amp; tricks</string>
+37 −28
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@ import android.annotation.LayoutRes;
import android.annotation.StringRes;
import android.app.Activity;
import android.app.DialogFragment;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -154,29 +156,30 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
        if (mHasInternet) {
            if (mSupportFeatureProvider.isAlwaysOperating(PHONE)
                    || mSupportFeatureProvider.isAlwaysOperating(CHAT)) {
                mSupportData.add(new SupportData.Builder(TYPE_TITLE)
                mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                        .setText1(R.string.support_escalation_24_7_title)
                        .setText2(R.string.support_escalation_24_7_summary)
                        .setText2(mActivity.getString(R.string.support_escalation_24_7_summary))
                        .build());
            } else if (mSupportFeatureProvider.isOperatingNow(PHONE)
                    || mSupportFeatureProvider.isOperatingNow(CHAT)) {
                mSupportData.add(new SupportData.Builder(TYPE_TITLE)
                mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                        .setText1(R.string.support_escalation_title)
                        .setText2(R.string.support_escalation_summary)
                        .build());
            } else {
                mSupportData.add(new SupportData.Builder(TYPE_TITLE)
                mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                        .setText1(R.string.support_escalation_closed_title)
                        .setText2(R.string.support_escalation_closed_summary)
                        .setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE))
                        .build());
            }
        } else {
            mSupportData.add(new SupportData.Builder(TYPE_TITLE)
            mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                    .setText1(R.string.support_offline_title)
                    .setText2(R.string.support_offline_summary)
                    .build());
        }
        final SupportData.Builder builder = new SupportData.Builder(TYPE_ESCALATION_OPTIONS);
        final SupportData.Builder builder =
                new SupportData.Builder(mActivity, TYPE_ESCALATION_OPTIONS);
        if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) {
            builder.setText1(R.string.support_escalation_by_phone);
            builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
@@ -191,24 +194,24 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
    }

    private void addSignInPromo() {
        mSupportData.add(new SupportData.Builder(TYPE_TITLE)
        mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                .setText1(R.string.support_sign_in_required_title)
                .setText2(R.string.support_sign_in_required_summary)
                .build());
        mSupportData.add(new SupportData.Builder(TYPE_SIGN_IN_BUTTON)
        mSupportData.add(new SupportData.Builder(mActivity, TYPE_SIGN_IN_BUTTON)
                .setText1(R.string.support_sign_in_button_text)
                .setText2(R.string.support_sign_in_required_help)
                .build());
    }

    private void addMoreHelpItems() {
        mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
        mSupportData.add(new SupportData.Builder(mActivity, TYPE_SUPPORT_TILE)
                .setIcon(R.drawable.ic_lightbulb_outline_24)
                .setText1(R.string.support_tips_and_tricks_title)
                .setIntent(mSupportFeatureProvider.getTipsAndTricksIntent(mActivity))
                .setMetricsEvent(MetricsProto.MetricsEvent.ACTION_SUPPORT_TIPS_AND_TRICKS)
                .build());
        mSupportData.add(new SupportData.Builder(TYPE_SUPPORT_TILE)
        mSupportData.add(new SupportData.Builder(mActivity, TYPE_SUPPORT_TILE)
                .setIcon(R.drawable.ic_help_24dp)
                .setText1(R.string.help_feedback_label)
                .setIntent(mSupportFeatureProvider.getHelpIntent(mActivity))
@@ -225,7 +228,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
            holder.text1View.setEnabled(data.enabled1 && mHasInternet);
            holder.text1View.setVisibility(View.VISIBLE);
        }
        if (data.text2 == 0) {
        if (TextUtils.isEmpty(data.text2)) {
            holder.text2View.setVisibility(View.GONE);
        } else {
            holder.text2View.setText(data.text2);
@@ -347,12 +350,11 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
        final int icon;
        @StringRes
        final int text1;
        @StringRes
        final int text2;
        final CharSequence text2;
        final boolean enabled1;
        final boolean enabled2;
        final String summary1;
        final String summary2;
        final CharSequence summary1;
        final CharSequence summary2;

        private SupportData(Builder builder) {
            this.type = builder.mType;
@@ -368,6 +370,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
        }

        static final class Builder {

            private final Context mContext;
            @LayoutRes
            private final int mType;
            @DrawableRes
@@ -376,14 +380,14 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
            private boolean mEnabled2;
            @StringRes
            private int mText1;
            @StringRes
            private int mText2;
            private String mSummary1;
            private String mSummary2;
            private CharSequence mText2;
            private CharSequence mSummary1;
            private CharSequence mSummary2;
            private Intent mIntent;
            private int mMetricsEvent = -1;

            Builder(@LayoutRes int type) {
            Builder(Context context, @LayoutRes int type) {
                mContext = context;
                mType = type;
            }

@@ -402,6 +406,16 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
                return this;
            }

            Builder setText2(@StringRes int text2) {
                mText2 = mContext.getString(text2);
                return this;
            }

            Builder setText2(CharSequence text2) {
                mText2 = text2;
                return this;
            }

            Builder setSummary1(String summary1) {
                mSummary1 = summary1;
                return this;
@@ -412,11 +426,6 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
                return this;
            }

            Builder setText2(@StringRes int text2) {
                mText2 = text2;
                return this;
            }

            Builder setSummary2(String summary2) {
                mSummary2 = summary2;
                return this;
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ public interface SupportFeatureProvider {
     */
    boolean isOperatingNow(@SupportType int type);

    /**
     * Returns localized string for operation hours.
     */
    CharSequence getOperationHours(Context context, @SupportType int type);

    /**
     * Returns a localized string indicating estimated wait time for a support time.
     */