Skip to content

Commit

Permalink
Additional cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Feb 27, 2024
1 parent a76cd0a commit 4a034c4
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 50 deletions.
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ afterEvaluate {
description = 'Material Components for Android is a static library ' +
'that you can add to your Android application in order to use ' +
'APIs that provide implementations of the Material Design specification. ' +
'Compatible on devices running API 14 or later.'
'Compatible on devices running API 19 or later.'
url = 'https://github.com/material-components/material-components-android'
inceptionYear = '2015'
licenses {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public interface Delegate {
public static final int BITMAP_SHADER = 0;
/**
* Specify that this view should use {@link Canvas#clipPath(Path)} to create the circular reveal
* effect. clipPath() is only hardware accelerated on {@link VERSION_CODES#JELLY_BEAN_MR2} and
* above.
* effect.
*/
public static final int CLIP_PATH = 1;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public ColorStateList getRippleColorStateList() {
/**
* Sets the ripple color for this button.
*
* <p>When running on devices with KitKat or below, we draw this color as a filled circle rather
* <p>When running on devices with KitKat, we draw this color as a filled circle rather
* than a ripple.
*
* @param color ARGB color to use for the ripple
Expand All @@ -337,7 +337,7 @@ public void setRippleColor(@ColorInt int color) {
/**
* Sets the ripple color for this button.
*
* <p>When running on devices with KitKat or below, we draw this color as a filled circle rather
* <p>When running on devices with KitKat, we draw this color as a filled circle rather
* than a ripple.
*
* @param color color state list to use for the ripple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import android.animation.TimeInterpolator;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
Expand Down Expand Up @@ -128,8 +127,6 @@ public final class CollapsingTextHelper {
private boolean isRtl;
private boolean isRtlTextDirectionHeuristicsEnabled = true;

@Nullable private Bitmap expandedTitleTexture;

private float scale;
private float currentTextSize;
private float currentShadowRadius;
Expand Down Expand Up @@ -803,8 +800,6 @@ private void calculateBaseOffsets(boolean forceRecalculate) {
break;
}

// The bounds have changed so we need to clear the texture
clearTexture();
// Now reset the text size back to the original
setInterpolatedTextSize(expandedFraction);
}
Expand Down Expand Up @@ -1126,7 +1121,6 @@ public void setText(@Nullable CharSequence text) {
if (text == null || !TextUtils.equals(this.text, text)) {
this.text = text;
textToDraw = null;
clearTexture();
recalculate();
}
}
Expand All @@ -1136,17 +1130,9 @@ public CharSequence getText() {
return text;
}

private void clearTexture() {
if (expandedTitleTexture != null) {
expandedTitleTexture.recycle();
expandedTitleTexture = null;
}
}

public void setMaxLines(int maxLines) {
if (maxLines != this.maxLines) {
this.maxLines = maxLines;
clearTexture();
recalculate();
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/java/com/google/android/material/tabs/TabLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ public ColorStateList getTabRippleColor() {
/**
* Sets the ripple color for this TabLayout.
*
* <p>When running on devices with KitKat or below, we draw this color as a filled overlay rather
* <p>When running on devices with KitKat, we draw this color as a filled overlay rather
* than a ripple.
*
* @param color color (or ColorStateList) to use for the ripple
Expand All @@ -1464,7 +1464,7 @@ public void setTabRippleColor(@Nullable ColorStateList color) {
/**
* Sets the ripple color resource for this TabLayout.
*
* <p>When running on devices with KitKat or below, we draw this color as a filled overlay rather
* <p>When running on devices with KitKat, we draw this color as a filled overlay rather
* than a ripple.
*
* @param tabRippleColorResourceId A color resource to use as ripple color.
Expand Down
2 changes: 1 addition & 1 deletion tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
defaultConfig {
testApplicationId "com.google.android.material.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 33
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
defaultConfig {
testApplicationId "com.google.android.material.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 33
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import android.os.Build;
import android.widget.ImageView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.testapp.R;
Expand All @@ -38,8 +36,6 @@
@SuppressWarnings("unchecked")
public class AppBarWithCollapsingToolbarTest extends AppBarLayoutBaseTest {
@Test
// Suppressed due to high % flakiness on API 15
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN)
public void testPinnedToolbar() throws Throwable {
configureContent(
R.layout.design_appbar_toolbar_collapse_pin, R.string.design_appbar_collapsing_toolbar_pin);
Expand Down Expand Up @@ -161,8 +157,6 @@ public void testPinnedToolbar() throws Throwable {
}

@Test
// Suppressed due to high % flakiness on API 15
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN)
public void testScrollingToolbar() throws Throwable {
configureContent(
R.layout.design_appbar_toolbar_collapse_scroll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,6 @@ public void testActionLayout() {

@Test
public void testAccessibility() throws Throwable {
if (VERSION.SDK_INT < KITKAT) {
// CollectionInfo and CollectionItemInfo only available on API 19+.
return;
}

// Open our drawer
onView(withId(R.id.drawer_layout)).perform(openDrawer(GravityCompat.START));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ public void setScrollPositionLtr() throws Throwable {
testSetScrollPosition(true);
}

@SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN_MR1)
@Test
public void setScrollPositionRtl() throws Throwable {
testSetScrollPosition(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
Expand All @@ -30,19 +29,15 @@
import static com.google.android.material.testutils.ViewPagerActions.setAdapter;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;

import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.util.Pair;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.TextView;
import androidx.annotation.DimenRes;
Expand Down Expand Up @@ -645,12 +640,6 @@ private void verifyMinMaxTabWidth(
isDescendantOfA(withId(R.id.tabs)),
not(withParent(isAssignableFrom(HorizontalScrollView.class))),
hasDescendant(withText(tabTitle)));
if (VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR2) {
// Additional criteria is needed for Pre API-18 devices because an extra container
// FrameLayout was added for badging support.
tabMatcher = allOf(tabMatcher, not(withClassName(is(FrameLayout.class.getName()))));
}

if (minTabWidth >= 0) {
onView(tabMatcher).check(matches(TestUtilsMatchers.isNotNarrowerThan(minTabWidth)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* Custom drawable class that provides a reliable way for testing various tinting scenarios across a
* range of platform versions. ColorDrawable doesn't support tinting on Kitkat and below, and
* range of platform versions. ColorDrawable doesn't support tinting on Kitkat, and
* BitmapDrawable (PNG sources) appears to slightly alter green and blue channels by a few units on
* some of the older platform versions (Gingerbread). Using GradientDrawable allows doing reliable
* tests at the level of individual channels (alpha / red / green / blue) for tinted and untinted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import androidx.test.filters.MediumTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.material.testapp.R;
Expand All @@ -39,7 +38,6 @@
import org.junit.runner.RunWith;

@MediumTest
@SdkSuppress(minSdkVersion = 17) // Needed for Configuration#setLocale
@RunWith(AndroidJUnit4.class)
public class TextInputLayoutPseudoLocaleTest {
@Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
multiDexEnabled true
testApplicationId "com.google.android.material.tests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 33
}

Expand Down

0 comments on commit 4a034c4

Please sign in to comment.