正在查看: SpinDisplay v2.0.2.6 应用的 MediaCloudPreviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: SpinDisplay v2.0.2.6 应用的 MediaCloudPreviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.dmz.f20ad.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.VideoView;
import b.b.k.l;
import b.u.c;
import b.u.y;
import butterknife.ButterKnife;
import com.dmz.f20ad.App;
import com.dmz.f20ad.activity.MediaCloudPreviewActivity;
import com.dmz.f20ad.model.CloudFile;
import com.dmz.f20ad.model.CloudFileDao;
import com.dmz.f20ad.model.CloudVideo;
import com.dmz.f20ad.model.LocalResource;
import com.dmz.f20ad.model.MediaFile;
import d.e.a.n.y2;
import d.e.a.n.z2;
import d.e.a.r.d;
import g.a.e;
import g.a.n.a;
import g.a.p.b;
import j.a0;
import j.b0;
import j.f0;
import j.h0;
import j.l0.f.f;
import j.r;
import j.v;
import j.y;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.PublicKey;
import java.text.DecimalFormat;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import javax.crypto.Cipher;
import me.zhanghai.android.materialprogressbar.SingleCircularProgressDrawable;
public class MediaCloudPreviewActivity extends l {
public ProgressBar mDownloadingProgress;
public TextView mDownloadingProgressText;
public RelativeLayout mDownloadingView;
public TextView mDuration;
public TextView mName;
public TextView mNotWifiIndicationAction;
public TextView mNotWifiIndicationText;
public LinearLayout mNotWifiIndicationView;
public TextView mPriceView;
public TextView mSave;
public ImageView mThumbnail;
public ProgressBar mVideoProgress;
public VideoView mVideoView;
public d.a s;
public File t;
public int u;
public int v;
public int w;
public a x;
public CloudVideo y;
public Boolean z = false;
public f0 a(v.a aVar) {
f fVar = (f) aVar;
f0 a2 = fVar.a(fVar.f6748f);
f0.a j2 = a2.j();
j2.f6594g = new d(a2.f6582h, this.s, 0);
return j2.a();
}
public Object a(h0 h0Var) {
Throwable th;
FileOutputStream fileOutputStream;
IOException e2;
FileNotFoundException e3;
InputStream i2 = h0Var.i();
OutputStream outputStream = null;
try {
try {
fileOutputStream = new FileOutputStream(this.t);
try {
byte[] bArr = new byte[4096];
while (true) {
int read = i2.read(bArr);
if (read == -1) {
try {
break;
} catch (IOException e4) {
e = e4;
e.printStackTrace();
h0Var.close();
return new Object();
}
}
fileOutputStream.write(bArr, 0, read);
}
i2.close();
fileOutputStream.close();
} catch (FileNotFoundException e5) {
e3 = e5;
e3.printStackTrace();
try {
i2.close();
fileOutputStream.close();
} catch (IOException e6) {
e = e6;
e.printStackTrace();
h0Var.close();
return new Object();
}
h0Var.close();
return new Object();
} catch (IOException e7) {
e2 = e7;
e2.printStackTrace();
this.t.delete();
finish();
try {
i2.close();
fileOutputStream.close();
} catch (IOException e8) {
e = e8;
e.printStackTrace();
h0Var.close();
return new Object();
}
h0Var.close();
return new Object();
}
} catch (Throwable th2) {
th = th2;
try {
i2.close();
outputStream.close();
} catch (IOException e9) {
e9.printStackTrace();
}
h0Var.close();
throw th;
}
} catch (FileNotFoundException e10) {
fileOutputStream = null;
e3 = e10;
} catch (IOException e11) {
fileOutputStream = null;
e2 = e11;
} catch (Throwable th3) {
th = th3;
i2.close();
outputStream.close();
h0Var.close();
throw th;
}
h0Var.close();
return new Object();
}
public void a(int i2, Long l2) {
this.mVideoProgress.setProgress((this.mVideoView.getCurrentPosition() * 100) / i2);
}
public void a(long j2, long j3) {
float f2 = (j2 * 100.0f) / j3;
this.mDownloadingProgress.setIndeterminate(false);
this.mDownloadingProgress.setProgress((int) f2);
this.mDownloadingProgressText.setText(getString(2131755073, new Object[]{new DecimalFormat("0.0").format(f2)}));
}
public void a(final long j2, final long j3, boolean z) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
MediaCloudPreviewActivity.this.a(j2, j3);
}
});
}
public void a(MediaPlayer mediaPlayer) {
mediaPlayer.start();
mediaPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() {
@Override
public final boolean onInfo(MediaPlayer mediaPlayer2, int i2, int i3) {
return MediaCloudPreviewActivity.this.a(mediaPlayer2, i2, i3);
}
});
}
public void a(Object obj) {
this.mDownloadingView.setVisibility(8);
w();
}
public boolean a(MediaPlayer mediaPlayer, int i2, int i3) {
if (i2 != 3) {
return false;
}
this.mThumbnail.animate().alpha(SingleCircularProgressDrawable.START_ANGLE_MAX_NORMAL).setDuration(300L).setListener(new y2(this));
mediaPlayer.setVolume(SingleCircularProgressDrawable.START_ANGLE_MAX_NORMAL, SingleCircularProgressDrawable.START_ANGLE_MAX_NORMAL);
final int duration = mediaPlayer.getDuration();
this.x.c(e.a(100L, TimeUnit.MILLISECONDS).a(g.a.m.b.a.a()).b(new b() {
@Override
public final void a(Object obj) {
MediaCloudPreviewActivity.this.a(duration, (Long) obj);
}
}));
return true;
}
public void b(final h0 h0Var) {
this.mNotWifiIndicationView.setVisibility(8);
this.mDownloadingView.setVisibility(0);
this.x.c(e.a(new Callable() {
@Override
public final Object call() {
return MediaCloudPreviewActivity.this.a(h0Var);
}
}).a(c.f2548a).b(new b() {
@Override
public final void a(Object obj) {
MediaCloudPreviewActivity.this.a(obj);
}
}));
}
public boolean b(MediaPlayer mediaPlayer, int i2, int i3) {
this.mVideoView.stopPlayback();
y.e(2131755260);
return true;
}
public void doClick(View view) {
int i2;
int id = view.getId();
if (id != 2131296416) {
if (id != 2131296704) {
return;
}
CloudFileDao cloudFileDao = App.f2838g.c().getCloudFileDao();
if (this.z.booleanValue()) {
cloudFileDao.deleteByKey(Long.valueOf(this.y.id));
i2 = 2131755083;
} else {
File file = new File(getExternalFilesDir(null).getPath(), "thumbnail");
if (!file.exists()) {
file.mkdirs();
}
File file2 = new File(file, this.u + ".bin");
if (!file2.exists()) {
try {
Bitmap bitmap = ((BitmapDrawable) this.mThumbnail.getDrawable()).getBitmap();
FileOutputStream fileOutputStream = new FileOutputStream(file2);
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
} catch (Exception e2) {
StringBuilder a2 = d.b.a.a.a.a("doClick: ");
a2.append(e2.getMessage());
Log.d("wyt", a2.toString());
}
}
Long valueOf = Long.valueOf(this.y.id);
int i3 = CloudFile.FILE_TYPE_VIDEO;
CloudVideo cloudVideo = this.y;
String str = cloudVideo.name;
String str2 = cloudVideo.name_en;
int i4 = cloudVideo.size;
String absolutePath = this.t.getAbsolutePath();
CloudVideo cloudVideo2 = this.y;
App.f2838g.c().getLocalResourceDao().insert(new LocalResource("yun_" + Long.valueOf(cloudFileDao.insert(new CloudFile(valueOf, i3, str, str2, i4, absolutePath, cloudVideo2.price, cloudVideo2.duration, file2.getAbsolutePath(), CloudFile.SAVE_STATUS_TRUE))), this.mName.getText().toString(), file2.getAbsolutePath(), 1, this.y.duration, this.t.getAbsolutePath(), 0, 0, 0));
i2 = 2131755084;
}
y.e(i2);
}
finish();
}
public h0 e(int i2) {
f0 g2 = g(i2);
String a2 = g2.f6581g.a("token");
if (a2 == null) {
a2 = null;
}
App.f2840i = a2;
return g2.f6582h;
}
public h0 f(int i2) {
f0 g2 = g(i2);
String a2 = g2.f6581g.a("token");
if (a2 == null) {
a2 = null;
}
App.f2840i = a2;
return g2.f6582h;
}
@Override
public void finish() {
super.finish();
overridePendingTransition(0, 2130771998);
}
public final f0 g(int i2) {
byte[] bArr;
y.b bVar = new y.b();
bVar.f7079f.add(new v() {
@Override
public final j.f0 a(v.a aVar) {
return MediaCloudPreviewActivity.this.a(aVar);
}
});
j.y yVar = new j.y(bVar);
byte[] bytes = (App.f2840i + "-" + i2).getBytes("UTF-8");
PublicKey publicKey = App.f2839h;
try {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(1, publicKey);
bArr = cipher.doFinal(bytes);
} catch (Exception e2) {
e2.printStackTrace();
bArr = null;
}
String a2 = d.e.a.u.b.a(bArr);
r.a aVar = new r.a();
aVar.a("deviceid", App.f2838g.f());
aVar.a("enstr", a2);
r rVar = new r(aVar.f7009a, aVar.f7010b);
b0.a aVar2 = new b0.a();
aVar2.a("POST", rVar);
aVar2.a("https://www.ftlled.com/api/ftl/app/getvideo");
f0 b2 = ((a0) yVar.a(aVar2.a())).b();
if (b2.i()) {
return b2;
}
throw new IOException("Unexpected code " + b2);
}
@Override
public void onActivityResult(int i2, int i3, Intent intent) {
super.onActivityResult(i2, i3, intent);
if (i3 == -1 && i2 == 0) {
App.f2838g.c().getMediaFileDao().insert((MediaFile) intent.getParcelableExtra("com.xddzkj.rainbowifi.extra.MEDIA_FILE"));
b.u.y.e(2131755259);
finish();
}
}
@Override
public void onCreate(Bundle bundle) {
TextView textView;
String str;
super.onCreate(bundle);
setContentView(2131492903);
ButterKnife.a(this);
this.x = new a();
this.y = (CloudVideo) getIntent().getParcelableExtra("com.xddzkj.rainbowifi.extra.MEDIA");
final int i2 = this.y.id;
this.t = new File(getFilesDir() + File.separator + this.y.id);
this.u = this.y.id;
this.v = -1;
if (App.f2838g.c().getCloudFileDao().load(Long.valueOf(this.y.id)) != null) {
this.z = true;
this.mSave.setText(getString(2131755256));
}
if (App.f2838g.g()) {
textView = this.mName;
str = this.y.name;
} else {
textView = this.mName;
str = this.y.name_en;
}
textView.setText(str);
this.mDuration.setText(getString(2131755095, new Object[]{Integer.valueOf(this.y.duration)}));
this.mVideoView.getHolder().setFormat(-2);
b.u.y.a((b.l.a.d) this).a(this.y.thumbnail).a(this.mThumbnail);
this.s = new d.a() {
@Override
public final void a(long j2, long j3, boolean z) {
MediaCloudPreviewActivity.this.a(j2, j3, z);
}
};
int i3 = this.w;
if (i3 == 5) {
b.u.y.e(2131755092);
return;
}
this.w = i3 + 1;
this.mDownloadingProgress.setIndeterminate(true);
this.x.c(e.a(new Callable() {
@Override
public final Object call() {
return MediaCloudPreviewActivity.this.e(i2);
}
}).a(c.f2548a).a(new b() {
@Override
public final void a(Object obj) {
MediaCloudPreviewActivity.this.a(i2, (j.h0) obj);
}
}, new z2(this)));
}
@Override
public void onDestroy() {
super.onDestroy();
a aVar = this.x;
if (aVar != null) {
aVar.a();
}
}
@Override
public void onPause() {
super.onPause();
if (this.mVideoView.isPlaying()) {
this.v = this.mVideoView.getCurrentPosition();
this.mVideoView.pause();
}
}
@Override
public void onResume() {
super.onResume();
int i2 = this.v;
if (i2 != -1) {
this.mVideoView.seekTo(i2);
this.mVideoView.start();
}
}
public final void w() {
this.mVideoView.setVideoURI(Uri.fromFile(this.t));
this.mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public final void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.start();
}
});
this.mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public final void onPrepared(MediaPlayer mediaPlayer) {
MediaCloudPreviewActivity.this.a(mediaPlayer);
}
});
this.mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public final boolean onError(MediaPlayer mediaPlayer, int i2, int i3) {
return MediaCloudPreviewActivity.this.b(mediaPlayer, i2, i3);
}
});
}
public void a(final int i2, final h0 h0Var) {
this.mDownloadingView.setVisibility(8);
long k2 = h0Var.k();
if (this.t.exists() && k2 == this.t.length()) {
w();
new Thread(new Runnable() {
@Override
public final void run() {
j.h0.this.close();
}
}).start();
return;
}
NetworkInfo activeNetworkInfo = ((ConnectivityManager) getApplicationContext().getSystemService("connectivity")).getActiveNetworkInfo();
if (!(activeNetworkInfo != null && activeNetworkInfo.isConnected() && activeNetworkInfo.getType() == 0)) {
b(h0Var);
return;
}
new Thread(new Runnable() {
@Override
public final void run() {
j.h0.this.close();
}
}).start();
this.mNotWifiIndicationView.setVisibility(0);
String string = getString(2131755257, new Object[]{new DecimalFormat("0.0").format((k2 / 1024.0d) / 1024.0d)});
SpannableString spannableString = new SpannableString(string);
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(2131099697)), string.indexOf(32), string.lastIndexOf(32), 33);
this.mNotWifiIndicationText.setText(spannableString);
this.mNotWifiIndicationAction.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MediaCloudPreviewActivity.this.a(i2, view);
}
});
}
public void a(final int i2, View view) {
this.x.c(e.a(new Callable() {
@Override
public final Object call() {
return MediaCloudPreviewActivity.this.f(i2);
}
}).a(c.f2548a).b(new b() {
@Override
public final void a(Object obj) {
MediaCloudPreviewActivity.this.b((j.h0) obj);
}
}));
}
}