OSDN Git Service

Show a static title/summary if country doesn't have support
authorFan Zhang <zhfan@google.com>
Mon, 27 Jun 2016 22:55:34 +0000 (15:55 -0700)
committerFan Zhang <zhfan@google.com>
Tue, 28 Jun 2016 00:38:03 +0000 (17:38 -0700)
Bug: 29105266
Change-Id: I874fbb1172ab2faf9372362cf0e1f933046c621c

res/values/strings.xml
src/com/android/settings/dashboard/SupportItemAdapter.java

index 017b33f..4690f88 100644 (file)
     <!-- Title text for connecting to 24/7 available customer support [CHAR LIMIT=80]-->
     <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">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</string>
 
     <!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]-->
     <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>
 
+    <!-- Summary text when customer support is unavailble in the region. [CHAR LIMIT=NONE]-->
+    <string name="support_escalation_unavailable_summary">Search help or explore tips &amp; tricks</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;
index 9d12ec0..cba956e 100644 (file)
@@ -169,32 +169,45 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
     }
 
     private void addEscalationCards() {
-        if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */)
+        final boolean hasPhoneOperation =
+                mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE);
+        final boolean hasChatOperation =
+                mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT);
+        if (!hasPhoneOperation && !hasChatOperation) {
+            // No support at all.
+            mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
+                    .setText1(R.string.support_escalation_title)
+                    .setText2(mActivity.getString(R.string.support_escalation_unavailable_summary))
+                    .build());
+        } else if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */)
                 || mSupportFeatureProvider.isAlwaysOperating(CHAT, null /* countryCode */)) {
+            // Support is available.
             mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                     .setText1(R.string.support_escalation_24_7_title)
                     .setText2(mActivity.getString(R.string.support_escalation_24_7_summary))
                     .build());
         } else if (mSupportFeatureProvider.isOperatingNow(PHONE)
                 || mSupportFeatureProvider.isOperatingNow(CHAT)) {
+            // Support is available now.
             mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
                     .setText1(R.string.support_escalation_title)
                     .setText2(R.string.support_escalation_summary)
                     .build());
         } else {
+            // Support is not temporarily unavailable.
             mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
-                    .setText1(R.string.support_escalation_closed_title)
+                    .setText1(R.string.support_escalation_title)
                     .setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null))
                     .build());
         }
         final SupportData.Builder builder =
                 new SupportData.Builder(mActivity, TYPE_ESCALATION_OPTIONS);
-        if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) {
+        if (hasPhoneOperation) {
             builder.setText1(R.string.support_escalation_by_phone);
             builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
             builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
         }
-        if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT)) {
+        if (hasChatOperation) {
             builder.setText2(R.string.support_escalation_by_chat);
             builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
             builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));