柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 ShortPopupView.java 源代码,内容仅作参考
package net.duohuo.magappx.more.view;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import anetwork.channel.util.RequestConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jianpuzhaitong.forum.R;
import com.zxing.activity.CaptureActivity;
import java.util.List;
import net.duohuo.core.build.UrlSchemeProxy;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.util.IUtil;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.magappx.SiteConfig;
import net.duohuo.magappx.UrlScheme;
import net.duohuo.magappx.common.model.TabConfig;
import net.duohuo.magappx.common.util.AppPreference;
import net.duohuo.magappx.common.view.ActionSheet;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.remote.helper.NavibarHelper;
public class ShortPopupView extends PopupWindow implements View.OnClickListener {
private View contentView;
private Context context;
private LinearLayout helpLayout;
private LinearLayout layoutPopu;
View.OnLongClickListener naviActionLongClick;
private boolean openContentText;
private final int position;
AppPreference preference;
private LinearLayout scanLayout;
private LinearLayout searchLayout;
public ShortPopupView(Context context, List<TabConfig.TabBean.NaviActionsBean> list) {
this(context, null, -1);
}
public ShortPopupView(Context context, List<TabConfig.TabBean.NaviActionsBean> list, int i) {
int i2;
this.naviActionLongClick = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
UserApi.afterLogin((Activity) ShortPopupView.this.context, new UserApi.LoginCallBack() {
@Override
public void onLogin() {
SiteConfig siteConfig = (SiteConfig) Ioc.get(SiteConfig.class);
if (siteConfig == null) {
return;
}
if (TextUtils.isEmpty(siteConfig.jump_to_circle)) {
UrlScheme.toUrl(ShortPopupView.this.context, UrlScheme.appcode + "://groupTree?type=1");
return;
}
try {
JSONObject parseObject = JSON.parseObject(siteConfig.jump_to_circle);
UrlSchemeProxy.showPost(ShortPopupView.this.context).circle_id(parseObject.getString("id")).circleTitle(parseObject.getString("name")).go();
} catch (Exception unused) {
}
}
});
return false;
}
};
this.context = context;
View inflate = LayoutInflater.from(context).inflate(R.layout.shortpopview, (ViewGroup) null);
this.contentView = inflate;
setContentView(inflate);
this.layoutPopu = (LinearLayout) this.contentView.findViewById(R.id.layout_pop);
this.position = i;
TabConfig.getInstance().getTabs().get(i);
if (list == null) {
return;
}
if (list != null && list.size() > 0) {
this.layoutPopu.removeAllViews();
while (i2 < list.size()) {
TabConfig.TabBean.NaviActionsBean naviActionsBean = list.get(i2);
if (SafeJsonUtil.getBoolean(((SiteConfig) Ioc.get(SiteConfig.class)).global_aka)) {
i2 = naviActionsBean.getHoliday() != 1 ? i2 + 1 : 0;
View inflate2 = LayoutInflater.from(context).inflate(R.layout.action_popup_item, (ViewGroup) null);
((TextView) inflate2.findViewById(R.id.text)).setText(naviActionsBean.getTitle());
ImageView imageView = (ImageView) inflate2.findViewById(R.id.icon);
View findViewById = inflate2.findViewById(R.id.line);
if (i2 == list.size() - 1) {
findViewById.setVisibility(8);
}
StringBuilder sb = new StringBuilder();
sb.append("navi_" + i + "_action_group_");
sb.append(i2);
NavibarHelper.setImageRes(imageView, sb.toString());
inflate2.setTag(naviActionsBean);
inflate2.setOnClickListener(this);
this.layoutPopu.addView(inflate2, -2, -2);
} else {
if (naviActionsBean.getWeekday() != 1) {
}
View inflate22 = LayoutInflater.from(context).inflate(R.layout.action_popup_item, (ViewGroup) null);
((TextView) inflate22.findViewById(R.id.text)).setText(naviActionsBean.getTitle());
ImageView imageView2 = (ImageView) inflate22.findViewById(R.id.icon);
View findViewById2 = inflate22.findViewById(R.id.line);
if (i2 == list.size() - 1) {
}
StringBuilder sb2 = new StringBuilder();
sb2.append("navi_" + i + "_action_group_");
sb2.append(i2);
NavibarHelper.setImageRes(imageView2, sb2.toString());
inflate22.setTag(naviActionsBean);
inflate22.setOnClickListener(this);
this.layoutPopu.addView(inflate22, -2, -2);
}
}
if (list.size() > 5) {
((ScrollView) this.contentView.findViewById(R.id.scroll)).getLayoutParams().height = (IUtil.dip2px(context, 45.0f) + 1) * 5;
}
}
setPopuWindow();
AppPreference appPreference = (AppPreference) Ioc.get(AppPreference.class);
this.preference = appPreference;
boolean z = appPreference.hasSeeSearchUpdate;
}
@Override
public void showAsDropDown(View view) {
if (Build.VERSION.SDK_INT >= 24) {
view.getGlobalVisibleRect(new Rect());
setHeight(view.getResources().getDisplayMetrics().heightPixels);
}
super.showAsDropDown(view);
}
private void setPopuWindow() {
setFocusable(true);
setWidth(-1);
setHeight(-1);
setInputMethodMode(1);
setSoftInputMode(16);
setClippingEnabled(false);
View findViewById = getContentView().findViewById(R.id.blank_for_statue);
try {
ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
int statusHeight = IUtil.getStatusHeight();
if (statusHeight < IUtil.dip2px(this.context, 50.0f) && statusHeight > IUtil.dip2px(this.context, 18.0f)) {
layoutParams.height = IUtil.dip2px(this.context, 48.0f) + statusHeight;
findViewById.setLayoutParams(layoutParams);
}
} catch (Exception unused) {
}
this.contentView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
int left = ShortPopupView.this.layoutPopu.getLeft();
int bottom = ShortPopupView.this.layoutPopu.getBottom();
int y = (int) motionEvent.getY();
int x = (int) motionEvent.getX();
if (motionEvent.getAction() == 1 && (x < left || y > bottom || y < bottom)) {
ShortPopupView.this.dismiss();
}
return true;
}
});
}
@Override
public void onClick(View view) {
SiteConfig siteConfig = (SiteConfig) Ioc.get(SiteConfig.class);
TabConfig.TabBean.NaviActionsBean naviActionsBean = (TabConfig.TabBean.NaviActionsBean) view.getTag();
if (naviActionsBean.getType() == null) {
return;
}
String type = naviActionsBean.getType();
type.hashCode();
char c = 65535;
switch (type.hashCode()) {
case -1367751899:
if (type.equals("camera")) {
c = 0;
break;
}
break;
case -906336856:
if (type.equals("search")) {
c = 1;
break;
}
break;
case -841101058:
if (type.equals("forum_post")) {
c = 2;
break;
}
break;
case -840979460:
if (type.equals("forum_tree")) {
c = 3;
break;
}
break;
case 3198785:
if (type.equals("help")) {
c = 4;
break;
}
break;
case 3524221:
if (type.equals("scan")) {
c = 5;
break;
}
break;
case 3530173:
if (type.equals("sign")) {
c = 6;
break;
}
break;
case 606175198:
if (type.equals("customer")) {
c = 7;
break;
}
break;
case 1223440372:
if (type.equals("weather")) {
c = '\b';
break;
}
break;
case 1282255454:
if (type.equals("group_list")) {
c = '\t';
break;
}
break;
case 1282380384:
if (type.equals("group_post")) {
c = '\n';
break;
}
break;
}
switch (c) {
case 0:
UserApi.afterLogin((Activity) this.context, new UserApi.LoginCallBack() {
@Override
public void onLogin() {
try {
JSONObject parseObject = JSON.parseObject(((SiteConfig) Ioc.get(SiteConfig.class)).jump_to_circle);
String string = parseObject.getString("id");
UrlSchemeProxy.showPost(ShortPopupView.this.context).addVideoFromCamera(true).circle_id(string).circleTitle(parseObject.getString("name")).goForResult(4099);
} catch (Exception unused) {
}
}
});
break;
case 1:
UrlSchemeProxy.search(this.context).url(siteConfig.seekUrl).go();
break;
case 2:
forumPost();
break;
case 3:
UrlScheme.toUrl(this.context, UrlScheme.appcode + "://groupTree");
break;
case 4:
UrlScheme.toUrl(this.context, siteConfig.helpUrl);
break;
case 5:
Intent intent = new Intent(this.context, (Class<?>) CaptureActivity.class);
intent.putExtra("deal", RequestConstant.TRUE);
this.context.startActivity(intent);
break;
case 6:
if (UserApi.checkLogin()) {
if (TextUtils.isEmpty(siteConfig.signin)) {
UrlScheme.toUrl(this.context, "https://app.jpztong.com//mag/addon/v1/sign/signView");
break;
} else {
UrlScheme.toUrl(this.context, siteConfig.signin);
break;
}
} else {
UrlSchemeProxy.login(this.context).go();
break;
}
case 7:
UrlScheme.toUrl(this.context, naviActionsBean.getLink());
break;
case '\b':
break;
case '\t':
UrlSchemeProxy.groupCateIndex(this.context).go();
break;
case '\n':
showPost();
break;
default:
UrlScheme.toUrl(this.context, naviActionsBean.getLink());
break;
}
dismiss();
}
public void forumPost() {
UserApi.afterLogin((Activity) this.context, new UserApi.LoginCallBack() {
@Override
public void onLogin() {
JSONObject parseJSONObject = SafeJsonUtil.parseJSONObject(((SiteConfig) Ioc.get(SiteConfig.class)).jump_to_forum);
if (parseJSONObject == null || parseJSONObject.isEmpty()) {
UrlScheme.toUrl(ShortPopupView.this.context, UrlScheme.appcode + "://groupTree?type=1");
return;
}
try {
UrlSchemeProxy.threadPost(ShortPopupView.this.context).circleId(parseJSONObject.getString("id")).fid(parseJSONObject.getString("fid")).name(parseJSONObject.getString("name")).go();
} catch (Exception e) {
e.getMessage();
}
}
});
}
public void showPost() {
UserApi.afterLogin((Activity) this.context, new UserApi.LoginCallBack() {
@Override
public void onLogin() {
SiteConfig siteConfig = (SiteConfig) Ioc.get(SiteConfig.class);
if (siteConfig == null) {
return;
}
if (TextUtils.isEmpty(siteConfig.jump_to_circle)) {
UrlScheme.toUrl(ShortPopupView.this.context, UrlScheme.appcode + "://groupTree?type=1");
return;
}
try {
JSONObject parseObject = JSON.parseObject(siteConfig.jump_to_circle);
ShortPopupView.this.setAction(parseObject.getString("id"), parseObject.getString("name"));
} catch (Exception e) {
e.getMessage();
}
}
});
}
public void setAction(final String str, final String str2) {
ActionSheet actionSheet = new ActionSheet(this.context);
View inflate = LayoutInflater.from(this.context).inflate(R.layout.action_sheet_item_select_pic, (ViewGroup) null);
if ("1".equals(((SiteConfig) Ioc.get(SiteConfig.class)).global_is_open_senior_shoot) && TabConfig.getInstance().isQiniu_video()) {
((TextView) inflate.findViewById(R.id.name)).setText(R.string.post_shooting_advanced);
((TextView) inflate.findViewById(R.id.des)).setText(R.string.post_shooting_advanced_des);
} else {
((TextView) inflate.findViewById(R.id.name)).setText(R.string.post_shooting);
((TextView) inflate.findViewById(R.id.des)).setVisibility(8);
}
View inflate2 = LayoutInflater.from(this.context).inflate(R.layout.action_sheet_item_select_pic, (ViewGroup) null);
((TextView) inflate2.findViewById(R.id.name)).setText(R.string.post_album);
((TextView) inflate2.findViewById(R.id.des)).setVisibility(8);
View inflate3 = LayoutInflater.from(this.context).inflate(R.layout.action_sheet_item_select_pic, (ViewGroup) null);
((TextView) inflate3.findViewById(R.id.name)).setText(R.string.post_article);
((TextView) inflate3.findViewById(R.id.des)).setText(R.string.post_article_des);
inflate.setOnClickListener(actionSheet);
inflate.setTag("0");
inflate2.setTag("1");
inflate3.setTag("2");
inflate2.setOnClickListener(actionSheet);
actionSheet.addItemView(inflate);
actionSheet.addItemView(inflate2);
if (this.openContentText) {
actionSheet.addItemView(inflate3);
inflate3.setOnClickListener(actionSheet);
}
actionSheet.show((Activity) this.context);
actionSheet.setOnActionClickListener(new ActionSheet.OnActionClickListener<Integer>() {
@Override
public void onAction(Integer num) {
int intValue = num.intValue();
if (intValue == 0) {
UrlSchemeProxy.showPost(ShortPopupView.this.context).addVideoFromCamera(true).circle_id(str).circleTitle(str2).goForResult(4099);
} else if (intValue == 1) {
UrlSchemeProxy.showPost(ShortPopupView.this.context).addPicFromPick(true).circle_id(str).circleTitle(str2).goForResult(4102);
} else {
if (intValue != 2) {
return;
}
UrlSchemeProxy.longcontentPost(ShortPopupView.this.context).circleId(str).title(str2).go();
}
}
});
}
public void setOpenContentText(boolean z) {
this.openContentText = z;
}
}