基本完成光环助手V4.3.0-个人主页优化https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/1004
This commit is contained in:
@ -90,7 +90,8 @@ public class ShareUtils {
|
||||
shareGh("APP分享"),
|
||||
communityArticle("文章详情"),
|
||||
video("视频"),
|
||||
web("web链接");
|
||||
web("web链接"),
|
||||
userHome("个人主页");
|
||||
|
||||
private String name;
|
||||
|
||||
@ -170,6 +171,67 @@ public class ShareUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showShareUserHomeWindows(Activity activity, View view, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
|
||||
if (activity.isFinishing()) return;
|
||||
this.mActivity = new WeakReference<>(activity);
|
||||
this.shareIcon = icon;
|
||||
this.shareUrl = url;
|
||||
this.mSummary = shareSummary;
|
||||
this.mTitle = shareTitle;
|
||||
this.mShareEntrance = shareEntrance;
|
||||
ShareUtils.shareEntrance = mShareEntrance;
|
||||
ShareUtils.resourceId = id;
|
||||
ShareUtils.shareEntity = new ShareEntity(shareUrl, mTitle, mSummary);
|
||||
LogUtils.uploadShareEnter(mShareEntrance.getName(), shareUrl, mTitle, mSummary, id);
|
||||
|
||||
View contentView = View.inflate(mActivity.get(), R.layout.popup_share_dialog, null);
|
||||
contentView.setFocusable(true);
|
||||
contentView.setFocusableInTouchMode(true);
|
||||
|
||||
View wechatType = contentView.findViewById(R.id.item_wechat);
|
||||
View wechatMomentsType = contentView.findViewById(R.id.item_wechat_moments);
|
||||
View qqType = contentView.findViewById(R.id.item_qq);
|
||||
View qqZoneType = contentView.findViewById(R.id.item_qq_zone);
|
||||
View weiboType = contentView.findViewById(R.id.item_weibo);
|
||||
|
||||
wechatType.setOnClickListener((v) -> wechatShare());
|
||||
wechatMomentsType.setOnClickListener((v) -> wechatMomentsShare());
|
||||
qqType.setOnClickListener((v) -> qqShare());
|
||||
qqZoneType.setOnClickListener((v) -> qZoneShare());
|
||||
weiboType.setOnClickListener((v) -> sinaWeiboShare());
|
||||
|
||||
popupWindow = new WeakReference<>(new SharePopupWindow(contentView, LinearLayout.LayoutParams.MATCH_PARENT
|
||||
, LinearLayout.LayoutParams.MATCH_PARENT, true));
|
||||
// popupWindow.get().setAnimationStyle(R.style.popwindow_exit_only_anim_style);
|
||||
//解决PopupWindow无法覆盖状态栏
|
||||
popupWindow.get().setClippingEnabled(false);
|
||||
|
||||
int bottomLocation = -DisplayUtils.retrieveNavigationHeight(activity);
|
||||
if (!DisplayUtils.isNavigationBarShow(activity)) {
|
||||
bottomLocation = 0;
|
||||
}
|
||||
try {
|
||||
popupWindow.get().showAtLocation(view, Gravity.NO_GRAVITY, 0, bottomLocation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
contentView.setOnClickListener(v -> safelyDismiss());
|
||||
|
||||
contentView.setOnKeyListener((v, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK
|
||||
&& event.getRepeatCount() == 0
|
||||
&& popupWindow.get() != null
|
||||
&& popupWindow.get().isShowing()) {
|
||||
if (callBack != null) {
|
||||
callBack.onCancel();
|
||||
}
|
||||
safelyDismiss();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public void showShareWindowsCallback(Activity activity, View view, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
|
||||
if (activity.isFinishing()) return;
|
||||
this.mActivity = new WeakReference<>(activity);
|
||||
|
||||
Reference in New Issue
Block a user