import com.android.camera.CaptureLayoutHelper;
import com.android.camera.ShutterButton;
import com.android.camera.debug.Log;
+import com.android.camera.util.ApiHelper;
import com.android.camera.util.CameraUtil;
import com.android.camera2.R;
private final float mCircleRadius;
private CaptureLayoutHelper mCaptureLayoutHelper = null;
- private final boolean mIsOsVersionL;
// for Android L, these backgrounds are RippleDrawables (ISA LayerDrawable)
// pre-L, they're plain old LayerDrawables
private final LayerDrawable[] mShutterButtonBackgrounds;
mBackgroundAlphaDefault = getResources()
.getInteger(R.integer.bottom_bar_background_alpha);
- mIsOsVersionL = context.getResources().getBoolean(R.bool.is_os_version_l);
-
// preload all the drawable BGs
TypedArray ar = context.getResources()
.obtainTypedArray(R.array.shutter_button_backgrounds);
if (mAnimatedCircleDrawable != null) {
mAnimatedCircleDrawable.setColor(color);
mAnimatedCircleDrawable.setAlpha(alpha);
- invalidateDrawable(mAnimatedCircleDrawable);
- invalidate();
} else if (mColorDrawable != null) {
mColorDrawable.setColor(color);
mColorDrawable.setAlpha(alpha);
- invalidateDrawable(mColorDrawable);
- invalidate();
}
if (mIntentReviewLayout != null) {
private void setCancelBackgroundColor(int alpha, int color) {
LayerDrawable layerDrawable = (LayerDrawable) mCancelButton.getBackground();
ColorDrawable colorDrawable = (ColorDrawable) layerDrawable.getDrawable(0);
- if (!mIsOsVersionL) {
+ if (!ApiHelper.isLOrHigher()) {
colorDrawable.setColor(color);
}
colorDrawable.setAlpha(alpha);
}
private void setCaptureButtonDown() {
- if (!mIsOsVersionL) {
+ if (!ApiHelper.isLOrHigher()) {
setPaintColor(mBackgroundAlpha, mBackgroundPressedColor);
}
}
}
private void setBackgroundPressedColor(int color) {
- if (mIsOsVersionL) {
+ if (ApiHelper.isLOrHigher()) {
// not supported (setting a color on a RippleDrawable is hard =[ )
} else {
mBackgroundPressedColor = color;