Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package at.technikum.mti.fancycoverflow;
/* loaded from: classes.dex */
public class AutoPlayer {
public enum PlayDirection {
to_left,
to_right
}
public enum PlayRecycleMode {
repeat_from_start,
play_back
}
public interface Playable {
}
public AutoPlayer(Playable playable) {
PlayDirection playDirection = PlayDirection.to_right;
PlayRecycleMode playRecycleMode = PlayRecycleMode.repeat_from_start;
}
public AutoPlayer a(int i) {
return this;
}
public AutoPlayer a(PlayRecycleMode playRecycleMode) {
return this;
}
public void a() {
}
public void b() {
}
}

View File

@@ -0,0 +1,261 @@
package at.technikum.mti.fancycoverflow;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Transformation;
import android.widget.Gallery;
import android.widget.SpinnerAdapter;
import at.technikum.mti.fancycoverflow.AutoPlayer;
/* loaded from: classes.dex */
public class FancyCoverFlow extends Gallery {
private float a;
private int b;
private boolean c;
private float d;
private Camera e;
private int f;
private float g;
private float h;
private int i;
private float j;
private AutoPlayer.Playable k;
private AutoPlayer l;
protected int m;
public static class LayoutParams extends Gallery.LayoutParams {
public LayoutParams(int i, int i2) {
super(i, i2);
}
}
public FancyCoverFlow(Context context) {
super(context);
this.a = 0.4f;
this.b = 20;
this.c = false;
this.f = 75;
this.h = 0.5f;
this.k = new AutoPlayer.Playable(this) { // from class: at.technikum.mti.fancycoverflow.FancyCoverFlow.1
};
this.m = 2000;
b();
}
private void a(AttributeSet attributeSet) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R$styleable.FancyCoverFlow);
this.i = obtainStyledAttributes.getInteger(R$styleable.FancyCoverFlow_actionDistance, Integer.MAX_VALUE);
this.h = obtainStyledAttributes.getFloat(R$styleable.FancyCoverFlow_scaleDownGravity, 1.0f);
this.f = obtainStyledAttributes.getInteger(R$styleable.FancyCoverFlow_maxRotation, 45);
this.d = obtainStyledAttributes.getFloat(R$styleable.FancyCoverFlow_unselectedAlpha, 0.3f);
this.j = obtainStyledAttributes.getFloat(R$styleable.FancyCoverFlow_unselectedSaturation, 0.0f);
this.g = obtainStyledAttributes.getFloat(R$styleable.FancyCoverFlow_unselectedScale, 0.75f);
}
private void b() {
this.e = new Camera();
setSpacing(0);
}
@Override // android.view.ViewGroup, android.view.View
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
AutoPlayer autoPlayer;
int action = motionEvent.getAction();
if (action == 0) {
AutoPlayer autoPlayer2 = this.l;
if (autoPlayer2 != null) {
autoPlayer2.a();
}
} else if ((action == 1 || action == 3) && (autoPlayer = this.l) != null) {
autoPlayer.b();
}
return super.dispatchTouchEvent(motionEvent);
}
public int getActionDistance() {
return this.i;
}
@Override // android.widget.Gallery, android.view.ViewGroup
protected boolean getChildStaticTransformation(View view, Transformation transformation) {
FancyCoverFlowItemWrapper fancyCoverFlowItemWrapper = (FancyCoverFlowItemWrapper) view;
if (Build.VERSION.SDK_INT >= 16) {
fancyCoverFlowItemWrapper.invalidate();
}
int width = getWidth() / 2;
int width2 = fancyCoverFlowItemWrapper.getWidth();
int height = fancyCoverFlowItemWrapper.getHeight();
int left = fancyCoverFlowItemWrapper.getLeft() + (width2 / 2);
int i = this.i;
if (i == Integer.MAX_VALUE) {
i = (int) ((r0 + width2) / 2.0f);
}
float min = Math.min(1.0f, Math.max(-1.0f, (1.0f / i) * (left - width)));
transformation.clear();
transformation.setTransformationType(3);
float f = this.d;
if (f != 1.0f) {
transformation.setAlpha(((f - 1.0f) * Math.abs(min)) + 1.0f);
}
float f2 = this.j;
if (f2 != 1.0f) {
fancyCoverFlowItemWrapper.b(((f2 - 1.0f) * Math.abs(min)) + 1.0f);
}
Matrix matrix = transformation.getMatrix();
if (this.f != 0) {
this.e.save();
this.e.rotateY((int) ((-min) * r10));
this.e.getMatrix(matrix);
this.e.restore();
}
float f3 = this.g;
if (f3 == 1.0f) {
return true;
}
float abs = ((f3 - 1.0f) * Math.abs(min)) + 1.0f;
float f4 = width2 / 2.0f;
float f5 = height * this.h;
matrix.preTranslate(-f4, -f5);
matrix.postScale(abs, abs);
matrix.postTranslate(f4, f5);
return true;
}
public int getMaxRotation() {
return this.f;
}
public int getReflectionGap() {
return this.b;
}
public float getReflectionRatio() {
return this.a;
}
public float getScaleDownGravity() {
return this.h;
}
public float getUnselectedAlpha() {
return this.d;
}
public float getUnselectedSaturation() {
return this.j;
}
public float getUnselectedScale() {
return this.g;
}
@Override // android.view.View
protected void onFinishInflate() {
super.onFinishInflate();
AutoPlayer autoPlayer = new AutoPlayer(this.k);
autoPlayer.a(AutoPlayer.PlayRecycleMode.play_back);
this.l = autoPlayer;
this.l.a(this.m);
}
public void setActionDistance(int i) {
this.i = i;
}
public void setMaxRotation(int i) {
this.f = i;
}
public void setReflectionEnabled(boolean z) {
this.c = z;
if (getAdapter() != null) {
((FancyCoverFlowAdapter) getAdapter()).notifyDataSetChanged();
}
}
public void setReflectionGap(int i) {
this.b = i;
if (getAdapter() != null) {
((FancyCoverFlowAdapter) getAdapter()).notifyDataSetChanged();
}
}
public void setReflectionRatio(float f) {
if (f <= 0.0f || f > 0.5f) {
throw new IllegalArgumentException("reflectionRatio may only be in the interval (0, 0.5]");
}
this.a = f;
if (getAdapter() != null) {
((FancyCoverFlowAdapter) getAdapter()).notifyDataSetChanged();
}
}
public void setScaleDownGravity(float f) {
this.h = f;
}
public void setTimeInterval(int i) {
this.l.a(i);
}
@Override // android.widget.Gallery
public void setUnselectedAlpha(float f) {
super.setUnselectedAlpha(f);
this.d = f;
}
public void setUnselectedSaturation(float f) {
this.j = f;
}
public void setUnselectedScale(float f) {
this.g = f;
}
@Override // android.widget.AdapterView
public void setAdapter(SpinnerAdapter spinnerAdapter) {
if (spinnerAdapter instanceof FancyCoverFlowAdapter) {
super.setAdapter(spinnerAdapter);
return;
}
throw new ClassCastException(FancyCoverFlow.class.getSimpleName() + " only works in conjunction with a " + FancyCoverFlowAdapter.class.getSimpleName());
}
public boolean a() {
return this.c;
}
public FancyCoverFlow(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = 0.4f;
this.b = 20;
this.c = false;
this.f = 75;
this.h = 0.5f;
this.k = new AutoPlayer.Playable(this) { // from class: at.technikum.mti.fancycoverflow.FancyCoverFlow.1
};
this.m = 2000;
b();
a(attributeSet);
}
public FancyCoverFlow(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.a = 0.4f;
this.b = 20;
this.c = false;
this.f = 75;
this.h = 0.5f;
this.k = new AutoPlayer.Playable(this) { // from class: at.technikum.mti.fancycoverflow.FancyCoverFlow.1
};
this.m = 2000;
b();
a(attributeSet);
}
}

View File

@@ -0,0 +1,38 @@
package at.technikum.mti.fancycoverflow;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/* loaded from: classes.dex */
public abstract class FancyCoverFlowAdapter extends BaseAdapter {
public abstract View getCoverFlowItem(int i, View view, ViewGroup viewGroup);
@Override // android.widget.Adapter
public final View getView(int i, View view, ViewGroup viewGroup) {
FancyCoverFlowItemWrapper fancyCoverFlowItemWrapper;
View view2;
FancyCoverFlow fancyCoverFlow = (FancyCoverFlow) viewGroup;
if (view != null) {
fancyCoverFlowItemWrapper = (FancyCoverFlowItemWrapper) view;
view2 = fancyCoverFlowItemWrapper.getChildAt(0);
fancyCoverFlowItemWrapper.removeAllViews();
} else {
fancyCoverFlowItemWrapper = new FancyCoverFlowItemWrapper(viewGroup.getContext());
view2 = null;
}
View coverFlowItem = getCoverFlowItem(i, view2, viewGroup);
if (coverFlowItem == null) {
throw new NullPointerException("getCoverFlowItem() was expected to return a view, but null was returned.");
}
boolean a = fancyCoverFlow.a();
fancyCoverFlowItemWrapper.a(a);
if (a) {
fancyCoverFlowItemWrapper.a(fancyCoverFlow.getReflectionGap());
fancyCoverFlowItemWrapper.a(fancyCoverFlow.getReflectionRatio());
}
fancyCoverFlowItemWrapper.addView(coverFlowItem);
fancyCoverFlowItemWrapper.setLayoutParams(coverFlowItem.getLayoutParams());
return fancyCoverFlowItemWrapper;
}
}

View File

@@ -0,0 +1,143 @@
package at.technikum.mti.fancycoverflow;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
/* loaded from: classes.dex */
class FancyCoverFlowItemWrapper extends ViewGroup {
private float a;
private boolean b;
private float c;
private int d;
private float e;
private Paint f;
private Bitmap g;
private Canvas h;
public FancyCoverFlowItemWrapper(Context context) {
super(context);
this.b = false;
b();
}
private void b() {
this.f = new Paint();
b(1.0f);
}
private void c() {
if (getChildAt(0) != null) {
int measuredHeight = getMeasuredHeight();
float f = 1.0f;
if (this.b) {
float f2 = measuredHeight;
f = (((1.0f - this.c) * f2) - this.d) / f2;
}
this.e = f;
float f3 = this.e;
int i = (int) (measuredHeight * f3);
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i, Integer.MIN_VALUE);
getChildAt(0).measure(View.MeasureSpec.makeMeasureSpec((int) (f3 * getMeasuredWidth()), Integer.MIN_VALUE), makeMeasureSpec);
}
}
void a(boolean z) {
if (z != this.b) {
this.b = z;
if (Build.VERSION.SDK_INT >= 11) {
setLayerType(z ? 1 : 2, null);
}
c();
}
}
@Override // android.view.ViewGroup, android.view.View
@TargetApi(11)
protected void dispatchDraw(Canvas canvas) {
View childAt = getChildAt(0);
if (childAt != null) {
if (Build.VERSION.SDK_INT < 11) {
childAt.draw(this.h);
} else if (childAt.isDirty()) {
childAt.draw(this.h);
if (this.b) {
a();
}
}
}
canvas.drawBitmap(this.g, (getWidth() - childAt.getWidth()) / 2, 0.0f, this.f);
}
@Override // android.view.ViewGroup, android.view.View
@SuppressLint({"DrawAllocation"})
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
if (z) {
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
Bitmap bitmap = this.g;
if (bitmap == null || bitmap.getWidth() != measuredWidth || this.g.getHeight() != measuredHeight) {
this.g = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
this.h = new Canvas(this.g);
}
View childAt = getChildAt(0);
int measuredWidth2 = (measuredWidth - childAt.getMeasuredWidth()) / 2;
childAt.layout(measuredWidth2, 0, measuredWidth - measuredWidth2, childAt.getMeasuredHeight());
}
}
@Override // android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
c();
if (this.b) {
setMeasuredDimension((int) (getMeasuredWidth() * this.e), getMeasuredHeight());
}
}
public void b(float f) {
if (f != this.a) {
this.a = f;
}
}
void a(float f) {
if (f != this.c) {
this.c = f;
c();
}
}
void a(int i) {
if (i != this.d) {
this.d = i;
c();
}
}
private void a() {
int width = this.g.getWidth();
int height = this.g.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(1.0f, -1.0f);
float f = height;
int i = (int) (this.e * f);
int i2 = (height - i) - this.d;
this.h.drawBitmap(Bitmap.createBitmap(this.g, 0, i - i2, width, i2, matrix, true), 0.0f, i + this.d, (Paint) null);
Paint paint = new Paint();
paint.setShader(new LinearGradient(0.0f, (this.c * f) + this.d, 0.0f, f, 1895825407, 16777215, Shader.TileMode.CLAMP));
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
this.h.drawRect(0.0f, f * (1.0f - this.c), width, f, paint);
}
}

View File

@@ -0,0 +1,14 @@
package at.technikum.mti.fancycoverflow;
import com.ubt.jimu.R;
/* loaded from: classes.dex */
public final class R$styleable {
public static final int[] FancyCoverFlow = {R.attr.actionDistance, R.attr.maxRotation, R.attr.scaleDownGravity, R.attr.unselectedAlpha, R.attr.unselectedSaturation, R.attr.unselectedScale};
public static final int FancyCoverFlow_actionDistance = 0;
public static final int FancyCoverFlow_maxRotation = 1;
public static final int FancyCoverFlow_scaleDownGravity = 2;
public static final int FancyCoverFlow_unselectedAlpha = 3;
public static final int FancyCoverFlow_unselectedSaturation = 4;
public static final int FancyCoverFlow_unselectedScale = 5;
}