TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 ChatHistoryForTroopFragment.java 源代码,内容仅作参考
package com.tencent.mobileqq.activity.chathistory;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.text.ClipboardManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import android.widget.WrapperListAdapter;
import com.tencent.biz.qqstory.utils.UIUtils;
import com.tencent.common.app.AppInterface;
import com.tencent.image.URLDrawable;
import com.tencent.mobileqq.activity.PublicFragmentActivity;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.activity.SplashActivity;
import com.tencent.mobileqq.activity.TroopMemberListActivity;
import com.tencent.mobileqq.activity.aio.AIOUtils;
import com.tencent.mobileqq.activity.aio.SessionInfo;
import com.tencent.mobileqq.activity.aio.photo.AIOImageProviderService;
import com.tencent.mobileqq.activity.aio.photo.AIORichMediaData;
import com.tencent.mobileqq.activity.messagesearch.MessageItem;
import com.tencent.mobileqq.activity.messagesearch.MessageResultAdapter;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.forward.ForwardBaseOption;
import com.tencent.mobileqq.fragment.PublicBaseFragment;
import com.tencent.mobileqq.ocr.ui.OCRTextSearchActivity;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.transfile.URLDrawableHelper;
import com.tencent.mobileqq.utils.BubbleContextMenu;
import com.tencent.mobileqq.utils.DBUtils;
import com.tencent.mobileqq.utils.dialogutils.QQCustomMenu;
import com.tencent.mobileqq.vaswebviewplugin.VasWebviewConstants;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.util.MqqWeakReferenceHandler;
import com.tencent.widget.AbsListView;
import com.tencent.widget.AdapterView;
import com.tencent.widget.XListView;
import com.tencent.widget.immersive.ImmersiveUtils;
import cooperation.peak.PeakUtils;
import cooperation.troop.TroopFileProxyActivity;
import java.util.Iterator;
import java.util.List;
public class ChatHistoryForTroopFragment extends PublicBaseFragment implements Handler.Callback, TextWatcher, View.OnClickListener, View.OnKeyListener, View.OnTouchListener, TextView.OnEditorActionListener, AbsListView.OnScrollButtomListener, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener {
static final int f86062a = 0;
static final String f13661a = "chatHistory.troop.portal";
static final int f86063b = 1;
static final String f13662b = "https://qun.qq.com/qqweb/m/qunurl/index.html?_bid=2010&groupUin=$GCODE$&_wv=3";
static final int f86064c = 2;
static final int d = 100;
View f13663a;
EditText f13664a;
TextView f13665a;
public AIORichMediaData f13666a;
SearchHistoryAdapter f13667a;
MessageItem f13668a;
MessageResultAdapter f13669a;
QQAppInterface f13670a;
QQProgressDialog f13671a;
XListView f13672a;
View f13673b;
View f13674c;
String f13675c;
View f13676d;
int e = 0;
@Override
public void a(Activity activity) {
super.a(activity);
activity.getWindow().setSoftInputMode(20);
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
this.f13663a = layoutInflater.inflate(R.layout.f57238name_res_0x7f03037d, viewGroup, false);
if (ImmersiveUtils.isSupporImmersive() == 1) {
this.f13663a.setFitsSystemWindows(true);
this.f13663a.setPadding(0, ImmersiveUtils.a(layoutInflater.getContext()), 0, 0);
}
a(getArguments());
a();
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "exp", 0, 0, this.f13675c, "", "", "");
return this.f13663a;
}
@Override
public void onDestroyView() {
d();
super.onDestroyView();
}
protected void a(Bundle bundle) {
this.f13675c = bundle.getString("troop_uin");
if (this.f13675c == null) {
QLog.e(f13661a, 1, "troop uin id required");
b();
return;
}
FragmentActivity activity = getActivity();
AppInterface appInterface = activity == null ? null : activity.getAppInterface();
if (appInterface instanceof QQAppInterface) {
this.f13670a = (QQAppInterface) appInterface;
e();
return;
}
QLog.e(f13661a, 1, "app is null");
b();
}
protected void a() {
FragmentActivity activity = getActivity();
if (activity != null) {
this.f13673b = this.f13663a.findViewById(R.id.f51613name_res_0x7f0911b9);
this.f13674c = this.f13663a.findViewById(R.id.f51611name_res_0x7f0911b7);
this.f13672a = (XListView) this.f13663a.findViewById(R.id.f48853search_result_list);
this.f13672a.setOnTouchListener(this);
int m1705a = UIUtils.m1705a((Context) activity, 10.0f);
this.f13665a = new TextView(activity);
this.f13665a.setTextSize(16.0f);
this.f13665a.setTextColor(getResources().getColorStateList(R.color.f39378name_res_0x7f0b03d1));
this.f13665a.setGravity(1);
this.f13665a.setPadding(0, m1705a, 0, m1705a);
this.f13665a.setVisibility(8);
this.f13672a.b((View) this.f13665a);
this.f13676d = this.f13663a.findViewById(R.id.f51612ib_clear_text);
this.f13676d.setOnClickListener(this);
this.f13664a = (EditText) this.f13663a.findViewById(R.id.f48670et_search_keyword);
this.f13664a.addTextChangedListener(this);
this.f13664a.setOnEditorActionListener(this);
this.f13664a.setOnKeyListener(this);
this.f13664a.setOnTouchListener(this);
this.f13663a.findViewById(R.id.f48669btn_cancel_search).setOnClickListener(this);
this.f13663a.findViewById(R.id.f47145image).setOnClickListener(this);
this.f13663a.findViewById(R.id.f51614name_res_0x7f0911ba).setOnClickListener(this);
this.f13663a.findViewById(R.id.f51615name_res_0x7f0911bb).setOnClickListener(this);
this.f13663a.findViewById(R.id.f51616name_res_0x7f0911bc).setOnClickListener(this);
this.f13663a.findViewById(R.id.f51617name_res_0x7f0911bd).setOnClickListener(this);
}
}
protected void a(int i) {
if (this.e != i) {
if (i == 1) {
this.f13672a.setAdapter((ListAdapter) null);
this.f13672a.setOnItemClickListener(null);
this.f13672a.setOnItemLongClickListener(null);
this.f13672a.setVisibility(0);
this.f13672a.setEmptyView(null);
this.f13674c.setVisibility(8);
this.f13673b.setVisibility(8);
this.f13672a.setOnScrollToButtomListener(null);
this.f13665a.setVisibility(8);
} else if (i == 2) {
this.f13672a.setAdapter((ListAdapter) this.f13669a);
this.f13672a.setOnItemClickListener(this);
this.f13672a.setOnItemLongClickListener(this);
this.f13672a.setVisibility(0);
this.f13672a.setEmptyView(this.f13674c);
this.f13673b.setVisibility(8);
this.f13672a.setOnScrollToButtomListener(this);
this.f13665a.setVisibility(this.f13669a.a() ? 8 : 0);
((TextView) this.f13674c.findViewById(R.id.f49829name_res_0x7f090ac1)).setText("无搜索结果");
Resources resources = this.f13663a.getContext().getResources();
URLDrawable.URLDrawableOptions obtain = URLDrawable.URLDrawableOptions.obtain();
obtain.mRequestWidth = AIOUtils.a(320.0f, resources);
obtain.mRequestHeight = AIOUtils.a(177.5f, resources);
obtain.mLoadingDrawable = URLDrawableHelper.f31210a;
obtain.mFailedDrawable = URLDrawableHelper.f31210a;
((ImageView) this.f13674c.findViewById(R.id.f49078name_res_0x7f0907d2)).setImageDrawable(URLDrawable.getDrawable("https://pub.idqqimg.com/pc/misc/files/20171229/54e96094adaf456f9b8f622f191f8fde.png", obtain));
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "chatRecor_search", "search_exp", 0, 0, this.f13675c, "", "", "");
} else {
this.f13672a.setVisibility(8);
this.f13674c.setVisibility(8);
this.f13673b.setVisibility(0);
}
this.e = i;
}
}
@Override
public void onClick(View view) {
FragmentActivity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.f47145image:
a(activity);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_pic", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f48355name_res_0x7f0904ff:
MessageItem messageItem = this.f13668a;
if (messageItem != null) {
Bundle bundle = new Bundle();
bundle.putInt(AppConstants.Key.G, -1);
bundle.putString(AppConstants.Key.F, messageItem.f14237a.f88923msg);
Intent intent = new Intent();
intent.putExtras(bundle);
ForwardBaseOption.a(activity, intent, 21);
return;
}
return;
case R.id.f48669btn_cancel_search:
b();
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_cancel", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f51612ib_clear_text:
this.f13664a.setText("");
((InputMethodManager) this.f13664a.getContext().getSystemService("input_method")).showSoftInput(this.f13664a, 0);
return;
case R.id.f51614name_res_0x7f0911ba:
String currentAccountUin = activity.getCurrentAccountUin();
DBUtils.a(currentAccountUin, DBUtils.f94519c, this.f13675c, 0);
Intent intent2 = new Intent();
intent2.putExtra(TroopFileProxyActivity.f71249a, this.f13675c);
intent2.putExtra("param_from", 5000);
TroopFileProxyActivity.a(activity, intent2, -1, currentAccountUin);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_file", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f51615name_res_0x7f0911bb:
Intent intent3 = new Intent(activity, QQBrowserActivity.class);
intent3.putExtra("url", a(this.f13675c));
intent3.putExtra("webStyle", "noBottomBar");
intent3.putExtra(VasWebviewConstants.KEY_OPEN_PAGE_TIME, System.currentTimeMillis());
startActivity(intent3);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_link", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f51616name_res_0x7f0911bc:
Intent intent4 = new Intent();
intent4.putExtra("troop_uin", this.f13675c);
PublicFragmentActivity.a(activity, intent4, ChatHistoryByDateFragment.class);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_date", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f51617name_res_0x7f0911bd:
Intent a2 = TroopMemberListActivity.a(activity, this.f13675c, 18);
a2.putExtra("uin", this.f13675c);
a2.putExtra("uintype", 1);
startActivity(a2);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_mber", 0, 0, this.f13675c, "", "", "");
return;
case R.id.f56269name_res_0x7f0923ea:
MessageItem messageItem2 = this.f13668a;
if (messageItem2 != null) {
((ClipboardManager) activity.getSystemService("clipboard")).setText(messageItem2.f14237a.f88923msg);
return;
}
return;
default:
return;
}
}
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if ((motionEvent.getAction() & 255) == 0) {
if (view == this.f13672a) {
((InputMethodManager) this.f13664a.getContext().getSystemService("input_method")).hideSoftInputFromWindow(this.f13664a.getWindowToken(), 0);
} else if (view == this.f13664a) {
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", "Clk_search", 0, 0, this.f13675c, "", "", "");
}
}
return false;
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
switch (i) {
case 21:
if (-1 == i2) {
b(intent.getExtras());
return;
}
return;
default:
return;
}
}
protected void b(Bundle bundle) {
FragmentActivity activity = getActivity();
if (activity != null) {
Intent a2 = AIOUtils.a(new Intent(activity, SplashActivity.class), (int[]) null);
a2.putExtras(new Bundle(bundle));
startActivity(a2);
}
}
protected void b() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.finish();
}
}
@Override
public void P_() {
InputMethodManager inputMethodManager;
super.P_();
FragmentActivity activity = getActivity();
if (activity != null && (inputMethodManager = (InputMethodManager) activity.getSystemService("input_method")) != null && inputMethodManager.isActive()) {
inputMethodManager.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
}
}
public void m3359a(String str) {
if (QLog.isColorLevel()) {
QLog.i(f13661a, 2, "searchMessage, currentKeyword = " + str);
}
if (!TextUtils.isEmpty(str)) {
if (this.f13669a == null) {
SessionInfo sessionInfo = new SessionInfo();
sessionInfo.f12447a = this.f13675c;
sessionInfo.f85624a = 1;
this.f13669a = new MessageResultAdapter(this.f13663a.getContext(), new MqqWeakReferenceHandler(Looper.getMainLooper(), this), sessionInfo, this.f13670a);
}
if (!str.equalsIgnoreCase(this.f13669a.a())) {
this.f13669a.a(System.currentTimeMillis(), str, 1);
b(R.string.f63612name_res_0x7f0a145b);
} else {
a(2);
}
((InputMethodManager) this.f13664a.getContext().getSystemService("input_method")).hideSoftInputFromWindow(this.f13664a.getWindowToken(), 0);
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "home", OCRTextSearchActivity.f, 0, 0, this.f13675c, "", "", "");
}
}
protected void b(int i) {
if (this.f13671a == null) {
Context context = this.f13663a.getContext();
this.f13671a = new QQProgressDialog(context, context.getResources().getDimensionPixelSize(R.dimen.f39450title_bar_height));
}
this.f13671a.setCancelable(false);
this.f13671a.setCanceledOnTouchOutside(false);
this.f13671a.b(i);
this.f13671a.show();
}
protected void d() {
if (this.f13671a != null && this.f13671a.isShowing()) {
this.f13671a.dismiss();
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
boolean z = editable.length() == 0;
a(z ? 0 : 1);
this.f13676d.setVisibility(z ? 8 : 0);
}
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == 3) {
String trim = textView.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
return false;
}
m3359a(trim);
return true;
}
return false;
}
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if (keyEvent.getAction() == 1) {
if (keyEvent.getKeyCode() == 66 || keyEvent.getKeyCode() == 84) {
String trim = ((TextView) view).getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
return false;
}
m3359a(trim);
return true;
}
return false;
}
return false;
}
@Override
public boolean handleMessage(Message message) {
switch (message.what) {
case 2:
d();
if (message.obj instanceof List) {
this.f13665a.setText("点击加载更多");
this.f13665a.setVisibility(this.f13669a.a() ? 8 : 0);
this.f13669a.a((List) message.obj, message.arg1);
this.f13669a.notifyDataSetChanged();
}
a(2);
return true;
default:
return true;
}
}
@Override
public void a(AdapterView adapterView, View view, int i, long j) {
if (QLog.isColorLevel()) {
QLog.i(f13661a, 2, "onItemClick, position = " + i);
}
if (view == this.f13665a) {
String a2 = this.f13669a.a();
this.f13665a.setText("加载中…");
this.f13669a.a(System.currentTimeMillis(), a2, 2);
return;
}
ListAdapter a3 = this.f13672a.a();
while (a3 instanceof WrapperListAdapter) {
a3 = ((WrapperListAdapter) a3).getWrappedAdapter();
}
if (a3 == this.f13669a) {
FragmentActivity activity = getActivity();
if (activity != null) {
MessageRecord messageRecord = ((MessageItem) a3.getItem(i)).f14237a;
ChatHistoryBubbleListForTroopFragment.a(activity, this.f13675c, messageRecord, 100, 2);
if (QLog.isColorLevel()) {
QLog.i(f13661a, 2, "onItemClick, message = " + messageRecord);
}
ReportController.b(this.f13670a, "dc01332", "Grp_chatRecord", "", "chatRecor_search", "search_clk", 0, 0, this.f13675c, "", "", "");
}
} else if (a3 == this.f13667a) {
String str = (String) a3.getItem(i);
this.f13664a.setText(str);
this.f13664a.setSelection(str.length());
m3359a(str);
} else if (QLog.isColorLevel()) {
QLog.i(f13661a, 2, "onItemClick, unknown data type");
}
}
@Override
public boolean mo1348a(AdapterView adapterView, View view, int i, long j) {
if (QLog.isColorLevel()) {
QLog.i(f13661a, 2, "onLongClick, position = " + i);
}
if (view == this.f13665a) {
return false;
}
this.f13668a = (MessageItem) adapterView.mo10338a().getItem(i);
view.setSelected(true);
QQCustomMenu qQCustomMenu = new QQCustomMenu();
qQCustomMenu.a(R.id.f56269name_res_0x7f0923ea, "复制", R.drawable.f41621name_res_0x7f020220);
qQCustomMenu.a(R.id.f48355name_res_0x7f0904ff, this.f13663a.getContext().getString(R.string.f64273name_res_0x7f0a16f0), R.drawable.f41629name_res_0x7f020228);
BubbleContextMenu.a(view, qQCustomMenu, this, new ncs(this, view));
return true;
}
private String a(String str) {
return f13662b.replace("$GCODE$", str);
}
private void a(FragmentActivity fragmentActivity) {
if (this.f13666a != null && fragmentActivity != null) {
Bundle bundle = new Bundle();
bundle.putString(PeakUtils.d, this.f13675c);
Iterator<ActivityManager.RunningAppProcessInfo> it = ((ActivityManager) fragmentActivity.getSystemService("activity")).getRunningAppProcesses().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ActivityManager.RunningAppProcessInfo next = it.next();
if (next.processName.endsWith("mobileqq")) {
bundle.putInt(PeakUtils.u, next.pid);
break;
}
}
bundle.putInt(AppConstants.Key.I, 1);
bundle.putBoolean(PeakUtils.q, true);
bundle.putBoolean(PeakUtils.r, true);
bundle.putBoolean(PeakUtils.l, true);
bundle.putString("uin", this.f13675c);
String currentAccountUin = fragmentActivity.getCurrentAccountUin();
if (currentAccountUin != null) {
PeakUtils.b(fragmentActivity, bundle, new AIOImageProviderService(currentAccountUin, this.f13675c, 1, null), this.f13666a, -1);
return;
}
return;
}
FragmentActivity activity = getActivity();
if (activity != null) {
TroopAIOImageEmptyFragment.a(activity, "图片与视频", "https://pub.idqqimg.com/pc/misc/files/20171229/bbe4775afd434f4f8be58e5f1bcd7671.png", "没有图片与视频");
}
}
private void e() {
TroopAIOImageGeter troopAIOImageGeter = new TroopAIOImageGeter(getActivity().getCurrentAccountUin(), this.f13675c, 1, null);
troopAIOImageGeter.a(new nct(this));
troopAIOImageGeter.a(0);
}
@Override
public void r(int i) {
if (i < 0) {
String a2 = this.f13669a.a();
this.f13665a.setText("加载中…");
this.f13669a.a(System.currentTimeMillis(), a2, 2);
}
}
}