完成公众号
This commit is contained in:
parent
b11622f561
commit
849bcbe83c
@ -36,8 +36,11 @@
|
||||
>
|
||||
> 4 多包名打包方式
|
||||
|
||||
|
||||
## 2022-12-19
|
||||
|
||||
> 1.App名称修改,以及动态获取
|
||||
> 2.首页地区选择去除
|
||||
> 2.首页地区选择去除
|
||||
|
||||
## 2023-7-28
|
||||
|
||||
> 1.新闻详情添加登录、关注公众号权限
|
@ -215,10 +215,7 @@ public class CommonWebActivity extends BaseActivity {
|
||||
String query = "";
|
||||
String str = "userId=" + UserLgUtils.getUserId();
|
||||
try {
|
||||
String key = URLEncoder.encode("userId", "UTF-8");
|
||||
String value = URLEncoder.encode(UserLgUtils.getUserId(), "UTF-8");
|
||||
query = key + "=" + value;
|
||||
// query = URLEncoder.encode(str, "UTF-8");
|
||||
query = URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -332,7 +332,6 @@ public class LoginActivity extends BaseActivity {
|
||||
public void onNext(Boolean baseSuccessBean) {
|
||||
dialog.dismiss();
|
||||
UserLgUtils.putIsPublicCode(baseSuccessBean);
|
||||
//连接socket
|
||||
setResult(333);
|
||||
finish();
|
||||
}
|
||||
@ -341,7 +340,9 @@ public class LoginActivity extends BaseActivity {
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
ToastUtils.show("登录失败,请稍后重试");
|
||||
setResult(333);
|
||||
finish();
|
||||
// ToastUtils.show("登录失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,6 +93,7 @@ import com.tengshisoft.mudulemain.cultural.beans.NewsDetailBean;
|
||||
import com.tengshisoft.mudulemain.cultural.net.HomeApi;
|
||||
import com.tengshisoft.mudulemain.cultural.socket.SocketService;
|
||||
import com.tengshisoft.mudulemain.cultural.widget.ButtomCommentListDialogView;
|
||||
import com.tengshisoft.mudulemain.cultural.widget.NoClickRelativeLayout;
|
||||
import com.youth.banner.Banner;
|
||||
import com.youth.banner.transformer.ScaleInTransformer;
|
||||
|
||||
@ -182,7 +183,7 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
@BindView(R2.id.btn_public)
|
||||
Button mBtnPublic;
|
||||
@BindView(R2.id.rl_public_code)
|
||||
RelativeLayout mRlPublicCode;
|
||||
NoClickRelativeLayout mRlPublicCode;
|
||||
|
||||
private AddPhotoBean mCurrentBean;
|
||||
private String mPicPath;
|
||||
@ -208,6 +209,8 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
private NewsCategoryAdapter mCategoryAdapter;
|
||||
private ActivityResultLauncher<Intent> mResultLauncher;
|
||||
private SocketMsg mSocketMsg;
|
||||
private boolean mIsAttention = false;//是否需要关注公众号
|
||||
private boolean mIsFirst = true;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
@ -378,6 +381,7 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
setDataToView(newsDetailBean);
|
||||
if (TextUtils.isEmpty(newsDetailBean.getNewsViewAuth())) {
|
||||
setDataToView(newsDetailBean);
|
||||
mIsAttention = false;
|
||||
} else {
|
||||
//是否登录
|
||||
if (TextUtils.isEmpty(UserLgUtils.getToken())) {
|
||||
@ -389,7 +393,9 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
//是否需要关注公众号
|
||||
if (newsDetailBean.getNewsViewAuth().contains("2")) {
|
||||
showPublicCodeDialog(newsDetailBean);
|
||||
mIsAttention = true;
|
||||
} else {
|
||||
mIsAttention = false;
|
||||
setDataToView(newsDetailBean);
|
||||
}
|
||||
}
|
||||
@ -1186,18 +1192,21 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
//在socket断链的情况先手动获取一次是否关注
|
||||
LogUtils.e("是否关注" + UserLgUtils.getIsPublicCode());
|
||||
if (!UserLgUtils.getIsPublicCode()) {
|
||||
if (mContentSkeleton != null) {
|
||||
mContentSkeleton.show();
|
||||
} else {
|
||||
mContentSkeleton = Skeleton.bind(mLlNewsContent)
|
||||
.load(R.layout.item_skeleton_news_content_local)
|
||||
.show();
|
||||
LogUtils.e("是否关注" + UserLgUtils.getIsPublicCode() + mIsFirst);
|
||||
if (!mIsFirst) {
|
||||
if (!UserLgUtils.getIsPublicCode() && mIsAttention) {
|
||||
if (mContentSkeleton != null) {
|
||||
mContentSkeleton.show();
|
||||
} else {
|
||||
mContentSkeleton = Skeleton.bind(mLlNewsContent)
|
||||
.load(R.layout.item_skeleton_news_content_local)
|
||||
.show();
|
||||
}
|
||||
mRlPublicCode.setVisibility(View.GONE);
|
||||
getUserIsPublicCode();
|
||||
}
|
||||
mRlPublicCode.setVisibility(View.GONE);
|
||||
getUserIsPublicCode();
|
||||
}
|
||||
mIsFirst = false;
|
||||
mCommentPage = 1;
|
||||
if (!TextUtils.isEmpty(UserLgUtils.getToken())) {
|
||||
getCommentListByLogin(mCommentPage);
|
||||
@ -1613,7 +1622,9 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
AttentionCodeBean errorBean = new Gson().fromJson(strData, AttentionCodeBean.class);
|
||||
UserLgUtils.putIsPublicCode(errorBean.isAttention());
|
||||
//刷新页面
|
||||
refreshPage();
|
||||
if (errorBean.isAttention()) {
|
||||
refreshPage();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.tengshisoft.mudulemain.cultural.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
public class NoClickRelativeLayout extends RelativeLayout {
|
||||
public NoClickRelativeLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoClickRelativeLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoClickRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
boolean bool = super.dispatchTouchEvent(ev);
|
||||
return bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
boolean bool = super.onInterceptTouchEvent(ev);
|
||||
return bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
boolean bool = super.onTouchEvent(event);
|
||||
return bool;
|
||||
}
|
||||
}
|
@ -286,11 +286,13 @@
|
||||
layout="@layout/layout_bottom_comment" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<com.tengshisoft.mudulemain.cultural.widget.NoClickRelativeLayout
|
||||
android:id="@+id/rl_public_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
@ -328,5 +330,5 @@
|
||||
android:paddingBottom="5dp"
|
||||
android:text="去关注"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
</com.tengshisoft.mudulemain.cultural.widget.NoClickRelativeLayout>
|
||||
</RelativeLayout>
|
@ -175,6 +175,7 @@ public class SettingActivity extends BaseActivity {
|
||||
private void loginOut() {
|
||||
UserLgUtils.setToken("");
|
||||
UserLgUtils.setId("");
|
||||
UserLgUtils.putIsPublicCode(false);
|
||||
isLogin = false;
|
||||
mTvLoginOut.setText("登录");
|
||||
ToastUtils.showShort("退出成功");
|
||||
|
Loading…
Reference in New Issue
Block a user