柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 ShowPostActivity.java 源代码,内容仅作参考
package net.duohuo.magappx.circle.show;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import anetwork.channel.util.RequestConstant;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.jianpuzhaitong.forum.R;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.open.SocialConstants;
import com.tencent.smtt.sdk.TbsReaderView;
import com.umeng.socialize.net.dplus.CommonNetImpl;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.functions.BiConsumer;
import io.reactivex.functions.Consumer;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Callable;
import net.duohuo.core.ITongdunOperation;
import net.duohuo.core.annotation.Extra;
import net.duohuo.core.build.UrlSchemeProxy;
import net.duohuo.core.dialog.DialogCallBack;
import net.duohuo.core.dialog.IDialog;
import net.duohuo.core.eventbus.EventBus;
import net.duohuo.core.fresco.FrescoImageView;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.net.Net;
import net.duohuo.core.net.Result;
import net.duohuo.core.net.Task;
import net.duohuo.core.util.FileUtil;
import net.duohuo.core.util.IUtil;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.core.util.StrUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.AppAbilitySplit;
import net.duohuo.magappx.SiteConfig;
import net.duohuo.magappx.UrlScheme;
import net.duohuo.magappx.attachment.activity.FileOperationActivity;
import net.duohuo.magappx.chat.bean.LocationBean;
import net.duohuo.magappx.chat.util.OnClickUtil;
import net.duohuo.magappx.chat.util.PermissionsChecker;
import net.duohuo.magappx.circle.PostHelper;
import net.duohuo.magappx.circle.SaveDraftUtil;
import net.duohuo.magappx.circle.circle.AllCircleActivity;
import net.duohuo.magappx.circle.circle.dataview.ShowPostAttachMentLayout;
import net.duohuo.magappx.circle.forum.model.ThreadPostItem;
import net.duohuo.magappx.circle.show.dataview.ShowPostAudioDataView;
import net.duohuo.magappx.circle.show.model.ContentAuthConfig;
import net.duohuo.magappx.circle.show.model.MagUserItem;
import net.duohuo.magappx.circle.show.model.ShowGoodsItem;
import net.duohuo.magappx.circle.show.postpanle.AddGoodsPanel;
import net.duohuo.magappx.circle.show.postpanle.AddLinkPanel;
import net.duohuo.magappx.circle.show.postpanle.ChangeMagUserPanel;
import net.duohuo.magappx.circle.show.postpanle.PostPanelContainer;
import net.duohuo.magappx.circle.show.postpanle.ReprintedPanel;
import net.duohuo.magappx.circle.show.viewmodel.ShowPostViewModel;
import net.duohuo.magappx.circle.vote.CreateVoteActivity;
import net.duohuo.magappx.collection.CollectionCreateActivity;
import net.duohuo.magappx.collection.bean.CollectionCreateBean;
import net.duohuo.magappx.collection.bean.CollectionManageBean;
import net.duohuo.magappx.collection.dialog.CollectionSelectDialog;
import net.duohuo.magappx.common.base.MagBaseActivity;
import net.duohuo.magappx.common.comp.picpick.PicUploadLayout;
import net.duohuo.magappx.common.comp.share.Share;
import net.duohuo.magappx.common.comp.share.ShareConfig;
import net.duohuo.magappx.common.comp.share.SharePostPopWindow;
import net.duohuo.magappx.common.dataview.model.AtUser;
import net.duohuo.magappx.common.dataview.model.Topic;
import net.duohuo.magappx.common.filter.EditInputFilter;
import net.duohuo.magappx.common.filter.TopicEditInputFilter;
import net.duohuo.magappx.common.model.TabConfig;
import net.duohuo.magappx.common.net.NetParams;
import net.duohuo.magappx.common.service.file.FileUploader;
import net.duohuo.magappx.common.service.file.Video;
import net.duohuo.magappx.common.util.AppPreference;
import net.duohuo.magappx.common.util.Constants;
import net.duohuo.magappx.common.util.IntentUtils;
import net.duohuo.magappx.common.util.PermissionChecker;
import net.duohuo.magappx.common.util.ShapeUtil;
import net.duohuo.magappx.common.util.TextFaceUtil;
import net.duohuo.magappx.common.view.ActionSheet;
import net.duohuo.magappx.common.view.FaceGroupLayout;
import net.duohuo.magappx.common.view.FlowLayout;
import net.duohuo.magappx.common.view.ImageCheckBox;
import net.duohuo.magappx.common.view.LayoutChangeLayout;
import net.duohuo.magappx.common.view.MagWebView;
import net.duohuo.magappx.common.view.VideoUploadView;
import net.duohuo.magappx.common.view.popup.RecordPopWindow;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.main.login.model.UserPreference;
import net.duohuo.magappx.video.util.Config;
import net.duohuo.magappx.video.videoplay.VideoPicActivity;
import net.duohuo.magappx.video.videoplay.view.VideoPopupWindow;
public class ShowPostActivity extends MagBaseActivity implements View.OnClickListener {
public static final int TYPE_AT = 2;
public static final int TYPE_ATTACHMENT = 7;
public static final int TYPE_FACE = 5;
public static final int TYPE_GOODS = 10;
public static final int TYPE_LINK = 8;
public static final int TYPE_LONGCONTENT = 9;
public static final int TYPE_MIC = 4;
public static final int TYPE_PC_POST = 12;
public static final int TYPE_PIC = 1;
public static final int TYPE_REPRINT = 11;
public static final int TYPE_TOPIC = 3;
public static final int TYPE_VOTE = 6;
@Extra(def = RequestConstant.FALSE)
String addPicFromCamera;
@Extra(def = RequestConstant.FALSE)
String addPicFromPick;
@Extra(def = RequestConstant.FALSE)
String addVideoFromCamera;
@Extra(def = RequestConstant.FALSE)
String addVideoFromLocal;
@BindView(R.id.address_close)
View addressCloseV;
@BindView(R.id.arrow)
ImageView arrowV;
JSONObject attachConfigJo;
BottomSheetBehavior behavior;
@Extra(def = "")
String circleTitle;
@Extra(def = "")
String circle_id;
@BindView(R.id.close_box)
View closeBox;
private ColorStateList cls;
private CollectionSelectDialog collectionSelectDialog;
@BindView(R.id.comment_bar)
LayoutChangeLayout commentBar;
@Extra
String contentId;
@BindView(R.id.content)
EditText contentV;
@Extra(def = "0")
String disableSwitchCircle;
long drafid;
long draftMessageid;
@BindView(R.id.facelayout)
FaceGroupLayout facelayout;
FileUploader fileUploader;
@BindView(R.id.gather_close)
ImageView gatherCloseV;
@BindView(R.id.gather_icon)
ImageView gatherIconV;
@BindView(R.id.gather_text)
TextView gatherTextV;
@BindView(R.id.gather)
View gatherV;
@BindView(R.id.goods_content_box)
View goodsContentBoxV;
private JSONObject goodsJo;
@BindView(R.id.goods_pic)
FrescoImageView goodsPicV;
@BindView(R.id.goods_price)
TextView goodsPriceV;
@BindView(R.id.goods_title)
TextView goodsTitlev;
@BindColor(R.color.grey_dark)
int grey_dark;
@Extra(def = "内容")
String hint;
@BindViews({R.id.img1, R.id.img2, R.id.img3, R.id.img4, R.id.img5, R.id.img6})
ImageView[] imageTools;
boolean isFromDraftBox;
boolean isIntobehavior;
@BindView(R.id.iv_record_img)
View ivRecordImgV;
@Extra(def = "")
String jobJo;
@Extra(def = RequestConstant.FALSE)
String jumpTo;
Double lat;
private View latelyFrontView;
@Extra(def = "")
String latitude;
@BindColor(R.color.link)
int link;
@Extra(def = "")
String linkId;
JSONObject linkJo;
@BindView(R.id.linklayout)
View linkLayout;
@Extra(def = "")
String linkPic;
@Extra(def = "")
String linkTitle;
@Extra(def = "")
String linkType;
Double lng;
@BindView(R.id.loc_icon)
ImageView locIconV;
@BindView(R.id.locplace)
TextView locPlaceV;
private String location;
@BindView(R.id.location)
View locationLayout;
@Extra(def = "")
String longitude;
private LocationClient mLocationClient;
@BindView(R.id.mark)
View markV;
private ShowPostViewModel model;
@BindView(R.id.more)
ImageView moreToolV;
@BindView(R.id.morebox)
View moreboxV;
NetParams netParams;
boolean openGoodsRecommend;
int pad;
@BindView(R.id.panel)
View panel;
@BindView(R.id.panel_box)
ViewGroup panelBoxV;
@BindView(R.id.picuploadlayout)
PicUploadLayout picUploadLayoutV;
@BindView(R.id.popup_container)
PostPanelContainer popupContainerV;
@Extra(def = "")
String predata;
@BindView(R.id.rl_record_box)
View recordBoxV;
AddLinkPanel reprintedPanel;
Result result;
SaveDraftUtil saveDraftUtil;
@BindView(R.id.setting)
TextView settingV;
private SharePostPopWindow sharePostPopWindow;
@Extra(def = "")
String showCamera;
@Extra(def = "")
String showPhotos;
@BindView(R.id.showpostattachment)
ShowPostAttachMentLayout showPostAttachMentLayout;
ShowPostAudioDataView showPostAudioDataView;
@BindView(R.id.show_toast)
TextView showToastV;
@Extra(def = "")
String showVote;
SiteConfig siteConfig;
@BindView(R.id.sort_box)
LinearLayout sortBox;
@BindView(R.id.sync_userhome)
ImageCheckBox syncCheckBoxV;
@Extra(def = "")
String token;
@BindViews({R.id.child_one, R.id.child_two})
LinearLayout[] toolLayouts;
@Extra(def = "")
String topicContentStr;
@BindView(R.id.topic_flow_layout)
FlowLayout topicFlowLayoutV;
@BindView(R.id.topic_recommed)
TextView topicRecommedV;
@Extra
String topicTitle;
@Extra(def = "")
String type;
@Extra
public String typeId;
@BindView(R.id.blank)
View typeLineV;
private boolean typeRequire;
@BindView(R.id.user_head)
FrescoImageView userHeadV;
@BindView(R.id.user_name)
TextView userNameV;
String vest_user_id;
Video video;
@BindView(R.id.video_layout)
View videoLayoutV;
String videoPath;
@BindView(R.id.video_thumbnail)
VideoUploadView videoThumbnailV;
JSONObject voiceConfigJo;
@BindView(R.id.vote_content)
TextView voteContentV;
@BindView(R.id.vote_delete)
View voteDeleteV;
JSONObject voteJo;
@BindView(R.id.votelayout)
View votelayout;
@BindView(R.id.vote_tip)
TextView votetipV;
@BindColor(R.color.white)
int white;
static final String[] PERMISSIONS = {"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"};
public static int[] TYPE_PIC_UNEXIT_COLUMN = {6, 4, 11};
public static int[] TYPE_MIC_UNEXIT_COLUMN = {1, 8, 11, 4, 9};
public static int[] TYPE_VOTE_UNEXIT_COLUMN = {1, 8, 11, 6, 9};
public static int[] TYPE_LINK_UNEXIT_COLUMN = {4, 6, 10, 8, 11, 7, 9};
public static int[] TYPE_GOODS_UNEXIT_COLUMN = {8, 11, 9};
public static int[] TYPE_ATTACHMENT_UNEXIT_COLUMN = {8, 11, 9};
boolean canPost = true;
int mediatype = 0;
private ArrayList<Topic> mList = new ArrayList<>();
boolean hasShowRecommendTopic = false;
private LocationBean locationBean = new LocationBean();
List<AtUser> atUsers = new ArrayList();
boolean hasVoteOnSecondEdit = false;
boolean hasAttachOnSecondEdit = false;
String vest_name = "";
String vest_head = "";
String atUserIdsStr = "";
boolean isLocation = false;
boolean isOpenTopic = "1".equals(((SiteConfig) Ioc.get(SiteConfig.class)).global_is_open_topic);
private ContentAuthConfig contentAuthConfig = new ContentAuthConfig();
private boolean niming_config_is_open = false;
JSONObject payConfig = new JSONObject();
List<View> toolList = new ArrayList();
List<int[]> setToolList = new ArrayList();
boolean isInput = true;
HashSet<AtUser> set = new HashSet<>();
List<AtUser> newList = new ArrayList();
View.OnClickListener toolClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
int intValue = ((Integer) view.getTag()).intValue();
if (intValue == 1) {
ShowPostActivity.this.picDefSelect();
return;
}
if (intValue == 2) {
ShowPostActivity.this.onAt();
return;
}
if (intValue == 3) {
ShowPostActivity.this.topicLayoutClick();
return;
}
if (intValue == 4) {
ShowPostActivity.this.audioTypeSelect();
return;
}
if (intValue == 5) {
ShowPostActivity.this.onFace(view);
return;
}
if (intValue == 6) {
ShowPostActivity.this.onVote();
return;
}
if (intValue == 7) {
if (ShowPostActivity.this.hasAttachOnSecondEdit) {
ShowPostActivity.this.showToast("暂不支持编辑");
return;
}
Intent intent = new Intent(ShowPostActivity.this.getActivity(), (Class<?>) FileOperationActivity.class);
if (ShowPostActivity.this.attachConfigJo != null) {
intent.putExtra("attachConfigJo", ShowPostActivity.this.attachConfigJo.toJSONString());
}
intent.putExtra("result", ShowPostActivity.this.showPostAttachMentLayout.getAttachmentResult().toJSONString());
ShowPostActivity.this.startActivityForResult(intent, IntentUtils.code_attachment_post);
return;
}
if (intValue == 8) {
ShowPostActivity.this.reprintedPanel = new AddLinkPanel(ShowPostActivity.this.getActivity(), new AddLinkPanel.AddLinkCallback() {
@Override
public void addLink(JSONObject jSONObject) {
ShowPostActivity.this.showLink(jSONObject);
}
@Override
public void onCancle() {
ShowPostActivity.this.behavior.setState(4);
}
});
ShowPostActivity.this.popupContainerV.addPanel(ShowPostActivity.this.reprintedPanel);
ShowPostActivity.this.behavior.setState(3);
return;
}
if (intValue != 9) {
if (intValue == 10) {
AddGoodsPanel addGoodsPanel = new AddGoodsPanel(ShowPostActivity.this.getActivity(), ShowPostActivity.this.openGoodsRecommend);
ShowPostActivity.this.popupContainerV.addPanel(addGoodsPanel);
ShowPostActivity.this.behavior.setState(3);
addGoodsPanel.setOnClickCallback(new AddGoodsPanel.OnClickCallback() {
@Override
public void onClickCallback(ShowGoodsItem showGoodsItem) {
ShowPostActivity.this.goodsJo = new JSONObject();
ShowPostActivity.this.goodsJo.put("cover", (Object) showGoodsItem.getCover());
ShowPostActivity.this.goodsJo.put("title", (Object) showGoodsItem.getTitle());
ShowPostActivity.this.goodsJo.put("price", (Object) showGoodsItem.getPrice());
ShowPostActivity.this.goodsJo.put("linkurl", (Object) showGoodsItem.getLinkurl());
ShowPostActivity.this.showGoods();
ShowPostActivity.this.behavior.setState(4);
}
@Override
public void onCancle() {
ShowPostActivity.this.behavior.setState(4);
}
});
return;
}
if (intValue == 11) {
ShowPostActivity.this.popupContainerV.addPanel(new ReprintedPanel(ShowPostActivity.this.getActivity(), new ReprintedPanel.ReprintedCallback() {
@Override
public void reprinted(String str, List<String> list) {
ShowPostActivity.this.mediatype = 1;
ShowPostActivity.this.contentV.setText(str);
for (int i = 0; i < list.size(); i++) {
ShowPostActivity.this.picUploadLayoutV.compressPhoto(list.get(i));
}
}
@Override
public void onCancle() {
ShowPostActivity.this.behavior.setState(4);
}
}));
ShowPostActivity.this.behavior.setState(3);
return;
} else {
if (intValue == 12) {
UrlScheme.toUrl(ShowPostActivity.this.getActivity(), API.Show.pcPosterArticle);
return;
}
return;
}
}
if (!TextUtils.isEmpty(ShowPostActivity.this.contentId)) {
ShowPostActivity.this.showToast("暂不支持编辑");
return;
}
if (TextUtils.isEmpty(ShowPostActivity.this.circle_id)) {
ShowPostActivity.this.showToast("请先选择版块");
return;
}
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
if (ShowPostActivity.this.videoLayoutV.getVisibility() != 0) {
jSONArray.add(ShowPostActivity.this.picUploadLayoutV.getRichContentToJo(ShowPostActivity.this.contentV.getText().toString()));
} else {
jSONArray.add(ShowPostActivity.this.videoThumbnailV.getRichContentToJo(ShowPostActivity.this.contentV.getText().toString()));
}
if (ShowPostActivity.this.goodsJo != null) {
jSONObject.put("goods", (Object) ShowPostActivity.this.goodsJo);
}
jSONObject.put("richContent", (Object) jSONArray);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("address", (Object) ShowPostActivity.this.location);
jSONObject2.put("lng", (Object) ShowPostActivity.this.lng);
jSONObject2.put("lat", (Object) ShowPostActivity.this.lat);
if (!TextUtils.isEmpty(ShowPostActivity.this.location)) {
jSONObject.put("location", (Object) jSONObject2);
}
Intent intent2 = new Intent();
intent2.setClass(ShowPostActivity.this.getActivity(), LongContentPostAcitivity.class);
intent2.putExtra("circleId", ShowPostActivity.this.circle_id);
intent2.putExtra("title", ShowPostActivity.this.circleTitle);
intent2.putExtra("predata", jSONObject.toJSONString());
ShowPostActivity.this.startActivity(intent2);
ShowPostActivity.this.finish();
}
};
private void getPermission() {
if (new PermissionsChecker(getActivity()).judgePermissions(PERMISSIONS)) {
this.isLocation = false;
} else {
this.isLocation = true;
initLocation();
}
}
@Override
public void onCreate(Bundle bundle) {
JSONObject jSONObject;
super.onCreate(bundle);
AddLinkPanel.activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult activityResult) {
if (ShowPostActivity.this.reprintedPanel != null) {
ShowPostActivity.this.reprintedPanel.onActivityResult(activityResult);
}
}
});
if (!((UserPreference) Ioc.get(UserPreference.class)).openUserPost) {
((IDialog) Ioc.get(IDialog.class)).showToastLong(getActivity(), ((SiteConfig) Ioc.get(SiteConfig.class)).post_user_post_txt);
finish();
return;
}
setContentView(R.layout.activity_show_post);
OriginalAgreementActivity.isAgreeOriginal = false;
this.model = (ShowPostViewModel) new ViewModelProvider(getActivity(), new ShowPostViewModel.FACTORY(new CollectionCreateBean("添加合集"))).get(ShowPostViewModel.class);
this.userHeadV.loadView(((UserPreference) Ioc.get(UserPreference.class)).head, R.color.image_def, (Boolean) true);
this.userNameV.setText(((UserPreference) Ioc.get(UserPreference.class)).name);
this.syncCheckBoxV.setCheckBg(R.drawable.release_pickers_icon_select_f, R.drawable.release_pickers_icon_select_n);
this.syncCheckBoxV.setOnCheckChangeListener(new ImageCheckBox.OnCheckChangeListener() {
@Override
public void onChange(View view, boolean z) {
if (!ShowPostActivity.this.syncCheckBoxV.isChecked() || ((AppPreference) Ioc.get(AppPreference.class)).has_show_not_sync_user_home) {
return;
}
((AppPreference) Ioc.get(AppPreference.class)).has_show_not_sync_user_home = true;
((AppPreference) Ioc.get(AppPreference.class)).commit();
((IDialog) Ioc.get(IDialog.class)).showDialog(ShowPostActivity.this.getActivity(), "提示", "该内容仅发布至圈子内,不会同步到你的动态,在你的个人主页和关注动态页都不显示", "", "确认", new DialogCallBack() {
@Override
public void onClick(int i) {
}
});
}
});
this.showPostAudioDataView = new ShowPostAudioDataView(getActivity(), findViewById(R.id.audio_cover_box));
this.behavior = BottomSheetBehavior.from(this.panel);
this.panel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
this.behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onSlide(View view, float f) {
}
@Override
public void onStateChanged(View view, int i) {
IUtil.hideSoftInput(ShowPostActivity.this.contentV);
if (i == 5 || i == 4) {
ShowPostActivity.this.markV.setVisibility(8);
ShowPostActivity.this.isIntobehavior = false;
} else if (i == 3) {
ShowPostActivity.this.markV.setVisibility(0);
ShowPostActivity.this.isIntobehavior = true;
}
}
});
getPermission();
this.drafid = getIntent().getLongExtra("draftid", -1L);
this.draftMessageid = getIntent().getLongExtra("draftMessageid", -1L);
this.isFromDraftBox = getIntent().getBooleanExtra("isFromDraftBox", false);
this.netParams = new NetParams(getBaseContext());
setSwipeBackEnable(false);
if (!"FFFFFF".equals(getString(R.string.navigator_bg))) {
this.arrowV.setImageResource(R.drawable.navi_arrow_white);
}
IUtil.init(this);
this.videoThumbnailV.setUploadType("1");
this.picUploadLayoutV.setUploadType("1");
this.picUploadLayoutV.setOnChildrenCountChangeListener(new PicUploadLayout.OnChildrenCountChangeListener() {
@Override
public void onChange(int i) {
if (i == 1) {
ShowPostActivity.this.setUnexitTool(false, ShowPostActivity.TYPE_PIC_UNEXIT_COLUMN);
} else {
ShowPostActivity.this.setUnexitTool(true, ShowPostActivity.TYPE_PIC_UNEXIT_COLUMN);
}
}
});
if (!"1".equals(this.showVote)) {
if ("1".equals(this.showCamera)) {
this.addVideoFromCamera = RequestConstant.TRUE;
}
if ("1".equals(this.showPhotos)) {
this.addPicFromPick = RequestConstant.TRUE;
}
}
this.cls = new ColorStateList(new int[][]{new int[]{android.R.attr.state_pressed}, new int[]{0}}, new int[]{ContextCompat.getColor(getActivity(), R.color.white), ContextCompat.getColor(getActivity(), R.color.grey_light)});
this.pad = IUtil.dip2px(this, 5.0f);
if (RequestConstant.TRUE.equals(this.addPicFromPick)) {
this.picUploadLayoutV.setVisibility(0);
this.picUploadLayoutV.getPicFromPhoto();
this.videoLayoutV.setVisibility(8);
}
if (RequestConstant.TRUE.equals(this.addVideoFromCamera)) {
if ("1".equals(this.siteConfig.global_is_open_senior_shoot) && TabConfig.getInstance().isQiniu_video()) {
UrlSchemeProxy.seniorShortVideo(this).uploadType("1").goForResult(4099);
} else {
UrlSchemeProxy.videoRecord(this).uploadType("1").goForResult(4099);
}
} else {
loadAllTopic();
IUtil.delayShowSoftInput(this.contentV);
}
if (!TextUtils.isEmpty(this.predata)) {
JSONObject parseObject = JSON.parseObject(this.predata);
JSONObject jSONObject2 = SafeJsonUtil.getJSONObject(parseObject, "vest");
String string = SafeJsonUtil.getString(jSONObject2, "vest_id");
this.vest_user_id = string;
if (!TextUtils.isEmpty(string)) {
this.vest_name = SafeJsonUtil.getString(jSONObject2, "name");
this.vest_head = SafeJsonUtil.getString(jSONObject2, "head");
this.userNameV.setText(this.vest_name);
this.userHeadV.loadView(this.vest_head, R.color.image_def, (Boolean) true);
}
JSONArray jSONArray = parseObject.getJSONArray("richContent");
if (jSONArray != null && jSONArray.size() > 0 && (jSONObject = jSONArray.getJSONObject(0)) != null) {
if (!TextUtils.isEmpty(jSONObject.getString("content"))) {
this.contentV.setText(TextFaceUtil.parseFaceLink(jSONObject.getString("content")));
EditText editText = this.contentV;
editText.setSelection(editText.length());
}
JSONArray jSONArray2 = jSONObject.getJSONArray("pic");
if (jSONArray2.size() > 0) {
if (jSONArray2.size() == 1 && !jSONArray2.getJSONObject(0).getBoolean("isPic").booleanValue()) {
if (new File(jSONArray2.getJSONObject(0).getString("videoFilePath")).exists()) {
this.picUploadLayoutV.setVisibility(8);
this.videoLayoutV.setVisibility(0);
this.videoThumbnailV.setValue(jSONArray2);
this.mediatype = 2;
this.videoPath = jSONArray2.getJSONObject(0).getString("videoFilePath");
}
} else {
this.picUploadLayoutV.setVisibility(0);
this.videoLayoutV.setVisibility(8);
this.picUploadLayoutV.setValue(jSONArray2);
this.mediatype = 1;
}
}
}
JSONObject jSONObject3 = parseObject.getJSONObject("location");
if (jSONObject3 != null) {
this.location = jSONObject3.getString("address");
this.lng = Double.valueOf(jSONObject3.getDoubleValue("lng"));
this.lat = Double.valueOf(jSONObject3.getDoubleValue("lat"));
showAddress();
}
this.goodsJo = parseObject.getJSONObject("goods");
showGoods();
}
if (TextUtils.isEmpty(this.contentId)) {
setData();
loadClassType();
if (!TextUtils.isEmpty(this.circle_id) && !TextUtils.isEmpty(this.topicTitle)) {
if (!this.topicTitle.startsWith("#")) {
this.topicTitle = " #" + this.topicTitle + "# ";
}
this.contentV.setText(TextFaceUtil.parseTopicLink(this.topicTitle));
EditText editText2 = this.contentV;
editText2.setSelection(editText2.length());
}
} else {
Net url = Net.url(API.Show.editContentDetail);
url.param("content_id", this.contentId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
ShowPostActivity.this.result = result;
ShowPostActivity.this.circle_id = SafeJsonUtil.getString(result.getData(), "circle_id");
ShowPostActivity.this.circleTitle = SafeJsonUtil.getString(result.getData(), "circle_name");
ShowPostActivity.this.typeId = SafeJsonUtil.getString(result.getData(), "type_id");
ShowPostActivity.this.contentAuthConfig.setCanCopy(SafeJsonUtil.getInteger(result.getData(), "can_copy"));
ShowPostActivity.this.contentAuthConfig.setCanDown(SafeJsonUtil.getInteger(result.getData(), "can_down"));
ShowPostActivity.this.contentAuthConfig.setIsOrigin(SafeJsonUtil.getInteger(result.getData(), "is_origin"));
ShowPostActivity.this.contentAuthConfig.setCanOriginPic(SafeJsonUtil.getInteger(result.getData(), "can_origin_pic"));
ShowPostActivity.this.model.getCollectionBean().setValue((CollectionCreateBean) SafeJsonUtil.parseBean(result.getData().getString("collect"), CollectionCreateBean.class));
ShowPostActivity.this.setData();
ShowPostActivity.this.loadClassType();
}
}
});
}
setListener();
if (TextUtils.isEmpty(this.contentId)) {
this.saveDraftUtil = new SaveDraftUtil(this.drafid, this.draftMessageid, this.isFromDraftBox, new SaveDraftUtil.TimeEndCallback() {
@Override
public void onEnd() {
ShowPostActivity.this.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (!TextUtils.isEmpty(ShowPostActivity.this.contentV.getText().toString()) || ShowPostActivity.this.picUploadLayoutV.getPics().size() >= 1 || ShowPostActivity.this.videoLayoutV.getVisibility() == 0) {
ShowPostActivity.this.saveDraf();
}
}
});
}
});
getLifecycle().addObserver(this.saveDraftUtil);
}
setDrawableLeft(this.settingV, R.drawable.editor_tool_icon_setupthe);
ShapeUtil.shapeOval(this.ivRecordImgV, 0, this.link);
this.model.getCollectionBean().observe(getActivity(), new Observer() {
@Override
public final void onChanged(Object obj) {
ShowPostActivity.this.lambda$onCreate$0$ShowPostActivity((CollectionCreateBean) obj);
}
});
this.model.getCollectionManage().observe(getActivity(), new Observer() {
@Override
public final void onChanged(Object obj) {
ShowPostActivity.this.lambda$onCreate$1$ShowPostActivity((CollectionManageBean) obj);
}
});
}
public void lambda$onCreate$0$ShowPostActivity(CollectionCreateBean collectionCreateBean) {
if (collectionCreateBean != null) {
if (collectionCreateBean.isDefault()) {
this.gatherIconV.setImageResource(R.drawable.editor_tool_icon_collection_n);
this.gatherTextV.setTextColor(ContextCompat.getColor(getActivity(), R.color.grey_shallow));
this.gatherTextV.setText("添加合集");
this.gatherCloseV.setVisibility(8);
this.gatherV.setBackgroundResource(R.drawable.bg_show_post_loc_n);
return;
}
this.gatherIconV.setImageResource(R.drawable.editor_tool_icon_collection_f);
this.gatherTextV.setTextColor(Color.parseColor("#586B94"));
this.gatherTextV.setText(collectionCreateBean.collectionTitle);
if ("1".equals(collectionCreateBean.status)) {
this.gatherCloseV.setVisibility(0);
} else {
this.gatherCloseV.setVisibility(8);
}
this.gatherV.setBackground(null);
}
}
public void lambda$onCreate$1$ShowPostActivity(CollectionManageBean collectionManageBean) {
if (collectionManageBean != null) {
this.gatherV.setVisibility(collectionManageBean.getIsShowTip().booleanValue() ? 0 : 8);
}
}
public void setDrawableLeft(TextView textView, int i) {
Drawable drawable = ContextCompat.getDrawable(getActivity(), i);
drawable.setBounds(0, 0, IUtil.dip2px(getActivity(), 16.0f), IUtil.dip2px(getActivity(), 16.0f));
textView.setCompoundDrawables(drawable, null, null, null);
}
public void showSecondEditContent() {
Result result = this.result;
if (result == null) {
return;
}
String string = SafeJsonUtil.getString(result.getData(), "goods_info");
if (!TextUtils.isEmpty(string)) {
this.goodsJo = SafeJsonUtil.parseJSONObject(string);
showGoods();
}
if (SafeJsonUtil.getInteger(this.result.getData(), "is_attach") == 1) {
JSONArray jSONArray = SafeJsonUtil.getJSONArray(this.result.getData(), "attachs");
this.hasAttachOnSecondEdit = jSONArray.size() > 0;
this.showPostAttachMentLayout.showOnSecondEdit(jSONArray);
}
if (!TextUtils.isEmpty(SafeJsonUtil.getString(this.result.getData(), "rel_article_info"))) {
JSONObject jSONObject = SafeJsonUtil.getJSONObject(this.result.getData(), "rel_article_info");
this.linkJo = jSONObject;
showLink(jSONObject);
}
if (!TextUtils.isEmpty(SafeJsonUtil.getString(this.result.getData(), "vote_content"))) {
this.hasVoteOnSecondEdit = true;
this.voteJo = SafeJsonUtil.getJSONObject(this.result.getData(), "vote_content");
showVote();
findViewById(R.id.vote_delete).setVisibility(4);
}
if (!TextUtils.isEmpty(SafeJsonUtil.getString(this.result.getData(), Constants.voice))) {
this.showPostAudioDataView.setData(SafeJsonUtil.getJSONObject(this.result.getData(), Constants.voice));
}
JSONArray jSONArray2 = SafeJsonUtil.getJSONArray(this.result.getData(), "pics_arr");
if (jSONArray2.size() > 0) {
String string2 = SafeJsonUtil.getString(this.result.getData(), "video_url");
String string3 = SafeJsonUtil.getString(this.result.getData(), "video");
if (!TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3)) {
JSONObject jSONObjectFromArray = SafeJsonUtil.getJSONObjectFromArray(jSONArray2, 0);
this.videoPath = string2;
this.mediatype = 2;
this.picUploadLayoutV.setVisibility(8);
this.videoLayoutV.setVisibility(0);
this.videoThumbnailV.showOnSecondEdit(this.videoPath, string3, SafeJsonUtil.getString(jSONObjectFromArray, "url"), SafeJsonUtil.getString(jSONObjectFromArray, CommonNetImpl.AID));
setUnexitTool(true, TYPE_PIC_UNEXIT_COLUMN);
} else {
this.mediatype = 1;
this.picUploadLayoutV.setVisibility(0);
this.videoLayoutV.setVisibility(8);
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray2.size(); i++) {
JSONObject jSONObjectFromArray2 = SafeJsonUtil.getJSONObjectFromArray(jSONArray2, i);
final String string4 = SafeJsonUtil.getString(jSONObjectFromArray2, "url");
final String string5 = SafeJsonUtil.getString(jSONObjectFromArray2, CommonNetImpl.AID);
arrayList.add(Observable.create(new ObservableOnSubscribe<JSONObject>() {
@Override
public void subscribe(final ObservableEmitter<JSONObject> observableEmitter) throws Exception {
final File file = new File(FileUtil.getDownloadDir(), StrUtil.md5(string4) + Config.COVER_PATH_SUFFIX);
if (file.exists()) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put(CommonNetImpl.AID, (Object) string5);
jSONObject2.put(Constants.VIDEO_RECORD_VIDEPATH, (Object) file.getAbsolutePath());
observableEmitter.onNext(jSONObject2);
observableEmitter.onComplete();
return;
}
Net.url(string4).download(file.getAbsolutePath(), new Task<File>() {
@Override
public void onError() {
super.onError();
observableEmitter.onNext(null);
observableEmitter.onComplete();
}
@Override
public void onResult(File file2) {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put(CommonNetImpl.AID, (Object) string5);
jSONObject3.put(Constants.VIDEO_RECORD_VIDEPATH, (Object) file.getAbsolutePath());
observableEmitter.onNext(jSONObject3);
observableEmitter.onComplete();
}
});
}
}));
}
Observable.mergeDelayError(arrayList).collect(new Callable<JSONArray>() {
@Override
public JSONArray call() throws Exception {
return new JSONArray();
}
}, new BiConsumer<JSONArray, JSONObject>() {
@Override
public void accept(JSONArray jSONArray3, JSONObject jSONObject2) throws Exception {
if (jSONObject2 != null) {
jSONArray3.add(jSONObject2);
}
}
}).subscribe(new Consumer<JSONArray>() {
@Override
public void accept(JSONArray jSONArray3) throws Exception {
if (jSONArray3.size() > 0) {
ShowPostActivity.this.setUnexitTool(true, ShowPostActivity.TYPE_PIC_UNEXIT_COLUMN);
ShowPostActivity.this.picUploadLayoutV.showOnSecondEdit(jSONArray3);
}
}
});
}
}
this.contentV.setText(TextFaceUtil.parseFaceLink(SafeJsonUtil.getString(this.result.getData(), "content"), (List<Topic>) SafeJsonUtil.parseList(SafeJsonUtil.getJSONArray(this.result.getData(), Constants.LINK_TOPIC), Topic.class)));
if (TextUtils.isEmpty(SafeJsonUtil.getString(this.result.getData(), "location"))) {
return;
}
this.location = SafeJsonUtil.getString(this.result.getData(), "location");
this.lng = SafeJsonUtil.getDouble(this.result.getData(), "lng");
this.lat = SafeJsonUtil.getDouble(this.result.getData(), "lat");
showAddress();
}
public void setUnexitTool(boolean z, int[] iArr) {
if (z) {
this.setToolList.add(iArr);
} else {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < this.setToolList.size(); i++) {
if (iArr == this.setToolList.get(i)) {
arrayList.add(this.setToolList.get(i));
}
}
this.setToolList.removeAll(arrayList);
}
ArrayList arrayList2 = new ArrayList();
for (int i2 = 0; i2 < this.setToolList.size(); i2++) {
for (int i3 : this.setToolList.get(i2)) {
for (int i4 = 0; i4 < this.toolList.size(); i4++) {
View view = this.toolList.get(i4);
if (((Integer) view.getTag()).intValue() == i3) {
arrayList2.add(view);
}
}
}
}
for (int i5 = 0; i5 < this.toolList.size(); i5++) {
View view2 = this.toolList.get(i5);
view2.setOnClickListener(this.toolClickListener);
view2.setAlpha(1.0f);
}
boolean z2 = true;
for (int i6 = 0; i6 < arrayList2.size(); i6++) {
View view3 = (View) arrayList2.get(i6);
view3.setOnClickListener(null);
view3.setAlpha(0.5f);
if (((Integer) view3.getTag()).intValue() == 1) {
z2 = false;
}
}
this.picUploadLayoutV.setVisibility((z2 && this.videoLayoutV.getVisibility() == 8) ? 0 : 8);
}
public void loadClassType() {
Net url = Net.url(API.Show.circleTypeClass);
url.param("circle_id", this.circle_id);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
String string = SafeJsonUtil.getString(result.json(), "publish_tips_text");
EditText editText = ShowPostActivity.this.contentV;
if (TextUtils.isEmpty(string)) {
string = "来吧,尽情发挥…";
}
editText.setHint(string);
if (TextUtils.isEmpty(ShowPostActivity.this.contentId)) {
ShowPostActivity.this.payConfig = SafeJsonUtil.getJSONObject(result.json(), "pay_config");
ShowPostActivity.this.showToastV.setVisibility((ShowPostActivity.this.payConfig.getInteger("is_open_pay") == null || ShowPostActivity.this.payConfig.getInteger("is_open_pay").intValue() == -1) ? 8 : 0);
String string2 = ShowPostActivity.this.payConfig.getString("pay_num");
if (TextUtils.isEmpty(string2)) {
string2 = "0";
}
ShowPostActivity.this.showToastV.setText("该圈子发帖需要付费" + string2 + SafeJsonUtil.getString(ShowPostActivity.this.payConfig, "unit"));
}
List parseList = SafeJsonUtil.parseList(result.getList(), ThreadPostItem.TypesBean.class);
boolean z = parseList != null && parseList.size() > 0;
ShowPostActivity.this.sortBox.setVisibility(z ? 0 : 8);
ShowPostActivity.this.typeLineV.setVisibility(z ? 0 : 8);
if (z) {
ShowPostActivity.this.bindType(parseList);
ShowPostActivity.this.typeRequire = "1".equals(SafeJsonUtil.getString(result.json(), "type_require"));
}
JSONObject jSONObject = SafeJsonUtil.getJSONObject(result.jo, "user_publish_privacy");
if ("1".equals(SafeJsonUtil.getString(jSONObject, "show_sync_user_home"))) {
ShowPostActivity.this.findViewById(R.id.sync_layout).setVisibility(0);
}
ShowPostActivity.this.niming_config_is_open = SafeJsonUtil.getBoolean(jSONObject, "niming_config.is_open");
ShowPostActivity.this.voiceConfigJo = SafeJsonUtil.getJSONObject(jSONObject, "voice_config");
ShowPostActivity.this.attachConfigJo = SafeJsonUtil.getJSONObject(jSONObject, "attach_config");
ShowPostActivity.this.settingV.setVisibility(SafeJsonUtil.getBoolean(jSONObject, "show_content_privacy") ? 0 : 8);
ShowPostActivity.this.contentAuthConfig.setOriginalLink(SafeJsonUtil.getString(jSONObject, OriginalAgreementActivity.EXTRA_ORIGINAL_LINK));
ShowPostActivity.this.model.getCollectionManage().setValue((CollectionManageBean) SafeJsonUtil.parseBean(jSONObject.getString("collect_manage"), CollectionManageBean.class));
ShowPostActivity.this.showPostAttachMentLayout.setAttachConfigJo(ShowPostActivity.this.attachConfigJo);
ShowPostActivity.this.setPublishConfig(jSONObject);
if (!TextUtils.isEmpty(ShowPostActivity.this.contentId) && ShowPostActivity.this.result != null) {
ShowPostActivity.this.showSecondEditContent();
}
if (TextUtils.isEmpty(ShowPostActivity.this.linkId) || TextUtils.isEmpty(ShowPostActivity.this.linkType)) {
return;
}
if (Constants.LINK_COMMON.equals(ShowPostActivity.this.linkType)) {
if (!TextUtils.isEmpty(ShowPostActivity.this.jobJo)) {
ShowPostActivity showPostActivity = ShowPostActivity.this;
showPostActivity.showLink(SafeJsonUtil.parseJSONObject(showPostActivity.jobJo));
return;
}
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("title", (Object) ShowPostActivity.this.linkTitle);
jSONObject2.put("link", (Object) ShowPostActivity.this.linkId);
jSONObject2.put("cover", (Object) ShowPostActivity.this.linkPic);
jSONObject2.put("type", (Object) 1);
ShowPostActivity.this.showLink(jSONObject2);
return;
}
Net url2 = Net.url(API.Show.appContentTurnLink);
url2.param("type", ShowPostActivity.this.linkType);
url2.param("content_id", ShowPostActivity.this.linkId);
url2.get(new Task<Result>() {
@Override
public void onResult(Result result2) {
if (result2.success()) {
ShowPostActivity.this.showLink(result2.getData());
}
}
});
}
}
});
}
public void setPublishConfig(JSONObject jSONObject) {
int i;
int i2;
if (AppAbilitySplit.judgeCirclePostAbility()) {
this.locationLayout.setVisibility(8);
}
JSONArray jSONArray = new JSONArray();
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("name", (Object) "图片");
jSONObject2.put("type", (Object) 1);
jSONObject2.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_picture_n));
jSONArray.add(jSONObject2);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("name", (Object) "at");
jSONObject3.put("type", (Object) 2);
jSONObject3.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_at_n));
jSONArray.add(jSONObject3);
if (this.isOpenTopic) {
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("name", (Object) "话题");
jSONObject4.put("type", (Object) 3);
jSONObject4.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_opic_of_conversation_n));
jSONArray.add(jSONObject4);
i = jSONArray.size() - 1;
} else {
i = 2;
}
int i3 = 4;
if (AppAbilitySplit.judgeCirclePostAbility() && SafeJsonUtil.getInteger(jSONObject, "voice_config.open_voice") == 1) {
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("name", (Object) "录音");
jSONObject5.put("type", (Object) 4);
jSONObject5.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_sound_recording_n));
jSONArray.add(jSONObject5);
}
if (AppAbilitySplit.judgeCirclePostAbility()) {
JSONObject jSONObject6 = new JSONObject();
jSONObject6.put("name", (Object) "表情");
jSONObject6.put("type", (Object) 5);
jSONObject6.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_expressione_n));
jSONArray.add(jSONObject6);
}
if (SafeJsonUtil.getInteger(jSONObject, "open_vote_txt") == 1) {
JSONObject jSONObject7 = new JSONObject();
jSONObject7.put("name", (Object) "投票");
jSONObject7.put("type", (Object) 6);
jSONObject7.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_vote_n));
jSONArray.add(jSONObject7);
if ("1".equals(this.showVote)) {
onVote();
}
}
if (AppAbilitySplit.judgeCirclePostAbility() && SafeJsonUtil.getInteger(jSONObject, "attach_config.open_attach") == 1) {
JSONObject jSONObject8 = new JSONObject();
jSONObject8.put("name", (Object) "附件");
jSONObject8.put("type", (Object) 7);
jSONObject8.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_enclosure_n));
jSONArray.add(jSONObject8);
}
if (AppAbilitySplit.judgeCirclePostAbility() && SafeJsonUtil.getInteger(jSONObject, "open_link") == 1) {
JSONObject jSONObject9 = new JSONObject();
jSONObject9.put("name", (Object) "链接");
jSONObject9.put("type", (Object) 8);
jSONObject9.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_link_n));
jSONArray.add(jSONObject9);
}
if (SafeJsonUtil.getInteger(jSONObject, "content_text_config.is_open") == 1) {
JSONObject jSONObject10 = new JSONObject();
jSONObject10.put("name", (Object) "长文");
jSONObject10.put("type", (Object) 9);
jSONObject10.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_long_essay_n));
jSONArray.add(jSONObject10);
}
if (AppAbilitySplit.judgeCirclePostAbility() && SafeJsonUtil.getInteger(jSONObject, "open_goods") == 1) {
JSONObject jSONObject11 = new JSONObject();
jSONObject11.put("name", (Object) "商品");
jSONObject11.put("type", (Object) 10);
jSONObject11.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_commodity_n));
jSONArray.add(jSONObject11);
}
int i4 = 0;
this.openGoodsRecommend = SafeJsonUtil.getInteger(jSONObject, "open_goods_recommend") == 1;
if (SafeJsonUtil.getInteger(jSONObject, "open_retweet") == 1) {
JSONObject jSONObject12 = new JSONObject();
jSONObject12.put("name", (Object) "转载");
jSONObject12.put("type", (Object) 11);
jSONObject12.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_reprint_n));
jSONArray.add(jSONObject12);
}
if (AppAbilitySplit.judgeCirclePostAbility() && SafeJsonUtil.getInteger(jSONObject, "can_pc_publish") == 1) {
JSONObject jSONObject13 = new JSONObject();
jSONObject13.put("name", (Object) "PC发文");
jSONObject13.put("type", (Object) 12);
jSONObject13.put("res", (Object) Integer.valueOf(R.drawable.editor_toolbar_btn_pc_release_n));
jSONArray.add(jSONObject13);
}
this.moreToolV.setVisibility(jSONArray.size() > 6 ? 0 : 8);
this.imageTools[5].setVisibility(jSONArray.size() < 6 ? 0 : 8);
int i5 = jSONArray.size() < 6 ? 6 : 5;
int size = jSONArray.size() >= 6 ? 0 : 6 - jSONArray.size();
int i6 = i + size;
int displayWidth = ((i6 != 5 ? 2 : 3) * IUtil.getDisplayWidth()) / 6;
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) this.topicRecommedV.getLayoutParams();
layoutParams.rightToRight = this.imageTools[i6].getId();
layoutParams.leftToLeft = this.imageTools[i6].getId();
this.topicRecommedV.setMaxWidth(displayWidth);
this.topicRecommedV.setLayoutParams(layoutParams);
for (int i7 = 0; i7 < i5; i7++) {
if (i7 >= size && jSONArray.size() > (i2 = i7 - size)) {
JSONObject jSONObjectFromArray = SafeJsonUtil.getJSONObjectFromArray(jSONArray, i2);
this.imageTools[i7].setImageResource(SafeJsonUtil.getInteger(jSONObjectFromArray, "res"));
this.imageTools[i7].setTag(Integer.valueOf(SafeJsonUtil.getInteger(jSONObjectFromArray, "type")));
this.imageTools[i7].setOnClickListener(this.toolClickListener);
this.toolList.add(this.imageTools[i7]);
}
}
int i8 = 0;
while (i8 < this.toolLayouts.length) {
int i9 = 0;
while (i9 < i3) {
LinearLayout linearLayout = (LinearLayout) this.toolLayouts[i8].getChildAt(i9);
int i10 = (i8 * 4) + i5 + i9;
if (jSONArray.size() > i10) {
JSONObject jSONObjectFromArray2 = SafeJsonUtil.getJSONObjectFromArray(jSONArray, i10);
ImageView imageView = (ImageView) linearLayout.getChildAt(i4);
TextView textView = (TextView) linearLayout.getChildAt(1);
imageView.setImageResource(SafeJsonUtil.getInteger(jSONObjectFromArray2, "res"));
textView.setText(SafeJsonUtil.getString(jSONObjectFromArray2, "name"));
linearLayout.setTag(Integer.valueOf(SafeJsonUtil.getInteger(jSONObjectFromArray2, "type")));
linearLayout.setOnClickListener(this.toolClickListener);
this.toolList.add(linearLayout);
}
i9++;
i4 = 0;
i3 = 4;
}
i8++;
i4 = 0;
i3 = 4;
}
if (!"1".equals(this.disableSwitchCircle) && SafeJsonUtil.getInteger(jSONObject, "can_change_circle") == 1 && TextUtils.isEmpty(this.contentId)) {
findViewById(R.id.titlelayout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!ShowPostActivity.this.picUploadLayoutV.isUploadOk()) {
ShowPostActivity.this.showToast("图片上传中…请稍后切换版块");
return;
}
if (!ShowPostActivity.this.videoThumbnailV.checkUploadVideoOk()) {
ShowPostActivity.this.showToast("视频正在上传中…请稍后切换版块");
return;
}
if ("1".equals(ShowPostActivity.this.siteConfig.change_post_is_go_tree)) {
Intent intent = new Intent(ShowPostActivity.this.getActivity(), (Class<?>) BottomSheetFragmentDisplayActivity.class);
intent.putExtra("url", ShowPostActivity.this.getString(R.string.app_code) + "://groupTree?choose=1");
ShowPostActivity.this.startActivityForResult(intent, LongContentPostAcitivity.CHOOSE_FORUM);
return;
}
ShowPostActivity.this.startActivityForResult(new Intent(ShowPostActivity.this.getActivity(), (Class<?>) AllCircleActivity.class), LongContentPostAcitivity.CHOOSE_FORUM);
}
});
this.arrowV.setVisibility(0);
} else {
findViewById(R.id.titlelayout).setOnClickListener(null);
this.arrowV.setVisibility(8);
}
if (this.niming_config_is_open && TextUtils.isEmpty(this.contentId)) {
findViewById(R.id.titlelayout).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
ChangeMagUserPanel changeMagUserPanel = new ChangeMagUserPanel(ShowPostActivity.this.getActivity());
ShowPostActivity.this.popupContainerV.addPanel(changeMagUserPanel);
ShowPostActivity.this.behavior.setState(3);
changeMagUserPanel.setOnClickCallback(new ChangeMagUserPanel.OnClickCallback() {
@Override
public void onClickCallback(String str, String str2, String str3, MagUserItem magUserItem) {
ShowPostActivity.this.userHeadV.loadView(TextUtils.isEmpty(str) ? ((UserPreference) Ioc.get(UserPreference.class)).head : str3, R.color.image_def, (Boolean) true);
ShowPostActivity.this.userNameV.setText(TextUtils.isEmpty(str) ? ((UserPreference) Ioc.get(UserPreference.class)).name : str2);
ShowPostActivity.this.behavior.setState(4);
ShowPostActivity.this.vest_user_id = str;
ShowPostActivity.this.vest_name = str2;
ShowPostActivity.this.vest_head = str3;
TextView textView2 = (TextView) ShowPostActivity.this.findViewById(R.id.niming_text);
ImageView imageView2 = (ImageView) ShowPostActivity.this.findViewById(R.id.niming_icon);
textView2.setText(TextUtils.isEmpty(str) ? "匿名发布" : "已匿名");
textView2.setTextColor(TextUtils.isEmpty(str) ? ContextCompat.getColor(ShowPostActivity.this.getActivity(), R.color.grey_shallow) : Color.parseColor("#586B94"));
imageView2.setImageResource(TextUtils.isEmpty(str) ? R.drawable.niming_n : R.drawable.niming_o);
}
@Override
public void onCancle() {
ShowPostActivity.this.behavior.setState(4);
}
});
return true;
}
});
findViewById(R.id.niming).setVisibility(0);
findViewById(R.id.niming).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ShowPostActivity.this.findViewById(R.id.titlelayout).performLongClick();
}
});
}
}
public void bindType(List<ThreadPostItem.TypesBean> list) {
this.sortBox.removeAllViews();
IUtil.dip2px(this, 8.0f);
int dip2px = IUtil.dip2px(this, 10.0f);
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ViewGroup viewGroup = (ViewGroup) view.getParent();
for (int i = 0; i < viewGroup.getChildCount(); i++) {
TextView textView = (TextView) viewGroup.getChildAt(i);
textView.setBackgroundResource(textView.equals(view) ? R.drawable.show_post_type_btn_round_link : R.drawable.show_post_type_bg_round_grey);
textView.setTextColor(textView.equals(view) ? ShowPostActivity.this.white : ShowPostActivity.this.grey_dark);
ThreadPostItem.TypesBean typesBean = (ThreadPostItem.TypesBean) view.getTag();
if (typesBean == null) {
return;
}
ShowPostActivity.this.typeId = typesBean.getId() + "";
}
}
};
for (int i = 0; i < list.size(); i++) {
TextView textView = (TextView) LayoutInflater.from(this).inflate(R.layout.text_sort, (ViewGroup) null);
textView.setTextColor(this.grey_dark);
textView.setText(list.get(i).getName());
if (!TextUtils.isEmpty(this.typeId)) {
if (this.typeId.equals(list.get(i).getId() + "")) {
textView.setBackgroundResource(R.drawable.show_post_type_btn_round_link);
textView.setTextColor(this.white);
textView.setOnClickListener(onClickListener);
textView.setTag(list.get(i));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.leftMargin = dip2px;
this.sortBox.addView(textView, layoutParams);
}
}
textView.setBackgroundResource(R.drawable.show_post_type_bg_round_grey);
textView.setOnClickListener(onClickListener);
textView.setTag(list.get(i));
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
layoutParams2.leftMargin = dip2px;
this.sortBox.addView(textView, layoutParams2);
}
}
private void setListener() {
this.contentV.setFilters(new InputFilter[]{new EditInputFilter(getActivity(), ((UserPreference) Ioc.get(UserPreference.class)).getUserId() + ""), new TopicEditInputFilter(this, this.circle_id, this.isOpenTopic)});
}
private void loadAllTopic() {
if (TextUtils.isEmpty(this.contentId) && !TextUtils.isEmpty(this.circle_id) && this.isOpenTopic) {
this.hasShowRecommendTopic = true;
Net url = Net.url(API.Show.recommendTopic);
url.param("circle_id", this.circle_id);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
List parseArray;
if (!result.success() || (parseArray = JSON.parseArray(result.getList().toJSONString(), Topic.class)) == null || parseArray.size() == 0) {
return;
}
Topic topic = (Topic) parseArray.get(0);
ShowPostActivity.this.topicRecommedV.setVisibility(0);
ShowPostActivity.this.topicRecommedV.setText(topic.getName());
ShowPostActivity.this.topicRecommedV.setTag(topic);
ShowPostActivity.this.topicRecommedV.setOnClickListener(ShowPostActivity.this);
ShowPostActivity.this.topicRecommedV.postDelayed(new Runnable() {
@Override
public void run() {
ShowPostActivity.this.topicRecommedV.setVisibility(8);
}
}, 3000L);
}
});
}
}
public void setData() {
setTitle("发布到 " + this.circleTitle);
getNavigator().setActionText("发布", new View.OnClickListener() {
@Override
public void onClick(View view) {
if (OnClickUtil.isFastDoubleClick(1000L)) {
return;
}
if (!TextUtils.isEmpty(ShowPostActivity.this.circle_id)) {
if (ShowPostActivity.this.toCheck()) {
ShowPostActivity.this.showPayTips();
return;
}
return;
}
ShowPostActivity.this.findViewById(R.id.titlelayout).performClick();
}
});
this.contentV.setHint(this.hint);
this.facelayout.bindFunction(this, this.contentV, new FaceGroupLayout.CustomFaceClick() {
@Override
public void onClick(final JSONObject jSONObject) {
File permanentPictureFile = FileUtil.getPermanentPictureFile(SafeJsonUtil.getString(jSONObject, "emotion_url"));
if (permanentPictureFile.exists()) {
ShowPostActivity.this.mediatype = 1;
ShowPostActivity.this.picUploadLayoutV.addImage(permanentPictureFile, SafeJsonUtil.getString(jSONObject, "emotion"));
ShowPostActivity.this.setUnexitTool(true, ShowPostActivity.TYPE_PIC_UNEXIT_COLUMN);
ShowPostActivity.this.picUploadLayoutV.setVisibility(0);
ShowPostActivity.this.videoLayoutV.setVisibility(8);
return;
}
Net.url(SafeJsonUtil.getString(jSONObject, "emotion_url")).download(permanentPictureFile.getAbsolutePath(), new Task<File>() {
@Override
public void onResult(File file) {
ShowPostActivity.this.mediatype = 1;
ShowPostActivity.this.picUploadLayoutV.addImage(file, SafeJsonUtil.getString(jSONObject, "emotion"));
ShowPostActivity.this.setUnexitTool(true, ShowPostActivity.TYPE_PIC_UNEXIT_COLUMN);
ShowPostActivity.this.picUploadLayoutV.setVisibility(0);
ShowPostActivity.this.videoLayoutV.setVisibility(8);
}
});
}
}, true);
this.contentV.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
ShowPostActivity.this.hideToolbarOperation();
return false;
}
});
}
public void showPayTips() {
try {
JSONObject jSONObject = this.payConfig;
if (jSONObject != null && jSONObject.getInteger("is_open_pay") != null && this.payConfig.getInteger("is_open_pay").intValue() == 1) {
String string = this.payConfig.getString("pay_num");
if (TextUtils.isEmpty(string)) {
string = "0";
}
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "提示", "当前发布圈子需要支付" + string + SafeJsonUtil.getString(this.payConfig, "unit") + ",确认发布?", "取消", "确认", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
ShowPostActivity.this.toPost();
}
}
});
} else {
toPost();
}
} catch (Exception e) {
e.getMessage();
}
}
public boolean toCheck() {
if (TextUtils.isEmpty(this.contentV.getText().toString()) && this.picUploadLayoutV.getPics().size() < 1 && this.videoLayoutV.getVisibility() != 0) {
showToast("请添加内容或图片!");
return false;
}
if (this.typeRequire && TextUtils.isEmpty(this.typeId)) {
showToast("请选择主题分类");
return false;
}
if (!this.picUploadLayoutV.isUploadOk()) {
showToast("图片上传中…请稍后");
return false;
}
if (this.videoThumbnailV.checkUploadVideoOk()) {
return this.canPost;
}
showToast("视频正在上传中…请稍后");
return false;
}
public void picDefSelect() {
IUtil.hideSoftInput(this.contentV);
ActionSheet actionSheet = new ActionSheet(getActivity());
View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.action_sheet_item_select_pic, (ViewGroup) null);
if ("1".equals(this.siteConfig.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(getActivity()).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);
inflate.setOnClickListener(actionSheet);
inflate.setTag("0");
inflate2.setTag("1");
inflate2.setOnClickListener(actionSheet);
actionSheet.addItemView(inflate);
actionSheet.addItemView(inflate2);
actionSheet.show(getActivity());
actionSheet.setOnActionClickListener(new ActionSheet.OnActionClickListener<Integer>() {
@Override
public void onAction(Integer num) {
int intValue = num.intValue();
if (intValue != 0) {
if (intValue != 1) {
return;
}
ShowPostActivity.this.picUploadLayoutV.getPicFromPhoto();
} else if ("1".equals(ShowPostActivity.this.siteConfig.global_is_open_senior_shoot) && TabConfig.getInstance().isQiniu_video()) {
UrlSchemeProxy.seniorShortVideo(ShowPostActivity.this.getActivity()).uploadType("1").goForResult(4099);
} else {
UrlSchemeProxy.videoRecord(ShowPostActivity.this.getActivity()).uploadType("1").goForResult(4099);
}
}
});
}
public void toPost() {
if (this.canPost) {
checkUser();
this.canPost = false;
Net url = Net.url(API.Show.show_post);
if (!TextUtils.isEmpty(this.contentId)) {
url = Net.url(API.Show.editContent);
url.param("content_id", this.contentId);
} else {
url.param("circle_id", this.circle_id);
}
url.param("is_sync_home_page", Integer.valueOf(this.syncCheckBoxV.isChecked() ? -1 : 1));
url.param("content", TextFaceUtil.addALabel(this.contentV.getText().toString()));
if (!TextUtils.isEmpty(this.vest_user_id)) {
url.param("vest_id", this.vest_user_id);
}
if (!TextUtils.isEmpty(Ioc.getApplicationContext().getString(R.string.android_partner_key))) {
url.param("auth", ((ITongdunOperation) Ioc.get(ITongdunOperation.class)).onEvent(Ioc.getApplicationContext()));
}
if (this.mediatype == 1) {
url.param(SocialConstants.PARAM_IMAGE, this.picUploadLayoutV.getPicAids());
}
if (!TextUtils.isEmpty(this.location)) {
url.param("location", this.location);
url.param("lng", this.lng);
url.param("lat", this.lat);
} else if (this.isLocation) {
url.param("lng", Double.valueOf(this.locationBean.getLongitude()));
url.param("lat", Double.valueOf(this.locationBean.getLatitude()));
this.netParams.setNetParams(url);
}
JSONObject jSONObject = this.goodsJo;
if (jSONObject != null) {
url.param("goods_info", jSONObject.toJSONString());
}
JSONObject jSONObject2 = this.voteJo;
if (jSONObject2 != null) {
url.param("vote_content", jSONObject2.toJSONString());
}
ContentAuthConfig contentAuthConfig = this.contentAuthConfig;
if (contentAuthConfig != null) {
url.param("can_copy", Integer.valueOf(contentAuthConfig.getCanCopy()));
url.param("can_down", Integer.valueOf(this.contentAuthConfig.getCanDown()));
url.param("is_origin", Integer.valueOf(this.contentAuthConfig.getIsOrigin()));
url.param("can_origin_pic", Integer.valueOf(this.contentAuthConfig.getCanOriginPic()));
}
if (this.model.getCollectionBean().getValue() != null) {
url.param("collect_id", this.model.getCollectionBean().getValue().id);
}
url.param("type_id", this.typeId);
if (this.showPostAudioDataView.hasAudio()) {
if (this.showPostAudioDataView.isUploadOk()) {
url.param(Constants.voice, this.showPostAudioDataView.getPostParams().toJSONString());
} else {
showToast("语音上传中,请稍后发布");
this.canPost = true;
return;
}
}
if (this.showPostAttachMentLayout.hasAttachement()) {
if (this.showPostAttachMentLayout.isUploadOk()) {
url.param("attach_infos", this.showPostAttachMentLayout.getPostAttachArray().toJSONString());
} else {
showToast("附件上传中,请稍后发布");
this.canPost = true;
return;
}
}
JSONObject jSONObject3 = this.linkJo;
if (jSONObject3 != null) {
url.param("rel_attach_info", jSONObject3.toJSONString());
}
if ("near".equals(this.type) && TextUtils.isEmpty(this.location)) {
if (this.locationBean.getLatitude() != 0.0d && this.locationBean.getLongitude() != 0.0d) {
url.param("lng", Double.valueOf(this.locationBean.getLongitude()));
url.param("lat", Double.valueOf(this.locationBean.getLatitude()));
} else {
url.param("lng", Double.valueOf(Double.parseDouble(this.longitude)));
url.param("lat", Double.valueOf(Double.parseDouble(this.latitude)));
}
}
if (!TextUtils.isEmpty(this.atUserIdsStr)) {
url.param("users", this.atUserIdsStr);
}
if (this.mediatype == 2 && this.videoThumbnailV.getPic() != null) {
url.param("video", this.videoThumbnailV.getPic().videoAid);
url.param(SocialConstants.PARAM_IMAGE, this.videoThumbnailV.getPic().thumbAid);
}
url.post(new Task<Result>() {
@Override
public void onResult(final Result result) {
if (result.success()) {
if (TextUtils.isEmpty(ShowPostActivity.this.contentId)) {
ShowPostActivity.this.setResult(-1);
if ("near".equals(ShowPostActivity.this.type) || ShowPostActivity.this.isLocation) {
((EventBus) Ioc.get(EventBus.class)).fireEvent(API.Event.nearPost, new Object[0]);
}
if (!RequestConstant.TRUE.equals(ShowPostActivity.this.jumpTo)) {
((EventBus) Ioc.get(EventBus.class)).fireEvent(API.Event.show_post, new Object[0]);
}
ShowPostActivity.this.saveDraftUtil.postSuccess();
}
JSONObject jSONObject4 = result.json().getJSONObject("sharedata");
ShareConfig build = ShareConfig.newBuilder(ShowPostActivity.this.getActivity()).appendPlatItems(ShareConfig.platsExcludeLetter).setShare((Share) SafeJsonUtil.parseBean(jSONObject4, Share.class)).setType(1).setTypeValue(SafeJsonUtil.getString(jSONObject4, "type_value")).build();
ShowPostActivity.this.sharePostPopWindow = new SharePostPopWindow(ShowPostActivity.this.getActivity(), build);
ShowPostActivity.this.sharePostPopWindow.show(ShowPostActivity.this.getActivity());
ShowPostActivity.this.sharePostPopWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
UrlScheme.toUrl(ShowPostActivity.this.getActivity(), JSON.parseObject(result.plain()).getString("link"));
ShowPostActivity.this.getActivity().finish();
}
});
} else {
ShowPostActivity.this.canPost = true;
}
if (!"10001".equals(result.code()) && !"1017".equals(result.code())) {
ShowPostActivity.this.showToast(result.msg());
}
ShowPostActivity.this.hideProgress();
}
@Override
public void onError() {
super.onError();
ShowPostActivity.this.canPost = true;
ShowPostActivity.this.hideProgress();
}
});
}
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i2 != -1) {
return;
}
if (i == 4097 || i == 4098 || i == 4099) {
if (intent != null && intent.getIntExtra("mediatype", 0) == 2) {
this.videoPath = JSONArray.parseArray(intent.getStringExtra("result")).getString(0);
this.mediatype = 2;
this.picUploadLayoutV.setVisibility(8);
this.videoLayoutV.setVisibility(0);
this.videoThumbnailV.onActivityResult(i, i2, intent);
} else {
this.mediatype = 1;
this.picUploadLayoutV.setVisibility(0);
this.videoLayoutV.setVisibility(8);
this.picUploadLayoutV.onActivityResult(i, i2, intent);
}
if (!this.hasShowRecommendTopic) {
IUtil.delayShowSoftInput(this.contentV);
loadAllTopic();
}
setUnexitTool(true, TYPE_PIC_UNEXIT_COLUMN);
return;
}
if (i == 4153) {
this.videoThumbnailV.onActivityResult(i, i2, intent);
return;
}
if (i == 4160 || i == 4161) {
this.showPostAttachMentLayout.onActivityResult(i, i2, intent);
return;
}
if (i == 4162 || i == IntentUtils.code_image_zoom) {
this.showPostAudioDataView.onActivityResult(i, i2, intent);
return;
}
if (i == 4101) {
if (intent.getBooleanExtra("doDeal", false) && !TextUtils.isEmpty(this.contentV.getText().toString())) {
this.contentV.getText().delete(this.contentV.length() - 1, this.contentV.length());
}
String stringExtra = intent.getStringExtra("name");
int selectionStart = this.contentV.getSelectionStart();
Editable text = this.contentV.getText();
StringBuilder sb = new StringBuilder(" ");
sb.append(stringExtra);
sb.append(" ");
SpannableString spanTopic = TextFaceUtil.getSpanTopic(SpannableString.valueOf(sb), "");
text.insert(selectionStart, spanTopic);
if (spanTopic.length() + selectionStart <= this.contentV.getText().length()) {
this.contentV.setSelection(selectionStart + spanTopic.length());
}
Topic topic = new Topic();
topic.setName(stringExtra);
this.mList.add(topic);
return;
}
if (i == 4100) {
int intExtra = intent.getIntExtra("type", 0);
if (intExtra == 0) {
addressClose(this.addressCloseV);
return;
} else {
if (1 == intExtra) {
this.location = intent.getStringExtra("address");
this.lng = Double.valueOf(intent.getDoubleExtra("lng", 0.0d));
this.lat = Double.valueOf(intent.getDoubleExtra("lat", 0.0d));
showAddress();
return;
}
return;
}
}
if (i == IntentUtils.code_select_name) {
if (!TextUtils.isEmpty(this.contentV.getText().toString())) {
this.contentV.getText().delete(this.contentV.length() - 1, this.contentV.length());
}
String stringExtra2 = intent.getStringExtra("atName");
addUser(stringExtra2, intent.getStringExtra("atUerId"));
StringBuilder sb2 = new StringBuilder("@");
sb2.append(stringExtra2);
sb2.append(" ");
SpannableString spanAt = TextFaceUtil.getSpanAt(SpannableString.valueOf(sb2), "");
int selectionStart2 = this.contentV.getSelectionStart();
this.contentV.getText().insert(selectionStart2, spanAt);
if (spanAt.length() + selectionStart2 <= this.contentV.getText().length()) {
this.contentV.setSelection(selectionStart2 + spanAt.length());
}
IUtil.delayShowSoftInput(this.contentV);
return;
}
if (i == IntentUtils.code_select_name_click) {
String stringExtra3 = intent.getStringExtra("atName");
addUser(stringExtra3, intent.getStringExtra("atUerId"));
StringBuilder sb3 = new StringBuilder("@");
sb3.append(stringExtra3);
sb3.append(" ");
SpannableString spanAt2 = TextFaceUtil.getSpanAt(SpannableString.valueOf(sb3), "");
int selectionStart3 = this.contentV.getSelectionStart();
this.contentV.getText().insert(selectionStart3, spanAt2);
if (spanAt2.length() + selectionStart3 <= this.contentV.getText().length()) {
this.contentV.setSelection(selectionStart3 + spanAt2.length());
}
IUtil.delayShowSoftInput(this.contentV);
return;
}
if (i == 2999) {
String stringExtra4 = intent.getStringExtra("circleId");
if (this.circle_id.equals(stringExtra4)) {
return;
}
String stringExtra5 = intent.getStringExtra("fid");
String stringExtra6 = intent.getStringExtra("title");
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
if (this.videoLayoutV.getVisibility() != 0) {
jSONArray.add(this.picUploadLayoutV.getRichContentToJo(this.contentV.getText().toString()));
} else {
jSONArray.add(this.videoThumbnailV.getRichContentToJo(this.contentV.getText().toString()));
}
JSONObject jSONObject2 = this.goodsJo;
if (jSONObject2 != null) {
jSONObject.put("goods", (Object) jSONObject2);
}
jSONObject.put("richContent", (Object) jSONArray);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("address", (Object) this.location);
jSONObject3.put("lng", (Object) this.lng);
jSONObject3.put("lat", (Object) this.lat);
if (!TextUtils.isEmpty(this.location)) {
jSONObject.put("location", (Object) jSONObject3);
}
new PostHelper(getActivity(), PostHelper.ForumType.Show).setPredata(jSONObject).toChangeForum(stringExtra5, stringExtra4, stringExtra6, this.drafid, this.saveDraftUtil.getDraftMessageId(), this.isFromDraftBox);
return;
}
if (i == IntentUtils.code_video_delete) {
this.picUploadLayoutV.setVisibility(0);
this.videoLayoutV.setVisibility(8);
this.videoThumbnailV.setPic(null);
setUnexitTool(false, TYPE_PIC_UNEXIT_COLUMN);
return;
}
if (i == 4151) {
this.voteJo = SafeJsonUtil.parseJSONObject(intent.getStringExtra(CreateVoteActivity.VOTE_CREAT_CONENT));
showVote();
return;
}
if (i == 4168) {
this.picUploadLayoutV.onActivityResult(i, i2, intent);
return;
}
if (i == 4176) {
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("time", (Object) Integer.valueOf(intent.getIntExtra("time", 0)));
jSONObject4.put(TbsReaderView.KEY_FILE_PATH, (Object) intent.getStringExtra(TbsReaderView.KEY_FILE_PATH));
this.showPostAudioDataView.setData(jSONObject4);
return;
}
if (i == IntentUtils.code_content_auth_setting) {
this.contentAuthConfig = (ContentAuthConfig) intent.getParcelableExtra(ContentAuthSettingActivity.EXTRA_CONTENT_AUTH_SETTING);
} else if (i == IntentUtils.code_collection_create) {
CollectionCreateBean collectionCreateBean = (CollectionCreateBean) intent.getParcelableExtra(CollectionCreateActivity.EXTRA_COLLECTION_CREATE);
if (collectionCreateBean != null) {
this.model.getCollectionBean().setValue(collectionCreateBean);
}
getCollectionSelectDialog().dismiss();
}
}
public void addUser(String str, String str2) {
AtUser atUser = new AtUser();
atUser.setName(str);
atUser.setUserId(str2);
this.atUsers.add(atUser);
}
public String checkUser() {
for (AtUser atUser : this.atUsers) {
if (this.set.add(atUser)) {
this.newList.add(atUser);
}
}
String obj = this.contentV.getText().toString();
for (AtUser atUser2 : this.newList) {
if (!TextUtils.isEmpty(atUser2.getName()) && obj.indexOf(atUser2.getName()) != -1) {
this.atUserIdsStr += atUser2.getUserId() + com.xiaomi.mipush.sdk.Constants.ACCEPT_TIME_SEPARATOR_SP;
}
}
return this.atUserIdsStr;
}
@Override
public void onClick(View view) {
Topic topic = (Topic) view.getTag();
if (isMaxTopic()) {
showToast("最多选择" + SafeJsonUtil.getInteger(this.siteConfig.choose_topic_max) + "个话题");
return;
}
if (topic == null) {
return;
}
toContent(topic);
View inflate = LayoutInflater.from(this).inflate(R.layout.show_popup_topic_participation, (ViewGroup) null, false);
if (!TextUtils.isEmpty(topic.getActivity_rules())) {
MagWebView magWebView = (MagWebView) inflate.findViewById(R.id.webview);
magWebView.setVisibility(0);
magWebView.loadDataWithBaseURL("https://app.jpztong.com/", topic.getActivity_rules(), "text/html", "utf-8", null);
}
FrescoImageView frescoImageView = (FrescoImageView) inflate.findViewById(R.id.cover_image);
ViewGroup.LayoutParams layoutParams = frescoImageView.getLayoutParams();
layoutParams.width = IUtil.getDisplayWidth() - IUtil.dip2px(getActivity(), 80.0f);
layoutParams.height = (IUtil.getDisplayWidth() * 90) / 246;
frescoImageView.setLayoutParams(layoutParams);
frescoImageView.setWidthAndHeight(layoutParams.width, layoutParams.height);
frescoImageView.loadView(topic.getCoverPic(), R.color.grey_bg);
VideoPopupWindow videoPopupWindow = new VideoPopupWindow(this, inflate);
if ("1".equals(topic.getIs_open_activity())) {
videoPopupWindow.show(this);
}
}
public boolean isMaxTopic() {
return (TextUtils.isEmpty(this.siteConfig.choose_topic_max) || SafeJsonUtil.getInteger(this.siteConfig.choose_topic_max) == 0 || TextFaceUtil.getMatchTopicCount(this.contentV.getText().toString()) < SafeJsonUtil.getInteger(this.siteConfig.choose_topic_max)) ? false : true;
}
public void onAt() {
if (UserApi.checkLogin()) {
UrlSchemeProxy.atFans(this).user_id(((UserPreference) Ioc.get(UserPreference.class)).getUserId() + "").goForResult(IntentUtils.code_select_name_click);
return;
}
UrlSchemeProxy.login(this).go();
}
public void audioTypeSelect() {
IUtil.hideSoftInput(this.contentV);
ActionSheet actionSheet = new ActionSheet(getActivity());
actionSheet.setItems("录音", true);
actionSheet.setItems("添加音频文件", true);
actionSheet.show(getActivity());
actionSheet.setOnActionClickListener(new ActionSheet.OnActionClickListener<Integer>() {
@Override
public void onAction(Integer num) {
int intValue = num.intValue();
if (intValue == 0) {
ShowPostActivity showPostActivity = ShowPostActivity.this;
showPostActivity.toolbarOperation(showPostActivity.recordBoxV);
} else {
if (intValue != 1) {
return;
}
Intent intent = new Intent(ShowPostActivity.this.getActivity(), (Class<?>) AudioFileActivity.class);
intent.putExtra("voiceConfigJo", ShowPostActivity.this.voiceConfigJo);
ShowPostActivity.this.startActivityForResult(intent, IntentUtils.code_audio_file_select);
}
}
});
}
private void toContent(Topic topic) {
if (TextUtils.isEmpty(topic.getName())) {
return;
}
int selectionStart = this.contentV.getSelectionStart();
Editable text = this.contentV.getText();
StringBuilder sb = new StringBuilder(" ");
sb.append(topic.getName());
sb.append(" ");
SpannableString spanTopic = TextFaceUtil.getSpanTopic(SpannableString.valueOf(sb), "");
text.insert(selectionStart, spanTopic);
if (spanTopic.length() + selectionStart <= this.contentV.getText().length()) {
this.contentV.setSelection(selectionStart + spanTopic.length());
}
this.mList.add(topic);
}
public void topicLayoutClick() {
if (TextUtils.isEmpty(this.circle_id)) {
showToast("请先选择版块");
return;
}
if (isMaxTopic()) {
showToast("最多选择" + SafeJsonUtil.getInteger(this.siteConfig.choose_topic_max) + "个话题");
return;
}
UrlSchemeProxy.search_topic(this).circle_id(this.circle_id).goForResult(4101);
}
public void onFace(View view) {
toolbarOperation(this.facelayout);
}
@OnClick({R.id.votelayout})
public void onVote() {
if (this.hasVoteOnSecondEdit) {
showToast("暂不支持编辑");
return;
}
Intent intent = new Intent(getActivity(), (Class<?>) CreateVoteActivity.class);
JSONObject jSONObject = this.voteJo;
if (jSONObject != null) {
intent.putExtra("voteJoS", jSONObject.toJSONString());
}
startActivityForResult(intent, IntentUtils.code_create_vote);
}
@OnClick({R.id.vote_delete})
public void onVoteDelete() {
this.voteJo = null;
this.votelayout.setVisibility(8);
setUnexitTool(false, TYPE_VOTE_UNEXIT_COLUMN);
}
@OnClick({R.id.more})
public void onMoreClick(View view) {
toolbarOperation(this.moreboxV);
}
public void toolbarOperation(final View view) {
if (this.latelyFrontView == view) {
if (view.getVisibility() == 0) {
hideToolbarOperation();
IUtil.showSoftInput(this.contentV);
} else {
IUtil.hideSoftInput(this.contentV);
view.postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(0);
view.bringToFront();
}
}, 200L);
}
} else {
IUtil.hideSoftInput(this.contentV);
view.postDelayed(new Runnable() {
@Override
public void run() {
ShowPostActivity.this.hideToolbarOperation();
view.setVisibility(0);
view.bringToFront();
}
}, 200L);
}
this.latelyFrontView = view;
view.postDelayed(new Runnable() {
@Override
public void run() {
ShowPostActivity.this.moreToolV.setImageResource(ShowPostActivity.this.moreboxV.getVisibility() == 0 ? R.drawable.show_post_more_f : R.drawable.show_post_more_n);
}
}, 210L);
}
public void hideToolbarOperation() {
for (int i = 0; i < this.panelBoxV.getChildCount(); i++) {
this.panelBoxV.getChildAt(i).setVisibility(8);
}
}
@OnTextChanged({R.id.content})
public void onContentTextChanged() {
if (TextUtils.isEmpty(this.contentV.getText().toString())) {
return;
}
this.contentV.getText().toString().contains("#");
}
@OnClick({R.id.location})
public void locationClick() {
startActivityForResult(new Intent(this, (Class<?>) ShowPositionActivity.class), 4100);
}
@OnClick({R.id.address_close})
public void addressClose(View view) {
this.location = "";
this.location = null;
this.locPlaceV.setText("你在哪里?");
this.locPlaceV.setTextColor(ContextCompat.getColor(getActivity(), R.color.grey_shallow));
this.addressCloseV.setVisibility(8);
this.locIconV.setImageResource(R.drawable.show_post_location_n);
this.locationLayout.setBackgroundResource(R.drawable.bg_show_post_loc_n);
}
public void showAddress() {
this.locPlaceV.setText(this.location);
this.locPlaceV.setTextColor(Color.parseColor("#586B94"));
this.addressCloseV.setVisibility(0);
this.locIconV.setImageResource(R.drawable.show_post_location_f);
this.locationLayout.setBackground(null);
}
@OnClick({R.id.iv_record_img})
public void ivRcordLayoutClick() {
if (new PermissionChecker(this).hasAudioPermission(this) && !OnClickUtil.isFastDoubleClick()) {
RecordPopWindow recordPopWindow = new RecordPopWindow(getActivity());
recordPopWindow.setData(this.voiceConfigJo);
recordPopWindow.show();
recordPopWindow.setFinishRecorderCallBack(new RecordPopWindow.AudioFinishRecorderCallBack() {
@Override
public void onFinish(float f, String str) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("time", (Object) Integer.valueOf((int) (f + 0.5f)));
jSONObject.put(TbsReaderView.KEY_FILE_PATH, (Object) str);
ShowPostActivity.this.showPostAudioDataView.setData(jSONObject);
ShowPostActivity.this.recordBoxV.setVisibility(8);
}
});
}
}
@OnClick({R.id.video_layout})
public void videoLayoutClick() {
if (TextUtils.isEmpty(this.videoPath)) {
return;
}
Intent intent = new Intent(this, (Class<?>) VideoPicActivity.class);
intent.putExtra("url", this.videoPath);
intent.putExtra("isDelete", "1");
startActivityForResult(intent, IntentUtils.code_video_delete);
overridePendingTransition(R.anim.zoomin, R.anim.alpha_out);
}
@Override
public void onBackPressed() {
showPostFinish();
}
@Override
public void onResume() {
super.onResume();
if (this.picUploadLayoutV.getVisibility() != 0) {
this.videoLayoutV.getVisibility();
}
}
@Override
public void onStop() {
super.onStop();
ShowPostAudioDataView showPostAudioDataView = this.showPostAudioDataView;
if (showPostAudioDataView == null || !showPostAudioDataView.isPlaying()) {
return;
}
this.showPostAudioDataView.onPlayClick(null);
}
@OnClick({R.id.navi_back})
public void naviBackClick() {
showPostFinish();
}
public void showPostFinish() {
if (this.isIntobehavior) {
this.behavior.setState(4);
return;
}
SharePostPopWindow sharePostPopWindow = this.sharePostPopWindow;
if (sharePostPopWindow != null && sharePostPopWindow.isShowing()) {
this.sharePostPopWindow.dismiss();
return;
}
if (TextUtils.isEmpty(this.contentV.getText().toString()) && this.picUploadLayoutV.getPics().size() < 1 && this.videoLayoutV.getVisibility() != 0) {
super.onBackPressed();
} else if (TextUtils.isEmpty(this.contentId)) {
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "提示", "内容还没有发布,确定退出?", "保存草稿", "直接退出", new DialogCallBack() {
@Override
public void onClick(int i) {
ShowPostActivity.this.saveDraftUtil.exitTip(i);
if (i == -1) {
ShowPostActivity.super.onBackPressed();
} else {
ShowPostActivity.this.saveDraf();
ShowPostActivity.this.finish();
}
}
});
} else {
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "是否退出二次编辑", "退出后将不保留修改内容", "放弃编辑", "继续编辑", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
return;
}
ShowPostActivity.this.finish();
}
});
}
}
public void saveDraf() {
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
if (this.videoLayoutV.getVisibility() != 0) {
jSONArray.add(this.picUploadLayoutV.getRichContentToJo(this.contentV.getText().toString()));
} else {
jSONArray.add(this.videoThumbnailV.getRichContentToJo(this.contentV.getText().toString()));
}
jSONObject.put("richContent", (Object) jSONArray);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("address", (Object) this.location);
jSONObject2.put("lng", (Object) this.lng);
jSONObject2.put("lat", (Object) this.lat);
if (!TextUtils.isEmpty(this.location)) {
jSONObject.put("location", (Object) jSONObject2);
}
if (!TextUtils.isEmpty(this.vest_user_id)) {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("vest_id", (Object) this.vest_user_id);
jSONObject3.put("name", (Object) this.vest_name);
jSONObject3.put("head", (Object) this.vest_head);
jSONObject.put("vest", (Object) jSONObject3);
}
this.drafid = this.saveDraftUtil.saveDraft(PostHelper.ForumType.Show, jSONObject, this.circle_id, "", this.circleTitle);
}
private void initLocation() {
try {
this.mLocationClient = new LocationClient(getActivity());
} catch (Exception unused) {
}
LocationClientOption locationClientOption = new LocationClientOption();
locationClientOption.setOpenGps(true);
locationClientOption.setCoorType("bd09ll");
this.mLocationClient.setLocOption(locationClientOption);
this.mLocationClient.registerLocationListener(new BDLocationListener() {
@Override
public void onReceiveLocation(BDLocation bDLocation) {
if (bDLocation == null) {
return;
}
if (bDLocation.getLatitude() != Double.MIN_VALUE && bDLocation.getLongitude() != Double.MIN_VALUE) {
ShowPostActivity.this.locationBean.setLatitude(bDLocation.getLatitude());
ShowPostActivity.this.locationBean.setLongitude(bDLocation.getLongitude());
ShowPostActivity.this.mLocationClient.stop();
return;
}
ShowPostActivity.this.isLocation = false;
}
});
this.mLocationClient.start();
}
@OnClick({R.id.link_delete})
public void deleteLink() {
this.linkLayout.setVisibility(8);
this.linkJo = null;
setUnexitTool(false, TYPE_LINK_UNEXIT_COLUMN);
}
public void showGoods() {
JSONObject jSONObject = this.goodsJo;
if (jSONObject != null && jSONObject.size() > 0) {
this.goodsContentBoxV.setVisibility(0);
this.goodsPicV.loadView(SafeJsonUtil.getString(this.goodsJo, "cover"), R.color.image_def);
this.goodsTitlev.setText(SafeJsonUtil.getString(this.goodsJo, "title"));
this.goodsPriceV.setText(SafeJsonUtil.getString(this.goodsJo, "price"));
setUnexitTool(true, TYPE_GOODS_UNEXIT_COLUMN);
this.closeBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ShowPostActivity.this.setUnexitTool(false, ShowPostActivity.TYPE_GOODS_UNEXIT_COLUMN);
ShowPostActivity.this.goodsContentBoxV.setVisibility(8);
ShowPostActivity.this.goodsJo = null;
}
});
return;
}
this.goodsContentBoxV.setVisibility(8);
setUnexitTool(true, TYPE_GOODS_UNEXIT_COLUMN);
}
public void showLink(JSONObject jSONObject) {
this.linkLayout.setVisibility(0);
this.linkJo = jSONObject;
setUnexitTool(true, TYPE_LINK_UNEXIT_COLUMN);
FrescoImageView frescoImageView = (FrescoImageView) this.linkLayout.findViewById(R.id.linkpic);
frescoImageView.loadView(SafeJsonUtil.getString(jSONObject, "cover"), R.drawable.link_icon);
frescoImageView.setVisibility(0);
TextView textView = (TextView) this.linkLayout.findViewById(R.id.linktitle);
TextView textView2 = (TextView) this.linkLayout.findViewById(R.id.artist);
textView.setText(SafeJsonUtil.getString(jSONObject, "title"));
View findViewById = this.linkLayout.findViewById(R.id.linkplay);
View findViewById2 = this.linkLayout.findViewById(R.id.group);
TextView textView3 = (TextView) this.linkLayout.findViewById(R.id.loc_link_name);
TextView textView4 = (TextView) this.linkLayout.findViewById(R.id.loc_link_author);
TextView textView5 = (TextView) this.linkLayout.findViewById(R.id.loc_link_tips);
TextView textView6 = (TextView) this.linkLayout.findViewById(R.id.loc_link_type);
textView3.setTextColor(Color.parseColor("#333333"));
this.linkLayout.findViewById(R.id.joblayout).setVisibility(8);
if (SafeJsonUtil.getInteger(jSONObject, "type") == 1) {
textView.setMaxLines(2);
findViewById2.setVisibility(0);
textView2.setVisibility(8);
textView.setVisibility(0);
findViewById.setVisibility(8);
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(8);
return;
}
if (SafeJsonUtil.getInteger(jSONObject, "type") == 2) {
findViewById2.setVisibility(0);
textView.setMaxLines(1);
textView2.setText(SafeJsonUtil.getString(jSONObject, "artist"));
textView2.setVisibility(0);
findViewById.setVisibility(0);
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(8);
return;
}
if (Constants.LINK_SHOW.equals(SafeJsonUtil.getString(jSONObject, "type"))) {
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(0);
findViewById.setVisibility(8);
findViewById2.setVisibility(8);
if ("3".equals(SafeJsonUtil.getString(jSONObject, "show_type"))) {
textView3.setMaxLines(1);
textView4.setVisibility(0);
textView3.setText(TextFaceUtil.parseFaceLink(SafeJsonUtil.getString(jSONObject, "title")));
textView4.setText(SafeJsonUtil.getString(jSONObject, "artist"));
} else {
textView3.setMaxLines(2);
textView4.setVisibility(8);
textView3.setTextColor(Color.parseColor("#999999"));
SpannableString valueOf = SpannableString.valueOf(TextFaceUtil.parseFaceLink(SafeJsonUtil.getString(jSONObject, "artist") + ":" + SafeJsonUtil.getString(jSONObject, "title")));
valueOf.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
}
@Override
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setColor(Color.parseColor("#333333"));
textPaint.setUnderlineText(false);
}
}, 0, SafeJsonUtil.getString(jSONObject, "artist").length() + 1, 33);
textView3.setText(valueOf);
}
textView6.setText(SafeJsonUtil.getString(jSONObject, "tags_txt_arr.0"));
textView5.setText(SafeJsonUtil.getString(jSONObject, "content_des"));
textView5.setVisibility(TextUtils.isEmpty(SafeJsonUtil.getString(jSONObject, "content_des")) ? 8 : 0);
return;
}
if (Constants.LINK_FORUM.equals(SafeJsonUtil.getString(jSONObject, "type"))) {
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(0);
findViewById2.setVisibility(8);
findViewById.setVisibility(8);
textView6.setText(SafeJsonUtil.getString(jSONObject, "tags_txt_arr.0"));
textView5.setText(SafeJsonUtil.getString(jSONObject, "content_des"));
textView5.setVisibility(TextUtils.isEmpty(SafeJsonUtil.getString(jSONObject, "content_des")) ? 8 : 0);
textView3.setMaxLines(1);
textView3.setText(TextFaceUtil.parseFaceLink(SafeJsonUtil.getString(jSONObject, "title")));
textView4.setVisibility(0);
textView4.setText(SafeJsonUtil.getString(jSONObject, "artist"));
return;
}
if (Constants.LINK_TOPIC.equals(SafeJsonUtil.getString(jSONObject, "type")) || "collect".equals(SafeJsonUtil.getString(jSONObject, "type"))) {
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(0);
findViewById2.setVisibility(8);
findViewById.setVisibility(8);
textView6.setText(SafeJsonUtil.getString(jSONObject, "tags_txt_arr.0"));
textView5.setText(SafeJsonUtil.getString(jSONObject, "content_des"));
textView5.setVisibility(TextUtils.isEmpty(SafeJsonUtil.getString(jSONObject, "content_des")) ? 8 : 0);
textView3.setMaxLines(1);
textView3.setText(TextFaceUtil.parseFaceLink(SafeJsonUtil.getString(jSONObject, "title")));
textView4.setVisibility(8);
return;
}
if (Constants.LINK_Job.equals(SafeJsonUtil.getString(jSONObject, "type"))) {
this.linkLayout.findViewById(R.id.loc_link_layout).setVisibility(8);
findViewById.setVisibility(8);
findViewById2.setVisibility(8);
findViewById.setVisibility(8);
frescoImageView.setVisibility(8);
this.linkLayout.findViewById(R.id.joblayout).setVisibility(0);
TextView textView7 = (TextView) this.linkLayout.findViewById(R.id.title);
TextView textView8 = (TextView) this.linkLayout.findViewById(R.id.time);
TextView textView9 = (TextView) this.linkLayout.findViewById(R.id.money);
TextView textView10 = (TextView) this.linkLayout.findViewById(R.id.unit);
textView8.setText(SafeJsonUtil.getString(jSONObject, "area"));
textView7.setText(SafeJsonUtil.getString(jSONObject, "title"));
textView9.setText(SafeJsonUtil.getString(jSONObject, "money"));
textView10.setText(SafeJsonUtil.getString(jSONObject, "unit"));
}
}
public void showVote() {
this.votelayout.setVisibility(0);
((FrescoImageView) this.votelayout.findViewById(R.id.votepic)).loadView(((SiteConfig) Ioc.get(SiteConfig.class)).post_vote_icon, R.color.image_def);
setUnexitTool(true, TYPE_VOTE_UNEXIT_COLUMN);
this.voteContentV.setText("[投票]" + SafeJsonUtil.getString(this.voteJo, "title"));
String format = !"-1".equals(SafeJsonUtil.getString(this.voteJo, PushConstants.REGISTER_STATUS_EXPIRE_TIME)) ? new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(Long.valueOf(SafeJsonUtil.getLong(this.voteJo, PushConstants.REGISTER_STATUS_EXPIRE_TIME).longValue() * 1000)) : "无";
TextView textView = this.votetipV;
StringBuilder sb = new StringBuilder();
sb.append("1".equals(SafeJsonUtil.getString(this.voteJo, "is_anonymous")) ? "匿名投票" : "普通投票");
sb.append(" 截止时间 ");
sb.append(format);
textView.setText(sb.toString());
}
private CollectionSelectDialog getCollectionSelectDialog() {
if (this.collectionSelectDialog == null) {
this.collectionSelectDialog = new CollectionSelectDialog(getActivity());
}
return this.collectionSelectDialog;
}
@OnClick({R.id.gather})
public void gatherClick() {
if (this.model.getCollectionManage().getValue() != null) {
if (this.model.checkEdit()) {
showToast(getString(R.string.collection_end_tip));
return;
}
final CollectionManageBean value = this.model.getCollectionManage().getValue();
if (value.getIsRule().booleanValue()) {
getCollectionSelectDialog().setData(this.model.getCollectionBean().getValue());
getCollectionSelectDialog().show();
return;
} else {
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "提示", value.getTipText(), "取消", TextUtils.isEmpty(value.getLink()) ? "" : value.getBtnDes(), new DialogCallBack() {
@Override
public final void onClick(int i) {
ShowPostActivity.this.lambda$gatherClick$2$ShowPostActivity(value, i);
}
});
return;
}
}
showToast(getString(R.string.loading_tip));
}
public void lambda$gatherClick$2$ShowPostActivity(CollectionManageBean collectionManageBean, int i) {
if (i == -1) {
UrlScheme.toUrl(getActivity(), collectionManageBean.getLink());
}
}
@OnClick({R.id.gather_close})
public void gatherCloseClick() {
this.model.getCollectionBean().setValue(new CollectionCreateBean());
}
@OnClick({R.id.setting})
public void settingClcik() {
startActivityForResult(new Intent(getActivity(), (Class<?>) ContentAuthSettingActivity.class).putExtra(ContentAuthSettingActivity.EXTRA_CONTENT_AUTH_SETTING, this.contentAuthConfig), IntentUtils.code_content_auth_setting);
}
}