TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 VipProfileCardPreviewActivity.java 源代码,内容仅作参考
package com.tencent.mobileqq.profile;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.text.TextUtils;
import android.util.Pair;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.image.URLDrawable;
import com.tencent.mobileqq.activity.FriendProfileCardActivity;
import com.tencent.mobileqq.activity.ProfileActivity;
import com.tencent.mobileqq.activity.QQFriendProfileCardActivity;
import com.tencent.mobileqq.app.BusinessObserver;
import com.tencent.mobileqq.app.CardHandler;
import com.tencent.mobileqq.app.CardObserver;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.filemanager.data.FMConstants;
import com.tencent.mobileqq.profile.upload.VipUploadUtils;
import com.tencent.mobileqq.profile.upload.task.VipBaseUpsImageUploadTask;
import com.tencent.mobileqq.profile.upload.task.VipImageUploadManager;
import com.tencent.mobileqq.profile.view.VipScaledViewPager;
import com.tencent.mobileqq.shortvideo.ShortVideoConstants;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.StructMsgConstants;
import com.tencent.mobileqq.theme.ThemeUtil;
import com.tencent.mobileqq.util.ProfileCardUtil;
import com.tencent.mobileqq.utils.VipUtils;
import com.tencent.mobileqq.widget.ProfileCardScrollImageView;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.qphone.base.util.QLog;
import com.tencent.smtt.sdk.stat.MttLoader;
import com.tencent.tim.R;
import com.tencent.upload.uinterface.data.UpsImageUploadResult;
import com.tencent.widget.CirclePageIndicator;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class VipProfileCardPreviewActivity extends VipProfileCardBaseActivity implements View.OnClickListener {
public static final int K = 0;
public static final int L = 1;
public static final int M = 2;
public static final int N = 3000;
public static final int O = 1500;
public static final int Q = -1;
public static final int R = 0;
public static final int S = 1;
public static final int T = 2;
public static final int U = 640;
public static final int V = 1136;
public static final int W = 2;
public static final int X = 45;
public static final int Y = 15;
public static final int Z = 15;
public static final int aa = 15;
public static final int ab = 3;
public static final int ac = 7;
public static final int ad = 20;
public static final int ae = 15;
public static final int af = 18;
public static final int ag = 40;
public static final int ah = 10;
public static final int ai = 11;
public static final int aj = 11;
public static final int ak = 3;
public static final int al = 7;
public static final int am = 20;
public static final int an = 15;
public static final int ao = 16;
public static final float f91436b = 1.78f;
public static final float f91437c = 14.5f;
public static final float d = 16.5f;
public static final String i = "ProfileCard.VipProfileCardPreviewActivity";
public static final String k = "com.tencent.tim.action.closeWeb";
public Drawable f91438a;
public SparseArray f26379a;
public View f26380a;
public Button f26381a;
public ImageView f26382a;
public TextView f26383a;
public ProfileCardBackground f26384a;
public ProfileCardTemplate f26385a;
public StylePagerAdapter f26386a;
public VipScaledViewPager f26387a;
public CirclePageIndicator f26388a;
public int aA;
public int aB;
public int aC;
public int ap;
public int aq;
public int ar;
public int as;
public int at;
public int au;
public int av;
public int aw;
public int ax;
public int ay;
public View f26392b;
public Button f26393b;
public TextView f26394b;
private Runnable f26396b;
public Button f26399c;
public TextView f26400c;
public boolean f26401c;
public boolean f26402d;
public float e;
public boolean f26403e;
public boolean f26404f;
private volatile boolean f26405g;
private String m;
public int P = -1;
public float f = 1.0f;
public int az = -1;
public float g = 1.6666666f;
public float h = 1.775f;
public long f26391b = -1;
public ArrayList f26397b = new ArrayList();
public List f26390a = Collections.synchronizedList(new ArrayList());
public List f26398b = Collections.synchronizedList(new ArrayList());
public String j = "0";
private int aE = 0;
public int aD = -1;
public String l = QQFriendProfileCardActivity.z;
private HashMap f26389a = new HashMap();
private CardObserver f26395b = new syk(this);
@Override
public boolean a(Message message) {
switch (message.what) {
case 1:
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.f26387a.getLayoutParams();
layoutParams.height = this.P;
layoutParams.topMargin = this.aw;
this.f26387a.setLayoutParams(layoutParams);
this.f26387a.setScale(this.e);
this.f26387a.setGap(this.ax);
this.f26387a.setAdapter(this.f26386a);
this.f26388a.setViewPager(this.f26387a);
this.f26388a.setVisibility(0);
l();
this.f26387a.setCurrentItem(this.az);
b(this.az);
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initiate now mCurrentViewPos = " + this.az);
}
if (this.f26404f) {
((CardHandler) this.app.getBusinessHandler(2)).m4162a(this.app.getCurrentAccountUin());
}
return true;
case 27:
int childCount = this.f26387a.getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
View childAt = this.f26387a.getChildAt(i2);
if (childAt.getTag() instanceof StylePagerAdapter.ViewHolder) {
((StylePagerAdapter.ViewHolder) childAt.getTag()).f26408a.setBackgroundDrawable(this.f91438a);
}
}
return true;
case 28:
d(message.arg1);
return true;
case 29:
d(message.arg1);
return true;
default:
if (message.what == 2) {
if (Build.VERSION.SDK_INT >= 16) {
this.f26382a.setBackground(this.f91438a);
} else {
this.f26382a.setBackgroundDrawable(this.f91438a);
}
return true;
} else if (message.what == 3) {
Toast.makeText(this.f26353a.getApplicationContext(), (int) R.string.f65425name_res_0x7f0a1b75, 0).show();
return true;
} else if (message.what == 20) {
d(message.arg1);
return true;
} else if (message.what == 5) {
Toast.makeText(this.f26353a.getApplicationContext(), (int) R.string.f65424name_res_0x7f0a1b74, 0).show();
if (this.B == 1 || this.B == 2) {
if (this.aE == 1) {
BaseApplicationImpl.getContext().sendBroadcast(new Intent(k), "com.tencent.tim.msg.permission.pushnotify");
} else {
Intent intent = new Intent();
intent.putExtra("uin", this.app.getCurrentAccountUin());
intent.putExtra(MttLoader.ENTRY_ID, this.B);
setResult(-1, intent);
}
} else {
Intent intent2 = new Intent(this, FriendProfileCardActivity.class);
intent2.putExtra(ProfileActivity.f10494t, new ProfileActivity.AllInOne(this.app.getCurrentAccountUin(), 0));
intent2.setFlags(67108864);
startActivity(intent2);
}
p();
finish();
return true;
} else if (message.what == 21) {
if (this.f26390a != null) {
((ProfileCardTemplateInfo) this.f26390a.get(message.arg1)).f91415a = -1;
}
return true;
} else if (message.what == 24 || message.what == 25) {
if (message.what == 25) {
b();
}
Toast.makeText(getApplicationContext(), getResources().getString(R.string.f65431name_res_0x7f0a1b7b), 1).show();
return true;
} else {
return false;
}
}
}
@Override
public boolean doOnCreate(Bundle bundle) {
super.doOnCreate(bundle);
this.f26405g = false;
setContentView(R.layout.f57754name_res_0x7f030581);
getWindow().setBackgroundDrawable(null);
this.f26353a = this;
this.f26392b = findViewById(R.id.f53097name_res_0x7f091786);
if (this.app != null && ThemeUtil.isInNightMode(this.app)) {
if (this.f26392b != null) {
this.f26392b.setVisibility(0);
}
} else if (this.f26392b != null) {
this.f26392b.setVisibility(8);
}
if (this.app != null) {
this.l += this.app.getCurrentAccountUin();
}
this.f26388a = (CirclePageIndicator) findViewById(R.id.f53743name_res_0x7f091a0c);
this.f26399c = (Button) findViewById(R.id.f53763name_res_0x7f091a20);
this.f26387a = (VipScaledViewPager) findViewById(R.id.f47773name_res_0x7f0902b9);
this.f26386a = new StylePagerAdapter(this.f26353a);
if (Build.MODEL.equals("HUAWEI C8812E")) {
this.f26387a.setLayerType(1, null);
}
this.f = this.f26350a / 2.0f;
if (this.H / this.I > (this.g + this.h) / 2.0f) {
float f = this.H / (1136.0f * this.f);
this.ap = Math.round(ProfileCardUtil.c(this.f26353a, 15) * f);
this.aq = Math.round(ProfileCardUtil.c(this.f26353a, 15) * f);
this.ar = Math.round(ProfileCardUtil.c(this.f26353a, 15) * f);
this.as = ProfileCardUtil.c(this.f26353a, 45);
this.at = Math.round(ProfileCardUtil.c(this.f26353a, 3) * f);
this.av = Math.round(ProfileCardUtil.c(this.f26353a, 7) * f);
this.au = Math.round(ProfileCardUtil.a(this.f26353a, 14.5f) * f);
this.aw = Math.round(ProfileCardUtil.c(this.f26353a, 20) * f);
this.ax = Math.round(f * ProfileCardUtil.c(this.f26353a, 15));
this.e = 0.8245033f;
this.ay = 18;
} else {
float f2 = this.H / (800.0f * this.f);
this.ap = Math.round(ProfileCardUtil.c(this.f26353a, 11) * f2);
this.aq = Math.round(ProfileCardUtil.c(this.f26353a, 10) * f2);
this.ar = Math.round(ProfileCardUtil.c(this.f26353a, 11) * f2);
this.as = ProfileCardUtil.c(this.f26353a, 40);
this.at = Math.round(ProfileCardUtil.c(this.f26353a, 3) * f2);
this.av = Math.round(ProfileCardUtil.c(this.f26353a, 7) * f2);
this.au = Math.round(ProfileCardUtil.a(this.f26353a, 16.5f) * f2);
this.aw = Math.round(ProfileCardUtil.c(this.f26353a, 20) * f2);
this.ax = Math.round(f2 * ProfileCardUtil.c(this.f26353a, 15));
this.ay = 16;
this.e = 0.8192771f;
}
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.f26399c.getLayoutParams();
layoutParams.height = this.as;
int i2 = this.ar;
layoutParams.leftMargin = i2;
layoutParams.rightMargin = i2;
layoutParams.bottomMargin = this.aq;
this.f26399c.setTextSize(1, this.ay);
this.f26399c.setLayoutParams(layoutParams);
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f26388a.getLayoutParams();
layoutParams2.topMargin = this.au;
layoutParams2.bottomMargin = this.au;
this.f26388a.setLayoutParams(layoutParams2);
this.f26388a.setCirclePadding(this.av);
this.f26388a.setRadius(this.at);
this.P = ((((((this.H - this.aw) - this.aq) - this.as) - (this.at * 2)) - (this.au * 2)) - getResources().getDimensionPixelSize(R.dimen.f39450title_bar_height)) - ProfileCardUtil.a(getResources());
this.aA = this.P;
this.aB = Math.round(this.aA / 1.78f);
this.f26388a.setStrokeWidth(0.0f);
addObserver(this.f26395b);
ThreadManager.a(new syb(this), 8, null, true);
j();
this.f26399c.setOnClickListener(this);
if (this.app != null) {
this.app.addObserver(this.f26357a, true);
}
this.f26388a.setOnPageChangeListener(new syc(this));
if (this.app != null) {
ReportController.b(this.app, "dc01331", "", "", "card_mall", "0X8004D59", 0, 0, this.f26384a == null ? "" : Integer.toString(this.f26384a.f91405a), "", "", VipUtils.a((AppInterface) this.app, this.app.getCurrentAccountUin()));
}
return true;
}
public void j() {
setLeftViewName(R.string.f63667button_back);
setTitle(R.string.f65427name_res_0x7f0a1b77);
}
public void c(int i2) {
View findViewById;
StylePagerAdapter.ViewHolder viewHolder;
if (this.f26387a != null && this.f26390a != null && i2 >= 0 && i2 < this.f26390a.size() && (findViewById = this.f26387a.findViewById(i2)) != null && findViewById.getTag() != null && (viewHolder = (StylePagerAdapter.ViewHolder) findViewById.getTag()) != null) {
ProfileCardScrollImageView profileCardScrollImageView = viewHolder.f26408a;
ProfileCardTemplateInfo profileCardTemplateInfo = (ProfileCardTemplateInfo) this.f26390a.get(i2);
if (profileCardTemplateInfo != null) {
switch (profileCardTemplateInfo.f26321a.f26306d) {
case 0:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "cancel ANIMATION_NONE");
return;
}
return;
case 1:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "cancel ANIMATION_SCROLL");
}
profileCardScrollImageView.a();
return;
case 2:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "cancel ANIMATION_FADE_IN_OUT");
}
if (this.f26396b != null) {
this.f26355a.removeCallbacks(this.f26396b);
}
Drawable drawable = profileCardScrollImageView.getDrawable();
if (drawable != null && (drawable instanceof TransitionDrawable)) {
((TransitionDrawable) drawable).resetTransition();
return;
}
return;
default:
return;
}
}
}
}
public void a(int i2) {
View findViewById;
StylePagerAdapter.ViewHolder viewHolder;
if (this.aD != -1) {
c(this.aD);
this.aD = -1;
}
if (this.f26387a != null && this.f26390a != null && i2 >= 0 && i2 < this.f26390a.size() && (findViewById = this.f26387a.findViewById(i2)) != null && findViewById.getTag() != null && (viewHolder = (StylePagerAdapter.ViewHolder) findViewById.getTag()) != null) {
ProfileCardScrollImageView profileCardScrollImageView = viewHolder.f26408a;
ProfileCardTemplateInfo profileCardTemplateInfo = (ProfileCardTemplateInfo) this.f26390a.get(i2);
if (profileCardTemplateInfo != null && profileCardScrollImageView.getTag() != null) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "startAnimation pos = " + i2);
}
switch (profileCardTemplateInfo.f26321a.f26306d) {
case 0:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "no animation to start !");
return;
}
return;
case 1:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "start ANIMATION_SCROLL");
}
profileCardScrollImageView.setScrollDuration(1500);
profileCardScrollImageView.a(this.aC);
return;
case 2:
if (QLog.isColorLevel()) {
QLog.d(i, 2, "start ANIMATION_FADE_IN_OUT");
}
Drawable drawable = profileCardScrollImageView.getDrawable();
if (drawable instanceof TransitionDrawable) {
TransitionDrawable transitionDrawable = (TransitionDrawable) drawable;
transitionDrawable.setCrossFadeEnabled(true);
transitionDrawable.startTransition(1500);
this.f26396b = new syd(this, transitionDrawable);
this.f26355a.postDelayed(this.f26396b, 2000L);
return;
}
return;
default:
return;
}
}
}
}
public void k() {
int i2;
boolean z;
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initTemplateListData start.");
}
if (this.f26390a != null && this.f26397b != null) {
ArrayList arrayList = null;
ArrayList a2 = a();
if (this.f26391b == 0) {
ProfileCardTemplate profileCardTemplate = new ProfileCardTemplate();
profileCardTemplate.f26313i = 0L;
profileCardTemplate.f26318m = "http://imgcache.gtimg.cn/club/mobile/profile/template/default_v_53.jpg";
profileCardTemplate.f26314i = "http://imgcache.gtimg.cn/club/mobile/profile/template/default_v_53.jpg";
profileCardTemplate.f26320o = "http://imgcache.gtimg.cn/club/mobile/profile/template/default_v_53.jpg";
profileCardTemplate.f26316k = "http://imgcache.gtimg.cn/club/mobile/profile/template/default_v_53.jpg";
profileCardTemplate.f26310g = "0";
profileCardTemplate.f26308e = getString(R.string.f65400name_res_0x7f0a1b5c);
a2.add(profileCardTemplate);
}
if (a2 != null && a2.size() > 0) {
ArrayList arrayList2 = new ArrayList();
if (this.f26401c) {
int i3 = 0;
while (true) {
int i4 = i3;
if (i4 >= a2.size()) {
break;
}
ProfileCardTemplate profileCardTemplate2 = (ProfileCardTemplate) a2.get(i4);
if (this.f26352a == profileCardTemplate2.f26313i) {
this.az = i4;
}
if (profileCardTemplate2.f26313i == ProfileCardTemplate.h) {
this.f26404f = true;
if (this.az == i4) {
this.az = 0;
ReportController.b(this.app, "dc01331", "", "", "Shop_Malltemplate", "0X8005B93", 0, 0, "", "", "", "");
}
} else {
this.f26397b.add(Long.valueOf(profileCardTemplate2.f26313i));
}
i3 = i4 + 1;
}
}
int i5 = 0;
while (i5 < this.f26397b.size()) {
boolean z2 = false;
int i6 = 0;
while (i6 < a2.size()) {
ProfileCardTemplate profileCardTemplate3 = (ProfileCardTemplate) a2.get(i6);
if (((Long) this.f26397b.get(i5)).longValue() == profileCardTemplate3.f26313i) {
ProfileCardTemplateInfo profileCardTemplateInfo = new ProfileCardTemplateInfo();
profileCardTemplateInfo.f26321a = profileCardTemplate3;
if (m7331a(profileCardTemplateInfo)) {
profileCardTemplateInfo.f91415a = 2;
} else {
profileCardTemplateInfo.f91415a = 0;
}
a(profileCardTemplateInfo.f26321a);
arrayList2.add(profileCardTemplateInfo);
z = true;
} else {
z = z2;
}
i6++;
z2 = z;
}
if (z2) {
i2 = i5;
} else {
this.f26397b.remove(i5);
if (this.az > 0 && i5 <= this.az) {
this.az--;
}
i2 = i5 - 1;
}
i5 = i2 + 1;
}
arrayList = arrayList2;
}
if (a2 != null && a2.size() > 0) {
if (arrayList != null && arrayList.size() > 0) {
if (!this.f26403e && this.f26390a != null) {
this.f26390a.clear();
}
if (this.f26390a != null) {
this.f26390a.addAll(arrayList);
this.f26402d = true;
if (QLog.isColorLevel()) {
int i7 = 0;
while (true) {
int i8 = i7;
if (i8 >= this.f26390a.size()) {
break;
}
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initTemplateListData, style : " + ((ProfileCardTemplateInfo) this.f26390a.get(i8)).f26321a.f26313i + ", status : " + ((ProfileCardTemplateInfo) this.f26390a.get(i8)).f91415a + ", position : " + i8);
}
i7 = i8 + 1;
}
}
} else {
return;
}
} else {
ArrayList arrayList3 = new ArrayList();
int i9 = 0;
while (true) {
int i10 = i9;
if (i10 >= a2.size()) {
break;
}
ProfileCardTemplateInfo profileCardTemplateInfo2 = new ProfileCardTemplateInfo();
profileCardTemplateInfo2.f26321a = (ProfileCardTemplate) a2.get(i10);
if (m7331a(profileCardTemplateInfo2)) {
profileCardTemplateInfo2.f91415a = 2;
} else {
profileCardTemplateInfo2.f91415a = 0;
}
a(profileCardTemplateInfo2.f26321a);
if (profileCardTemplateInfo2.f26321a.f26313i != ProfileCardTemplate.h) {
arrayList3.add(profileCardTemplateInfo2);
}
i9 = i10 + 1;
}
if (this.f26390a != null) {
this.f26390a.clear();
this.f26390a.addAll(arrayList3);
this.f26402d = true;
} else {
return;
}
}
}
this.f26355a.sendEmptyMessage(1);
}
}
public boolean m7331a(ProfileCardTemplateInfo profileCardTemplateInfo) {
if (profileCardTemplateInfo == null || profileCardTemplateInfo.f26321a == null) {
return false;
}
List<String> a2 = a(profileCardTemplateInfo);
if (a2 == null || a2.size() == 0) {
return false;
}
for (String str : a2) {
if (!ProfileCardUtil.m9035a(this.f26353a, str)) {
return false;
}
}
return true;
}
public List a(ProfileCardTemplateInfo profileCardTemplateInfo) {
ArrayList arrayList = new ArrayList();
if (profileCardTemplateInfo != null && profileCardTemplateInfo.f26321a != null) {
if (this.D == 1) {
arrayList.add(profileCardTemplateInfo.f26321a.f26320o);
} else {
arrayList.add(profileCardTemplateInfo.f26321a.f26316k);
}
if (profileCardTemplateInfo.f26321a.f26306d == 2) {
if (this.D == 1) {
arrayList.add(profileCardTemplateInfo.f26321a.s);
} else {
arrayList.add(profileCardTemplateInfo.f26321a.w);
}
}
}
return arrayList;
}
public void a(int i2, List list) {
if (list != null && list.size() != 0) {
Iterator it = list.iterator();
while (it.hasNext()) {
a(i2, (String) it.next());
}
}
}
public void a(int i2, String str) {
ThreadManager.a(new sye(this, i2, str), 5, null, true);
}
public ProfileCardTemplateInfo m7330a(long j) {
if (this.f26390a != null) {
int i2 = 0;
while (true) {
int i3 = i2;
if (i3 >= this.f26390a.size()) {
break;
}
ProfileCardTemplateInfo profileCardTemplateInfo = (ProfileCardTemplateInfo) this.f26390a.get(i3);
if (profileCardTemplateInfo.f26321a.f26313i != j) {
i2 = i3 + 1;
} else {
return profileCardTemplateInfo;
}
}
}
return null;
}
public int a(long j) {
if (this.f26390a != null) {
int i2 = 0;
while (true) {
int i3 = i2;
if (i3 >= this.f26390a.size()) {
break;
} else if (((ProfileCardTemplateInfo) this.f26390a.get(i3)).f26321a.f26313i != j) {
i2 = i3 + 1;
} else {
return i3;
}
}
}
return -1;
}
public void l() {
if (this.f26390a != null && this.f26390a.size() > 0) {
if (this.az != -1) {
a(this.az, (ProfileCardTemplateInfo) this.f26390a.get(this.az));
}
int i2 = 0;
while (true) {
int i3 = i2;
if (i3 < this.f26390a.size()) {
if (this.az == -1 || i3 != this.az) {
a(i3, (ProfileCardTemplateInfo) this.f26390a.get(i3));
}
i2 = i3 + 1;
} else {
return;
}
}
}
}
public void a(int i2, ProfileCardTemplateInfo profileCardTemplateInfo) {
if (profileCardTemplateInfo != null) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "startDownload pos = " + i2 + ", status = " + profileCardTemplateInfo.f91415a);
}
if (profileCardTemplateInfo.f91415a != 2 && profileCardTemplateInfo.f91415a != 1) {
profileCardTemplateInfo.f91415a = 1;
List a2 = a(profileCardTemplateInfo);
this.f26398b.addAll(a2);
a(i2, a2);
}
}
}
public class StylePagerAdapter extends PagerAdapter {
public Context f91439a;
public LayoutInflater f26406a;
public StylePagerAdapter(Context context) {
this.f91439a = context;
this.f26406a = LayoutInflater.from(this.f91439a);
}
@Override
public Object instantiateItem(ViewGroup viewGroup, int i) {
if (QLog.isColorLevel()) {
QLog.d(VipProfileCardPreviewActivity.i, 2, "instantiateItem, pos = " + i);
}
View inflate = this.f26406a.inflate(R.layout.f57753name_res_0x7f030580, viewGroup, false);
ViewHolder viewHolder = new ViewHolder();
viewHolder.f26408a = (ProfileCardScrollImageView) inflate.findViewById(R.id.f53741name_res_0x7f091a0a);
inflate.setTag(viewHolder);
viewHolder.f26408a.setScaleType(ImageView.ScaleType.FIT_XY);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewHolder.f26408a.getLayoutParams();
layoutParams.width = VipProfileCardPreviewActivity.this.aB;
layoutParams.height = VipProfileCardPreviewActivity.this.aA;
viewHolder.f26408a.setLayoutParams(layoutParams);
if (Build.VERSION.SDK_INT >= 16) {
viewHolder.f26408a.setBackground(VipProfileCardPreviewActivity.this.f91438a);
} else {
viewHolder.f26408a.setBackgroundDrawable(VipProfileCardPreviewActivity.this.f91438a);
}
viewHolder.f26408a.setImageDrawable(this.f91439a.getResources().getDrawable(R.drawable.f44921name_res_0x7f020f09));
inflate.setId(i);
viewGroup.addView(inflate);
VipProfileCardPreviewActivity.this.a(viewHolder, (ProfileCardTemplateInfo) VipProfileCardPreviewActivity.this.f26390a.get(i), i);
return inflate;
}
@Override
public int getCount() {
return VipProfileCardPreviewActivity.this.f26390a.size();
}
@Override
public boolean isViewFromObject(View view, Object obj) {
return view == obj;
}
@Override
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
if (QLog.isColorLevel()) {
QLog.d(VipProfileCardPreviewActivity.i, 2, "destroyItem, pos = " + i);
}
View view = (View) obj;
ViewHolder viewHolder = (ViewHolder) view.getTag();
viewGroup.removeView(view);
}
public class ViewHolder {
ProfileCardScrollImageView f26408a;
public ViewHolder() {
}
}
}
public void a(StylePagerAdapter.ViewHolder viewHolder, ProfileCardTemplateInfo profileCardTemplateInfo, int i2) {
if (m7331a(profileCardTemplateInfo)) {
profileCardTemplateInfo.f91415a = 2;
if (QLog.isColorLevel()) {
QLog.d(i, 2, "loadImageDrawable pos = " + i2 + " info exist");
}
List a2 = a(profileCardTemplateInfo);
if (a2 != null && a2.size() != 0) {
switch (profileCardTemplateInfo.f26321a.f26306d) {
case 0:
viewHolder.f26408a.setIsScroll(false);
viewHolder.f26408a.setImageDrawable(URLDrawable.getDrawable(FMConstants.f23377aY + ProfileCardUtil.a(this.f26353a, (String) a2.get(0)), this.aB, this.aA, viewHolder.f26408a.getDrawable(), viewHolder.f26408a.getDrawable(), false));
viewHolder.f26408a.setTag(Integer.valueOf(i2));
return;
case 1:
viewHolder.f26408a.setIsScroll(true);
String a3 = ProfileCardUtil.a(this.f26353a, (String) a2.get(0));
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
options.inDensity = this.J;
options.inTargetDensity = this.J;
options.inScreenDensity = this.J;
BitmapFactory.decodeFile(a3, options);
int i3 = options.outWidth;
this.aC = this.aA - ((options.outHeight * this.aB) / i3);
viewHolder.f26408a.setScaleType(ImageView.ScaleType.MATRIX);
Matrix matrix = new Matrix();
matrix.postScale(this.aB / i3, this.aB / i3);
viewHolder.f26408a.setImageMatrix(matrix);
Drawable drawable = (Drawable) BaseApplicationImpl.f6969a.get(a3);
if (drawable != null) {
viewHolder.f26408a.setImageDrawable(drawable);
viewHolder.f26408a.setTag(Integer.valueOf(i2));
if (this.az == i2) {
a(i2);
return;
}
return;
}
ThreadManager.a(new syg(this, a3, i2), 8, null, true);
return;
case 2:
viewHolder.f26408a.setIsScroll(false);
if (a2.size() > 1 && !TextUtils.isEmpty((CharSequence) a2.get(0)) && !TextUtils.isEmpty((CharSequence) a2.get(1))) {
String str = ((String) a2.get(0)) + ((String) a2.get(1));
Drawable drawable2 = (Drawable) BaseApplicationImpl.f6969a.get(str);
if (drawable2 != null) {
viewHolder.f26408a.setImageDrawable(drawable2);
viewHolder.f26408a.setTag(Integer.valueOf(i2));
if (this.az == i2) {
a(i2);
return;
}
return;
}
ThreadManager.a(new syh(this, a2, str, i2), 8, null, true);
return;
}
return;
default:
return;
}
}
} else if (QLog.isColorLevel()) {
QLog.d(i, 2, "loadImageDrawable pos = " + i2 + " info not exist");
}
}
public Bitmap a(String str, boolean z) {
Bitmap bitmap = null;
Bitmap.Config config = Bitmap.Config.ARGB_8888;
int i2 = 1;
while (i2 <= 2) {
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = config;
options.inDensity = this.J;
options.inTargetDensity = this.J;
options.inScreenDensity = this.J;
if (z) {
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(str, options);
options.inSampleSize = a(options, this.aB, this.aA);
}
options.inJustDecodeBounds = false;
bitmap = BitmapFactory.decodeFile(str, options);
break;
} catch (Exception e) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "getFrameBitmap oom path = " + str + ", msg = " + e.getMessage() + ", try count : " + i2);
}
} catch (OutOfMemoryError e2) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "getFrameBitmap oom path = " + str + ", try count : " + i2);
}
i2++;
config = Bitmap.Config.ARGB_4444;
}
}
return bitmap;
}
public int a(BitmapFactory.Options options, int i2, int i3) {
int i4 = 1;
if (i2 != 0 && i3 != 0 && i2 != -1 && i3 != -1) {
int i5 = options.outHeight;
int i6 = options.outWidth;
for (int i7 = i5; i7 > i3 && i6 > i2; i7 /= 2) {
int round = Math.round(i7 / i3);
int round2 = Math.round(i6 / i2);
if (round <= round2) {
round = round2;
}
if (round < 2) {
break;
}
i4 *= 2;
i6 /= 2;
}
}
return i4;
}
private void d(int i2) {
View findViewById;
if (this.f26387a != null && this.f26390a != null && (findViewById = this.f26387a.findViewById(i2)) != null && findViewById.getTag() != null) {
a((StylePagerAdapter.ViewHolder) findViewById.getTag(), (ProfileCardTemplateInfo) this.f26390a.get(i2), i2);
}
}
public void b(int i2) {
if (this.f26390a != null && i2 >= 0 && i2 < this.f26390a.size() && this.f26390a.get(i2) != null) {
a(((ProfileCardTemplateInfo) this.f26390a.get(i2)).f26321a, this.f26384a, false);
if (this.f26363b == 4) {
this.f26399c.setText(R.string.f65429name_res_0x7f0a1b79);
this.j = "2";
} else if (this.f26363b == 2) {
this.f26399c.setText(R.string.f65428name_res_0x7f0a1b78);
this.j = "1";
} else {
this.f26399c.setText(R.string.f65426name_res_0x7f0a1b76);
this.j = "0";
}
}
}
public void a(String str) {
if (!TextUtils.isEmpty(str)) {
String a2 = ProfileCardUtil.a(this.f26353a, str);
File file = new File(a2);
if (file.isFile() && file.exists()) {
String str2 = "profilecard_preview:" + a2;
Pair pair = (Pair) BaseApplicationImpl.f6969a.get(str2);
if (pair != null && pair.first != null) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "get image form sImageCache filePath=" + a2);
}
this.f91438a = ((Drawable.ConstantState) pair.first).newDrawable();
return;
}
a(a2, str2);
}
}
}
private void a(String str, String str2) {
ThreadManager.a(new syi(this, str, str2), 8, null, true);
}
public void m() {
long[] jArr;
i();
Intent intent = getIntent();
if (intent != null) {
if (intent.hasExtra(ShortVideoConstants.aC)) {
this.aE = 0;
String stringExtra = intent.getStringExtra(ShortVideoConstants.aC);
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initStyleAndBg preview = " + stringExtra);
}
try {
JSONObject jSONObject = new JSONObject(stringExtra);
if (jSONObject.has(MttLoader.ENTRY_ID)) {
this.B = jSONObject.getInt(MttLoader.ENTRY_ID);
}
JSONObject jSONObject2 = jSONObject.getJSONObject("item");
this.f26384a = new ProfileCardBackground();
this.f26384a.f91405a = jSONObject2.optInt("id");
this.f26384a.f26269a = jSONObject2.optString("name");
this.f26384a.f91406b = jSONObject2.optInt("type");
this.f26384a.f26271b = jSONObject2.optString("image_url");
this.f26384a.f26272c = jSONObject2.optString("thumb_url");
this.f26384a.f91407c = jSONObject2.optInt("auth");
this.f26384a.d = jSONObject2.optInt("limitefree_type");
this.f26384a.e = jSONObject2.optInt("limitefree_btime");
this.f26384a.f = jSONObject2.optInt("limitefree_etime");
this.f26384a.m = jSONObject2.optInt(StructMsgConstants.bK);
this.f26384a.g = jSONObject2.optInt(StructMsgConstants.bp);
this.f26384a.h = jSONObject2.optInt("tag_btime");
this.f26384a.i = jSONObject2.optInt("tag_etime");
this.f26384a.j = jSONObject2.optInt("background_btime");
this.f26384a.k = jSONObject2.optInt("background_etime");
this.D = this.f26384a.m;
a(this.f26384a);
this.f26391b = jSONObject2.optInt("style");
if (this.f26384a.f91405a == 160) {
this.f26391b = 1L;
jArr = a();
} else {
JSONArray jSONArray = jSONObject2.getJSONArray("style_list");
jArr = new long[jSONArray.length()];
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
jArr[i2] = jSONArray.getLong(i2);
}
}
a(jArr);
a(this.f26384a.f26271b);
} catch (JSONException e) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initStyleAndBg JSONException json = " + stringExtra);
}
}
} else if (intent.hasExtra("custom_card_background")) {
this.aE = 1;
this.m = intent.getStringExtra("custom_card_background");
this.f26384a = new ProfileCardBackground();
this.f26384a.f91405a = 160;
this.f26391b = 1L;
a(a());
a(this.m, (String) null);
}
}
}
@Override
protected void mo7328a() {
if (this.f26387a != null) {
b(this.f26387a.getCurrentItem());
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.f53763name_res_0x7f091a20:
if (this.f26387a != null && this.f26390a != null && this.f26390a.size() > 0) {
if (this.aE == 0) {
ProfileCardTemplateInfo profileCardTemplateInfo = (ProfileCardTemplateInfo) this.f26390a.get(this.f26387a.getCurrentItem());
ReportController.b(this.app, "dc01331", "", "", "card_mall", "0X8004C27", 0, 0, this.j, Long.toString(profileCardTemplateInfo.f26321a.f26313i), "", VipUtils.a((AppInterface) this.app, this.app.getCurrentAccountUin()));
if (profileCardTemplateInfo.f26321a.f26313i == ProfileCardTemplate.h) {
ReportController.b(this.app, "dc01331", "", "", "Shop_Malltemplateclk", "0X8005B92", 0, 0, "", "", "", "");
}
if (a(profileCardTemplateInfo.f26321a, this.f26384a, true)) {
if (this.f26384a.f91405a != 160) {
a(profileCardTemplateInfo.f26321a.f26313i, this.f26384a.f91405a);
return;
} else {
a(a(), this.f26384a.f91405a, this.f26384a.f26271b, this.f26384a.m);
return;
}
}
return;
} else if (this.aE == 1) {
ReportController.b(this.app, "dc01331", "", "", "card_mall", "0X8004C27", 0, 0, this.j, "-1", "", VipUtils.a((AppInterface) this.app, this.app.getCurrentAccountUin()));
ProfileCardUtil.a(this.m, 100, 0.5633803f);
if (!TextUtils.isEmpty((CharSequence) this.f26389a.get(this.m))) {
b(this.m, (String) this.f26389a.get(this.m));
return;
} else {
b(this.m);
return;
}
} else {
return;
}
}
return;
default:
return;
}
}
@Override
public boolean onBackEvent() {
ReportController.b(this.app, "dc01331", "", "", "card_mall", "0X8004C28", 0, 0, "", "", "", VipUtils.a((AppInterface) this.app, this.app.getCurrentAccountUin()));
return super.onBackEvent();
}
@Override
public boolean isWrapContent() {
return false;
}
private void b(String str) {
syj syjVar = new syj(this, Long.parseLong(this.app.getCurrentAccountUin()), str, VipUploadUtils.a(this.app), VipUploadUtils.f26409a, str);
syjVar.f26426b = VipUploadUtils.a(this.app);
((VipBaseUpsImageUploadTask) syjVar).n = VipUploadUtils.a(this.app, str);
n();
syjVar.mo7334a();
((VipImageUploadManager) this.app.getManager(89)).a(this.app, syjVar, null);
}
private void n() {
this.f26359a = new QQProgressDialog(this, getTitleBarHeight());
this.f26359a.setCancelable(false);
this.f26359a.b(R.string.f65432name_res_0x7f0a1b7c);
try {
this.f26359a.show();
this.f26355a.sendEmptyMessageDelayed(25, 30000L);
} catch (Exception e) {
}
}
public void o() {
b();
this.f26355a.removeMessages(25);
}
public void a(String str, UpsImageUploadResult upsImageUploadResult) {
if (QLog.isColorLevel()) {
QLog.d(i, 2, "url from UPS:" + upsImageUploadResult.url);
}
this.f26389a.put(str, upsImageUploadResult.url);
b(str, upsImageUploadResult.url);
}
private void b(String str, String str2) {
if (this.f26390a != null && this.f26390a.size() != 0) {
ProfileCardBackground profileCardBackground = new ProfileCardBackground();
profileCardBackground.f91405a = 160;
ProfileCardTemplate profileCardTemplate = ((ProfileCardTemplateInfo) this.f26390a.get(this.f26387a.getCurrentItem())).f26321a;
if (profileCardTemplate != null && !this.f26405g && !isFinishing() && a(profileCardTemplate, profileCardBackground, true)) {
a(a(), 0L, str2, ProfileCardUtil.a(str));
}
}
}
private void a(long[] jArr) {
boolean z;
if (jArr != null) {
for (int i2 = 0; i2 < jArr.length; i2++) {
long j = jArr[i2];
if (j == ProfileCardTemplate.h) {
this.f26404f = true;
if (this.az == i2) {
this.az = 0;
}
if (this.f26352a == ProfileCardTemplate.f91412a) {
this.az = 0;
}
} else {
this.f26397b.add(Long.valueOf(j));
}
}
z = false;
boolean z2 = false;
for (int i3 = 0; i3 < this.f26397b.size(); i3++) {
long longValue = ((Long) this.f26397b.get(i3)).longValue();
if (longValue == this.f26352a) {
this.az = i3;
z = true;
z2 = true;
} else if (longValue == this.f26391b) {
if (!z2) {
this.az = i3;
}
z = true;
}
}
} else {
z = false;
}
if (!z && this.f26397b.size() > 0) {
this.f26397b.add(Long.valueOf(this.f26391b));
if (this.az == -1) {
this.az = this.f26397b.size() - 1;
}
}
if (this.az == -1) {
this.az = 0;
this.f26401c = true;
}
if (QLog.isColorLevel()) {
QLog.d(i, 2, "initStyleAndBg mWebStyleList = " + this.f26397b.toString() + ", mCurrentStyleId = " + this.f26352a + ", mWebStyleId = " + this.f26391b + ", mCurrentViewPos = " + this.az + ", mStyleListNull = " + this.f26401c);
}
}
private long a() {
return ((ProfileCardTemplateInfo) this.f26390a.get(this.f26387a.getCurrentItem())).f26321a.f26313i;
}
private void p() {
if (!TextUtils.isEmpty(this.m)) {
File file = new File(this.m);
if (file.exists()) {
file.delete();
}
}
}
@Override
public void doOnDestroy() {
super.doOnDestroy();
this.f26405g = true;
if (this.f26395b != null) {
this.app.removeObserver(this.f26395b);
this.f26395b = null;
}
}
@Override
public void addObserver(BusinessObserver businessObserver) {
if (this.app != null) {
this.app.addObserver(businessObserver);
}
}
}