Initial commit
This commit is contained in:
514
sources/com/ubt/jimu/widgets/choosePhotos/AlbumActivity.java
Normal file
514
sources/com/ubt/jimu/widgets/choosePhotos/AlbumActivity.java
Normal file
@@ -0,0 +1,514 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPImage;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayer;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtech.permission.PermissionRequestListener;
|
||||
import com.ubtech.utils.BitmapFile;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AlbumActivity extends BaseActivity implements AlbumOnClickListener {
|
||||
private static StaticHandler m;
|
||||
private View a;
|
||||
private RecyclerView c;
|
||||
private AlbumRecyclerViewAdapter d;
|
||||
private int k;
|
||||
private NavigationBarView l;
|
||||
private final String b = AlbumActivity.class.getSimpleName();
|
||||
private ArrayList<HPMedia> e = new ArrayList<>();
|
||||
private List<HPMedia> f = new ArrayList();
|
||||
private List<HPMedia> g = new ArrayList();
|
||||
private ArrayList<HPMedia> h = new ArrayList<>();
|
||||
public String i = "MULTITERM_VIDEO_IMAGE";
|
||||
private int j = 5;
|
||||
|
||||
private static class StaticHandler extends Handler {
|
||||
private WeakReference<AlbumActivity> a;
|
||||
|
||||
public StaticHandler(AlbumActivity albumActivity) {
|
||||
this.a = new WeakReference<>(albumActivity);
|
||||
}
|
||||
|
||||
public WeakReference<AlbumActivity> a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void F0() {
|
||||
this.e.add(D0());
|
||||
this.e.addAll(this.g);
|
||||
this.e.addAll(this.f);
|
||||
Collections.sort(this.e, new HPMediaComparator());
|
||||
this.d.a(this.i);
|
||||
this.d.a(this.e);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void initData() {
|
||||
this.c.setLayoutManager(new GridLayoutManager(this, 6));
|
||||
this.d = new AlbumRecyclerViewAdapter(this);
|
||||
this.d.a(this);
|
||||
this.c.setAdapter(this.d);
|
||||
Intent intent = getIntent();
|
||||
ArrayList arrayList = (ArrayList) intent.getSerializableExtra("selected_items");
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
this.h.addAll(arrayList);
|
||||
}
|
||||
if (intent.getIntExtra("type", 0) == 1 && "UNITERMING_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
|
||||
this.l.setTitle(R.string.my_albums);
|
||||
this.i = "UNITERMING_IMAGE";
|
||||
this.l.setMode(0);
|
||||
}
|
||||
if ("MULTITERM_VIDEO_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
|
||||
this.l.setTitle(R.string.title_album);
|
||||
this.l.setRightIcon(R.drawable.community_collection_icon);
|
||||
this.l.setRightAlpha(0.3f);
|
||||
this.l.setLeftIcon(R.drawable.community_cancel);
|
||||
}
|
||||
if ("MULTITERM_VIDEO".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
|
||||
this.i = "MULTITERM_VIDEO";
|
||||
this.l.setTitle(R.string.video);
|
||||
this.l.setRightIcon(R.drawable.community_collection_icon);
|
||||
}
|
||||
if ("MULTITERM_IMAGE".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
|
||||
this.i = "MULTITERM_IMAGE";
|
||||
this.l.setTitle(R.string.title_photo);
|
||||
this.l.setRightIcon(R.drawable.community_collection_icon);
|
||||
}
|
||||
if ("UNITERMING_VIDEO".equals(intent.getStringExtra("FROM_PAGE_KEY"))) {
|
||||
this.i = "UNITERMING_VIDEO";
|
||||
this.l.setTitle(R.string.video);
|
||||
this.l.setRightIcon(R.drawable.community_collection_icon);
|
||||
}
|
||||
new Thread(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.8
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (AlbumActivity.this.j == 1 || AlbumActivity.this.j == -1) {
|
||||
AlbumActivity.this.f.addAll(HPImage.getImages(AlbumActivity.this));
|
||||
} else if (AlbumActivity.this.j == 2) {
|
||||
AlbumActivity.this.g.addAll(HPVideo.getVideos(AlbumActivity.this));
|
||||
} else {
|
||||
AlbumActivity.this.f.addAll(HPImage.getImages(AlbumActivity.this));
|
||||
AlbumActivity.this.g.addAll(HPVideo.getVideos(AlbumActivity.this));
|
||||
}
|
||||
AlbumActivity.m.sendEmptyMessage(Constant.Publish.REQUEST_CODE_PICK_FILE);
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
Iterator it = AlbumActivity.this.h.iterator();
|
||||
while (it.hasNext()) {
|
||||
HPMedia hPMedia = (HPMedia) it.next();
|
||||
for (HPMedia hPMedia2 : AlbumActivity.this.f) {
|
||||
if (hPMedia.getId() == hPMedia2.getId() || hPMedia.getPath().equals(hPMedia2.getPath())) {
|
||||
hPMedia2.setSelected(true);
|
||||
arrayList2.add(hPMedia2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator it2 = AlbumActivity.this.h.iterator();
|
||||
while (it2.hasNext()) {
|
||||
HPMedia hPMedia3 = (HPMedia) it2.next();
|
||||
for (HPMedia hPMedia4 : AlbumActivity.this.g) {
|
||||
if (hPMedia3.getId() == hPMedia4.getId() || hPMedia3.getPath().equals(hPMedia4.getPath())) {
|
||||
hPMedia4.setSelected(true);
|
||||
arrayList2.add(hPMedia4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
AlbumActivity.this.h.clear();
|
||||
AlbumActivity.this.h.addAll(arrayList2);
|
||||
final ArrayList arrayList3 = new ArrayList();
|
||||
ArrayList<HPMedia> arrayList4 = new ArrayList();
|
||||
arrayList4.addAll(AlbumActivity.this.g);
|
||||
for (HPMedia hPMedia5 : arrayList4) {
|
||||
if (((HPVideo) hPMedia5).getDuration() < 500) {
|
||||
arrayList3.add(hPMedia5);
|
||||
} else {
|
||||
HPVideo.getVideoThumnail(AlbumActivity.this, hPMedia5);
|
||||
}
|
||||
}
|
||||
AlbumActivity.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.8.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AlbumActivity.this.g.removeAll(arrayList3);
|
||||
AlbumActivity.this.e.removeAll(arrayList3);
|
||||
AlbumActivity.this.d.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.l = (NavigationBarView) findViewById(R.id.nbv_bar);
|
||||
this.l.setRightIcon(R.drawable.ic_nav_finish);
|
||||
this.l.setRightAlpha(0.3f);
|
||||
this.l.setRightEnabled(false);
|
||||
this.l.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.7
|
||||
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
||||
public void onLeftClick(View view) {
|
||||
AlbumActivity.this.e(false);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
||||
public void onRightClick(View view) {
|
||||
AlbumActivity.this.e(true);
|
||||
}
|
||||
});
|
||||
this.k = getIntent().getIntExtra(FileDownloadModel.TOTAL, 10);
|
||||
this.j = getIntent().getIntExtra("type", 5);
|
||||
this.c = (RecyclerView) findViewById(R.id.rv_album_list);
|
||||
}
|
||||
|
||||
public HPMedia D0() {
|
||||
HPMedia hPMedia = new HPMedia();
|
||||
hPMedia.setId(Integer.MAX_VALUE);
|
||||
hPMedia.setModifyDate("2147483647");
|
||||
return hPMedia;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
|
||||
public void n0() {
|
||||
if (this.h.size() == this.k) {
|
||||
ToastView.a(this, getString(R.string.choose_more_pictures), ToastView.Type.ERROR).a();
|
||||
} else {
|
||||
JimuPermissionRequest.a((Context) this, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.9
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
Log.i(AlbumActivity.this.b, "User denied CAMERA permission.");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
AlbumActivity albumActivity = AlbumActivity.this;
|
||||
int i = 5;
|
||||
if (albumActivity.j != 5) {
|
||||
i = AlbumActivity.this.j;
|
||||
} else if (AlbumActivity.this.h.size() != 0) {
|
||||
i = 1;
|
||||
}
|
||||
VideoCaptureActivity.a(albumActivity, 102, i);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
if (i == 101) {
|
||||
a(i2, intent);
|
||||
} else if (i == 102) {
|
||||
b(i2, intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.choosePhotos.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);
|
||||
m = new StaticHandler(this, this) { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.5
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
if (a() == null || a().get() == null) {
|
||||
return;
|
||||
}
|
||||
int i = message.what;
|
||||
if (i == 201) {
|
||||
a().get().a(message);
|
||||
} else if (i == 202) {
|
||||
a().get().F0();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.a = View.inflate(this, R.layout.activity_album_select, null);
|
||||
setContentView(this.a);
|
||||
initView();
|
||||
JimuPermissionRequest.c(this, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.6
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
Log.e(AlbumActivity.this.b, "Should not to here, should check storage permission before goto AlbumActivity!");
|
||||
AlbumActivity.this.finish();
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
AlbumActivity.this.initData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onDestroy() {
|
||||
m.removeCallbacksAndMessages(null);
|
||||
this.f.clear();
|
||||
this.g.clear();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i != 4) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
e(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private void b(int i, Intent intent) {
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
String stringExtra = intent.getStringExtra("data");
|
||||
if (!TextUtils.isEmpty(stringExtra) && new File(stringExtra).exists()) {
|
||||
int intExtra = intent.getIntExtra("data_type", -1);
|
||||
if (1 == intExtra) {
|
||||
try {
|
||||
HPVideo searchVideoByName = HPVideo.searchVideoByName(this, stringExtra);
|
||||
if (searchVideoByName == null) {
|
||||
searchVideoByName = new HPVideo();
|
||||
searchVideoByName.setPath(stringExtra);
|
||||
searchVideoByName.setMediaType(intExtra);
|
||||
File file = new File(stringExtra);
|
||||
if (!file.exists()) {
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
searchVideoByName.setSize(file.length());
|
||||
searchVideoByName.setDuration(HPVideo.getVideoDuration(stringExtra));
|
||||
}
|
||||
}
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
mediaMetadataRetriever.setDataSource(stringExtra);
|
||||
String str = stringExtra.substring(0, stringExtra.lastIndexOf(".")) + ".jpg";
|
||||
BitmapFile.a(mediaMetadataRetriever.getFrameAtTime(), str);
|
||||
searchVideoByName.setPreview(str);
|
||||
this.h.clear();
|
||||
this.h.add(searchVideoByName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
HPMedia searchImageByName = HPImage.searchImageByName(this, stringExtra);
|
||||
if (searchImageByName == null) {
|
||||
searchImageByName = new HPImage();
|
||||
searchImageByName.setId(0);
|
||||
searchImageByName.setPath(stringExtra);
|
||||
searchImageByName.setPreview(stringExtra);
|
||||
}
|
||||
this.h.add(searchImageByName);
|
||||
}
|
||||
e(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void e(boolean z) {
|
||||
if (this.h.size() == 0) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
if (z) {
|
||||
intent.putExtra("result_data", this.h);
|
||||
setResult(-1, intent);
|
||||
} else {
|
||||
setResult(0, intent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
public static void a(final Activity activity, final int i, final int i2, final ArrayList<HPMedia> arrayList, final int i3, final String str) {
|
||||
JimuPermissionRequest.c(activity, new PermissionRequestListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumActivity.2
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
Intent intent = new Intent(activity, (Class<?>) AlbumActivity.class);
|
||||
intent.putExtra(FileDownloadModel.TOTAL, i2);
|
||||
intent.putExtra("selected_items", arrayList);
|
||||
intent.putExtra("type", i3);
|
||||
intent.putExtra("FROM_PAGE_KEY", str);
|
||||
activity.startActivityForResult(intent, i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void a(int i, Intent intent) {
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
List list = (List) intent.getSerializableExtra("selected");
|
||||
List list2 = (List) SPUtils.c("ResultDate");
|
||||
int intExtra = intent.getIntExtra("current", 0);
|
||||
intent.getIntExtra("type", -1);
|
||||
intent.getBooleanExtra("done", false);
|
||||
if (list == null) {
|
||||
list = new ArrayList();
|
||||
this.l.setRightEnabled(false);
|
||||
} else if (list.size() > 0) {
|
||||
this.l.setRightEnabled(true);
|
||||
} else {
|
||||
this.l.setRightEnabled(false);
|
||||
}
|
||||
this.h.clear();
|
||||
this.h.addAll(list);
|
||||
this.e.clear();
|
||||
this.e.addAll(list2);
|
||||
if (i == 105) {
|
||||
e(true);
|
||||
return;
|
||||
}
|
||||
ArrayList<HPMedia> arrayList = this.h;
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
this.l.setRightEnabled(true);
|
||||
this.l.setRightAlpha(1.0f);
|
||||
} else {
|
||||
this.l.setRightEnabled(false);
|
||||
this.l.setRightAlpha(0.3f);
|
||||
}
|
||||
Message message = new Message();
|
||||
message.what = 201;
|
||||
message.arg1 = intExtra;
|
||||
m.sendMessage(message);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(Message message) {
|
||||
if (this.h.size() == 0) {
|
||||
this.l.setRightAlpha(0.4f);
|
||||
} else {
|
||||
this.l.setRightAlpha(1.0f);
|
||||
}
|
||||
this.d.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
|
||||
public void a(CheckBox checkBox, HPMedia hPMedia, int i) {
|
||||
if (this.i.equals("UNITERMING_IMAGE")) {
|
||||
checkBox.setVisibility(0);
|
||||
checkBox.setChecked(true);
|
||||
Intent intent = new Intent();
|
||||
this.h.add(hPMedia);
|
||||
intent.putExtra("result_data", this.h);
|
||||
setResult(-1, intent);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
PreviewActivity.a(this, this.e, this.h, this.k, i);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
|
||||
public void a(HPVideo hPVideo, int i) {
|
||||
if (this.i.equals("UNITERMING_VIDEO")) {
|
||||
UbtPlayer.a(this, null, hPVideo.getPath());
|
||||
} else {
|
||||
PreviewActivity.a(this, this.e, this.h, this.k, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.choosePhotos.AlbumOnClickListener
|
||||
public void a(CheckBox checkBox, boolean z, HPMedia hPMedia) {
|
||||
if (z) {
|
||||
if ("MULTITERM_VIDEO".equals(this.i) && hPMedia.getMediaType() == 0) {
|
||||
Iterator<HPMedia> it = this.h.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().isVideo()) {
|
||||
ToastView.a(this, getString(R.string.tips_type_limit), ToastView.Type.ERROR).a();
|
||||
hPMedia.setSelected(false);
|
||||
checkBox.setChecked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("MULTITERM_VIDEO".equals(this.i) && hPMedia.getMediaType() == 1) {
|
||||
Iterator<HPMedia> it2 = this.h.iterator();
|
||||
while (it2.hasNext()) {
|
||||
if (it2.next().getMediaType() == 0) {
|
||||
ToastView.a(this, getString(R.string.tips_type_limit), ToastView.Type.ERROR).a();
|
||||
hPMedia.setSelected(false);
|
||||
checkBox.setChecked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.h.size() >= this.k) {
|
||||
checkBox.setSelected(false);
|
||||
ToastView.a(this, getString(R.string.choose_more_pictures), ToastView.Type.ERROR).a();
|
||||
} else {
|
||||
hPMedia.setSelected(true);
|
||||
this.h.add(hPMedia);
|
||||
this.l.setRightEnabled(true);
|
||||
}
|
||||
} else {
|
||||
hPMedia.setSelected(false);
|
||||
Iterator<HPMedia> it3 = this.h.iterator();
|
||||
while (true) {
|
||||
if (!it3.hasNext()) {
|
||||
break;
|
||||
}
|
||||
HPMedia next = it3.next();
|
||||
if (next.getId() == hPMedia.getId()) {
|
||||
this.h.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.h.size() <= 0) {
|
||||
this.l.setRightAlpha(0.3f);
|
||||
this.l.setRightEnabled(false);
|
||||
} else {
|
||||
this.l.setRightAlpha(1.0f);
|
||||
this.l.setRightEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.widget.CheckBox;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface AlbumOnClickListener {
|
||||
void a(CheckBox checkBox, HPMedia hPMedia, int i);
|
||||
|
||||
void a(CheckBox checkBox, boolean z, HPMedia hPMedia);
|
||||
|
||||
void a(HPVideo hPVideo, int i);
|
||||
|
||||
void n0();
|
||||
}
|
@@ -0,0 +1,178 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPVideo;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AlbumRecyclerViewAdapter extends RecyclerView.Adapter {
|
||||
private List<HPMedia> a;
|
||||
private Context b;
|
||||
private AlbumOnClickListener c;
|
||||
private String d;
|
||||
|
||||
class AlbumHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView a;
|
||||
public RelativeLayout b;
|
||||
public TextView c;
|
||||
public CheckBox d;
|
||||
public ImageView e;
|
||||
|
||||
public AlbumHolder(AlbumRecyclerViewAdapter albumRecyclerViewAdapter, View view) {
|
||||
super(view);
|
||||
a(view);
|
||||
}
|
||||
|
||||
private void a(View view) {
|
||||
this.a = (ImageView) view.findViewById(R.id.imgMask);
|
||||
this.b = (RelativeLayout) view.findViewById(R.id.llVideo);
|
||||
this.c = (TextView) view.findViewById(R.id.tvDuration);
|
||||
this.d = (CheckBox) view.findViewById(R.id.cb_select);
|
||||
this.e = (ImageView) view.findViewById(R.id.view_shade);
|
||||
}
|
||||
}
|
||||
|
||||
class PhotographyHolder extends RecyclerView.ViewHolder {
|
||||
public PhotographyHolder(View view) {
|
||||
super(view);
|
||||
a(view);
|
||||
}
|
||||
|
||||
private void a(View view) {
|
||||
view.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.PhotographyHolder.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
if (AlbumRecyclerViewAdapter.this.c != null) {
|
||||
AlbumRecyclerViewAdapter.this.c.n0();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public AlbumRecyclerViewAdapter(Context context) {
|
||||
this.b = context;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
List<HPMedia> list = this.a;
|
||||
if (list == null || list.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.a.size();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return i == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i) {
|
||||
if (viewHolder instanceof PhotographyHolder) {
|
||||
return;
|
||||
}
|
||||
final HPMedia hPMedia = this.a.get(i);
|
||||
int mediaType = hPMedia.getMediaType();
|
||||
final AlbumHolder albumHolder = (AlbumHolder) viewHolder;
|
||||
if (mediaType == 0) {
|
||||
albumHolder.b.setVisibility(8);
|
||||
if ("UNITERMING_IMAGE".equals(this.d)) {
|
||||
albumHolder.d.setVisibility(8);
|
||||
} else {
|
||||
albumHolder.d.setVisibility(0);
|
||||
}
|
||||
albumHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (AlbumRecyclerViewAdapter.this.c != null) {
|
||||
AlbumRecyclerViewAdapter.this.c.a(albumHolder.d, hPMedia, i);
|
||||
}
|
||||
}
|
||||
});
|
||||
a(hPMedia.getPreview(), albumHolder);
|
||||
} else if (1 == mediaType) {
|
||||
final HPVideo hPVideo = (HPVideo) hPMedia;
|
||||
albumHolder.b.setVisibility(0);
|
||||
albumHolder.c.setText(Utils.a(hPVideo.getDuration()));
|
||||
albumHolder.d.setVisibility(hPVideo.getDuration() > 50499 ? 8 : 0);
|
||||
albumHolder.e.setVisibility(hPVideo.getDuration() > 50499 ? 0 : 8);
|
||||
albumHolder.e.setOnClickListener(new View.OnClickListener(this) { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
}
|
||||
});
|
||||
albumHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (AlbumRecyclerViewAdapter.this.c != null) {
|
||||
AlbumRecyclerViewAdapter.this.c.a(hPVideo, i);
|
||||
}
|
||||
}
|
||||
});
|
||||
a(hPVideo.getPath(), albumHolder);
|
||||
}
|
||||
albumHolder.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.choosePhotos.AlbumRecyclerViewAdapter.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (AlbumRecyclerViewAdapter.this.c != null) {
|
||||
AlbumOnClickListener albumOnClickListener = AlbumRecyclerViewAdapter.this.c;
|
||||
CheckBox checkBox = albumHolder.d;
|
||||
albumOnClickListener.a(checkBox, checkBox.isChecked(), hPMedia);
|
||||
AlbumRecyclerViewAdapter.this.notifyItemChanged(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (hPMedia.isSelected()) {
|
||||
albumHolder.d.setChecked(true);
|
||||
} else {
|
||||
albumHolder.d.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
return i == 0 ? new PhotographyHolder(View.inflate(this.b, R.layout.item_album_photography, null)) : new AlbumHolder(this, View.inflate(this.b, R.layout.item_album_layout, null));
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.d = str;
|
||||
}
|
||||
|
||||
public void a(List<HPMedia> list) {
|
||||
this.a = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void a(String str, AlbumHolder albumHolder) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(Integer.valueOf(R.mipmap.load_failed));
|
||||
a.a(new RequestOptions().b());
|
||||
a.a(albumHolder.a);
|
||||
} else {
|
||||
RequestBuilder<Drawable> a2 = Glide.e(JimuApplication.l()).a(str);
|
||||
a2.a(new RequestOptions().b().a(R.mipmap.load_failed));
|
||||
a2.a(albumHolder.a);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(AlbumOnClickListener albumOnClickListener) {
|
||||
this.c = albumOnClickListener;
|
||||
}
|
||||
}
|
18
sources/com/ubt/jimu/widgets/choosePhotos/BaseActivity.java
Normal file
18
sources/com/ubt/jimu/widgets/choosePhotos/BaseActivity.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.ScreenRotationManageActivity;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class BaseActivity extends ScreenRotationManageActivity {
|
||||
@Override // 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);
|
||||
try {
|
||||
getResources().getBoolean(R.bool.isTablet);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import java.util.Comparator;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HPMediaComparator implements Comparator<HPMedia> {
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(HPMedia hPMedia, HPMedia hPMedia2) {
|
||||
String str;
|
||||
if (hPMedia == null && hPMedia2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (hPMedia == null) {
|
||||
return 1;
|
||||
}
|
||||
if (hPMedia2 == null) {
|
||||
return -1;
|
||||
}
|
||||
String str2 = null;
|
||||
try {
|
||||
str = hPMedia.getModifyDate();
|
||||
} catch (Exception unused) {
|
||||
str = null;
|
||||
}
|
||||
try {
|
||||
str2 = hPMedia2.getModifyDate();
|
||||
} catch (Exception unused2) {
|
||||
}
|
||||
if (str == null) {
|
||||
return 1;
|
||||
}
|
||||
if (str2 == null) {
|
||||
return -1;
|
||||
}
|
||||
if (str.equals(str2)) {
|
||||
return 0;
|
||||
}
|
||||
if (!Utils.a(str) || !Utils.a(str2)) {
|
||||
if (Utils.a(str) || Utils.a(str2)) {
|
||||
return !Utils.a(str) ? 1 : -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
long parseLong = Long.parseLong(hPMedia.getModifyDate());
|
||||
long parseLong2 = Long.parseLong(hPMedia2.getModifyDate());
|
||||
if (parseLong == parseLong2) {
|
||||
return 0;
|
||||
}
|
||||
return parseLong > parseLong2 ? -1 : 1;
|
||||
}
|
||||
}
|
190
sources/com/ubt/jimu/widgets/choosePhotos/PreviewActivity.java
Normal file
190
sources/com/ubt/jimu/widgets/choosePhotos/PreviewActivity.java
Normal file
@@ -0,0 +1,190 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import com.bottle.hp.album.photoview.HackyViewPager;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.utils.TSnackbarUtils;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayerView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PreviewActivity extends SuperActivity implements View.OnClickListener, ViewPager.OnPageChangeListener {
|
||||
private ArrayList<HPMedia> a;
|
||||
ArrayList<HPMedia> b;
|
||||
private int c = 1;
|
||||
CheckBox cbChoose;
|
||||
private View d;
|
||||
private PreviewAdapter e;
|
||||
private String f;
|
||||
private int g;
|
||||
ImageView im_preview_back;
|
||||
HackyViewPager mHackyViewPager;
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public void initData() {
|
||||
Intent intent = getIntent();
|
||||
this.b = (ArrayList) intent.getSerializableExtra("selected");
|
||||
this.a = (ArrayList) SPUtils.c("data");
|
||||
this.c = intent.getIntExtra("startIndex", 1);
|
||||
this.g = intent.getIntExtra("selectedAmount", 10);
|
||||
this.e = new PreviewAdapter(this, this.a, this.b);
|
||||
this.e.a(this.a);
|
||||
this.mHackyViewPager.setOffscreenPageLimit(0);
|
||||
this.mHackyViewPager.setAdapter(this.e);
|
||||
this.mHackyViewPager.setCurrentItem(this.c);
|
||||
this.cbChoose.setChecked(this.a.get(this.c).isSelected());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public void initEvent() {
|
||||
this.im_preview_back.setOnClickListener(this);
|
||||
this.mHackyViewPager.setOnPageChangeListener(this);
|
||||
this.cbChoose.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.widgets.choosePhotos.PreviewActivity.1
|
||||
@Override // android.widget.CompoundButton.OnCheckedChangeListener
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
|
||||
if (z && PreviewActivity.this.b.size() >= PreviewActivity.this.g) {
|
||||
TSnackbarUtils.a(PreviewActivity.this.d, PreviewActivity.this.getString(R.string.choose_more_pictures));
|
||||
PreviewActivity.this.cbChoose.setChecked(false);
|
||||
return;
|
||||
}
|
||||
HPMedia hPMedia = (HPMedia) PreviewActivity.this.a.get(PreviewActivity.this.mHackyViewPager.getCurrentItem());
|
||||
if (z) {
|
||||
hPMedia.setSelected(true);
|
||||
Iterator<HPMedia> it = PreviewActivity.this.b.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().getId() == hPMedia.getId()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
PreviewActivity.this.b.add(hPMedia);
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= PreviewActivity.this.b.size()) {
|
||||
break;
|
||||
}
|
||||
if (hPMedia.getId() == PreviewActivity.this.b.get(i).getId()) {
|
||||
PreviewActivity.this.b.remove(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
hPMedia.setSelected(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
this.d = View.inflate(this, R.layout.activity_preview_layout, null);
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnCompleted) {
|
||||
Intent intent = new Intent();
|
||||
SPUtils.a("ResultDate", this.a);
|
||||
intent.putExtra("selected", this.b);
|
||||
setResult(105, intent);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (id != R.id.im_preview_back) {
|
||||
return;
|
||||
}
|
||||
Intent intent2 = new Intent();
|
||||
SPUtils.a("ResultDate", this.a);
|
||||
intent2.putExtra("selected", this.b);
|
||||
setResult(101, intent2);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrolled(int i, float f, int i2) {
|
||||
Map<String, UbtPlayerView> a;
|
||||
if (i == 0) {
|
||||
this.mHackyViewPager.setCurrentItem(1);
|
||||
}
|
||||
if (this.mHackyViewPager == null || (a = this.e.a()) == null || a.size() == 0) {
|
||||
return;
|
||||
}
|
||||
UbtPlayerView ubtPlayerView = a.get(i + "");
|
||||
if (ubtPlayerView == null) {
|
||||
return;
|
||||
}
|
||||
HPMedia hPMedia = this.a.get(i);
|
||||
if (hPMedia.isVideo()) {
|
||||
this.f = hPMedia.getPath();
|
||||
ubtPlayerView.setVideoPath(this.f);
|
||||
ubtPlayerView.f();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageSelected(int i) {
|
||||
ArrayList<HPMedia> arrayList = this.a;
|
||||
if (arrayList == null || arrayList.size() < i) {
|
||||
return;
|
||||
}
|
||||
HPMedia hPMedia = this.a.get(i);
|
||||
if (hPMedia.isSelected()) {
|
||||
this.cbChoose.setChecked(true);
|
||||
} else {
|
||||
this.cbChoose.setChecked(false);
|
||||
}
|
||||
Map<String, UbtPlayerView> a = this.e.a();
|
||||
if (a == null || a.size() == 0) {
|
||||
return;
|
||||
}
|
||||
if (a.get(i + "") == null) {
|
||||
return;
|
||||
}
|
||||
this.f = hPMedia.getPath();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
Map<String, UbtPlayerView> a;
|
||||
super.onPause();
|
||||
PreviewAdapter previewAdapter = this.e;
|
||||
if (previewAdapter == null || (a = previewAdapter.a()) == null || a.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<UbtPlayerView> it = a.values().iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().g();
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Activity activity, ArrayList<HPMedia> arrayList, ArrayList<HPMedia> arrayList2, int i, int i2) {
|
||||
Intent intent = new Intent(activity, (Class<?>) PreviewActivity.class);
|
||||
intent.putExtra("selected", arrayList2);
|
||||
intent.putExtra("selectedAmount", i);
|
||||
SPUtils.a("data", arrayList);
|
||||
intent.putExtra("startIndex", i2);
|
||||
activity.startActivityForResult(intent, 101);
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import butterknife.Unbinder;
|
||||
import com.bottle.hp.album.photoview.HackyViewPager;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PreviewActivity_ViewBinding implements Unbinder {
|
||||
private PreviewActivity b;
|
||||
|
||||
public PreviewActivity_ViewBinding(PreviewActivity previewActivity, View view) {
|
||||
this.b = previewActivity;
|
||||
previewActivity.cbChoose = (CheckBox) butterknife.internal.Utils.b(view, R.id.cbChoose, "field 'cbChoose'", CheckBox.class);
|
||||
previewActivity.mHackyViewPager = (HackyViewPager) butterknife.internal.Utils.b(view, R.id.hackyViewPager, "field 'mHackyViewPager'", HackyViewPager.class);
|
||||
previewActivity.im_preview_back = (ImageView) butterknife.internal.Utils.b(view, R.id.im_preview_back, "field 'im_preview_back'", ImageView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
PreviewActivity previewActivity = this.b;
|
||||
if (previewActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
previewActivity.cbChoose = null;
|
||||
previewActivity.mHackyViewPager = null;
|
||||
previewActivity.im_preview_back = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayerView;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PreviewAdapter extends PagerAdapter {
|
||||
private Activity a;
|
||||
private List<HPMedia> b;
|
||||
private Map<String, UbtPlayerView> c = new HashMap();
|
||||
|
||||
public PreviewAdapter(Activity activity, List<HPMedia> list, List<HPMedia> list2) {
|
||||
this.a = activity;
|
||||
this.b = list;
|
||||
}
|
||||
|
||||
public void a(List<HPMedia> list) {
|
||||
this.b = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
viewGroup.removeView((View) obj);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
List<HPMedia> list = this.b;
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public boolean isViewFromObject(View view, Object obj) {
|
||||
return view == obj;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public View instantiateItem(ViewGroup viewGroup, int i) {
|
||||
View inflate = View.inflate(this.a, R.layout.adapter_preview_layout, null);
|
||||
HPMedia hPMedia = this.b.get(i);
|
||||
int mediaType = hPMedia.getMediaType();
|
||||
PhotoView photoView = (PhotoView) inflate.findViewById(R.id.photoView);
|
||||
ImageView imageView = (ImageView) inflate.findViewById(R.id.im_play_bnt);
|
||||
inflate.findViewById(R.id.view_background).setVisibility(8);
|
||||
UbtPlayerView ubtPlayerView = (UbtPlayerView) inflate.findViewById(R.id.sv_play);
|
||||
if (mediaType == 0) {
|
||||
RequestBuilder<Drawable> a = Glide.a(this.a).a(hPMedia.getPath());
|
||||
a.a(new RequestOptions().b());
|
||||
a.a((ImageView) photoView);
|
||||
imageView.setVisibility(8);
|
||||
ubtPlayerView.setVisibility(8);
|
||||
} else if (mediaType == 1) {
|
||||
ubtPlayerView.setVisibility(0);
|
||||
Log.e("Test", "URL:" + hPMedia.getPath() + " position:" + i);
|
||||
photoView.setVisibility(8);
|
||||
imageView.setVisibility(8);
|
||||
this.c.put(i + "", ubtPlayerView);
|
||||
}
|
||||
viewGroup.addView(inflate, -1, -1);
|
||||
return inflate;
|
||||
}
|
||||
|
||||
public Map<String, UbtPlayerView> a() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
27
sources/com/ubt/jimu/widgets/choosePhotos/Utils.java
Normal file
27
sources/com/ubt/jimu/widgets/choosePhotos/Utils.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Utils {
|
||||
public static String a(long j) {
|
||||
long j2 = j / 1000;
|
||||
long j3 = j2 % 60;
|
||||
long j4 = (j2 / 60) % 60;
|
||||
long j5 = j2 / 3600;
|
||||
return j5 > 0 ? String.format("%d:%02d:%02d", Long.valueOf(j5), Long.valueOf(j4), Long.valueOf(j3)) : String.format("%02d:%02d", Long.valueOf(j4), Long.valueOf(j3));
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return Pattern.compile("[0-9]{1,}").matcher(str).matches();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,638 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.hardware.Camera;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import com.bottle.hp.album.capture.VideoFile;
|
||||
import com.bottle.hp.album.capture.VideoPreviewActivity;
|
||||
import com.bottle.hp.album.capture.camera.CameraWrapper;
|
||||
import com.bottle.hp.album.capture.camera.NativeCamera;
|
||||
import com.bottle.hp.album.capture.configuration.CaptureConfiguration;
|
||||
import com.bottle.hp.album.capture.configuration.PredefinedCaptureConfigurations$CaptureQuality;
|
||||
import com.bottle.hp.album.capture.configuration.PredefinedCaptureConfigurations$CaptureResolution;
|
||||
import com.bottle.hp.album.capture.preview.CapturePreviewInterface;
|
||||
import com.bottle.hp.album.capture.recorder.AlreadyUsedException;
|
||||
import com.bottle.hp.album.capture.recorder.VideoRecorder;
|
||||
import com.bottle.hp.album.capture.recorder.VideoRecorderInterface;
|
||||
import com.bottle.hp.album.capture.view.VideoCaptureView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayer;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import com.yanzhenjie.permission.Permission$Group;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class VideoCaptureActivity extends com.bottle.hp.album.BaseActivity implements Camera.PictureCallback, CapturePreviewInterface, VideoCaptureView.IVideoCaptureUIListener, VideoRecorderInterface, View.OnClickListener, Camera.PreviewCallback {
|
||||
private static int y = 50000;
|
||||
private VideoCaptureView d;
|
||||
private CameraWrapper e;
|
||||
private String g;
|
||||
private Timer l;
|
||||
private CaptureConfiguration p;
|
||||
private VideoRecorder q;
|
||||
private AlbumOrientationEventListener s;
|
||||
private int t;
|
||||
private TimeCounter u;
|
||||
private final String c = VideoCaptureActivity.class.getSimpleName();
|
||||
private int f = 5;
|
||||
private boolean h = false;
|
||||
private long i = 0;
|
||||
private boolean j = false;
|
||||
private long k = 0;
|
||||
private Handler m = new Handler();
|
||||
private boolean n = false;
|
||||
private VideoFile o = null;
|
||||
private int r = 0;
|
||||
private int v = 100;
|
||||
private boolean x = false;
|
||||
|
||||
private class AlbumOrientationEventListener extends OrientationEventListener {
|
||||
public AlbumOrientationEventListener(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
@Override // android.view.OrientationEventListener
|
||||
public void onOrientationChanged(int i) {
|
||||
int i2;
|
||||
if (i == -1 || (i2 = (((i + 45) / 90) * 90) % 360) == VideoCaptureActivity.this.t) {
|
||||
return;
|
||||
}
|
||||
VideoCaptureActivity.this.t = i2;
|
||||
ALog.a(VideoCaptureActivity.this.c).d("角度" + VideoCaptureActivity.this.t);
|
||||
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
|
||||
videoCaptureActivity.l(videoCaptureActivity.t);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
class StartRecordTask extends TimerTask {
|
||||
private StartRecordTask() {
|
||||
}
|
||||
|
||||
public /* synthetic */ void a() {
|
||||
VideoCaptureActivity.this.b(R.string.unsupport_recording, 2);
|
||||
}
|
||||
|
||||
@Override // java.util.TimerTask, java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
VideoCaptureActivity.this.x = false;
|
||||
VideoCaptureActivity.this.q.f();
|
||||
VideoCaptureActivity.this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.StartRecordTask.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (VideoCaptureActivity.this.e.c() == null) {
|
||||
VideoCaptureActivity.this.b(R.string.tips_ask_camera_permission, 2);
|
||||
} else {
|
||||
VideoCaptureActivity.this.d.d();
|
||||
}
|
||||
}
|
||||
}, 10L);
|
||||
} catch (AlreadyUsedException unused) {
|
||||
ALog.a(VideoCaptureActivity.this.c).b("Cannot toggle recording after cleaning up all resources", new Object[0]);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
ALog.a(VideoCaptureActivity.this.c).b(e.getMessage(), new Object[0]);
|
||||
VideoCaptureActivity.this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.a
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
VideoCaptureActivity.StartRecordTask.this.a();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TimeCounter extends CountDownTimer {
|
||||
private long a;
|
||||
|
||||
public TimeCounter(long j, long j2) {
|
||||
super(j, j2);
|
||||
this.a = 0L;
|
||||
}
|
||||
|
||||
public long a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.os.CountDownTimer
|
||||
public void onFinish() {
|
||||
VideoCaptureActivity.this.d.a(100);
|
||||
}
|
||||
|
||||
@Override // android.os.CountDownTimer
|
||||
public void onTick(long j) {
|
||||
int i = (int) (VideoCaptureActivity.y - j);
|
||||
this.a = i;
|
||||
VideoCaptureActivity.this.d.a((i * 100) / VideoCaptureActivity.y);
|
||||
}
|
||||
}
|
||||
|
||||
private void G0() {
|
||||
TimeCounter timeCounter = this.u;
|
||||
if (timeCounter != null) {
|
||||
timeCounter.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public static String H0() {
|
||||
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + File.separator + "Jimu");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
private File I0() {
|
||||
this.g = H0() + File.separator + com.bottle.hp.album.Utils.a() + ".png";
|
||||
return new File(this.g);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void J0() {
|
||||
try {
|
||||
if (this.q != null) {
|
||||
this.d.getPreviewSurfaceHolder().removeCallback(this.q.b());
|
||||
this.q.d();
|
||||
}
|
||||
this.e = new CameraWrapper(new NativeCamera(), ((WindowManager) getSystemService("window")).getDefaultDisplay().getRotation(), this.r, this);
|
||||
this.o = a((Bundle) null);
|
||||
this.q = new VideoRecorder(this, this.p, this.o, this.e, this.d.getPreviewSurfaceHolder());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void K0() {
|
||||
if (System.currentTimeMillis() - this.k < 1000) {
|
||||
return;
|
||||
}
|
||||
if (this.e.c() != null) {
|
||||
try {
|
||||
this.e.a((Camera.ShutterCallback) null, (Camera.PictureCallback) null, this);
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, "拍照失败:" + e.getMessage());
|
||||
b(R.string.tips_ask_camera_permission, 2);
|
||||
}
|
||||
} else {
|
||||
Log.e(this.c, "camera 对象为空");
|
||||
b(R.string.tips_ask_camera_permission, 2);
|
||||
}
|
||||
this.k = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private boolean L0() {
|
||||
TimeCounter timeCounter = this.u;
|
||||
if (timeCounter == null || timeCounter.a() >= 1500) {
|
||||
return false;
|
||||
}
|
||||
K0();
|
||||
VideoFile videoFile = this.o;
|
||||
if (videoFile != null && videoFile.a().exists()) {
|
||||
this.o.a().delete();
|
||||
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.d = (VideoCaptureView) findViewById(R.id.videoCaptureView);
|
||||
this.d.setUIListener(this);
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void B0() {
|
||||
if (this.r == 0) {
|
||||
this.r = 1;
|
||||
} else {
|
||||
this.r = 0;
|
||||
}
|
||||
J0();
|
||||
}
|
||||
|
||||
protected CaptureConfiguration E0() {
|
||||
CaptureConfiguration captureConfiguration = (CaptureConfiguration) getIntent().getParcelableExtra("com.bottle.extracaptureconfiguration");
|
||||
if (captureConfiguration != null) {
|
||||
return captureConfiguration;
|
||||
}
|
||||
CaptureConfiguration captureConfiguration2 = new CaptureConfiguration();
|
||||
ALog.a(this.c).d("No captureconfiguration passed - using default configuration");
|
||||
return captureConfiguration2;
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
|
||||
public void f0() {
|
||||
if (!this.j) {
|
||||
this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
VideoCaptureActivity.this.q.a("user cancel");
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.g = null;
|
||||
ALog.a(this.c).d("开始录制");
|
||||
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
|
||||
videoCaptureActivity.u = videoCaptureActivity.new TimeCounter(VideoCaptureActivity.y, VideoCaptureActivity.this.v);
|
||||
VideoCaptureActivity.this.u.start();
|
||||
}
|
||||
}, 300L);
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void h0() {
|
||||
this.j = true;
|
||||
if (this.f == 1) {
|
||||
return;
|
||||
}
|
||||
this.i = System.currentTimeMillis();
|
||||
this.l = new Timer();
|
||||
this.l.schedule(new StartRecordTask(), 300L);
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
|
||||
public boolean j0() {
|
||||
return JimuPermissionRequest.b(this, Permission$Group.c);
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
|
||||
public void l(String str) {
|
||||
ALog.a(this.c).d("停止录制");
|
||||
G0();
|
||||
if (this.x) {
|
||||
this.g = "";
|
||||
} else {
|
||||
if (L0()) {
|
||||
return;
|
||||
}
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
|
||||
public void m(String str) {
|
||||
ALog.a(this.c).d("录制失败");
|
||||
G0();
|
||||
setResult(0);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (101 == i) {
|
||||
if (i2 == -1) {
|
||||
x0();
|
||||
} else {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void onCancel() {
|
||||
VideoFile videoFile = this.o;
|
||||
if (videoFile != null && videoFile.a().exists()) {
|
||||
this.o.a().delete();
|
||||
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.g)) {
|
||||
File file = new File(this.g);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
|
||||
}
|
||||
}
|
||||
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
VideoCaptureActivity.this.J0();
|
||||
}
|
||||
}, 10L);
|
||||
this.m.postDelayed(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
VideoCaptureActivity.this.d.b();
|
||||
}
|
||||
}, 500L);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.BaseActivity, 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_video_capture);
|
||||
c(bundle);
|
||||
initView();
|
||||
this.s = new AlbumOrientationEventListener(this, 3);
|
||||
if (this.s.canDetectOrientation()) {
|
||||
this.s.enable();
|
||||
} else {
|
||||
Log.e(this.c, "Can't Detect Orientation");
|
||||
}
|
||||
this.f = getIntent().getIntExtra("recordType", 5);
|
||||
int i = this.f;
|
||||
if (i == 1) {
|
||||
this.d.c();
|
||||
} else if (i == 2) {
|
||||
this.d.e();
|
||||
} else {
|
||||
this.d.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
this.m.removeCallbacksAndMessages(null);
|
||||
this.m = null;
|
||||
VideoRecorder videoRecorder = this.q;
|
||||
if (videoRecorder != null) {
|
||||
videoRecorder.d();
|
||||
}
|
||||
this.s.disable();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (this.j) {
|
||||
return true;
|
||||
}
|
||||
if (i != 4) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
setResult(0);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.hardware.Camera.PictureCallback
|
||||
public void onPictureTaken(byte[] bArr, Camera camera) {
|
||||
a(bArr);
|
||||
}
|
||||
|
||||
@Override // android.hardware.Camera.PreviewCallback
|
||||
public void onPreviewFrame(byte[] bArr, Camera camera) {
|
||||
if (bArr == null || bArr.length == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
public void onSaveInstanceState(Bundle bundle) {
|
||||
bundle.putBoolean("com.bottle.savedrecordedboolean", this.n);
|
||||
bundle.putString("com.bottle.savedoutputfilename", this.o.b());
|
||||
super.onSaveInstanceState(bundle);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
super.onWindowFocusChanged(z);
|
||||
if (this.h) {
|
||||
return;
|
||||
}
|
||||
this.h = true;
|
||||
J0();
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void r0() {
|
||||
this.j = false;
|
||||
if (this.f == 1) {
|
||||
K0();
|
||||
return;
|
||||
}
|
||||
this.l.cancel();
|
||||
if (System.currentTimeMillis() - this.i >= 300) {
|
||||
this.q.a("stop recoding");
|
||||
} else if (this.f == 5) {
|
||||
K0();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void t0() {
|
||||
VideoPreviewActivity.a(this, 1001, this.o.b());
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.recorder.VideoRecorderInterface
|
||||
public void u0() {
|
||||
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.o.a())));
|
||||
this.x = true;
|
||||
if (this.u.a() < 1500) {
|
||||
this.x = false;
|
||||
} else {
|
||||
this.m.post(new Runnable() { // from class: com.ubt.jimu.widgets.choosePhotos.VideoCaptureActivity.5
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
VideoCaptureActivity videoCaptureActivity = VideoCaptureActivity.this;
|
||||
UbtPlayer.a(videoCaptureActivity, 101, null, videoCaptureActivity.o.b(), true);
|
||||
try {
|
||||
VideoCaptureActivity.this.e.j();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void x0() {
|
||||
Intent intent = new Intent();
|
||||
if (TextUtils.isEmpty(this.g)) {
|
||||
intent.putExtra("data", this.o.b());
|
||||
intent.putExtra("data_type", 1);
|
||||
} else {
|
||||
intent.putExtra("data", this.g);
|
||||
intent.putExtra("data_type", 0);
|
||||
}
|
||||
setResult(-1, intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.view.VideoCaptureView.IVideoCaptureUIListener
|
||||
public void y0() {
|
||||
if (this.j) {
|
||||
return;
|
||||
}
|
||||
setResult(0);
|
||||
finish();
|
||||
}
|
||||
|
||||
public static CaptureConfiguration c(int i, int i2) {
|
||||
PredefinedCaptureConfigurations$CaptureResolution predefinedCaptureConfigurations$CaptureResolution = PredefinedCaptureConfigurations$CaptureResolution.RES_720P;
|
||||
PredefinedCaptureConfigurations$CaptureQuality predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.LOW;
|
||||
if (i2 != 1) {
|
||||
if (i2 == 2) {
|
||||
predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.MEDIUM;
|
||||
} else if (i2 == 3) {
|
||||
predefinedCaptureConfigurations$CaptureQuality = PredefinedCaptureConfigurations$CaptureQuality.HIGH;
|
||||
}
|
||||
}
|
||||
return new CaptureConfiguration(predefinedCaptureConfigurations$CaptureResolution, predefinedCaptureConfigurations$CaptureQuality, i, -1);
|
||||
}
|
||||
|
||||
@Override // com.bottle.hp.album.capture.preview.CapturePreviewInterface
|
||||
public void i() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private boolean b(Bundle bundle) {
|
||||
if (bundle == null) {
|
||||
return false;
|
||||
}
|
||||
return bundle.getBoolean("com.bottle.savedrecordedboolean", false);
|
||||
}
|
||||
|
||||
public static void a(Activity activity, int i, int i2) {
|
||||
Intent intent = new Intent(activity, (Class<?>) VideoCaptureActivity.class);
|
||||
intent.putExtra("com.bottle.extracaptureconfiguration", c(y / 1000, 1));
|
||||
intent.putExtra("com.bottle.extraoutputfilename", H0());
|
||||
intent.putExtra("recordType", i2);
|
||||
activity.startActivityForResult(intent, i);
|
||||
}
|
||||
|
||||
private void c(Bundle bundle) {
|
||||
this.p = E0();
|
||||
this.n = b(bundle);
|
||||
this.o = a(bundle);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void l(int i) {
|
||||
int i2;
|
||||
CameraWrapper cameraWrapper = this.e;
|
||||
if (cameraWrapper == null || cameraWrapper.c() == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Camera.Parameters parameters = this.e.c().getParameters();
|
||||
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
||||
Camera.getCameraInfo(this.r, cameraInfo);
|
||||
int i3 = ((i + 45) / 90) * 90;
|
||||
if (cameraInfo.facing == 1) {
|
||||
i2 = ((cameraInfo.orientation - i3) + 360) % 360;
|
||||
} else {
|
||||
i2 = (cameraInfo.orientation + i3) % 360;
|
||||
}
|
||||
parameters.setRotation(i2);
|
||||
this.e.c().setParameters(parameters);
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:45:0x002e -> B:9:0x0079). Please report as a decompilation issue!!! */
|
||||
private void a(byte[] bArr) {
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
try {
|
||||
File I0 = I0();
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(I0);
|
||||
try {
|
||||
fileOutputStream2.write(bArr);
|
||||
a(I0);
|
||||
fileOutputStream2.close();
|
||||
} catch (FileNotFoundException e2) {
|
||||
e = e2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, "File not found: " + e.getMessage());
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
}
|
||||
} catch (IOException e3) {
|
||||
e = e3;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, "Error accessing file: " + e.getMessage());
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
}
|
||||
} catch (Exception e4) {
|
||||
e = e4;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
e.printStackTrace();
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (Exception e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (FileNotFoundException e6) {
|
||||
e = e6;
|
||||
} catch (IOException e7) {
|
||||
e = e7;
|
||||
} catch (Exception e8) {
|
||||
e = e8;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(File file) {
|
||||
try {
|
||||
sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file)));
|
||||
this.e.j();
|
||||
this.d.a(file.getAbsolutePath(), 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(this.c, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected VideoFile a(Bundle bundle) {
|
||||
if (bundle != null) {
|
||||
return new VideoFile(bundle.getString("com.bottle.savedoutputfilename"));
|
||||
}
|
||||
return new VideoFile(VideoFile.a(getIntent().getStringExtra("com.bottle.extraoutputfilename")));
|
||||
}
|
||||
}
|
93
sources/com/ubt/jimu/widgets/choosePhotos/media/HPAudio.java
Normal file
93
sources/com/ubt/jimu/widgets/choosePhotos/media/HPAudio.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.provider.MediaStore;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HPAudio extends HPMedia implements Serializable {
|
||||
private String album;
|
||||
private String artist;
|
||||
private long duration;
|
||||
|
||||
public HPAudio() {
|
||||
this.mediaType = 2;
|
||||
}
|
||||
|
||||
public static List<HPAudio> getAudios(Context context) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (context == null) {
|
||||
return arrayList;
|
||||
}
|
||||
Cursor query = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"}, null, null, "date_modified DESC");
|
||||
if (query != null) {
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("album");
|
||||
int columnIndex8 = query.getColumnIndex("artist");
|
||||
int columnIndex9 = query.getColumnIndex("duration");
|
||||
int columnIndex10 = query.getColumnIndex("date_modified");
|
||||
while (query.moveToNext()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
String string3 = query.getString(columnIndex4);
|
||||
String string4 = query.getString(columnIndex5);
|
||||
long j = query.getLong(columnIndex6);
|
||||
String string5 = query.getString(columnIndex7);
|
||||
String string6 = query.getString(columnIndex8);
|
||||
int i2 = columnIndex;
|
||||
long j2 = query.getInt(columnIndex9);
|
||||
int i3 = columnIndex3;
|
||||
HPAudio hPAudio = new HPAudio(i, string, string2, string3, string4, j, "", query.getString(columnIndex10));
|
||||
hPAudio.setAlbum(string5);
|
||||
hPAudio.setArtist(string6);
|
||||
hPAudio.setDuration(j2);
|
||||
arrayList.add(hPAudio);
|
||||
columnIndex = i2;
|
||||
columnIndex2 = columnIndex2;
|
||||
columnIndex3 = i3;
|
||||
columnIndex4 = columnIndex4;
|
||||
}
|
||||
query.close();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public String getAlbum() {
|
||||
return this.album;
|
||||
}
|
||||
|
||||
public String getArtist() {
|
||||
return this.artist;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
public void setAlbum(String str) {
|
||||
this.album = str;
|
||||
}
|
||||
|
||||
public void setArtist(String str) {
|
||||
this.artist = str;
|
||||
}
|
||||
|
||||
public void setDuration(long j) {
|
||||
this.duration = j;
|
||||
}
|
||||
|
||||
public HPAudio(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
|
||||
super(i, str, str2, str3, str4, j, str5, str6);
|
||||
this.mediaType = 2;
|
||||
}
|
||||
}
|
70
sources/com/ubt/jimu/widgets/choosePhotos/media/HPImage.java
Normal file
70
sources/com/ubt/jimu/widgets/choosePhotos/media/HPImage.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.provider.MediaStore;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HPImage extends HPMedia implements Serializable {
|
||||
private static final String TAG = HPMedia.class.getSimpleName();
|
||||
private static String[] thumbColumns = {FileDownloadModel.ID, "image_id", "_data"};
|
||||
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "date_modified"};
|
||||
|
||||
public HPImage() {
|
||||
this.mediaType = 0;
|
||||
}
|
||||
|
||||
public static List<HPMedia> getImages(Context context) {
|
||||
Cursor query;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (context != null && (query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) != null) {
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("date_modified");
|
||||
while (query.moveToNext()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
arrayList.add(new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7)));
|
||||
}
|
||||
query.close();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static HPMedia searchImageByName(Context context, String str) {
|
||||
Cursor query = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
|
||||
HPImage hPImage = null;
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("date_modified");
|
||||
if (query.moveToNext()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
hPImage = new HPImage(i, string, query.getString(columnIndex4), query.getString(columnIndex5), string2, query.getLong(columnIndex6), string2, query.getString(columnIndex7));
|
||||
}
|
||||
query.close();
|
||||
return hPImage;
|
||||
}
|
||||
|
||||
public HPImage(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
|
||||
super(i, str, str2, str3, str4, j, str5, str6);
|
||||
this.mediaType = 0;
|
||||
}
|
||||
}
|
136
sources/com/ubt/jimu/widgets/choosePhotos/media/HPMedia.java
Normal file
136
sources/com/ubt/jimu/widgets/choosePhotos/media/HPMedia.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos.media;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HPMedia implements Serializable {
|
||||
public static final int MEDIA_TYPE_AUDIO = 2;
|
||||
public static final int MEDIA_TYPE_IMAGE = 0;
|
||||
public static final int MEDIA_TYPE_NONE = -1;
|
||||
public static final int MEDIA_TYPE_VIDEO = 1;
|
||||
protected String compressPath;
|
||||
protected String displayName;
|
||||
protected int id;
|
||||
protected int mediaType;
|
||||
protected String mimeType;
|
||||
protected String modifyDate;
|
||||
protected String path;
|
||||
protected String preview;
|
||||
protected boolean selected;
|
||||
protected long size;
|
||||
protected String title;
|
||||
|
||||
public HPMedia() {
|
||||
}
|
||||
|
||||
public String getCompressPath() {
|
||||
return this.compressPath;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getMediaType() {
|
||||
return this.mediaType;
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return this.mimeType;
|
||||
}
|
||||
|
||||
public String getModifyDate() {
|
||||
return this.modifyDate;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public String getPreview() {
|
||||
return this.preview;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return this.selected;
|
||||
}
|
||||
|
||||
public boolean isVideo() {
|
||||
return this.mediaType == 1;
|
||||
}
|
||||
|
||||
public void setCompressPath(String str) {
|
||||
this.compressPath = str;
|
||||
}
|
||||
|
||||
public void setDisplayName(String str) {
|
||||
this.displayName = str;
|
||||
}
|
||||
|
||||
public void setId(int i) {
|
||||
this.id = i;
|
||||
}
|
||||
|
||||
public void setMediaType(int i) {
|
||||
this.mediaType = i;
|
||||
}
|
||||
|
||||
public void setMimeType(String str) {
|
||||
this.mimeType = str;
|
||||
}
|
||||
|
||||
public void setModifyDate(String str) {
|
||||
this.modifyDate = str;
|
||||
}
|
||||
|
||||
public void setPath(String str) {
|
||||
this.path = str;
|
||||
}
|
||||
|
||||
public void setPreview(String str) {
|
||||
this.preview = str;
|
||||
}
|
||||
|
||||
public void setSelected(boolean z) {
|
||||
this.selected = z;
|
||||
}
|
||||
|
||||
public void setSize(long j) {
|
||||
this.size = j;
|
||||
}
|
||||
|
||||
public void setTitle(String str) {
|
||||
this.title = str;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "HPMedia{id=" + this.id + ", title='" + this.title + "', displayName='" + this.displayName + "', mimeType='" + this.mimeType + "', path='" + this.path + "', size=" + this.size + ", modifyDate='" + this.modifyDate + "', preview='" + this.preview + "', selected=" + this.selected + ", mediaType=" + this.mediaType + '}';
|
||||
}
|
||||
|
||||
public HPMedia(int i) {
|
||||
this.id = i;
|
||||
}
|
||||
|
||||
public HPMedia(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
|
||||
this.id = i;
|
||||
this.title = str;
|
||||
this.displayName = str2;
|
||||
this.mimeType = str3;
|
||||
this.path = str4;
|
||||
this.size = j;
|
||||
this.preview = str5;
|
||||
this.modifyDate = str6;
|
||||
}
|
||||
}
|
239
sources/com/ubt/jimu/widgets/choosePhotos/media/HPVideo.java
Normal file
239
sources/com/ubt/jimu/widgets/choosePhotos/media/HPVideo.java
Normal file
@@ -0,0 +1,239 @@
|
||||
package com.ubt.jimu.widgets.choosePhotos.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.ubtech.utils.BitmapFile;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HPVideo extends HPMedia implements Serializable {
|
||||
private static String[] projection = {FileDownloadModel.ID, "title", "_data", "_display_name", "mime_type", "_size", "album", "artist", "duration", "date_modified"};
|
||||
private static String[] thumbColumns = {FileDownloadModel.ID, "video_id", "_data"};
|
||||
private String album;
|
||||
private String artist;
|
||||
private long duration;
|
||||
|
||||
public HPVideo() {
|
||||
super(0, "title", "displayName", "mimeType", "", 0L, "", "");
|
||||
this.mediaType = 1;
|
||||
}
|
||||
|
||||
private static void createThumbnail(HPMedia hPMedia) {
|
||||
String path = hPMedia.getPath();
|
||||
Bitmap createVideoThumbnail = ThumbnailUtils.createVideoThumbnail(path, 3);
|
||||
if (createVideoThumbnail != null) {
|
||||
String str = path.substring(0, path.lastIndexOf(".")) + ".jpg";
|
||||
try {
|
||||
BitmapFile.a(createVideoThumbnail, str);
|
||||
hPMedia.setPreview(str);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static long getVideoDuration(String str) {
|
||||
try {
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
mediaMetadataRetriever.setDataSource(str);
|
||||
return Long.parseLong(mediaMetadataRetriever.extractMetadata(9));
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public static HPMedia getVideoThumnail(Context context, HPMedia hPMedia) {
|
||||
Cursor query = context.getContentResolver().query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, thumbColumns, "video_id=?", new String[]{hPMedia.getId() + ""}, null);
|
||||
if (query == null || !query.moveToFirst()) {
|
||||
createThumbnail(hPMedia);
|
||||
} else {
|
||||
String string = query.getString(query.getColumnIndex("_data"));
|
||||
if (TextUtils.isEmpty(string)) {
|
||||
createThumbnail(hPMedia);
|
||||
} else if (new File(string).exists()) {
|
||||
hPMedia.setPreview(string);
|
||||
} else {
|
||||
createThumbnail(hPMedia);
|
||||
}
|
||||
}
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
return hPMedia;
|
||||
}
|
||||
|
||||
public static List<HPMedia> getVideos(Context context) {
|
||||
Cursor query;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (context == null || (query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, null, null, "date_modified DESC")) == null) {
|
||||
return arrayList;
|
||||
}
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("album");
|
||||
int columnIndex8 = query.getColumnIndex("artist");
|
||||
int columnIndex9 = query.getColumnIndex("duration");
|
||||
int columnIndex10 = query.getColumnIndex("date_modified");
|
||||
if (query.moveToFirst()) {
|
||||
while (true) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
String string3 = query.getString(columnIndex4);
|
||||
String string4 = query.getString(columnIndex5);
|
||||
long j = query.getLong(columnIndex6);
|
||||
String string5 = query.getString(columnIndex7);
|
||||
String string6 = query.getString(columnIndex8);
|
||||
int i2 = columnIndex;
|
||||
int i3 = columnIndex2;
|
||||
long j2 = query.getInt(columnIndex9);
|
||||
int i4 = columnIndex3;
|
||||
int i5 = columnIndex4;
|
||||
HPVideo hPVideo = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
|
||||
hPVideo.setAlbum(string5);
|
||||
hPVideo.setArtist(string6);
|
||||
hPVideo.setDuration(j2);
|
||||
arrayList.add(hPVideo);
|
||||
if (!query.moveToNext()) {
|
||||
break;
|
||||
}
|
||||
columnIndex = i2;
|
||||
columnIndex2 = i3;
|
||||
columnIndex3 = i4;
|
||||
columnIndex4 = i5;
|
||||
}
|
||||
}
|
||||
query.close();
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static HPVideo searchVideoByName(Context context, String str) {
|
||||
Cursor query = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, "_data=?", new String[]{str + ""}, null);
|
||||
HPVideo hPVideo = null;
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
int columnIndex = query.getColumnIndex(FileDownloadModel.ID);
|
||||
int columnIndex2 = query.getColumnIndex("title");
|
||||
int columnIndex3 = query.getColumnIndex("_data");
|
||||
int columnIndex4 = query.getColumnIndex("_display_name");
|
||||
int columnIndex5 = query.getColumnIndex("mime_type");
|
||||
int columnIndex6 = query.getColumnIndex("_size");
|
||||
int columnIndex7 = query.getColumnIndex("album");
|
||||
int columnIndex8 = query.getColumnIndex("artist");
|
||||
int columnIndex9 = query.getColumnIndex("duration");
|
||||
int columnIndex10 = query.getColumnIndex("date_modified");
|
||||
if (query.moveToFirst()) {
|
||||
int i = query.getInt(columnIndex);
|
||||
String string = query.getString(columnIndex2);
|
||||
String string2 = query.getString(columnIndex3);
|
||||
String string3 = query.getString(columnIndex4);
|
||||
String string4 = query.getString(columnIndex5);
|
||||
long j = query.getLong(columnIndex6);
|
||||
String string5 = query.getString(columnIndex7);
|
||||
String string6 = query.getString(columnIndex8);
|
||||
long j2 = query.getInt(columnIndex9);
|
||||
HPVideo hPVideo2 = new HPVideo(i, string, string3, string4, string2, j, "", query.getString(columnIndex10));
|
||||
hPVideo2.setAlbum(string5);
|
||||
hPVideo2.setArtist(string6);
|
||||
hPVideo2.setDuration(j2);
|
||||
hPVideo = hPVideo2;
|
||||
}
|
||||
query.close();
|
||||
return hPVideo;
|
||||
}
|
||||
|
||||
public String getAlbum() {
|
||||
return this.album;
|
||||
}
|
||||
|
||||
public String getArtist() {
|
||||
return this.artist;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:13:0x001f, code lost:
|
||||
|
||||
if (r1 == null) goto L15;
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:17:0x0026 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public android.graphics.Bitmap getFirstFrame() {
|
||||
/*
|
||||
r4 = this;
|
||||
r0 = 0
|
||||
android.media.MediaMetadataRetriever r1 = new android.media.MediaMetadataRetriever // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
|
||||
r1.<init>() // Catch: java.lang.Throwable -> L15 java.lang.Exception -> L1a
|
||||
java.lang.String r2 = r4.path // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
|
||||
r1.setDataSource(r2) // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
|
||||
android.graphics.Bitmap r0 = r1.getFrameAtTime() // Catch: java.lang.Exception -> L13 java.lang.Throwable -> L23
|
||||
Lf:
|
||||
r1.release()
|
||||
goto L22
|
||||
L13:
|
||||
r2 = move-exception
|
||||
goto L1c
|
||||
L15:
|
||||
r1 = move-exception
|
||||
r3 = r1
|
||||
r1 = r0
|
||||
r0 = r3
|
||||
goto L24
|
||||
L1a:
|
||||
r2 = move-exception
|
||||
r1 = r0
|
||||
L1c:
|
||||
r2.printStackTrace() // Catch: java.lang.Throwable -> L23
|
||||
if (r1 == 0) goto L22
|
||||
goto Lf
|
||||
L22:
|
||||
return r0
|
||||
L23:
|
||||
r0 = move-exception
|
||||
L24:
|
||||
if (r1 == 0) goto L29
|
||||
r1.release()
|
||||
L29:
|
||||
throw r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.widgets.choosePhotos.media.HPVideo.getFirstFrame():android.graphics.Bitmap");
|
||||
}
|
||||
|
||||
public void setAlbum(String str) {
|
||||
this.album = str;
|
||||
}
|
||||
|
||||
public void setArtist(String str) {
|
||||
this.artist = str;
|
||||
}
|
||||
|
||||
public void setDuration(long j) {
|
||||
this.duration = j;
|
||||
}
|
||||
|
||||
public HPVideo(int i, String str, String str2, String str3, String str4, long j, String str5, String str6) {
|
||||
super(i, str, str2, str3, str4, j, str5, str6);
|
||||
this.mediaType = 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user