254 lines
8.6 KiB
Java
254 lines
8.6 KiB
Java
package com.ubt.jimu.wxapi;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import com.ubt.jimu.BaseActivity;
|
|
import com.ubt.jimu.R;
|
|
import com.ubtrobot.ubtlib.share.ShareBuilder;
|
|
import com.ubtrobot.ubtlib.share.UbtSocialShareListener;
|
|
import com.ubtrobot.ubtlib.social.SocialTool;
|
|
import com.ubtrobot.ubtlib.social.UbtSocial;
|
|
import com.ubtrobot.ubtlib.social.UbtSocialType;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ShareActivity extends BaseActivity implements View.OnClickListener {
|
|
private String a;
|
|
private String b;
|
|
private ImageView d;
|
|
private ImageView e;
|
|
private ImageView f;
|
|
private ImageView g;
|
|
private ImageView h;
|
|
private ViewGroup j;
|
|
private ViewGroup k;
|
|
private ViewGroup l;
|
|
private ViewGroup m;
|
|
private ViewGroup n;
|
|
private UbtSocial p;
|
|
private String c = "http://www.ubtrobot.com/";
|
|
private int i = 0;
|
|
UbtSocialShareListener o = new UbtSocialShareListener() { // from class: com.ubt.jimu.wxapi.ShareActivity.1
|
|
@Override // com.ubtrobot.ubtlib.share.UbtSocialShareListener
|
|
public void a() {
|
|
ShareActivity.this.finish();
|
|
SocialTool.a((Activity) ShareActivity.this, "share failure");
|
|
}
|
|
|
|
@Override // com.ubtrobot.ubtlib.share.UbtSocialShareListener
|
|
public void onCancel() {
|
|
ShareActivity.this.finish();
|
|
SocialTool.a((Activity) ShareActivity.this, "share cancel");
|
|
}
|
|
|
|
@Override // com.ubtrobot.ubtlib.share.UbtSocialShareListener
|
|
public void onSuccess() {
|
|
ShareActivity.this.finish();
|
|
SocialTool.a((Activity) ShareActivity.this, "share success");
|
|
}
|
|
};
|
|
|
|
private void D0() {
|
|
if (UbtSocial.a(this, UbtSocialType.WECHAT).b()) {
|
|
this.j.setVisibility(0);
|
|
this.k.setVisibility(0);
|
|
} else {
|
|
this.j.setVisibility(8);
|
|
this.k.setVisibility(8);
|
|
this.i++;
|
|
this.i++;
|
|
}
|
|
if (UbtSocial.a(this, UbtSocialType.QQ).b()) {
|
|
this.l.setVisibility(0);
|
|
} else {
|
|
this.l.setVisibility(8);
|
|
this.i++;
|
|
}
|
|
if (UbtSocial.a(this, UbtSocialType.TWITTER).b()) {
|
|
this.m.setVisibility(0);
|
|
} else {
|
|
this.m.setVisibility(8);
|
|
this.i++;
|
|
}
|
|
if (UbtSocial.a(this, UbtSocialType.FACEBOOK).b()) {
|
|
this.n.setVisibility(0);
|
|
} else {
|
|
this.n.setVisibility(8);
|
|
this.i++;
|
|
}
|
|
this.d = (ImageView) findViewById(R.id.imgWechat);
|
|
this.e = (ImageView) findViewById(R.id.imgWechatMoments);
|
|
this.f = (ImageView) findViewById(R.id.imgQQ);
|
|
this.g = (ImageView) findViewById(R.id.imgTwitter);
|
|
this.h = (ImageView) findViewById(R.id.imgFacebook);
|
|
this.l.setEnabled(true);
|
|
this.m.setEnabled(true);
|
|
this.n.setEnabled(true);
|
|
this.j.setEnabled(true);
|
|
this.k.setEnabled(true);
|
|
this.m.setVisibility(8);
|
|
this.n.setVisibility(8);
|
|
if (this.i == 5) {
|
|
this.d.setAlpha(0.3f);
|
|
this.e.setAlpha(0.3f);
|
|
this.f.setAlpha(0.3f);
|
|
this.g.setAlpha(0.3f);
|
|
this.h.setAlpha(0.3f);
|
|
this.j.setVisibility(0);
|
|
this.k.setVisibility(0);
|
|
this.l.setVisibility(0);
|
|
this.m.setVisibility(0);
|
|
this.n.setVisibility(0);
|
|
}
|
|
}
|
|
|
|
public static void a(Activity activity, String str, String str2, String str3, String str4, String str5, String str6) {
|
|
Intent intent = new Intent(activity, (Class<?>) ShareActivity.class);
|
|
intent.putExtra("title", str);
|
|
intent.putExtra("content", str2);
|
|
intent.putExtra("url", str3);
|
|
intent.putExtra("imgPath", str4);
|
|
intent.putExtra("imgUrl", str5);
|
|
intent.putExtra("imgs", str6);
|
|
activity.startActivity(intent);
|
|
}
|
|
|
|
private void initData() {
|
|
this.a = getIntent().getStringExtra("title");
|
|
this.b = getIntent().getStringExtra("content");
|
|
this.c = getIntent().getStringExtra("url");
|
|
getIntent().getStringExtra("imgPath");
|
|
getIntent().getStringExtra("imgs");
|
|
}
|
|
|
|
public void initView() {
|
|
this.j = (ViewGroup) findViewById(R.id.activity_share_img_wechat);
|
|
this.j.setOnClickListener(this);
|
|
this.k = (ViewGroup) findViewById(R.id.activity_share_img_moments);
|
|
this.k.setOnClickListener(this);
|
|
this.l = (ViewGroup) findViewById(R.id.activity_share_img_qq);
|
|
this.l.setOnClickListener(this);
|
|
this.m = (ViewGroup) findViewById(R.id.activity_share_img_twitter);
|
|
this.m.setOnClickListener(this);
|
|
this.n = (ViewGroup) findViewById(R.id.activity_share_img_facebook);
|
|
this.n.setOnClickListener(this);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onActivityResult(int i, int i2, Intent intent) {
|
|
super.onActivityResult(i, i2, intent);
|
|
UbtSocial ubtSocial = this.p;
|
|
if (ubtSocial != null) {
|
|
ubtSocial.a(i, i2, intent);
|
|
}
|
|
}
|
|
|
|
public void onBackFinishClick(View view) {
|
|
finish();
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (this.i == 5) {
|
|
finish();
|
|
}
|
|
int id = view.getId();
|
|
if (id == 16908290) {
|
|
finish();
|
|
return;
|
|
}
|
|
switch (id) {
|
|
case R.id.activity_share_img_facebook /* 2131296301 */:
|
|
onShareFacebook(view);
|
|
break;
|
|
case R.id.activity_share_img_moments /* 2131296302 */:
|
|
onShareWechatTimeLineClick(view);
|
|
break;
|
|
case R.id.activity_share_img_qq /* 2131296303 */:
|
|
onShareQQClick(view);
|
|
break;
|
|
case R.id.activity_share_img_twitter /* 2131296304 */:
|
|
onShareTwitter(view);
|
|
break;
|
|
case R.id.activity_share_img_wechat /* 2131296305 */:
|
|
onShareWechatClick(view);
|
|
break;
|
|
}
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
setContentView(R.layout.activity_share);
|
|
findViewById(android.R.id.content).setOnClickListener(this);
|
|
initView();
|
|
initData();
|
|
D0();
|
|
}
|
|
|
|
public void onShareFacebook(View view) {
|
|
this.p = UbtSocial.a(this, UbtSocialType.FACEBOOK);
|
|
this.p.a(this.o);
|
|
ShareBuilder shareBuilder = new ShareBuilder();
|
|
shareBuilder.b(this.a);
|
|
shareBuilder.c(this.c);
|
|
shareBuilder.a(this.b);
|
|
shareBuilder.a(Uri.parse("/mnt/sdcard/test.png"));
|
|
shareBuilder.a(278);
|
|
this.p.a(shareBuilder);
|
|
}
|
|
|
|
public void onShareQQClick(View view) {
|
|
this.p = UbtSocial.a(this, UbtSocialType.QQ);
|
|
this.p.a(this.o);
|
|
ShareBuilder shareBuilder = new ShareBuilder();
|
|
shareBuilder.b(this.a);
|
|
shareBuilder.c(this.c);
|
|
shareBuilder.a(this.b);
|
|
shareBuilder.a(272);
|
|
this.p.a(shareBuilder);
|
|
}
|
|
|
|
public void onShareTwitter(View view) {
|
|
this.p = UbtSocial.a(this, UbtSocialType.TWITTER);
|
|
this.p.a(this.o);
|
|
ShareBuilder shareBuilder = new ShareBuilder();
|
|
shareBuilder.b(this.a);
|
|
shareBuilder.c(this.c);
|
|
shareBuilder.a(this.b);
|
|
shareBuilder.a(Uri.parse("/mnt/sdcard/test.png"));
|
|
shareBuilder.a(277);
|
|
this.p.a(shareBuilder);
|
|
}
|
|
|
|
public void onShareWechatClick(View view) {
|
|
this.p = UbtSocial.a(this, UbtSocialType.WECHAT);
|
|
this.p.a(this.o);
|
|
ShareBuilder shareBuilder = new ShareBuilder();
|
|
shareBuilder.b(this.a);
|
|
shareBuilder.c(this.c);
|
|
shareBuilder.a(this.a);
|
|
shareBuilder.a(274);
|
|
this.p.a(shareBuilder);
|
|
}
|
|
|
|
public void onShareWechatTimeLineClick(View view) {
|
|
this.p = UbtSocial.a(this, UbtSocialType.WECHAT);
|
|
this.p.a(this.o);
|
|
ShareBuilder shareBuilder = new ShareBuilder();
|
|
shareBuilder.b(this.a);
|
|
shareBuilder.c(this.c);
|
|
shareBuilder.a(this.a);
|
|
shareBuilder.a(275);
|
|
this.p.a(shareBuilder);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity
|
|
public void relayout() {
|
|
}
|
|
}
|