Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23
以下内容为反编译后的 StickersAdapter.java 源代码,内容仅作参考
package com.perm.kate;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.perm.kate.api.Product;
import com.perm.kate.smile.StickerConfig;
import com.perm.kate.theme.ColorTheme;
import java.util.ArrayList;
public class StickersAdapter extends BaseAdapter {
private final Activity activity;
private ArrayList stickers = new ArrayList();
public boolean show_buttons = true;
private final View.OnClickListener activet_ClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
Product product = (Product) view.getTag();
if (product != null) {
StickersAdapter.this.stickers.remove(product);
StickersAdapter.this.notifyDataSetChanged();
StickerConfig.setStickers(StickersAdapter.this.stickers);
}
}
};
public StickersAdapter(Activity activity) {
this.activity = activity;
}
public void displayData(ArrayList arrayList) {
if (arrayList == null) {
this.stickers.clear();
} else {
this.stickers = arrayList;
}
notifyDataSetChanged();
}
@Override
public int getCount() {
return this.stickers.size();
}
@Override
public Object getItem(int i) {
if (i == this.stickers.size()) {
return null;
}
return this.stickers.get(i);
}
@Override
public long getItemId(int i) {
if (i == this.stickers.size()) {
return -1L;
}
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
String str;
if (view == null) {
try {
view = ((LayoutInflater) this.activity.getSystemService("layout_inflater")).inflate(R.layout.stickers_list_item, viewGroup, false);
} catch (Exception e) {
e.printStackTrace();
Helper.reportError(e);
return null;
}
}
Product product = (Product) this.stickers.get(i);
((TextView) view.findViewById(R.id.tv_sticker_name)).setText(product.title);
view.setTag(product);
ImageView imageView = (ImageView) view.findViewById(R.id.img_sticker);
int dip = Helper.getDIP(64.0d);
int i2 = dip > 64 ? 128 : 64;
if (dip > 128) {
i2 = 256;
}
int[] iArr = product.sticker_ids;
if (iArr == null || iArr.length <= 0) {
str = "";
} else {
str = "https://vk.com/sticker/1-" + product.sticker_ids[0] + "-" + i2 + "b";
}
KApplication.getImageLoader().DisplayImage(str, imageView, true, dip, R.drawable.no_photo, false);
View findViewById = view.findViewById(R.id.fl_button_bg);
if (BaseActivity.IsCustomTheme) {
findViewById.setBackground(ColorTheme.getColorTheme().getButtonBgDrawable());
}
Button button = (Button) view.findViewById(R.id.btn_active);
if (this.show_buttons) {
button.setText(R.string.label_hide);
button.setOnClickListener(this.activet_ClickListener);
button.setTag(product);
} else {
findViewById.setVisibility(8);
}
return view;
}
}