Initial commit
This commit is contained in:
84
sources/com/ubt/jimu/picture/PictureScrollActivity.java
Normal file
84
sources/com/ubt/jimu/picture/PictureScrollActivity.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.ubt.jimu.picture;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.picture.PictureShowAdapter;
|
||||
import com.ubt.jimu.picture.pagerecyclerview.HorizontalPageLayoutManager;
|
||||
import com.ubt.jimu.picture.pagerecyclerview.PagerHelper;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PictureScrollActivity extends BaseActivity {
|
||||
private RecyclerView a;
|
||||
private View b;
|
||||
private TextView c;
|
||||
private TextView d;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void e(boolean z) {
|
||||
if (z) {
|
||||
this.d.setVisibility(0);
|
||||
} else {
|
||||
this.d.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
final ArrayList arrayList = (ArrayList) getIntent().getSerializableExtra("urlString");
|
||||
this.b.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.picture.PictureScrollActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
PictureScrollActivity.this.finish();
|
||||
}
|
||||
});
|
||||
PictureShowAdapter pictureShowAdapter = new PictureShowAdapter(this, arrayList);
|
||||
PagerHelper pagerHelper = new PagerHelper();
|
||||
this.a.setLayoutManager(new HorizontalPageLayoutManager(1, 1));
|
||||
this.a.setAdapter(pictureShowAdapter);
|
||||
pagerHelper.a(this.a);
|
||||
this.c.setText(String.format(getString(R.string.picture_text_index), String.valueOf(1), String.valueOf(arrayList.size())));
|
||||
pagerHelper.a(new PagerHelper.onPageChangeListener() { // from class: com.ubt.jimu.picture.PictureScrollActivity.2
|
||||
@Override // com.ubt.jimu.picture.pagerecyclerview.PagerHelper.onPageChangeListener
|
||||
public void a(int i) {
|
||||
PictureScrollActivity.this.c.setText(String.format(PictureScrollActivity.this.getString(R.string.picture_text_index), String.valueOf(i + 1), String.valueOf(arrayList.size())));
|
||||
PictureScrollActivity.this.d.setText(((PictureShowModel) arrayList.get(i)).getText());
|
||||
PictureScrollActivity.this.e(!StringUtils.e(((PictureShowModel) arrayList.get(i)).getText()));
|
||||
}
|
||||
});
|
||||
pictureShowAdapter.a(new PictureShowAdapter.ItemOnClickListener() { // from class: com.ubt.jimu.picture.PictureScrollActivity.3
|
||||
@Override // com.ubt.jimu.picture.PictureShowAdapter.ItemOnClickListener
|
||||
public void a(View view, int i) {
|
||||
PictureScrollActivity pictureScrollActivity = PictureScrollActivity.this;
|
||||
pictureScrollActivity.e((pictureScrollActivity.d.getVisibility() == 0 || StringUtils.e(((PictureShowModel) arrayList.get(i)).getText())) ? false : true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.activity_picture_scroll);
|
||||
this.a = (RecyclerView) findViewById(R.id.ry_picture);
|
||||
this.b = findViewById(R.id.img_back);
|
||||
this.c = (TextView) findViewById(R.id.tv_index);
|
||||
this.d = (TextView) findViewById(R.id.tv_pic_desc);
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
public static void a(Context context, ArrayList<PictureShowModel> arrayList) {
|
||||
Intent intent = new Intent(context, (Class<?>) PictureScrollActivity.class);
|
||||
intent.putExtra("urlString", arrayList);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
181
sources/com/ubt/jimu/picture/PictureShowActivity.java
Normal file
181
sources/com/ubt/jimu/picture/PictureShowActivity.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package com.ubt.jimu.picture;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import butterknife.ButterKnife;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.chrisbanes.photoview.OnViewTouchListener;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.picture.PictureShowActivity;
|
||||
import com.ubt.jimu.utils.ThreadManagerUtils;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtech.permission.PermissionRequestListener;
|
||||
import com.ubtech.utils.BitmapFile;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PictureShowActivity extends BaseActivity {
|
||||
private String a;
|
||||
private String b;
|
||||
private float c;
|
||||
private float d;
|
||||
ImageView imgExit;
|
||||
PhotoView imgPreviewPicture;
|
||||
ImageView imgSave;
|
||||
TextView tvPicDesc;
|
||||
|
||||
/* renamed from: com.ubt.jimu.picture.PictureShowActivity$1, reason: invalid class name */
|
||||
class AnonymousClass1 implements PermissionRequestListener {
|
||||
AnonymousClass1() {
|
||||
}
|
||||
|
||||
public /* synthetic */ void a() {
|
||||
PictureShowActivity pictureShowActivity = PictureShowActivity.this;
|
||||
ToastView.a(pictureShowActivity, pictureShowActivity.getString(R.string.picture_save), ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
|
||||
public /* synthetic */ void b() {
|
||||
try {
|
||||
String str = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + File.separator + "Camera" + File.separator + PictureShowActivity.this.b.substring(PictureShowActivity.this.b.lastIndexOf("/") + 1, PictureShowActivity.this.b.length());
|
||||
if (new File(str).exists()) {
|
||||
return;
|
||||
}
|
||||
BitmapFile.a(null, str);
|
||||
MediaStore.Images.Media.insertImage(PictureShowActivity.this.getContentResolver(), str, "mUrl", SocialConstants.PARAM_COMMENT);
|
||||
PictureShowActivity.this.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(new File(str))));
|
||||
PictureShowActivity.this.runOnUiThread(new Runnable() { // from class: com.ubt.jimu.picture.b
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
PictureShowActivity.AnonymousClass1.this.a();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
Log.e(((BaseActivity) PictureShowActivity.this).TAG, "User denied storage permission, and cannot save image to system album!");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
ThreadManagerUtils.a().a(new Runnable() { // from class: com.ubt.jimu.picture.a
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
PictureShowActivity.AnonymousClass1.this.b();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void bindClick() {
|
||||
this.imgExit.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.picture.d
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
PictureShowActivity.this.a(view);
|
||||
}
|
||||
});
|
||||
this.imgSave.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.picture.e
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
PictureShowActivity.this.b(view);
|
||||
}
|
||||
});
|
||||
this.imgPreviewPicture.getAttacher().a(new OnViewTouchListener() { // from class: com.ubt.jimu.picture.c
|
||||
@Override // com.github.chrisbanes.photoview.OnViewTouchListener
|
||||
public final void a(MotionEvent motionEvent) {
|
||||
PictureShowActivity.this.a(motionEvent);
|
||||
}
|
||||
});
|
||||
this.imgPreviewPicture.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.picture.PictureShowActivity.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (PictureShowActivity.this.tvPicDesc.getVisibility() == 0 || StringUtils.e(PictureShowActivity.this.a)) {
|
||||
PictureShowActivity.this.tvPicDesc.setVisibility(8);
|
||||
} else {
|
||||
PictureShowActivity.this.tvPicDesc.setVisibility(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
this.b = getIntent().getStringExtra("url");
|
||||
this.a = getIntent().getStringExtra("Text");
|
||||
if (StringUtils.e(this.a)) {
|
||||
this.tvPicDesc.setVisibility(8);
|
||||
} else {
|
||||
this.tvPicDesc.setText(this.a);
|
||||
this.imgSave.setVisibility(8);
|
||||
}
|
||||
Glide.a((FragmentActivity) this).a(this.b).a((ImageView) this.imgPreviewPicture);
|
||||
}
|
||||
|
||||
public static void start(Context context, String str, String str2) {
|
||||
Intent intent = new Intent(context, (Class<?>) PictureShowActivity.class);
|
||||
intent.putExtra("url", str2);
|
||||
intent.putExtra("Text", str);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.activity_picture_show);
|
||||
ButterKnife.a(this);
|
||||
initData();
|
||||
bindClick();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
ThreadManagerUtils.a().a();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
JimuPermissionRequest.c(this, new AnonymousClass1());
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(MotionEvent motionEvent) {
|
||||
if (this.imgPreviewPicture.getScale() == 1.0f && motionEvent.getPointerCount() == 1) {
|
||||
int action = motionEvent.getAction();
|
||||
if (action == 0) {
|
||||
this.c = motionEvent.getY();
|
||||
} else {
|
||||
if (action != 1) {
|
||||
return;
|
||||
}
|
||||
this.d = motionEvent.getY();
|
||||
if (this.d - this.c > 60.0f) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.ubt.jimu.picture;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PictureShowActivity_ViewBinding implements Unbinder {
|
||||
private PictureShowActivity b;
|
||||
|
||||
public PictureShowActivity_ViewBinding(PictureShowActivity pictureShowActivity, View view) {
|
||||
this.b = pictureShowActivity;
|
||||
pictureShowActivity.imgPreviewPicture = (PhotoView) Utils.b(view, R.id.img_preview_picture, "field 'imgPreviewPicture'", PhotoView.class);
|
||||
pictureShowActivity.imgExit = (ImageView) Utils.b(view, R.id.img_exit, "field 'imgExit'", ImageView.class);
|
||||
pictureShowActivity.imgSave = (ImageView) Utils.b(view, R.id.img_save, "field 'imgSave'", ImageView.class);
|
||||
pictureShowActivity.tvPicDesc = (TextView) Utils.b(view, R.id.tv_pic_desc, "field 'tvPicDesc'", TextView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
PictureShowActivity pictureShowActivity = this.b;
|
||||
if (pictureShowActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
pictureShowActivity.imgPreviewPicture = null;
|
||||
pictureShowActivity.imgExit = null;
|
||||
pictureShowActivity.imgSave = null;
|
||||
pictureShowActivity.tvPicDesc = null;
|
||||
}
|
||||
}
|
65
sources/com/ubt/jimu/picture/PictureShowAdapter.java
Normal file
65
sources/com/ubt/jimu/picture/PictureShowAdapter.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.picture;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.ubt.jimu.R;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PictureShowAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private Context a;
|
||||
private List<PictureShowModel> b;
|
||||
private ItemOnClickListener c;
|
||||
|
||||
public interface ItemOnClickListener {
|
||||
void a(View view, int i);
|
||||
}
|
||||
|
||||
private static class PictureViewHolder extends RecyclerView.ViewHolder {
|
||||
private final PhotoView a;
|
||||
|
||||
public PictureViewHolder(View view) {
|
||||
super(view);
|
||||
this.a = (PhotoView) view.findViewById(R.id.photo_picture);
|
||||
}
|
||||
}
|
||||
|
||||
public PictureShowAdapter(Context context, List<PictureShowModel> list) {
|
||||
this.a = context;
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
return this.b.size();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i) {
|
||||
PictureViewHolder pictureViewHolder = (PictureViewHolder) viewHolder;
|
||||
Glide.e(this.a).a(this.b.get(i).getUrl()).a((ImageView) pictureViewHolder.a);
|
||||
pictureViewHolder.a.getAttacher().b(true);
|
||||
pictureViewHolder.a.setZoomable(true);
|
||||
pictureViewHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.picture.PictureShowAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
PictureShowAdapter.this.c.a(view, i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(ItemOnClickListener itemOnClickListener) {
|
||||
this.c = itemOnClickListener;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
return new PictureViewHolder(LayoutInflater.from(this.a).inflate(R.layout.item_picture, viewGroup, false));
|
||||
}
|
||||
}
|
34
sources/com/ubt/jimu/picture/PictureShowModel.java
Normal file
34
sources/com/ubt/jimu/picture/PictureShowModel.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.ubt.jimu.picture;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PictureShowModel implements Serializable {
|
||||
private boolean isFullScreen = false;
|
||||
private String text;
|
||||
private String url;
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public boolean isFullScreen() {
|
||||
return this.isFullScreen;
|
||||
}
|
||||
|
||||
public void setFullScreen(boolean z) {
|
||||
this.isFullScreen = z;
|
||||
}
|
||||
|
||||
public void setText(String str) {
|
||||
this.text = str;
|
||||
}
|
||||
|
||||
public void setUrl(String str) {
|
||||
this.url = str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,158 @@
|
||||
package com.ubt.jimu.picture.pagerecyclerview;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HorizontalPageLayoutManager extends RecyclerView.LayoutManager implements PageDecorationLastJudge {
|
||||
int A;
|
||||
int B;
|
||||
int C;
|
||||
int v;
|
||||
int w;
|
||||
int s = 0;
|
||||
int t = 0;
|
||||
private SparseArray<Rect> u = new SparseArray<>();
|
||||
public int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
public HorizontalPageLayoutManager(int i, int i2) {
|
||||
this.v = 0;
|
||||
this.w = 0;
|
||||
this.A = 0;
|
||||
this.v = i;
|
||||
this.w = i2;
|
||||
this.A = i * i2;
|
||||
}
|
||||
|
||||
private int E() {
|
||||
return (h() - q()) - n();
|
||||
}
|
||||
|
||||
private int F() {
|
||||
return (r() - o()) - p();
|
||||
}
|
||||
|
||||
private void f(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
if (state.d()) {
|
||||
return;
|
||||
}
|
||||
Rect rect = new Rect(o() + this.t, q(), ((r() - o()) - p()) + this.t, (h() - q()) - n());
|
||||
Rect rect2 = new Rect();
|
||||
for (int i = 0; i < e(); i++) {
|
||||
View d = d(i);
|
||||
rect2.left = f(d);
|
||||
rect2.top = j(d);
|
||||
rect2.right = i(d);
|
||||
rect2.bottom = e(d);
|
||||
if (!Rect.intersects(rect, rect2)) {
|
||||
a(d, recycler);
|
||||
}
|
||||
}
|
||||
for (int i2 = 0; i2 < j(); i2++) {
|
||||
if (Rect.intersects(rect, this.u.get(i2))) {
|
||||
View d2 = recycler.d(i2);
|
||||
b(d2);
|
||||
a(d2, this.B, this.C);
|
||||
Rect rect3 = this.u.get(i2);
|
||||
int i3 = rect3.left;
|
||||
int i4 = this.t;
|
||||
a(d2, i3 - i4, rect3.top, rect3.right - i4, rect3.bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public int a(int i, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
a(recycler);
|
||||
int i2 = this.t;
|
||||
int i3 = i2 + i;
|
||||
int i4 = this.s;
|
||||
if (i3 > i4) {
|
||||
i = i4 - i2;
|
||||
} else if (i3 < 0) {
|
||||
i = 0 - i2;
|
||||
}
|
||||
this.t += i;
|
||||
e(-i);
|
||||
f(recycler, state);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void b(RecyclerView recyclerView, RecyclerView.Recycler recycler) {
|
||||
super.b(recyclerView, recycler);
|
||||
this.t = 0;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public RecyclerView.LayoutParams c() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void e(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
int i;
|
||||
if (j() == 0) {
|
||||
b(recycler);
|
||||
return;
|
||||
}
|
||||
if (state.d()) {
|
||||
return;
|
||||
}
|
||||
this.y = F() / this.w;
|
||||
int E = E();
|
||||
int i2 = this.v;
|
||||
this.z = E / i2;
|
||||
this.B = (this.w - 1) * this.y;
|
||||
this.C = (i2 - 1) * this.z;
|
||||
this.x = (j() / this.A) + (j() % this.A == 0 ? 0 : 1);
|
||||
this.s = (this.x - 1) * r();
|
||||
a(recycler);
|
||||
int j = j();
|
||||
for (int i3 = 0; i3 < this.x; i3 = i + 1) {
|
||||
i = i3;
|
||||
int i4 = 0;
|
||||
while (i4 < this.v) {
|
||||
int i5 = 0;
|
||||
while (true) {
|
||||
int i6 = this.w;
|
||||
if (i5 >= i6) {
|
||||
break;
|
||||
}
|
||||
int i7 = (this.A * i) + (i6 * i4) + i5;
|
||||
if (i7 == j) {
|
||||
i4 = this.v;
|
||||
i = this.x;
|
||||
break;
|
||||
}
|
||||
View d = recycler.d(i7);
|
||||
b(d);
|
||||
a(d, this.B, this.C);
|
||||
int h = h(d);
|
||||
int g = g(d);
|
||||
Rect rect = this.u.get(i7);
|
||||
if (rect == null) {
|
||||
rect = new Rect();
|
||||
}
|
||||
int F = (F() * i) + (this.y * i5);
|
||||
int i8 = this.z * i4;
|
||||
rect.set(F, i8, h + F, g + i8);
|
||||
this.u.put(i7, rect);
|
||||
i5++;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
b(recycler);
|
||||
}
|
||||
f(recycler, state);
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.ubt.jimu.picture.pagerecyclerview;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface PageDecorationLastJudge {
|
||||
}
|
213
sources/com/ubt/jimu/picture/pagerecyclerview/PagerHelper.java
Normal file
213
sources/com/ubt/jimu/picture/pagerecyclerview/PagerHelper.java
Normal file
@@ -0,0 +1,213 @@
|
||||
package com.ubt.jimu.picture.pagerecyclerview;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.baidu.cloud.media.player.IMediaPlayer;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PagerHelper {
|
||||
RecyclerView a = null;
|
||||
private MyOnScrollListener b = new MyOnScrollListener();
|
||||
private MyOnFlingListener c = new MyOnFlingListener();
|
||||
private int d = 0;
|
||||
private int e = 0;
|
||||
int f = 0;
|
||||
int g = 0;
|
||||
ORIENTATION h = ORIENTATION.HORIZONTAL;
|
||||
ValueAnimator i = null;
|
||||
private MyOnTouchListener j = new MyOnTouchListener();
|
||||
onPageChangeListener k;
|
||||
|
||||
public class MyOnFlingListener extends RecyclerView.OnFlingListener {
|
||||
public MyOnFlingListener() {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnFlingListener
|
||||
public boolean a(int i, int i2) {
|
||||
int width;
|
||||
int i3;
|
||||
PagerHelper pagerHelper = PagerHelper.this;
|
||||
if (pagerHelper.h == ORIENTATION.NULL) {
|
||||
return false;
|
||||
}
|
||||
int c = pagerHelper.c();
|
||||
PagerHelper pagerHelper2 = PagerHelper.this;
|
||||
if (pagerHelper2.h == ORIENTATION.VERTICAL) {
|
||||
i3 = pagerHelper2.d;
|
||||
if (i2 < 0) {
|
||||
c--;
|
||||
} else if (i2 > 0) {
|
||||
c++;
|
||||
}
|
||||
width = c * PagerHelper.this.a.getHeight();
|
||||
} else {
|
||||
int i4 = pagerHelper2.e;
|
||||
if (i < 0) {
|
||||
c--;
|
||||
} else if (i > 0) {
|
||||
c++;
|
||||
}
|
||||
width = c * PagerHelper.this.a.getWidth();
|
||||
i3 = i4;
|
||||
}
|
||||
if (width < 0) {
|
||||
width = 0;
|
||||
}
|
||||
PagerHelper pagerHelper3 = PagerHelper.this;
|
||||
ValueAnimator valueAnimator = pagerHelper3.i;
|
||||
if (valueAnimator == null) {
|
||||
new ValueAnimator();
|
||||
pagerHelper3.i = ValueAnimator.ofInt(i3, width);
|
||||
PagerHelper.this.i.setDuration(300L);
|
||||
PagerHelper.this.i.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.ubt.jimu.picture.pagerecyclerview.PagerHelper.MyOnFlingListener.1
|
||||
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator2) {
|
||||
int intValue = ((Integer) valueAnimator2.getAnimatedValue()).intValue();
|
||||
PagerHelper pagerHelper4 = PagerHelper.this;
|
||||
if (pagerHelper4.h == ORIENTATION.VERTICAL) {
|
||||
PagerHelper.this.a.scrollBy(0, intValue - pagerHelper4.d);
|
||||
} else {
|
||||
PagerHelper.this.a.scrollBy(intValue - pagerHelper4.e, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
PagerHelper.this.i.addListener(new AnimatorListenerAdapter() { // from class: com.ubt.jimu.picture.pagerecyclerview.PagerHelper.MyOnFlingListener.2
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
PagerHelper pagerHelper4 = PagerHelper.this;
|
||||
onPageChangeListener onpagechangelistener = pagerHelper4.k;
|
||||
if (onpagechangelistener != null) {
|
||||
onpagechangelistener.a(pagerHelper4.b());
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
valueAnimator.cancel();
|
||||
PagerHelper.this.i.setIntValues(i3, width);
|
||||
}
|
||||
PagerHelper.this.i.start();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class MyOnTouchListener implements View.OnTouchListener {
|
||||
public MyOnTouchListener() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() != 0) {
|
||||
return false;
|
||||
}
|
||||
PagerHelper pagerHelper = PagerHelper.this;
|
||||
pagerHelper.f = pagerHelper.d;
|
||||
PagerHelper pagerHelper2 = PagerHelper.this;
|
||||
pagerHelper2.g = pagerHelper2.e;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum ORIENTATION {
|
||||
HORIZONTAL,
|
||||
VERTICAL,
|
||||
NULL
|
||||
}
|
||||
|
||||
public interface onPageChangeListener {
|
||||
void a(int i);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public int c() {
|
||||
return this.h == ORIENTATION.VERTICAL ? this.f / this.a.getHeight() : this.g / this.a.getWidth();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public int b() {
|
||||
if (this.h == ORIENTATION.VERTICAL) {
|
||||
return this.d / this.a.getHeight();
|
||||
}
|
||||
return this.e / this.a.getWidth();
|
||||
}
|
||||
|
||||
public void a(RecyclerView recyclerView) {
|
||||
if (recyclerView != null) {
|
||||
this.a = recyclerView;
|
||||
recyclerView.setOnFlingListener(this.c);
|
||||
recyclerView.setOnScrollListener(this.b);
|
||||
recyclerView.setOnTouchListener(this.j);
|
||||
a();
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("recycleView must be not null");
|
||||
}
|
||||
|
||||
public class MyOnScrollListener extends RecyclerView.OnScrollListener {
|
||||
public MyOnScrollListener() {
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
public void a(RecyclerView recyclerView, int i) {
|
||||
PagerHelper pagerHelper;
|
||||
ORIENTATION orientation;
|
||||
if (i != 0 || (orientation = (pagerHelper = PagerHelper.this).h) == ORIENTATION.NULL) {
|
||||
return;
|
||||
}
|
||||
ORIENTATION orientation2 = ORIENTATION.VERTICAL;
|
||||
int i2 = IMediaPlayer.MEDIA_ERROR_AUTH_FAILURE;
|
||||
int i3 = 0;
|
||||
if (orientation == orientation2) {
|
||||
if (Math.abs(pagerHelper.d - PagerHelper.this.f) > recyclerView.getHeight() / 2) {
|
||||
if (PagerHelper.this.d - PagerHelper.this.f >= 0) {
|
||||
i2 = 1000;
|
||||
}
|
||||
PagerHelper.this.c.a(i3, i2);
|
||||
}
|
||||
} else {
|
||||
if (Math.abs(pagerHelper.e - PagerHelper.this.g) > recyclerView.getWidth() / 2) {
|
||||
if (PagerHelper.this.e - PagerHelper.this.g >= 0) {
|
||||
i2 = 1000;
|
||||
}
|
||||
i3 = i2;
|
||||
}
|
||||
}
|
||||
i2 = 0;
|
||||
PagerHelper.this.c.a(i3, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
public void a(RecyclerView recyclerView, int i, int i2) {
|
||||
PagerHelper.this.d += i2;
|
||||
PagerHelper.this.e += i;
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
RecyclerView.LayoutManager layoutManager = this.a.getLayoutManager();
|
||||
if (layoutManager != null) {
|
||||
if (layoutManager.b()) {
|
||||
this.h = ORIENTATION.VERTICAL;
|
||||
} else if (layoutManager.a()) {
|
||||
this.h = ORIENTATION.HORIZONTAL;
|
||||
} else {
|
||||
this.h = ORIENTATION.NULL;
|
||||
}
|
||||
ValueAnimator valueAnimator = this.i;
|
||||
if (valueAnimator != null) {
|
||||
valueAnimator.cancel();
|
||||
}
|
||||
this.g = 0;
|
||||
this.f = 0;
|
||||
this.e = 0;
|
||||
this.d = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(onPageChangeListener onpagechangelistener) {
|
||||
this.k = onpagechangelistener;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user