OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.record;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import androidx.annotation.NonNull;
import com.bumptech.glide.g.b.k;
import com.bumptech.glide.i;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.gs.base.f;
import com.excelliance.kxqp.gs.discover.model.MediaResource;
import com.excelliance.kxqp.gs.discover.model.ResourceType;
import com.excelliance.kxqp.gs.ui.share.core.config.SocializeMedia;
import com.excelliance.kxqp.gs.ui.share.core.helper.ShareHelper;
import com.excelliance.kxqp.gs.ui.share.core.param.BigImageShareParam;
import com.excelliance.kxqp.gs.ui.share.core.param.ShareImage;
import com.excelliance.kxqp.gs.ui.share.core.param.VideoShareParam;
import com.excelliance.kxqp.gs.util.ad;
import com.excelliance.kxqp.gs.util.ae;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.ui.detail.e;
import java.io.File;
public class b extends f implements View.OnClickListener {
private VideoView f8045a;
private ImageView f8046b;
private ImageView e;
private TextView f;
private TextView g;
private TextView h;
private TextView i;
private TextView j;
private MediaResource k;
private View l;
private boolean m;
@Override
public String b() {
return "dialog_share_record";
}
@Override
public int d() {
return 0;
}
@Override
public int e() {
return 0;
}
public b(@NonNull Context context, MediaResource mediaResource) {
super(context);
this.m = false;
this.k = mediaResource;
}
@Override
protected void a(View view) {
this.f8045a = (VideoView) com.excelliance.kxqp.ui.util.b.a("video_view", view);
this.f8046b = (ImageView) com.excelliance.kxqp.ui.util.b.a("iv_pic", view);
this.e = (ImageView) com.excelliance.kxqp.ui.util.b.a("iv_start", view);
this.f = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_share_weixin", view);
this.g = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_share_moment", view);
this.h = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_share_qq", view);
this.j = (TextView) view.findViewById(R.id.tv_share_douyin);
this.i = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_share_save", view);
this.l = com.excelliance.kxqp.ui.util.b.a("rl_resource", view);
this.f.setTag(1);
this.g.setTag(2);
this.h.setTag(3);
this.i.setTag(4);
this.e.setTag(5);
this.j.setTag(6);
this.f.setOnClickListener(this);
this.g.setOnClickListener(this);
this.h.setOnClickListener(this);
this.j.setOnClickListener(this);
this.i.setOnClickListener(this);
this.e.setOnClickListener(this);
this.l.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (b.this.m) {
return;
}
b.this.g();
b.this.m = true;
}
});
}
public void g() {
if (this.k != null) {
this.f8046b.setVisibility(0);
this.f8046b.setScaleType(ImageView.ScaleType.CENTER_CROP);
e eVar = new e();
eVar.b(this.k.getWidth());
eVar.a(this.k.getHeight());
Log.d("VideoShareDialog", "applyResource imageSize: " + eVar);
a(eVar, this.f8046b);
com.excelliance.kxqp.gs.view.other.a aVar = new com.excelliance.kxqp.gs.view.other.a(this.c, this.f8046b.getLayoutParams().width, this.f8046b.getLayoutParams().height);
i.b(this.c).a(this.k.getLocalPath()).d(aVar).c((Drawable) aVar).b(new com.bumptech.glide.g.f<String, com.bumptech.glide.d.d.b.b>() {
@Override
public boolean a(Exception exc, String str, k<com.bumptech.glide.d.d.b.b> kVar, boolean z) {
return false;
}
@Override
public boolean a(com.bumptech.glide.d.d.b.b bVar, String str, k<com.bumptech.glide.d.d.b.b> kVar, boolean z, boolean z2) {
e eVar2 = new e();
eVar2.b(bVar.getIntrinsicWidth());
eVar2.a(bVar.getIntrinsicHeight());
b.this.a(eVar2, b.this.f8046b);
return false;
}
}).a(this.f8046b);
if (this.k.getResourceType() == ResourceType.VIDEO_MP4) {
this.f8045a.setVisibility(0);
a(eVar, this.f8045a);
this.e.setVisibility(0);
this.f8045a.setVideoPath(this.k.getLocalPath());
this.f8045a.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
}
});
this.f8045a.setOnClickListener(new View.OnClickListener() {
private Runnable f8055b = new Runnable() {
@Override
public void run() {
b.this.e.setVisibility(8);
}
};
@Override
public void onClick(View view) {
if (!b.this.f8045a.isPlaying() || b.this.e.getVisibility() != 8) {
b.this.e.setVisibility(0);
return;
}
b.this.e.setVisibility(0);
b.this.e.removeCallbacks(this.f8055b);
b.this.e.postDelayed(this.f8055b, 3000L);
}
});
this.f8045a.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
b.this.f8046b.setVisibility(0);
b.this.e.setVisibility(0);
b.this.e.setImageResource(w.j(b.this.c, "ic_record_video_start"));
}
});
}
}
}
public void a(e eVar, View view) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
if (eVar.b() >= eVar.a()) {
layoutParams.width = this.l.getWidth();
layoutParams.height = (int) (((this.l.getWidth() * 1.0f) / eVar.b()) * eVar.a());
view.requestLayout();
} else {
layoutParams.height = ad.a(this.c, 320.0f);
layoutParams.width = (int) (((layoutParams.height * 1.0f) / eVar.a()) * eVar.b());
view.requestLayout();
}
}
@Override
public void onClick(View view) {
Object tag = view.getTag();
if (tag == null || !(tag instanceof Integer)) {
return;
}
switch (((Integer) tag).intValue()) {
case 1:
if (as.i(this.c, "com.tencent.mm")) {
a(SocializeMedia.WEIXIN);
return;
} else {
cg.a(this.c, w.e(this.c, "share_sdk_not_install_wechat"));
return;
}
case 2:
if (as.i(this.c, "com.tencent.mm")) {
a(SocializeMedia.WEIXIN_MONMENT);
return;
} else {
cg.a(this.c, w.e(this.c, "share_sdk_not_install_wechat"));
return;
}
case 3:
if (as.i(this.c, "com.tencent.mobileqq")) {
a(SocializeMedia.QQ);
return;
} else {
cg.a(this.c, w.e(this.c, "share_sdk_not_install_qq"));
return;
}
case 4:
if (this.k != null) {
ae.a(this.c, new File(this.k.getLocalPath()));
cg.a(this.c, "已保存到相册~");
return;
}
return;
case 5:
if (this.f8045a.isPlaying()) {
this.f8045a.pause();
this.e.setImageResource(w.j(this.c, "ic_record_video_start"));
this.e.setVisibility(0);
return;
} else {
this.f8045a.start();
this.f8046b.setVisibility(8);
this.e.setImageResource(w.j(this.c, "ic_record_video_pause"));
this.e.postDelayed(new Runnable() {
@Override
public void run() {
b.this.e.setVisibility(8);
}
}, 1000L);
return;
}
case 6:
if (as.i(this.c, "com.ss.android.ugc.aweme")) {
a(SocializeMedia.DOU_YIN);
return;
} else {
cg.a(this.c, this.c.getString(R.string.share_sdk_not_install_douyin));
return;
}
default:
return;
}
}
private void a(SocializeMedia socializeMedia) {
String format;
if (this.k == null) {
return;
}
if (this.k.getResourceType() == ResourceType.PIC_JPG) {
ShareHelper instance = ShareHelper.instance((Activity) this.c);
instance.from(4);
String q = bx.a().q(this.c);
if (TextUtils.isEmpty(q)) {
format = w.e(this.c, "title_capture_image_share_default");
} else {
format = String.format(w.e(this.c, "title_capture_image_share"), q);
}
BigImageShareParam bigImageShareParam = new BigImageShareParam(format, format, "http://ourplay.com.cn/");
ShareImage shareImage = new ShareImage();
shareImage.setLocalFile(new File(this.k.getLocalPath()));
bigImageShareParam.setThumb(shareImage);
instance.shareMediaTo(socializeMedia, bigImageShareParam);
return;
}
if (socializeMedia == SocializeMedia.DOU_YIN && this.k.getResourceType() == ResourceType.VIDEO_MP4) {
ShareHelper instance2 = ShareHelper.instance((Activity) this.c);
instance2.from(4);
instance2.shareMediaTo(SocializeMedia.DOU_YIN, new VideoShareParam(this.k.getLocalPath()));
} else if (this.k.getResourceType() == ResourceType.VIDEO_MP4) {
c(socializeMedia);
}
}
private void b(SocializeMedia socializeMedia) {
final f fVar = new f(this.c) {
@Override
protected void a(View view) {
}
@Override
public String b() {
return "dialog_share_video";
}
};
fVar.show();
TextView textView = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_desc", fVar.c());
View a2 = com.excelliance.kxqp.ui.util.b.a("rl_share", fVar.c());
TextView textView2 = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_share", fVar.c());
if (socializeMedia == SocializeMedia.QQ) {
textView.setText("由于QQ分享限制,请到QQ上传视频来享。");
a2.setBackgroundResource(w.j(this.c, "btn_bg_record_share_qq"));
textView2.setText("继续分享到QQ");
com.excelliance.kxqp.ui.util.b.a(textView2, w.k(this.c, "ic_left_record_share_qq"), null, null, null);
a2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fVar.dismiss();
try {
b.this.c.startActivity(b.this.c.getPackageManager().getLaunchIntentForPackage("com.tencent.mobileqq"));
} catch (Exception e) {
e.printStackTrace();
}
}
});
return;
}
if (socializeMedia == SocializeMedia.WEIXIN) {
textView.setText("由于微信分享限制,请到微信上传视频来分享。");
a2.setBackgroundResource(w.j(this.c, "btn_bg_record_share_weixin"));
textView2.setText("继续分享到微信");
com.excelliance.kxqp.ui.util.b.a(textView2, w.k(this.c, "ic_left_record_share_weixin"), null, null, null);
a2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fVar.dismiss();
try {
Intent intent = new Intent("android.intent.action.MAIN");
ComponentName componentName = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory("android.intent.category.LAUNCHER");
intent.addFlags(268435456);
intent.setComponent(componentName);
b.this.c.startActivity(intent);
} catch (ActivityNotFoundException unused) {
Toast.makeText(b.this.c, "没有安装微信~", 0).show();
}
}
});
return;
}
if (socializeMedia == SocializeMedia.WEIXIN_MONMENT) {
textView.setText("由于微信朋友圈分享限制,请到微信朋友圈上传视频来分享。");
a2.setBackgroundResource(w.j(this.c, "btn_bg_record_share_weixin"));
textView2.setText("继续分享到朋友圈");
com.excelliance.kxqp.ui.util.b.a(textView2, w.k(this.c, "ic_left_record_share_weixin"), null, null, null);
a2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fVar.dismiss();
try {
Intent intent = new Intent("android.intent.action.MAIN");
ComponentName componentName = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory("android.intent.category.LAUNCHER");
intent.addFlags(268435456);
intent.setComponent(componentName);
b.this.c.startActivity(intent);
} catch (ActivityNotFoundException unused) {
Toast.makeText(b.this.c, "没有安装微信~", 0).show();
}
}
});
}
}
private void c(SocializeMedia socializeMedia) {
ae.a(this.c, new File(this.k.getLocalPath()));
b(socializeMedia);
}
}