Merge "Fix resource problem in PrivateVolumeForgetTest" into sc-dev

This commit is contained in:
Arc Wang
2021-03-25 09:17:59 +00:00
committed by Android (Google) Code Review

View File

@@ -63,7 +63,8 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
int defStyleRes) { int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
LayoutInflater.from(context).inflate(R.layout.main_switch_bar, this); LayoutInflater.from(context).inflate(resourceId(context, "layout", "main_switch_bar"),
this);
setFocusable(true); setFocusable(true);
setClickable(true); setClickable(true);
@@ -255,4 +256,8 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
requestLayout(); requestLayout();
} }
private int resourceId(Context context, String type, String name) {
return context.getResources().getIdentifier(name, type, context.getPackageName());
}
} }