360手机助手 v5.2.50版本的 MD5 值为:087c008db9e518cd556c792742e6830c
以下内容为反编译后的 ContainerNews12.java 源代码,内容仅作参考
package com.qihoo360.newssdk.view.impl;
import android.content.Context;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qihoo360.newssdk.a;
import com.qihoo360.newssdk.channel.common.CardInterestItem;
import com.qihoo360.newssdk.f.a.a.e;
import com.qihoo360.newssdk.f.c.c.b;
import com.qihoo360.newssdk.h;
import com.qihoo360.newssdk.i;
import com.qihoo360.newssdk.view.ContainerBase;
import com.qihoo360.newssdk.view.action.ActionJump;
import com.qihoo360.newssdk.view.utils.ApullIgnoreClickUtil;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
public class ContainerNews12 extends ContainerBase implements ApullIgnoreClickUtil.IgnoreListener {
private static final boolean DEBUG = a.e();
private static final String TAG = "ContainerNews12";
private boolean mHasAddContainer;
private View mIngoreBtn;
private e mNewsTemplate;
private LinearLayout mScrollLL;
private TextView mTitle;
private TextView mTitleDesc;
public ContainerNews12(Context context, com.qihoo360.newssdk.f.a.a aVar) {
super(context, aVar);
}
public ContainerNews12(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public ContainerNews12(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
@Override
public void initView(com.qihoo360.newssdk.f.a.a aVar) {
inflate(getContext(), i.newssdk_container_news_12, this);
this.mTitle = (TextView) findViewById(h.card_interest_title);
this.mTitleDesc = (TextView) findViewById(h.card_interest_title_desc);
this.mIngoreBtn = findViewById(h.card_interest_ignore);
this.mScrollLL = (LinearLayout) findViewById(h.card_interest_ll);
}
@Override
public void updateView(com.qihoo360.newssdk.f.a.a aVar) {
ArrayList arrayList;
ArrayList arrayList2 = null;
if (aVar != null && (aVar instanceof e) && this.mNewsTemplate != aVar) {
setVisibility(0);
this.mNewsTemplate = (e) aVar;
if (Looper.myLooper() != Looper.getMainLooper()) {
throw new RuntimeException("must called in Main thread");
}
if (this.mNewsTemplate != null) {
if (!TextUtils.isEmpty(this.mNewsTemplate.u)) {
this.mTitle.setText(this.mNewsTemplate.u);
}
if (!TextUtils.isEmpty(this.mNewsTemplate.T)) {
this.mTitleDesc.setText(this.mNewsTemplate.T);
}
if (TextUtils.isEmpty(this.mNewsTemplate.U)) {
arrayList = null;
} else {
arrayList = new ArrayList();
try {
JSONArray jSONArray = new JSONArray(this.mNewsTemplate.U);
for (int i = 0; i < jSONArray.length(); i++) {
Object opt = jSONArray.opt(i);
if (opt != null && (opt instanceof String)) {
arrayList.add((String) opt);
}
}
} catch (JSONException e) {
}
}
if (TextUtils.isEmpty(this.mNewsTemplate.ae) && arrayList != null) {
JSONArray jSONArray2 = new JSONArray();
for (int i2 = 0; i2 < arrayList.size(); i2++) {
jSONArray2.put(false);
CardInterestItem cardInterestItem = (CardInterestItem) this.mScrollLL.getChildAt(i2);
if (cardInterestItem != null) {
cardInterestItem.setItemState(CardInterestItem.ItemState.ITEMNORMAL);
}
}
this.mNewsTemplate.ae = jSONArray2.toString();
}
if (!TextUtils.isEmpty(this.mNewsTemplate.ae)) {
arrayList2 = new ArrayList();
try {
JSONArray jSONArray3 = new JSONArray(this.mNewsTemplate.ae);
for (int i3 = 0; i3 < jSONArray3.length(); i3++) {
Object opt2 = jSONArray3.opt(i3);
if (opt2 != null && (opt2 instanceof Boolean)) {
arrayList2.add((Boolean) opt2);
}
}
} catch (JSONException e2) {
}
}
if (this.mHasAddContainer) {
this.mScrollLL.removeAllViews();
this.mHasAddContainer = false;
}
if (arrayList != null && arrayList.size() > 0 && !this.mHasAddContainer) {
for (int i4 = 0; i4 < arrayList.size(); i4++) {
CardInterestItem cardInterestItem2 = new CardInterestItem(getContext());
cardInterestItem2.setText((CharSequence) arrayList.get(i4));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -1);
if (i4 > 0) {
layoutParams.leftMargin = com.qihoo360.newssdk.i.e.a(getContext(), 20.0f);
}
cardInterestItem2.setTag(Integer.valueOf(i4));
cardInterestItem2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view instanceof CardInterestItem) {
CardInterestItem cardInterestItem3 = (CardInterestItem) view;
if (cardInterestItem3.getState() == CardInterestItem.ItemState.ITEMNORMAL) {
cardInterestItem3.setItemState(CardInterestItem.ItemState.UNITEMNORMAL);
ContainerNews12.this.setClick(((Integer) cardInterestItem3.getTag()).intValue(), true);
com.qihoo360.newssdk.f.e.a(ContainerNews12.this.getContext(), ContainerNews12.this.mNewsTemplate, "click", "intexplore_card", "http://api.look.360.cn/srv/c2", b.d((String) ((CardInterestItem) view).getText()));
} else if (cardInterestItem3.getState() == CardInterestItem.ItemState.UNITEMNORMAL) {
cardInterestItem3.setItemState(CardInterestItem.ItemState.ITEMNORMAL);
ContainerNews12.this.setClick(((Integer) cardInterestItem3.getTag()).intValue(), false);
com.qihoo360.newssdk.f.e.a(ContainerNews12.this.getContext(), ContainerNews12.this.mNewsTemplate, "click", "intexplore_card", "http://api.look.360.cn/srv/c2", b.e((String) ((CardInterestItem) view).getText()));
}
}
}
});
this.mScrollLL.addView(cardInterestItem2, layoutParams);
this.mHasAddContainer = true;
}
}
if (arrayList2 != null && arrayList2.size() > 0) {
for (int i5 = 0; i5 < arrayList2.size(); i5++) {
CardInterestItem cardInterestItem3 = (CardInterestItem) this.mScrollLL.getChildAt(i5);
if (cardInterestItem3 != null) {
if (((Boolean) arrayList2.get(i5)).booleanValue()) {
cardInterestItem3.setItemState(CardInterestItem.ItemState.UNITEMNORMAL);
} else {
cardInterestItem3.setItemState(CardInterestItem.ItemState.ITEMNORMAL);
}
}
}
}
}
if (this.mIngoreBtn != null) {
this.mIngoreBtn.setVisibility(0);
if (!TextUtils.isEmpty(this.mNewsTemplate.y) && this.mNewsTemplate.y.equals("t")) {
this.mIngoreBtn.setVisibility(8);
}
this.mIngoreBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ApullIgnoreClickUtil.showSmallPopupWindow(ContainerNews12.this.getContext(), ContainerNews12.this, ContainerNews12.this.mIngoreBtn, ContainerNews12.this);
}
});
}
}
}
@Override
public com.qihoo360.newssdk.f.a.a getTemplate() {
return this.mNewsTemplate;
}
@Override
public void onIgnoreClick(List list) {
ActionJump.actionIngore(this.mNewsTemplate);
com.qihoo360.newssdk.f.e.a(getContext(), "dislike", (com.qihoo360.newssdk.f.a.a) this.mNewsTemplate, b.a(list));
}
public void setClick(int i, boolean z) {
if (DEBUG) {
Log.d(TAG, "setClick mNewsTemplate = " + this.mNewsTemplate + " which = " + i + " isClicked = " + z);
}
if (!TextUtils.isEmpty(this.mNewsTemplate.ae)) {
ArrayList arrayList = new ArrayList();
try {
JSONArray jSONArray = new JSONArray(this.mNewsTemplate.ae);
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
Object opt = jSONArray.opt(i2);
if (opt != null && (opt instanceof Boolean)) {
arrayList.add((Boolean) opt);
}
}
} catch (JSONException e) {
}
if (arrayList.get(i) != null && ((Boolean) arrayList.get(i)).booleanValue() != z) {
arrayList.set(i, Boolean.valueOf(z));
JSONArray jSONArray2 = new JSONArray();
for (int i3 = 0; i3 < arrayList.size(); i3++) {
jSONArray2.put(arrayList.get(i3));
}
this.mNewsTemplate.ae = jSONArray2.toString();
}
}
}
@Override
public void onPause() {
}
@Override
public void onResume() {
}
@Override
public void onDestroy() {
}
@Override
public boolean onBackPressed() {
return false;
}
@Override
public void onTimer() {
}
@Override
public void onFocus(boolean z) {
}
}