Enable/disable support buttons based on operation hours.
Also update support title based on whether support operation is available. Bug: 28827790 Change-Id: I65eb70d18ba16ccc263bce019fcbbe5e10ffa596
This commit is contained in:
@@ -7505,10 +7505,22 @@
|
|||||||
<string name="deletion_helper_free_button">Free up <xliff:g id="freeable" example="1.2GB">%1$s</xliff:g></string>
|
<string name="deletion_helper_free_button">Free up <xliff:g id="freeable" example="1.2GB">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- Title text for connecting to customer support [CHAR LIMIT=80]-->
|
<!-- Title text for connecting to customer support [CHAR LIMIT=80]-->
|
||||||
<string name="support_escalation_title">Around-the-clock support</string>
|
<string name="support_escalation_title">We\'re here to help</string>
|
||||||
|
|
||||||
|
<!-- 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">Live support closed</string>
|
||||||
|
|
||||||
<!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
|
<!-- Summary text for connecting to customer support [CHAR LIMIT=NONE]-->
|
||||||
<string name="support_escalation_summary">You can request a support call or chat and we\'ll get back to you with a quickness</string>
|
<string name="support_escalation_summary">Our support team is here to address any issues as soon as we can.</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>
|
||||||
|
|
||||||
|
<!-- Summary text when customer support is closed. [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="support_escalation_closed_summary">Come back again during support hours.</string>
|
||||||
|
|
||||||
<!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]-->
|
<!-- Title text that indicates there is not internet connection. [CHAR LIMIT=80]-->
|
||||||
<string name="support_offline_title">You\'re offline</string>
|
<string name="support_offline_title">You\'re offline</string>
|
||||||
|
@@ -147,10 +147,24 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
|
|
||||||
private void addEscalationCards() {
|
private void addEscalationCards() {
|
||||||
if (mHasInternet) {
|
if (mHasInternet) {
|
||||||
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
if (mSupportFeatureProvider.isAlwaysOperating(PHONE)
|
||||||
.setText1(R.string.support_escalation_title)
|
|| mSupportFeatureProvider.isAlwaysOperating(CHAT)) {
|
||||||
.setText2(R.string.support_escalation_summary)
|
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
||||||
.build());
|
.setText1(R.string.support_escalation_24_7_title)
|
||||||
|
.setText2(R.string.support_escalation_24_7_summary)
|
||||||
|
.build());
|
||||||
|
} else if (mSupportFeatureProvider.isOperatingNow(PHONE)
|
||||||
|
|| mSupportFeatureProvider.isOperatingNow(CHAT)) {
|
||||||
|
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
||||||
|
.setText1(R.string.support_escalation_title)
|
||||||
|
.setText2(R.string.support_escalation_summary)
|
||||||
|
.build());
|
||||||
|
} else {
|
||||||
|
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
||||||
|
.setText1(R.string.support_escalation_closed_title)
|
||||||
|
.setText2(R.string.support_escalation_closed_summary)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
mSupportData.add(new SupportData.Builder(TYPE_TITLE)
|
||||||
.setText1(R.string.support_offline_title)
|
.setText1(R.string.support_offline_title)
|
||||||
@@ -161,10 +175,12 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) {
|
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE)) {
|
||||||
builder.setText1(R.string.support_escalation_by_phone);
|
builder.setText1(R.string.support_escalation_by_phone);
|
||||||
builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
|
builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
|
||||||
|
builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
|
||||||
}
|
}
|
||||||
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT)) {
|
if (mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT)) {
|
||||||
builder.setText2(R.string.support_escalation_by_chat);
|
builder.setText2(R.string.support_escalation_by_chat);
|
||||||
builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
|
builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
|
||||||
|
builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));
|
||||||
}
|
}
|
||||||
mSupportData.add(builder.build());
|
mSupportData.add(builder.build());
|
||||||
}
|
}
|
||||||
@@ -199,7 +215,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
} else {
|
} else {
|
||||||
holder.text1View.setText(data.text1);
|
holder.text1View.setText(data.text1);
|
||||||
holder.text1View.setOnClickListener(mEscalationClickListener);
|
holder.text1View.setOnClickListener(mEscalationClickListener);
|
||||||
holder.text1View.setEnabled(mHasInternet);
|
holder.text1View.setEnabled(data.enabled1 && mHasInternet);
|
||||||
holder.text1View.setVisibility(View.VISIBLE);
|
holder.text1View.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (data.text2 == 0) {
|
if (data.text2 == 0) {
|
||||||
@@ -207,7 +223,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
} else {
|
} else {
|
||||||
holder.text2View.setText(data.text2);
|
holder.text2View.setText(data.text2);
|
||||||
holder.text2View.setOnClickListener(mEscalationClickListener);
|
holder.text2View.setOnClickListener(mEscalationClickListener);
|
||||||
holder.text2View.setEnabled(mHasInternet);
|
holder.text2View.setEnabled(data.enabled2 && mHasInternet);
|
||||||
holder.text2View.setVisibility(View.VISIBLE);
|
holder.text2View.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (holder.summary1View != null) {
|
if (holder.summary1View != null) {
|
||||||
@@ -319,6 +335,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
final int text1;
|
final int text1;
|
||||||
@StringRes
|
@StringRes
|
||||||
final int text2;
|
final int text2;
|
||||||
|
final boolean enabled1;
|
||||||
|
final boolean enabled2;
|
||||||
final String summary1;
|
final String summary1;
|
||||||
final String summary2;
|
final String summary2;
|
||||||
|
|
||||||
@@ -329,6 +347,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
this.text2 = builder.mText2;
|
this.text2 = builder.mText2;
|
||||||
this.summary1 = builder.mSummary1;
|
this.summary1 = builder.mSummary1;
|
||||||
this.summary2 = builder.mSummary2;
|
this.summary2 = builder.mSummary2;
|
||||||
|
this.enabled1 = builder.mEnabled1;
|
||||||
|
this.enabled2 = builder.mEnabled2;
|
||||||
this.intent = builder.mIntent;
|
this.intent = builder.mIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +357,8 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
private final int mType;
|
private final int mType;
|
||||||
@DrawableRes
|
@DrawableRes
|
||||||
private int mIcon;
|
private int mIcon;
|
||||||
|
private boolean mEnabled1;
|
||||||
|
private boolean mEnabled2;
|
||||||
@StringRes
|
@StringRes
|
||||||
private int mText1;
|
private int mText1;
|
||||||
@StringRes
|
@StringRes
|
||||||
@@ -354,6 +376,11 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Builder setEnabled1(boolean enabled) {
|
||||||
|
mEnabled1 = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
Builder setText1(@StringRes int text1) {
|
Builder setText1(@StringRes int text1) {
|
||||||
mText1 = text1;
|
mText1 = text1;
|
||||||
return this;
|
return this;
|
||||||
@@ -364,6 +391,11 @@ public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAd
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Builder setEnabled2(boolean enabled) {
|
||||||
|
mEnabled2 = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
Builder setText2(@StringRes int text2) {
|
Builder setText2(@StringRes int text2) {
|
||||||
mText2 = text2;
|
mText2 = text2;
|
||||||
return this;
|
return this;
|
||||||
|
@@ -48,6 +48,16 @@ public interface SupportFeatureProvider {
|
|||||||
*/
|
*/
|
||||||
boolean isSupportTypeEnabled(Context context, @SupportType int type);
|
boolean isSupportTypeEnabled(Context context, @SupportType int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not a support type is in operation 24/7.
|
||||||
|
*/
|
||||||
|
boolean isAlwaysOperating(@SupportType int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not a support type is operating now.
|
||||||
|
*/
|
||||||
|
boolean isOperatingNow(@SupportType int type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a localized string indicating estimated wait time for a support time.
|
* Returns a localized string indicating estimated wait time for a support time.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user