公众号
This commit is contained in:
parent
43e0531396
commit
22158b6eb3
@ -74,5 +74,6 @@ dependencies {
|
||||
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
||||
// fragment快速实现(可选)
|
||||
implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
|
||||
|
||||
//高斯模糊
|
||||
api 'com.github.mmin18:realtimeblurview:1.2.1'
|
||||
}
|
||||
|
@ -30,9 +30,10 @@ public class PathConfig {
|
||||
public static final String MODULE_VISITOR = "visitor";
|
||||
public static final String MODULE_PATROL = "patrol";
|
||||
public static final String SECRET = "CMXX_TOKEN_INFOS";//秘钥
|
||||
public static final String WECHAT_LINK = "weixin://dl/business/?t=";
|
||||
public static final String WECHAT_APPID="wx3267db0076f8b522";
|
||||
public static final String WECHAT_SECERT="3d4dcd2a2c2d131f42ed986fa2d5a903";
|
||||
public static final String ACTION_FROM_SOCKET_PUSH_MSG = "com.tenlionsoft.xz_cultural.SOCKET_MSG_PUBLIC_ACTION";
|
||||
|
||||
public static final String PUSH_DATA_KEY = "PUBLIC_CODE_KEY";
|
||||
|
||||
public static final String PROJECT_NAME = "locationReal";//TODO ===项目名称==
|
||||
public static final String ACTION_SYSTEM_MESSAGE = "com.sucstepsoft.hs.message";
|
||||
public static final String ACTION_LOCATION_MESSAGE = "com.sucstepsoft.realtimelocation.MESSAGE_RECEIVED_ACTION";
|
||||
@ -281,4 +282,14 @@ public class PathConfig {
|
||||
public static final String PATH_MODULE_SHOP_ACTIVITY_SHOP_ADD_ADDRESS = "/moduleshop/activity/shopAddAddress";//新增收货地
|
||||
|
||||
|
||||
public static final String WECHAT_APPID="wxa5c5246b283713de";
|
||||
public static final String WECHAT_SECERT = "e5b761f20841f81dd73a6d4aad2f8060";
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String WECHAT_OPENLINK = "https://api.weixin.qq.com/wxa/generatescheme?access_token=";
|
||||
public static final String WECHAT_ACCESSTOKEN = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,9 +11,10 @@ public class BaseUrlApi {
|
||||
public static final String IP_URL = "https://www.xzszwhy.cn/";/* 测试IP */
|
||||
// public static final String IP_URL = "http://192.168.0.120:8081/";/* 测试IP */
|
||||
|
||||
public static final String BASE_SYSTEM_IP = "http://192.168.0.120:8081/xzszwhy/";/*测试IP*/
|
||||
// public static final String BASE_SYSTEM_IP = "http://192.168.0.120:8081/xzszwhy/";/*测试IP*/
|
||||
// public static final String BASE_SYSTEM_IP = "http://v3.xzszwhy.cn/xzszwhy/";/*正式IP*/
|
||||
// public static final String BASE_SYSTEM_IP = "https://www.xzszwhy.cn/xzszwhy/";/*正式IP*/
|
||||
public static final String BASE_SYSTEM_IP = "https://www.xzszwhy.cn/xzszwhy/";/*正式IP*/
|
||||
public static final String BASE_SYSTEM_SOCKET_IP = "wss://www.xzszwhy.cn/xzszwhy/";/*正式IP*/
|
||||
|
||||
public static final String PROJECT_NAME = "app/";
|
||||
public static final String BASE_URL = BASE_SYSTEM_IP;
|
||||
@ -86,6 +87,5 @@ public class BaseUrlApi {
|
||||
public static final String BASE_SOCIAL_IMG_URL = BASE_CULTURAL_SHARE + "route/file/download/true/";
|
||||
public static final String APK_DOWNLOAD_URL = "downloadUrl";
|
||||
public static final String UPDATE_URL = "version.json";
|
||||
public static final String WECHAT_OPENLINK = "https://api.weixin.qq.com/wxa/generatescheme?access_token=";
|
||||
public static final String WECHAT_ACCESSTOKEN = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
public static final String SOCKET_IP = BASE_SYSTEM_SOCKET_IP + "app/wxeventrelease/";
|
||||
}
|
||||
|
@ -349,4 +349,14 @@ public interface BaseApiService {
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST
|
||||
Observable<TicketBean> getWechatOpenLink(@Url String url, @Body RequestBody body);
|
||||
|
||||
/**
|
||||
* 获取是否关注公众号
|
||||
*/
|
||||
@Headers({"base_url_name:news", "Content-Type:application/json", "Accept:application/json"})
|
||||
@GET("app/wxopen/attentionrelease/{userId}")
|
||||
Observable<Boolean> getIsPublicCode(@Path("userId") String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,11 +18,14 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.beans.AccessToken;
|
||||
import com.sucstepsoft.cm_utils.core.beans.PostWeChatTicketBean;
|
||||
import com.sucstepsoft.cm_utils.core.beans.TicketBean;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.api.BaseApiService;
|
||||
import com.sucstepsoft.cm_utils.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -109,7 +112,7 @@ public class CommonWebActivity extends BaseActivity {
|
||||
private void getAccessToken() {
|
||||
RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.getWechatAccessToken(BaseUrlApi.WECHAT_ACCESSTOKEN,
|
||||
.getWechatAccessToken(PathConfig.WECHAT_ACCESSTOKEN,
|
||||
"client_credential",
|
||||
PathConfig.WECHAT_APPID,
|
||||
PathConfig.WECHAT_SECERT)
|
||||
@ -153,7 +156,7 @@ public class CommonWebActivity extends BaseActivity {
|
||||
RequestBody body = buildRequestBody();
|
||||
RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.getWechatOpenLink(BaseUrlApi.WECHAT_OPENLINK + token,
|
||||
.getWechatOpenLink(PathConfig.WECHAT_OPENLINK + token,
|
||||
body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -193,6 +196,8 @@ public class CommonWebActivity extends BaseActivity {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(openlink));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -202,9 +207,16 @@ public class CommonWebActivity extends BaseActivity {
|
||||
PostWeChatTicketBean bean = new PostWeChatTicketBean();
|
||||
PostWeChatTicketBean.JumpWxaBean subBean = new PostWeChatTicketBean.JumpWxaBean();
|
||||
subBean.setEnv_version("release");//默认 release 正式版 trial 体验版 develop 开发版
|
||||
// subBean.setPath("/pages/commonQrCode/commonQrCode");
|
||||
subBean.setPath("/pages/heritage/heritage");
|
||||
subBean.setQuery("");
|
||||
subBean.setPath("/pages/commonQrCode/commonQrCode");
|
||||
|
||||
String query = "";
|
||||
String str = "userId=" + UserLgUtils.getUserId();
|
||||
try {
|
||||
query = URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
subBean.setQuery(query);
|
||||
bean.setJump_wxa(subBean);
|
||||
bean.setIs_expire(true);
|
||||
bean.setExpire_type(1);
|
||||
|
@ -248,4 +248,12 @@ public class UserLgUtils {
|
||||
public static String getAppVersionPathCode() {
|
||||
return SPUtils.getInstance(SP_USER_INFO).getString("versionPathCode");
|
||||
}
|
||||
|
||||
public static Boolean getIsPublicCode() {
|
||||
return SPUtils.getInstance(SP_USER_INFO).getBoolean("isPublicCode", false);
|
||||
}
|
||||
|
||||
public static void putIsPublicCode(boolean isPublic) {
|
||||
SPUtils.getInstance(SP_USER_INFO).put("isPublicCode", isPublic);
|
||||
}
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ project.ext {
|
||||
city {
|
||||
applicationId "com.tengshisoft.cultural"
|
||||
dimension 'market'
|
||||
resValue("string", "APP_CHANNEL", "cultural")
|
||||
resValue("string", "CITY_CODE", "540200000000")
|
||||
resValue("string", "CITY_ID", "640675")
|
||||
resValue("string", "VERSION_PATH_CODE", "f5935aa1-4405-4cbe-85bc-d7c1a8ddc9c4")
|
||||
resValue("string", "CITY_NAME", "日喀则市")
|
||||
resValue("string","APP_PATH_CODE","f5935aa1-4405-4cbe-85bc-d7c1a8ddc9c4")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "cultural",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "640676",
|
||||
CITY_CODE : "540202000000",
|
||||
CITY_ID : "640675",
|
||||
CITY_CODE : "540200000000",
|
||||
BD_KEY : "sdX2qpmzj85dEUGLS74982Gt1fFBjvS7",
|
||||
APP_NAME : "日喀则市数字文化云"]
|
||||
}
|
||||
@ -26,9 +26,10 @@ project.ext {
|
||||
resValue("string", "APP_CHANNEL", "sangzhuzi")
|
||||
resValue("string", "CITY_CODE", "540202000000")
|
||||
resValue("string", "CITY_ID", "640676")
|
||||
resValue("string", "CITY_NAME", "桑珠孜区")
|
||||
resValue("string", "VERSION_PATH_CODE", "8eccbd6b-4d97-4aef-a00f-0a0288d6d188")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "sangzhuzi",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "640676",
|
||||
CITY_CODE : "540202000000",
|
||||
BD_KEY : "ipb1ae32sNDRMbwOOpApG6bVBji9K86R",
|
||||
@ -40,9 +41,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "nanmulin"
|
||||
resValue("string", "CITY_CODE", "540221000000")
|
||||
resValue("string", "CITY_ID", "640865")
|
||||
resValue("string", "CITY_NAME", "南木林县")
|
||||
resValue("string", "VERSION_PATH_CODE", "732f4c4c-7db7-4d25-8486-d8c2ab8d03cc")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "nanmulin",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "640865",
|
||||
CITY_CODE : "540221000000",
|
||||
BD_KEY : "g0G2QLpGCAFV8QKxKo5irCZDwPlCPRTQ",
|
||||
@ -54,9 +56,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "jiangzi"
|
||||
resValue("string", "CITY_CODE", "540222000000")
|
||||
resValue("string", "CITY_ID", "641029")
|
||||
resValue("string", "CITY_NAME", "江孜县")
|
||||
resValue("string", "VERSION_PATH_CODE", "2bf65ae3-fda9-4081-a5f6-2abb864001e8")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "jiangzi",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641029",
|
||||
CITY_CODE : "540222000000",
|
||||
BD_KEY : "ZkcqIoGvjy8EfIwaal796KSNEWFsmObL",
|
||||
@ -68,9 +71,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "dingri"
|
||||
resValue("string", "CITY_CODE", "540223000000")
|
||||
resValue("string", "CITY_ID", "641204")
|
||||
resValue("string", "CITY_NAME", "定日县")
|
||||
resValue("string", "VERSION_PATH_CODE", "c12da6cc-066e-4f85-a9da-05ea3524726e")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "dingri",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641204",
|
||||
CITY_CODE : "540223000000",
|
||||
BD_KEY : "ql1MLXVWxztmqN2cdxGpe7aYdcvNdRSd",
|
||||
@ -82,9 +86,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "sajia"
|
||||
resValue("string", "CITY_CODE", "540224000000")
|
||||
resValue("string", "CITY_ID", "641393")
|
||||
resValue("string", "CITY_NAME", "萨迦县")
|
||||
resValue("string", "VERSION_PATH_CODE", "d2782af6-b624-4db0-b3ee-73dc16e475bb")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "sajia",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641393",
|
||||
CITY_CODE : "540224000000",
|
||||
BD_KEY : "PoMpzyP5FGptOGR4dFByXd6euQ66IDI5",
|
||||
@ -96,9 +101,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "lazi"
|
||||
resValue("string", "CITY_CODE", "540225000000")
|
||||
resValue("string", "CITY_ID", "641512")
|
||||
resValue("string", "CITY_NAME", "拉孜县")
|
||||
resValue("string", "VERSION_PATH_CODE", "79d571ad-f720-493b-9a63-80f0039bf1b9")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "lazi",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641512",
|
||||
CITY_CODE : "540225000000",
|
||||
BD_KEY : "LYw9cxjZ6eNLQ5vFIMvmcvafENtfIG8y",
|
||||
@ -110,9 +116,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "angren"
|
||||
resValue("string", "CITY_CODE", "540226000000")
|
||||
resValue("string", "CITY_ID", "641622")
|
||||
resValue("string", "CITY_NAME", "昂仁县")
|
||||
resValue("string", "VERSION_PATH_CODE", "c9b97c66-9d4a-44fb-94d7-3623a3c36685")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "angren",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641622",
|
||||
CITY_CODE : "540226000000",
|
||||
BD_KEY : "YGTBM02Sgut6xqT9D5lrcfeYqBhE6Ncr",
|
||||
@ -124,9 +131,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "xietongmen"
|
||||
resValue("string", "CITY_CODE", "540227000000")
|
||||
resValue("string", "CITY_ID", "641825")
|
||||
resValue("string", "CITY_NAME", "谢通门县")
|
||||
resValue("string", "VERSION_PATH_CODE", "15f5bea0-ef38-4f9e-bfe3-ca78a3248794")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "xietongmen",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641825",
|
||||
CITY_CODE : "540227000000",
|
||||
BD_KEY : "3Y4ZNEGjTGt9iFSHpF1r1iNdnCBxmYIg",
|
||||
@ -138,9 +146,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "bailang"
|
||||
resValue("string", "CITY_CODE", "540228000000")
|
||||
resValue("string", "CITY_ID", "641940")
|
||||
resValue("string", "CITY_NAME", "白朗县")
|
||||
resValue("string", "VERSION_PATH_CODE", "3baff28e-bf1a-4652-a523-6eb20203d967")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "bailang",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "641940",
|
||||
CITY_CODE : "540228000000",
|
||||
BD_KEY : "DlnhdI1CmTqBZBCRFkGdnxrDaStkQsu5",
|
||||
@ -152,9 +161,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "renbu"
|
||||
resValue("string", "CITY_CODE", "540229000000")
|
||||
resValue("string", "CITY_ID", "642063")
|
||||
resValue("string", "CITY_NAME", "仁布县")
|
||||
resValue("string", "VERSION_PATH_CODE", "2d04eba0-c84d-4f81-9c4c-4aa7175faaae")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "renbu",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642063",
|
||||
CITY_CODE : "540229000000",
|
||||
BD_KEY : "UL2rUUtPhOq3xBBWpnDGiEuTNHLvtWuh",
|
||||
@ -166,9 +176,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "kangma"
|
||||
resValue("string", "CITY_CODE", "540230000000")
|
||||
resValue("string", "CITY_ID", "642146")
|
||||
resValue("string", "CITY_NAME", "康马县")
|
||||
resValue("string", "VERSION_PATH_CODE", "632a8ea7-8042-4d74-8af2-2f1b9f4ecba7")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "kangma",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642146",
|
||||
CITY_CODE : "540230000000",
|
||||
BD_KEY : "kQsUL41b09E3nhtNIo2ohEKalWwhDFeV",
|
||||
@ -180,9 +191,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "dingjie"
|
||||
resValue("string", "CITY_CODE", "540231000000")
|
||||
resValue("string", "CITY_ID", "642203")
|
||||
resValue("string", "CITY_NAME", "定结县")
|
||||
resValue("string", "VERSION_PATH_CODE", "1c92cf20-6142-4404-bd81-6f54aebe7334")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "dingjie",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642203",
|
||||
CITY_CODE : "540231000000",
|
||||
BD_KEY : "4rGrPthpteXXbkyrQXYkbX34YQ31PpH5",
|
||||
@ -194,9 +206,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "zhongba"
|
||||
resValue("string", "CITY_CODE", "540232000000")
|
||||
resValue("string", "CITY_ID", "642284")
|
||||
resValue("string", "CITY_NAME", "仲巴县")
|
||||
resValue("string", "VERSION_PATH_CODE", "127e8782-8c38-4fa3-a999-b4fd742f23b8")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "zhongba",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642284",
|
||||
CITY_CODE : "540232000000",
|
||||
BD_KEY : "HpPUfcA5QdexPDpP7QOakTFGHGGtmSQo",
|
||||
@ -208,9 +221,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "yadong"
|
||||
resValue("string", "CITY_CODE", "540233000000")
|
||||
resValue("string", "CITY_ID", "642356")
|
||||
resValue("string", "CITY_NAME", "亚东县")
|
||||
resValue("string", "VERSION_PATH_CODE", "dc478f35-f44c-4d76-9521-bdefcf6288de")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "yadong",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642356",
|
||||
CITY_CODE : "540233000000",
|
||||
BD_KEY : "vICh5EdGtR5k2RdTaXYWoyDLBai2fVof",
|
||||
@ -222,9 +236,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "jilong"
|
||||
resValue("string", "CITY_CODE", "540234000000")
|
||||
resValue("string", "CITY_ID", "642389")
|
||||
resValue("string", "CITY_NAME", "吉隆县")
|
||||
resValue("string", "VERSION_PATH_CODE", "4a6c3ae0-c512-4a5a-a4b2-80d92e566c45")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "jilong",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642389",
|
||||
CITY_CODE : "540234000000",
|
||||
BD_KEY : "1uYUV884B8jzRnQG3FlZe5484mWWBkr4",
|
||||
@ -236,9 +251,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "nielamu"
|
||||
resValue("string", "CITY_CODE", "540235000000")
|
||||
resValue("string", "CITY_ID", "642437")
|
||||
resValue("string", "CITY_NAME", "聂拉木县")
|
||||
resValue("string", "VERSION_PATH_CODE", "9e416a8f-48a6-412f-b79f-6ee8cb1eb06d")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "nielamu",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642437",
|
||||
CITY_CODE : "540235000000",
|
||||
BD_KEY : "EZOGc1TFrNolwpiwDNWgaTIzCYQOKrk0",
|
||||
@ -250,9 +266,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "saga"
|
||||
resValue("string", "CITY_CODE", "540236000000")
|
||||
resValue("string", "CITY_ID", "642489")
|
||||
resValue("string", "CITY_NAME", "萨嘎县")
|
||||
resValue("string", "VERSION_PATH_CODE", "f23254e5-8060-483a-968a-d143335a5bf5")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "saga",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642489",
|
||||
CITY_CODE : "540236000000",
|
||||
BD_KEY : "FzlGpMenDV34XFpGWIuiO4s6Tw2otlIK",
|
||||
@ -264,9 +281,10 @@ project.ext {
|
||||
resValue "string", "APP_CHANNEL", "gangba"
|
||||
resValue("string", "CITY_CODE", "540237000000")
|
||||
resValue("string", "CITY_ID", "642536")
|
||||
resValue("string", "CITY_NAME", "岗巴县")
|
||||
resValue("string", "VERSION_PATH_CODE", "ba09f890-3b2b-4885-aeaa-f48e730c2775")
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "gangba",
|
||||
APP_LOGO : "@drawable/app_logo_county",
|
||||
APP_LOGO : "@drawable/app_logo",
|
||||
CITY_ID : "642536",
|
||||
CITY_CODE : "540237000000",
|
||||
BD_KEY : "PCSYjtiOsUEBCpK5SjZ2xsBN55jqfsIl",
|
||||
|
@ -281,7 +281,6 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onNext(BaseUserInfo baseUserInfo) {
|
||||
dialog.dismiss();
|
||||
if (baseUserInfo != null) {
|
||||
UserLgUtils.setAvatar(baseUserInfo.getAvatar());
|
||||
UserLgUtils.setEmail(baseUserInfo.getEmail());
|
||||
@ -293,9 +292,10 @@ public class LoginActivity extends BaseActivity {
|
||||
UserLgUtils.setToken(token);
|
||||
UserLgUtils.setLocationLat("-1");
|
||||
UserLgUtils.setLocationLng("-1");
|
||||
setResult(333);
|
||||
finish();
|
||||
//获取是否关注公众号
|
||||
getUserIsPublicCode(dialog);
|
||||
} else {
|
||||
dialog.dismiss();
|
||||
ToastUtils.showShort("登录失败,请稍后重试");
|
||||
}
|
||||
}
|
||||
@ -313,6 +313,44 @@ public class LoginActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否关注公众号
|
||||
*/
|
||||
private void getUserIsPublicCode(ProgressDialog dialog) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.getIsPublicCode(UserLgUtils.getUserId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Boolean baseSuccessBean) {
|
||||
dialog.dismiss();
|
||||
UserLgUtils.putIsPublicCode(baseSuccessBean);
|
||||
//连接socket
|
||||
setResult(333);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
ToastUtils.show("登录失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数
|
||||
*/
|
||||
|
@ -276,6 +276,38 @@ public class MainActivity extends BaseActivity {
|
||||
HomeFragment fragment = (HomeFragment) mFragments.get(0);
|
||||
fragment.notifyData();
|
||||
}
|
||||
/**
|
||||
* 获取是否关注公众号
|
||||
*/
|
||||
private void getUserIsPublicCode() {
|
||||
if (!TextUtils.isEmpty(UserLgUtils.getUserId())) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(BaseApiService.class)
|
||||
.getIsPublicCode(UserLgUtils.getUserId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Boolean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Boolean baseSuccessBean) {
|
||||
UserLgUtils.putIsPublicCode(baseSuccessBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
|
@ -2,7 +2,10 @@ package com.tengshisoft.mudulemain.cultural.activitys.news;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
@ -20,11 +23,14 @@ import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -44,6 +50,7 @@ import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BannerImageTextAllAdapter;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.CommonWebActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.BottomDialogShareView;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogCommentView;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView;
|
||||
@ -81,6 +88,7 @@ import com.tengshisoft.mudulemain.cultural.beans.CommentPublishBean;
|
||||
import com.tengshisoft.mudulemain.cultural.beans.LikeBean;
|
||||
import com.tengshisoft.mudulemain.cultural.beans.NewsDetailBean;
|
||||
import com.tengshisoft.mudulemain.cultural.net.HomeApi;
|
||||
import com.tengshisoft.mudulemain.cultural.socket.WsManager;
|
||||
import com.tengshisoft.mudulemain.cultural.widget.ButtomCommentListDialogView;
|
||||
import com.youth.banner.Banner;
|
||||
import com.youth.banner.transformer.ScaleInTransformer;
|
||||
@ -168,6 +176,11 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
ImageView mIvImgLeft;
|
||||
@BindView(R2.id.iv_banner_right)
|
||||
ImageView mIvImgRight;
|
||||
@BindView(R2.id.btn_public)
|
||||
Button mBtnPublic;
|
||||
@BindView(R2.id.rl_public_code)
|
||||
RelativeLayout mRlPublicCode;
|
||||
|
||||
private AddPhotoBean mCurrentBean;
|
||||
private String mPicPath;
|
||||
private Unbinder mBind;
|
||||
@ -190,6 +203,8 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
private String mPhoto;
|
||||
private File mDestFile;
|
||||
private NewsCategoryAdapter mCategoryAdapter;
|
||||
private ActivityResultLauncher<Intent> mResultLauncher;
|
||||
private SocketMsg mSocketMsg;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
@ -317,6 +332,21 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
.navigation();
|
||||
}
|
||||
});
|
||||
mResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
int resultCode = result.getResultCode();
|
||||
if (RESULT_OK == resultCode) {
|
||||
//打开微信成功
|
||||
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
mSocketMsg = new SocketMsg();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(PathConfig.ACTION_FROM_SOCKET_PUSH_MSG);
|
||||
registerReceiver(mSocketMsg, filter);
|
||||
|
||||
getNewsDetail();
|
||||
String read = String.format(getResources().getString(R.string.big_data_str), "", mNId, "新闻");
|
||||
LogUtils.e(read);
|
||||
@ -343,9 +373,29 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
public void onNext(NewsDetailBean newsDetailBean) {
|
||||
if (!"".equals(newsDetailBean.getNewsContentId())) {
|
||||
setDataToView(newsDetailBean);
|
||||
if (TextUtils.isEmpty(newsDetailBean.getNewsViewAuth())) {
|
||||
setDataToView(newsDetailBean);
|
||||
} else {
|
||||
//是否登录
|
||||
if (TextUtils.isEmpty(UserLgUtils.getToken())) {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_MAIN_LOGIN)
|
||||
.navigation();
|
||||
finish();
|
||||
} else {
|
||||
//是否需要关注公众号
|
||||
if (newsDetailBean.getNewsViewAuth().contains("2")) {
|
||||
startSocket();
|
||||
showPublicCodeDialog(newsDetailBean);
|
||||
} else {
|
||||
setDataToView(newsDetailBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -361,6 +411,37 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启Socket
|
||||
*/
|
||||
private void startSocket() {
|
||||
WsManager wsManager = new WsManager
|
||||
.Builder(getApplication())
|
||||
.wsUrl(BaseUrlApi.SOCKET_IP + UserLgUtils.getUserId())
|
||||
.needReconnect(true)
|
||||
.build();
|
||||
wsManager.startConnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关注公众号
|
||||
*
|
||||
* @param newsDetailBean
|
||||
*/
|
||||
private void showPublicCodeDialog(NewsDetailBean newsDetailBean) {
|
||||
if (!UserLgUtils.getIsPublicCode()) {
|
||||
mRlPublicCode.setVisibility(View.VISIBLE);
|
||||
mBtnPublic.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(mActivity, CommonWebActivity.class);
|
||||
mResultLauncher.launch(intent);
|
||||
});
|
||||
} else {
|
||||
setDataToView(newsDetailBean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加载详情数据
|
||||
*
|
||||
@ -1456,6 +1537,19 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public class SocketMsg extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (PathConfig.ACTION_FROM_SOCKET_PUSH_MSG.equals(action)) {
|
||||
//关注公众号
|
||||
String strData = intent.getStringExtra(PathConfig.PUSH_DATA_KEY);
|
||||
LogUtils.e("二维码返回:" + strData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mContentView = null;
|
||||
@ -1463,6 +1557,9 @@ public class NewsLocalDetailActivity extends BaseActivity {
|
||||
mAudio.pause();
|
||||
mAudio.release();
|
||||
}
|
||||
if (mSocketMsg != null) {
|
||||
unregisterReceiver(mSocketMsg);
|
||||
}
|
||||
if (mVideo != null) {
|
||||
mVideo.pause();
|
||||
mVideo.release();
|
||||
|
@ -44,6 +44,18 @@ public class NewsDetailBean {
|
||||
private String typesettingImage;
|
||||
private String typesettingName;
|
||||
|
||||
|
||||
private String newsViewAuth;//1登录2公众号
|
||||
|
||||
public String getNewsViewAuth() {
|
||||
return newsViewAuth;
|
||||
}
|
||||
|
||||
public void setNewsViewAuth(String newsViewAuth) {
|
||||
this.newsViewAuth = newsViewAuth;
|
||||
}
|
||||
|
||||
|
||||
public String getContentCoverId() {
|
||||
return contentCoverId;
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.tengshisoft.mudulemain.cultural.socket;
|
||||
|
||||
|
||||
import okhttp3.WebSocket;
|
||||
import okio.ByteString;
|
||||
|
||||
public interface IWsManager {
|
||||
WebSocket getWebSocket();
|
||||
|
||||
void startConnect();
|
||||
|
||||
void stopConnect();
|
||||
|
||||
boolean isWsConnected();
|
||||
|
||||
int getCurrentStatus();
|
||||
|
||||
void setCurrentStatus(int currentStatus);
|
||||
|
||||
boolean sendMessage(String msg);
|
||||
|
||||
boolean sendMessage(ByteString byteString);
|
||||
|
||||
}
|
@ -0,0 +1,354 @@
|
||||
package com.tengshisoft.mudulemain.cultural.socket;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.tengshisoft.mudulemain.cultural.utils.AesUtil;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
* 作者: Adam
|
||||
* 日期: 2021年11月16日15:51:45
|
||||
* 邮箱: itgaojian@163.com
|
||||
* 描述: WebSocket管理
|
||||
*/
|
||||
public class WsManager implements IWsManager {
|
||||
private final static int RECONNECT_INTERVAL = 10 * 1000; //重连自增步长
|
||||
private final static long RECONNECT_MAX_TIME = 120 * 1000; //最大重连间隔
|
||||
private final static int PING_TIME = 50;
|
||||
private Context mContext;
|
||||
private String wsUrl;
|
||||
private WebSocket mWebSocket;
|
||||
private OkHttpClient mOkHttpClient;
|
||||
private Request mRequest;
|
||||
private int mCurrentStatus = WsStatus.DISCONNECTED; //websocket连接状态
|
||||
private boolean isNeedReconnect; //是否需要断线自动重连
|
||||
private boolean isManualClose = false; //是否为手动关闭websocket连接
|
||||
private Lock mLock;
|
||||
private Handler wsMainHandler = new Handler(Looper.getMainLooper());
|
||||
private int reconnectCount = 5; //重连次数
|
||||
private Runnable reconnectRunnable = () -> {
|
||||
if (reconnectCount < 10) {
|
||||
// Intent intent = new Intent();
|
||||
// intent.setAction(PathConfig.ACTION_SOCKET_RELINK);
|
||||
// mContext.sendBroadcast(intent);
|
||||
}
|
||||
};
|
||||
private WebSocketListener mWebSocketListener = new WebSocketListener() {
|
||||
|
||||
private String buildMsgBean(int type, String body) {
|
||||
// AppSocketMessage message = new AppSocketMessage();
|
||||
// message.setType(type);
|
||||
// String userId = GlobalProvider.getString(mContext, "userId");
|
||||
// message.setFrom(userId);
|
||||
// message.setTo(userId);
|
||||
//
|
||||
// BaseSocketBodyBean bodyBean = null;
|
||||
// switch (type) {
|
||||
// case 1000:
|
||||
// bodyBean = new SocketRegisterBodyBean();
|
||||
// ((SocketRegisterBodyBean) bodyBean).setSessionId(body);
|
||||
// break;
|
||||
// }
|
||||
// Gson gson = new Gson();
|
||||
// String s = gson.toJson(bodyBean);
|
||||
// message.setBody(s);
|
||||
// String messageStr = gson.toJson(message);
|
||||
// return messageStr;
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(WebSocket webSocket, final Response response) {
|
||||
mWebSocket = webSocket;
|
||||
setCurrentStatus(WsStatus.CONNECTED);
|
||||
LogUtils.e("连接成功");
|
||||
connected();
|
||||
//注册websocket
|
||||
// String sessionId = GlobalProvider.getString(mContext, StatusCode.SESSION_ID);
|
||||
// LogUtils.e("Session_Id==" + sessionId);
|
||||
// String messageStr = buildMsgBean(1000, sessionId);
|
||||
// if (Looper.myLooper() != Looper.getMainLooper()) {//主线程
|
||||
// boolean isSend = sendMessage(messageStr);
|
||||
// } else {//子线程
|
||||
// boolean isSend = sendMessage(messageStr);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(WebSocket webSocket, final ByteString bytes) {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
wsMainHandler.post(() -> sendNotify(bytes.toString()));
|
||||
} else {
|
||||
sendNotify(bytes.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(WebSocket webSocket, final String text) {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
wsMainHandler.post(() -> sendNotify(text));
|
||||
} else {
|
||||
sendNotify(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosing(WebSocket webSocket, final int code, final String reason) {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
wsMainHandler.post(() -> LogUtils.e("连接关闭中"));
|
||||
} else {
|
||||
LogUtils.e("连接关闭中");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(WebSocket webSocket, final int code, final String reason) {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
wsMainHandler.post(() -> LogUtils.e("服务器连接已关闭"));
|
||||
} else {
|
||||
LogUtils.e("服务器连接已关闭");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(WebSocket webSocket, final Throwable t, final Response response) {
|
||||
try {
|
||||
tryReconnect();
|
||||
// Intent intent = new Intent();
|
||||
// intent.setAction(PathConfig.ACTION_MSG_SOCKET_FAIL);
|
||||
// mContext.sendBroadcast(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public WsManager(Builder builder) {
|
||||
mContext = builder.mContext;
|
||||
wsUrl = builder.wsUrl;
|
||||
isNeedReconnect = builder.needReconnect;
|
||||
mOkHttpClient = builder.mOkHttpClient;
|
||||
this.mLock = new ReentrantLock();
|
||||
}
|
||||
|
||||
private void initWebSocket() {
|
||||
if (mOkHttpClient == null) {
|
||||
mOkHttpClient =
|
||||
new OkHttpClient.Builder().pingInterval(PING_TIME, TimeUnit.SECONDS).retryOnConnectionFailure(true).build();
|
||||
}
|
||||
if (mRequest == null) {
|
||||
mRequest = new Request.Builder().url(wsUrl).build();
|
||||
}
|
||||
mOkHttpClient.dispatcher().cancelAll();
|
||||
try {
|
||||
mLock.lockInterruptibly();
|
||||
try {
|
||||
mOkHttpClient.newWebSocket(mRequest, mWebSocketListener);
|
||||
} finally {
|
||||
mLock.unlock();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocket getWebSocket() {
|
||||
return mWebSocket;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized boolean isWsConnected() {
|
||||
return mCurrentStatus == WsStatus.CONNECTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int getCurrentStatus() {
|
||||
return mCurrentStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setCurrentStatus(int currentStatus) {
|
||||
this.mCurrentStatus = currentStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnect() {
|
||||
isManualClose = false;
|
||||
buildConnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnect() {
|
||||
isManualClose = true;
|
||||
disconnect();
|
||||
}
|
||||
|
||||
private void tryReconnect() {
|
||||
if (!isNeedReconnect | isManualClose) {
|
||||
return;
|
||||
}
|
||||
if (!isNetworkConnected(mContext)) {
|
||||
setCurrentStatus(WsStatus.DISCONNECTED);
|
||||
}
|
||||
setCurrentStatus(WsStatus.RECONNECT);
|
||||
long delay = reconnectCount * RECONNECT_INTERVAL;
|
||||
wsMainHandler.postDelayed(reconnectRunnable, delay);
|
||||
reconnectCount++;
|
||||
}
|
||||
|
||||
private void cancelReconnect() {
|
||||
wsMainHandler.removeCallbacks(reconnectRunnable);
|
||||
reconnectCount = 0;
|
||||
}
|
||||
|
||||
private void connected() {
|
||||
cancelReconnect();
|
||||
}
|
||||
|
||||
private void disconnect() {
|
||||
if (mCurrentStatus == WsStatus.DISCONNECTED) {
|
||||
return;
|
||||
}
|
||||
cancelReconnect();
|
||||
if (mOkHttpClient != null) {
|
||||
mOkHttpClient.dispatcher().cancelAll();
|
||||
}
|
||||
if (mWebSocket != null) {
|
||||
boolean isClosed = mWebSocket.close(WsStatus.CODE.NORMAL_CLOSE,
|
||||
WsStatus.TIP.NORMAL_CLOSE);
|
||||
//非正常关闭连接
|
||||
if (!isClosed) {
|
||||
LogUtils.e("服务器连接失败");
|
||||
}
|
||||
}
|
||||
setCurrentStatus(WsStatus.DISCONNECTED);
|
||||
}
|
||||
|
||||
private synchronized void buildConnect() {
|
||||
if (!isNetworkConnected(mContext)) {
|
||||
setCurrentStatus(WsStatus.DISCONNECTED);
|
||||
}
|
||||
switch (getCurrentStatus()) {
|
||||
case WsStatus.CONNECTED:
|
||||
case WsStatus.CONNECTING:
|
||||
break;
|
||||
default:
|
||||
setCurrentStatus(WsStatus.CONNECTING);
|
||||
initWebSocket();
|
||||
}
|
||||
}
|
||||
|
||||
//发送消息
|
||||
@Override
|
||||
public boolean sendMessage(String msg) {
|
||||
return send(msg);
|
||||
// if (PathConfig.IS_SECRET) {
|
||||
// try {
|
||||
// String strMsg = AesUtil.aesCommonEncoder(PathConfig.SOCKET_MSG_SECRET, msg);
|
||||
// return send(strMsg);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
// return send(msg);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendMessage(ByteString byteString) {
|
||||
return send(byteString);
|
||||
}
|
||||
|
||||
private boolean send(Object msg) {
|
||||
boolean isSend = false;
|
||||
if (mWebSocket != null && mCurrentStatus == WsStatus.CONNECTED) {
|
||||
if (msg instanceof String) {
|
||||
isSend = mWebSocket.send((String) msg);
|
||||
} else if (msg instanceof ByteString) {
|
||||
isSend = mWebSocket.send((ByteString) msg);
|
||||
}
|
||||
if (!isSend) {
|
||||
tryReconnect();
|
||||
}
|
||||
}
|
||||
return isSend;
|
||||
}
|
||||
|
||||
public void sendImg(String img) {
|
||||
}
|
||||
|
||||
//检查网络是否连接
|
||||
private boolean isNetworkConnected(Context context) {
|
||||
if (context != null) {
|
||||
ConnectivityManager mConnectivityManager =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
|
||||
if (mNetworkInfo != null) {
|
||||
return mNetworkInfo.isAvailable();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendNotify(String jsonStr) {
|
||||
if (!TextUtils.isEmpty(jsonStr)) {
|
||||
LogUtils.e("收到消息:" + jsonStr);
|
||||
Intent broadCstIntent = new Intent();
|
||||
broadCstIntent.setAction(PathConfig.ACTION_FROM_SOCKET_PUSH_MSG);
|
||||
broadCstIntent.putExtra(PathConfig.PUSH_DATA_KEY, jsonStr);
|
||||
mContext.sendBroadcast(broadCstIntent);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private Context mContext;
|
||||
private String wsUrl;
|
||||
private boolean needReconnect = true;
|
||||
private OkHttpClient mOkHttpClient;
|
||||
|
||||
public Builder(Context val) {
|
||||
mContext = val;
|
||||
}
|
||||
|
||||
public Builder wsUrl(String val) {
|
||||
wsUrl = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder client(OkHttpClient val) {
|
||||
mOkHttpClient = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder needReconnect(boolean val) {
|
||||
needReconnect = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WsManager build() {
|
||||
return new WsManager(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.tengshisoft.mudulemain.cultural.socket;
|
||||
|
||||
public class WsStatus {
|
||||
public final static int CONNECTED = 1;
|
||||
public final static int CONNECTING = 0;
|
||||
public final static int RECONNECT = 2;
|
||||
public final static int DISCONNECTED = -1;
|
||||
|
||||
class CODE {
|
||||
|
||||
public final static int NORMAL_CLOSE = 1000;
|
||||
public final static int ABNORMAL_CLOSE = 1001;
|
||||
}
|
||||
|
||||
class TIP {
|
||||
|
||||
public final static String NORMAL_CLOSE = "normal close";
|
||||
public final static String ABNORMAL_CLOSE = "abnormal close";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,278 +7,317 @@
|
||||
android:background="@color/white"
|
||||
tools:context=".cultural.activitys.news.NewsDetailActivity">
|
||||
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/srl_content"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="45dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nsl_content"
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/srl_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
android:layout_marginBottom="45dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nsl_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_news_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_title_view"
|
||||
android:id="@+id/ll_news_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
app:text_type_cus="2"
|
||||
tools:text="新闻标题" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="12sp"
|
||||
tools:text="新闻来源:网络" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="12sp"
|
||||
tools:text="发布时间:2022-22-22" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--====================视频===========================-->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.tengshisoft.moduleijkplayer.player.VideoView
|
||||
android:id="@+id/vv_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="目录"
|
||||
android:textColor="@color/white"
|
||||
app:text_type_cus="2" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_video_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_catelog_indic_line"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="视频详情"
|
||||
app:text_type_cus="1" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_video_txt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="视频详情"
|
||||
app:text_type_cus="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--====================图片===========================-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone">
|
||||
|
||||
<com.youth.banner.Banner
|
||||
android:id="@+id/bn_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner_left"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@drawable/ic_img_arrow_left" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner_right"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_img_arrow_right" />
|
||||
|
||||
</RelativeLayout>
|
||||
<!--====================音频===========================-->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp">
|
||||
|
||||
|
||||
<com.tengshisoft.moduleijkplayer.player.VideoView
|
||||
android:id="@+id/vv_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="目录"
|
||||
android:textColor="@color/white"
|
||||
app:text_type_cus="2" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_audio_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_title_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp">
|
||||
android:visibility="gone">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_catelog_indic_line"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="音频详情"
|
||||
app:text_type_cus="1" />
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
app:text_type_cus="2"
|
||||
tools:text="新闻标题" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_audio_txt"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="音频内容"
|
||||
app:text_type_cus="1" />
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_source"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="12sp"
|
||||
tools:text="新闻来源:网络" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="@color/gray_text"
|
||||
android:textSize="12sp"
|
||||
tools:text="发布时间:2022-22-22" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--====================视频===========================-->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.tengshisoft.moduleijkplayer.player.VideoView
|
||||
android:id="@+id/vv_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="目录"
|
||||
android:textColor="@color/white"
|
||||
app:text_type_cus="2" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_video_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_catelog_indic_line"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="视频详情"
|
||||
app:text_type_cus="1" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_video_txt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="视频详情"
|
||||
app:text_type_cus="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--====================图片===========================-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone">
|
||||
|
||||
<com.youth.banner.Banner
|
||||
android:id="@+id/bn_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner_left"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@drawable/ic_img_arrow_left" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner_right"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_img_arrow_right" />
|
||||
|
||||
</RelativeLayout>
|
||||
<!--====================音频===========================-->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp">
|
||||
|
||||
|
||||
<com.tengshisoft.moduleijkplayer.player.VideoView
|
||||
android:id="@+id/vv_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="目录"
|
||||
android:textColor="@color/white"
|
||||
app:text_type_cus="2" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_audio_category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/ic_catelog_indic_line"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="音频详情"
|
||||
app:text_type_cus="1" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_audio_txt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="音频内容"
|
||||
app:text_type_cus="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--====================文章===========================-->
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.NestedScrollWebView
|
||||
android:id="@+id/nwv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
<!--====================文章===========================-->
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.NestedScrollWebView
|
||||
android:id="@+id/nwv_content"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone" />
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
<include
|
||||
android:id="@+id/ll_input_comment"
|
||||
layout="@layout/layout_bottom_comment" />
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/ll_input_comment"
|
||||
layout="@layout/layout_bottom_comment" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_public_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:realtimeBlurRadius="20dp"
|
||||
app:realtimeOverlayColor="#8000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text="关注公众号继续阅读"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/text_20"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_public"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/sel_btn_submit_no_size"
|
||||
android:text="去关注"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
@ -174,6 +174,7 @@ public class SettingActivity extends BaseActivity {
|
||||
*/
|
||||
private void loginOut() {
|
||||
UserLgUtils.setToken("");
|
||||
UserLgUtils.setId("");
|
||||
isLogin = false;
|
||||
mTvLoginOut.setText("登录");
|
||||
ToastUtils.showShort("退出成功");
|
||||
|
Loading…
Reference in New Issue
Block a user