Remove mIsHalfWidth field from ContextualCard

mIsHalfWidth in ContextualCard is too generic to identify its
responsibility, it is used to hold the value of is_support_half from
database and used to decide the card width. Also, it limits the
relationship of CardType-to-Renderer not to be extended to one-to-many.

To deal with this, we replaced mIsHalfWidth with mViewType to implement
one-to-many relationship of CardType-to-Renderer, and removed all
related logic of mIsHalfWidth.

Bug: 121303357
Test: robotests, visual

Change-Id: I03e14392272194424f317d11bf9d0d794a6133f4
This commit is contained in:
Mill Chen
2019-01-09 18:54:31 +08:00
parent 46285fe08f
commit 1c3ed19a09
34 changed files with 187 additions and 228 deletions

View File

@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.provider.Settings;
import android.service.notification.ZenModeConfig;
import androidx.annotation.VisibleForTesting;
@@ -100,7 +99,7 @@ public class DndConditionCardController implements ConditionalCardController {
.setTitleText(mAppContext.getText(R.string.condition_zen_title).toString())
.setSummaryText(mAppContext.getText(R.string.condition_zen_summary).toString())
.setIconDrawable(mAppContext.getDrawable(R.drawable.ic_do_not_disturb_on_24dp))
.setIsHalfWidth(true)
.setViewType(ConditionContextualCardRenderer.VIEW_TYPE_HALF_WIDTH)
.build();
}