ADD week 5
This commit is contained in:
		| @@ -0,0 +1,43 @@ | ||||
| package com.google.android.material.theme; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.util.AttributeSet; | ||||
| import androidx.appcompat.app.AppCompatViewInflater; | ||||
| import androidx.appcompat.widget.AppCompatAutoCompleteTextView; | ||||
| import androidx.appcompat.widget.AppCompatButton; | ||||
| import androidx.appcompat.widget.AppCompatCheckBox; | ||||
| import androidx.appcompat.widget.AppCompatRadioButton; | ||||
| import androidx.appcompat.widget.AppCompatTextView; | ||||
| import com.google.android.material.button.MaterialButton; | ||||
| import com.google.android.material.checkbox.MaterialCheckBox; | ||||
| import com.google.android.material.radiobutton.MaterialRadioButton; | ||||
| import com.google.android.material.textfield.MaterialAutoCompleteTextView; | ||||
| import com.google.android.material.textview.MaterialTextView; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class MaterialComponentsViewInflater extends AppCompatViewInflater { | ||||
|     @Override // androidx.appcompat.app.AppCompatViewInflater | ||||
|     protected AppCompatButton createButton(Context context, AttributeSet attributeSet) { | ||||
|         return new MaterialButton(context, attributeSet); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.app.AppCompatViewInflater | ||||
|     protected AppCompatCheckBox createCheckBox(Context context, AttributeSet attributeSet) { | ||||
|         return new MaterialCheckBox(context, attributeSet); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.app.AppCompatViewInflater | ||||
|     protected AppCompatRadioButton createRadioButton(Context context, AttributeSet attributeSet) { | ||||
|         return new MaterialRadioButton(context, attributeSet); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.app.AppCompatViewInflater | ||||
|     protected AppCompatTextView createTextView(Context context, AttributeSet attributeSet) { | ||||
|         return new MaterialTextView(context, attributeSet); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.app.AppCompatViewInflater | ||||
|     protected AppCompatAutoCompleteTextView createAutoCompleteTextView(Context context, AttributeSet attributeSet) { | ||||
|         return new MaterialAutoCompleteTextView(context, attributeSet); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,45 @@ | ||||
| package com.google.android.material.theme.overlay; | ||||
|  | ||||
| import android.R; | ||||
| import android.content.Context; | ||||
| import android.content.res.TypedArray; | ||||
| import android.util.AttributeSet; | ||||
| import androidx.appcompat.view.ContextThemeWrapper; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class MaterialThemeOverlay { | ||||
|     private static final int[] ANDROID_THEME_OVERLAY_ATTRS = {R.attr.theme, com.google.android.material.R.attr.theme}; | ||||
|     private static final int[] MATERIAL_THEME_OVERLAY_ATTR = {com.google.android.material.R.attr.materialThemeOverlay}; | ||||
|  | ||||
|     private MaterialThemeOverlay() { | ||||
|     } | ||||
|  | ||||
|     public static Context wrap(Context context, AttributeSet attributeSet, int i, int i2) { | ||||
|         int obtainMaterialThemeOverlayId = obtainMaterialThemeOverlayId(context, attributeSet, i, i2); | ||||
|         boolean z = (context instanceof ContextThemeWrapper) && ((ContextThemeWrapper) context).getThemeResId() == obtainMaterialThemeOverlayId; | ||||
|         if (obtainMaterialThemeOverlayId == 0 || z) { | ||||
|             return context; | ||||
|         } | ||||
|         ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, obtainMaterialThemeOverlayId); | ||||
|         int obtainAndroidThemeOverlayId = obtainAndroidThemeOverlayId(context, attributeSet); | ||||
|         if (obtainAndroidThemeOverlayId != 0) { | ||||
|             contextThemeWrapper.getTheme().applyStyle(obtainAndroidThemeOverlayId, true); | ||||
|         } | ||||
|         return contextThemeWrapper; | ||||
|     } | ||||
|  | ||||
|     private static int obtainAndroidThemeOverlayId(Context context, AttributeSet attributeSet) { | ||||
|         TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ANDROID_THEME_OVERLAY_ATTRS); | ||||
|         int resourceId = obtainStyledAttributes.getResourceId(0, 0); | ||||
|         int resourceId2 = obtainStyledAttributes.getResourceId(1, 0); | ||||
|         obtainStyledAttributes.recycle(); | ||||
|         return resourceId != 0 ? resourceId : resourceId2; | ||||
|     } | ||||
|  | ||||
|     private static int obtainMaterialThemeOverlayId(Context context, AttributeSet attributeSet, int i, int i2) { | ||||
|         TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, MATERIAL_THEME_OVERLAY_ATTR, i, i2); | ||||
|         int resourceId = obtainStyledAttributes.getResourceId(0, 0); | ||||
|         obtainStyledAttributes.recycle(); | ||||
|         return resourceId; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user