发布1.2.1 socket消息列表
This commit is contained in:
parent
1b1212b5fa
commit
27a962fbd3
@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":21,"versionName":"1.2.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":22,"versionName":"1.2.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}]
|
@ -282,6 +282,12 @@
|
||||
<activity
|
||||
android:name=".activitys.mine.UserInfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.MsgListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.MsgDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activitys.mine.ChangePwdActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
@ -1,9 +1,18 @@
|
||||
package com.sucstepsoft.txrealtimelocation.activitys.mine;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.beans.MessageBean;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.txrealtimelocation.R;
|
||||
import com.sucstepsoft.txrealtimelocation.activitys.trouble.RandomMissionActivity;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
@ -11,7 +20,14 @@ import butterknife.Unbinder;
|
||||
* 消息详情
|
||||
*/
|
||||
public class MsgDetailActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.tv_title)
|
||||
TextView mTvTitle;
|
||||
@BindView(R.id.tv_time)
|
||||
TextView mTvTime;
|
||||
@BindView(R.id.tv_gator)
|
||||
TextView mTvGator;
|
||||
@BindView(R.id.tv_content)
|
||||
TextView mTvContent;
|
||||
|
||||
private Unbinder mBind;
|
||||
private MessageBean mBean;
|
||||
@ -33,6 +49,22 @@ public class MsgDetailActivity extends BaseActivity {
|
||||
|
||||
private void setDataToView() {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
|
||||
String time = TimeUtils.millis2Str(mBean.getTimestamp());
|
||||
mTvTime.setText(time);
|
||||
mTvGator.setText("系统消息");
|
||||
String body = mBean.getBody();
|
||||
JSONObject obj = null;
|
||||
try {
|
||||
obj = new JSONObject(body);
|
||||
String msg = obj.getString("msg");
|
||||
String title = obj.getString("title");
|
||||
mTvContent.setText(msg);
|
||||
mTvTitle.setText(title);
|
||||
mTvContent.setOnClickListener(v -> startActivity(new Intent(MsgDetailActivity.this,
|
||||
RandomMissionActivity.class)));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.beans.MessageBean;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.TimeUtils;
|
||||
import com.sucstepsoft.txrealtimelocation.R;
|
||||
import com.sucstepsoft.txrealtimelocation.adapters.holders.MsgHolder;
|
||||
|
||||
@ -31,6 +32,7 @@ public class MsgListAdapter extends BaseRecyclerAdapter<MessageBean, MsgHolder>
|
||||
|
||||
@Override
|
||||
public void bindHolder(MsgHolder h, int i) {
|
||||
h.mTvTime.setText(mData.get(i).getTimestamp() + "");
|
||||
String time = TimeUtils.millis2Str(mData.get(i).getTimestamp());
|
||||
h.mTvTime.setText(time);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activitys.mine.MsgDetailActivity">
|
||||
tools:background="@color/gray_bg"
|
||||
tools:context=".activitys.notice.NoticeDetailActivity">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rectangle_white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ff353535"
|
||||
android:textSize="20sp"
|
||||
tools:text="标题标题标题标题标题" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="#ff808080"
|
||||
android:textSize="12sp"
|
||||
tools:text="2019年01月01日 10:09:09" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ff808080"
|
||||
android:textSize="12sp"
|
||||
tools:text="张三" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shape_rectangle_white"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="15dp"
|
||||
android:textColor="@color/black"
|
||||
tools:text="您有新的企业检查任务待处理" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/shape_rectangle_white"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp"
|
||||
tools:layout_height="60dp">
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
|
@ -59,8 +59,8 @@ ext {
|
||||
gCompileSdkVersion = 28
|
||||
gMinSdkVersion = 16
|
||||
gTargetSdkVersion = 28
|
||||
gVersionCode = 21
|
||||
gVersionName = '1.2.0'
|
||||
gVersionCode = 22
|
||||
gVersionName = '1.2.1'
|
||||
// gVersionCode=26
|
||||
// gVersionName='1.3.0'
|
||||
//Router编译版本
|
||||
|
@ -10,9 +10,9 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
public class BaseUrlApi {
|
||||
|
||||
// public static final String IP = "http://1.180.60.42:8083/usercenter/";/* 正式IP */
|
||||
// public static final String IP = "http://1.180.60.42:8084/usercenter/";/* 试用IP */
|
||||
public static final String IP = "http://1.180.60.42:8084/usercenter/";/* 试用IP */
|
||||
// public static final String IP = "http://192.168.0.103:7001/usercenter/";/* 测试IP */
|
||||
public static final String IP = "http://49.233.36.36:58091/usercenter/";/* 测试IP */
|
||||
// public static final String IP = "http://49.233.36.36:58091/usercenter/";/* 测试IP */
|
||||
public static final String PROJECT_NAME = "app/";
|
||||
public static final String BASE_URL = IP + PROJECT_NAME;
|
||||
public static final String APP_VERSION = BASE_URL + "appCmVersionManagement/getAppVersion";
|
||||
@ -21,16 +21,17 @@ public class BaseUrlApi {
|
||||
public static final int PHOTO_REQUEST = 233;
|
||||
public static final int CAMERA_REQUEST = 123;
|
||||
// public static final String BASE_IP = "http://1.180.60.42:8083/inspection/";/* 正式IP */
|
||||
// public static final String BASE_IP = "http://1.180.60.42:8084/inspection/";/* 试用IP */
|
||||
public static final String BASE_IP = "http://49.233.36.36:58092/inspection/";/* 试用IP */
|
||||
public static final String BASE_IP = "http://1.180.60.42:8084/inspection/";/* 试用IP */
|
||||
// public static final String BASE_IP = "http://49.233.36.36:58092/inspection/";/* 试用IP */
|
||||
// public static final String BASE_IP = "http://192.168.0.103:7012/inspection/";/* 测试IP */
|
||||
public static final String BASE_IMG_URL = BASE_IP + "route/file/downloadfile/true/";
|
||||
// public static final String SOCKET_IP = "http://192.168.0.103:7001/usercenter/ws";/*SocketIP测试*/
|
||||
// public static final String SOCKET_IP = "http://1.180.60.42:8083/usercenter/ws";/*SocketIP正式*/
|
||||
public static final String SOCKET_IP = "http://1.180.60.42:8084/usercenter/ws";/*试用SocketIP正式*/
|
||||
public static final String SOCKET_IP = "ws://1.180.60.42:8084/usercenter/ws";/*试用SocketIP正式*/
|
||||
// public static final String SOCKET_IP = "http://49.233.36.36:58091/usercenter/ws";/*试用SocketIP正式*/
|
||||
public static final String APP_DOWNLOAD_URL = BASE_URL + "appversion/downloadapp/" + PathConfig.APP_VERSION_ID;
|
||||
/*======百度定位city-code=======*/
|
||||
// public static final String CITY_BAIDU_CODE = "229";//包头市
|
||||
public static final String CITY_BAIDU_CODE = "321";//呼和浩特市
|
||||
public static final String CITY_BAIDU_CODE = "229";//包头市
|
||||
// public static final String CITY_BAIDU_CODE = "321";//呼和浩特市
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@ -167,6 +168,7 @@ public class WsManager implements IWsManager {
|
||||
if (mOkHttpClient == null) {
|
||||
mOkHttpClient = new OkHttpClient.Builder()
|
||||
.retryOnConnectionFailure(true)
|
||||
.pingInterval(40, TimeUnit.SECONDS)
|
||||
.build();
|
||||
}
|
||||
if (mRequest == null) {
|
||||
|
@ -84,6 +84,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
// TODO 禁止屏幕截图
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
super.onCreate(savedInstanceState);
|
||||
// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
|
@ -500,7 +500,6 @@ public class BusinessService extends Service {
|
||||
LogUtils.e(data);
|
||||
JSONObject jsonObject = new JSONObject(data);
|
||||
String from = jsonObject.getString("from");
|
||||
saveLocalDatabase(data);
|
||||
int type = jsonObject.getInt("type");
|
||||
//系统消息
|
||||
switch (type) {
|
||||
@ -513,6 +512,7 @@ public class BusinessService extends Service {
|
||||
String serviceId = bodyObj.getString("serviceId");
|
||||
sendNotify(bodyObj.getString("title"), bodyObj.getString("msg"),
|
||||
bodyObj.getString("target"), serviceId);
|
||||
saveLocalDatabase(data);
|
||||
}
|
||||
break;
|
||||
case PathConfig.MSG_MESSAGE:
|
||||
@ -603,10 +603,15 @@ public class BusinessService extends Service {
|
||||
*/
|
||||
private void saveLocalDatabase(String data) {
|
||||
String socketMsg = GlobalProvider.getString(this, "socketMsg");
|
||||
Gson gson = new Gson();
|
||||
if (TextUtils.isEmpty(socketMsg)) {
|
||||
GlobalProvider.save(this, "socketMsg", data);
|
||||
List<MessageBean> beans = new ArrayList<>();
|
||||
MessageBean bean = gson.fromJson(data, new TypeToken<MessageBean>() {
|
||||
}.getType());
|
||||
beans.add(bean);
|
||||
String s = gson.toJson(beans);
|
||||
GlobalProvider.save(this, "socketMsg", s);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
List<MessageBean> beans = gson.fromJson(socketMsg, new TypeToken<List<MessageBean>>() {
|
||||
}.getType());
|
||||
MessageBean b = gson.fromJson(data, new TypeToken<MessageBean>() {
|
||||
@ -623,7 +628,11 @@ public class BusinessService extends Service {
|
||||
private void startSocketService() {
|
||||
if (mWsManager == null) {
|
||||
mWsManager =
|
||||
new WsManager.Builder(getApplication()).wsUrl(BaseUrlApi.SOCKET_IP).needReconnect(true).build();
|
||||
new WsManager
|
||||
.Builder(getApplication())
|
||||
.wsUrl(BaseUrlApi.SOCKET_IP)
|
||||
.needReconnect(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
if (!mWsManager.isWsConnected()) {
|
||||
|
@ -90,6 +90,19 @@ public final class TimeUtils {
|
||||
return format.format(new Date(millis));
|
||||
}
|
||||
|
||||
public static String millis2Str(long millis) {
|
||||
try {
|
||||
Date date = new Date();
|
||||
date.setTime(millis);
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String format1 = format.format(date);
|
||||
return format1;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatted time string to the milliseconds.
|
||||
* <p>The pattern is {@code yyyy-MM-dd HH:mm:ss}.</p>
|
||||
|
Loading…
Reference in New Issue
Block a user