mirror of
https://github.com/material-components/material-components-android.git
synced 2026-01-20 03:51:33 +08:00
Bazel is happier if Java/Java test roots are named 'java' and 'javatests', and
this will mean that once we create a BUILD file for
android/support/design/{widget,internal}/ we'll no longer need a custom package
specified in our build (which tends to cause build problems that manifest quite
weirdly). This commit doesn't attempt to refactor the build at all yet, and is
just a pure move.
PiperOrigin-RevId: 178060739
112 lines
2.8 KiB
Java
112 lines
2.8 KiB
Java
/*
|
|
* Copyright 2017 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package android.support.design.circularreveal;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.support.annotation.ColorInt;
|
|
import android.support.annotation.Nullable;
|
|
import android.util.AttributeSet;
|
|
import android.widget.FrameLayout;
|
|
|
|
/** A CircularRevealWidget wrapper for {@link FrameLayout}. */
|
|
public class CircularRevealFrameLayout extends FrameLayout implements CircularRevealWidget {
|
|
|
|
private final CircularRevealHelper helper;
|
|
|
|
public CircularRevealFrameLayout(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public CircularRevealFrameLayout(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
helper = new CircularRevealHelper(this);
|
|
}
|
|
|
|
@Override
|
|
public void buildCircularRevealCache() {
|
|
helper.buildCircularRevealCache();
|
|
}
|
|
|
|
@Override
|
|
public void destroyCircularRevealCache() {
|
|
helper.destroyCircularRevealCache();
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public RevealInfo getRevealInfo() {
|
|
return helper.getRevealInfo();
|
|
}
|
|
|
|
@Override
|
|
public void setRevealInfo(@Nullable RevealInfo revealInfo) {
|
|
helper.setRevealInfo(revealInfo);
|
|
}
|
|
|
|
@Override
|
|
public int getCircularRevealScrimColor() {
|
|
return helper.getCircularRevealScrimColor();
|
|
}
|
|
|
|
@Override
|
|
public void setCircularRevealScrimColor(@ColorInt int color) {
|
|
helper.setCircularRevealScrimColor(color);
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public Drawable getCircularRevealOverlayDrawable() {
|
|
return helper.getCircularRevealOverlayDrawable();
|
|
}
|
|
|
|
@Override
|
|
public void setCircularRevealOverlayDrawable(@Nullable Drawable drawable) {
|
|
helper.setCircularRevealOverlayDrawable(drawable);
|
|
}
|
|
|
|
@SuppressLint("MissingSuperCall")
|
|
@Override
|
|
public void draw(Canvas canvas) {
|
|
if (helper != null) {
|
|
helper.draw(canvas);
|
|
} else {
|
|
super.draw(canvas);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void actualDraw(Canvas canvas) {
|
|
super.draw(canvas);
|
|
}
|
|
|
|
@Override
|
|
public boolean isOpaque() {
|
|
if (helper != null) {
|
|
return helper.isOpaque();
|
|
} else {
|
|
return super.isOpaque();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean actualIsOpaque() {
|
|
return super.isOpaque();
|
|
}
|
|
}
|