Commit de5c40dd48dfe691f0d17e83dcea3704a5939cfd

Authored by 姚旭斌
2 parents 2a83582a f79e086c

Merge branch 'developer' into yxb_dev

# Conflicts:
#	app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
#	app/src/main/res/layout/fragment_mine.xml
.gitignore
1 1 *.iml
2 2 .gradle
3 3 /local.properties
4   -/.idea/workspace.xml
5   -/.idea/libraries
  4 +/.idea
6 5 .DS_Store
7 6 /build
8 7 /captures
... ...
app/build.gradle
... ... @@ -32,7 +32,9 @@ android {
32 32 productFlavors {
33 33 }
34 34 }
35   -
  35 +greendao{
  36 + schemaVersion 1//数据库版本升级
  37 +}
36 38 dependencies {
37 39 implementation fileTree(include: ['*.jar'], dir: 'libs')
38 40 implementation 'com.android.support:appcompat-v7:26.1.0'
... ...
app/src/main/AndroidManifest.xml
... ... @@ -128,7 +128,9 @@
128 128 <activity
129 129 android:name=".ui.activity.MyChildActivity"
130 130 android:screenOrientation="portrait"/>
131   - <activity android:name=".ui.activity.consult.ConsultOneLevelActivity"/>
  131 + <activity android:name=".ui.activity.consult.ConsultOneLevelActivity"
  132 + android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
  133 + />
132 134 <!-- <activity android:name=".ui.activity.LoginAndRegistActivity" /> -->
133 135 <activity
134 136 android:name=".ui.MainActivity"
... ... @@ -175,6 +177,7 @@
175 177 android:screenOrientation="portrait" />
176 178  
177 179 <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity"
  180 + android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
178 181 android:launchMode="singleInstance"/>
179 182  
180 183 <activity android:name=".ui.activity.orderdetail.OrderDetailActivity"
... ...
app/src/main/java/com/shunzhi/parent/AppContext.java
... ... @@ -14,6 +14,13 @@ import com.netease.nimlib.sdk.SDKOptions;
14 14 import com.netease.nimlib.sdk.StatusBarNotificationConfig;
15 15 import com.netease.nimlib.sdk.auth.LoginInfo;
16 16 import com.share.mvpsdk.global.GlobalApplication;
  17 +import com.amap.api.location.AMapLocationClientOption.AMapLocationMode;
  18 +import com.shunzhi.parent.bean.message.DaoMaster;
  19 +import com.shunzhi.parent.bean.message.DaoMaster.DevOpenHelper;
  20 +import com.shunzhi.parent.bean.message.DaoSession;
  21 +import com.shunzhi.parent.ui.MainActivity;
  22 +
  23 +import org.greenrobot.greendao.database.Database;
17 24  
18 25 /**
19 26 * Created by Administrator on 2018/3/7 0007.
... ... @@ -26,6 +33,12 @@ public class AppContext extends GlobalApplication {
26 33  
27 34 public String cityName = "", district = "";
28 35  
  36 + public DaoSession getDaoSession() {
  37 + return daoSession;
  38 + }
  39 +
  40 + private DaoSession daoSession;
  41 +
29 42 public static AppContext getInstance() {
30 43 return appContext;
31 44 }
... ... @@ -43,6 +56,18 @@ public class AppContext extends GlobalApplication {
43 56 //开启地图地位
44 57 initMapLocal();
45 58 NIMClient.init(this, loginInfo(), options());
  59 + initDB();
  60 + }
  61 +
  62 + private void initDB() {
  63 + //如果需要对数据库加密可以使用注释掉的方法,密码设置方式可以参考微信的数据密码生成方式:
  64 + //读取手机的IMEI与APP安装时生成的随机码(微信是在登录账号以后为不同的账号创建不同的文件夹微信随机码是微信账号的id)拼接,
  65 + // 经md5加密后取前n位做密码
  66 +// DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, ENCRYPTED ? "notes-db-encrypted" : "notes-db");
  67 +// Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb();
  68 + DevOpenHelper helper = new DevOpenHelper(this, "pw_messages");
  69 + Database db = helper.getWritableDb();
  70 + daoSession = new DaoMaster(db).newSession();
46 71 }
47 72  
48 73 private SDKOptions options() {
... ... @@ -50,7 +75,7 @@ public class AppContext extends GlobalApplication {
50 75  
51 76 // 如果将新消息通知提醒托管给 SDK 完成,需要添加以下配置。否则无需设置。
52 77 StatusBarNotificationConfig config = new StatusBarNotificationConfig();
53   - //config.notificationEntrance = MainActivity.class; // 点击通知栏跳转到该Activity
  78 + config.notificationEntrance = MainActivity.class; // 点击通知栏跳转到该Activity
54 79 config.notificationSmallIconId = R.mipmap.ic_launcher;
55 80 options.sdkStorageRootPath = getExternalFilesDir(null).getPath() + "/nim";
56 81 options.statusBarNotificationConfig = config;
... ...
app/src/main/java/com/shunzhi/parent/bean/message/PHMessage.java
1 1 package com.shunzhi.parent.bean.message;
2 2  
  3 +import org.greenrobot.greendao.annotation.Entity;
  4 +import org.greenrobot.greendao.annotation.Id;
  5 +import org.greenrobot.greendao.annotation.NotNull;
  6 +
  7 +import java.util.Date;
  8 +
  9 +import org.greenrobot.greendao.annotation.Generated;
  10 +
3 11 /**
4   - * Created by 10501 on 2018/3/19.
  12 + * 内部变量可能存在值为null,使用时要注意
5 13 */
  14 +@Entity(nameInDb = "message")
  15 +public class PHMessage {
  16 + @Id(autoincrement = true)
  17 + private Long id;
  18 +
  19 + private Date date;
  20 + private String messageId;
  21 + private String sessionId;
  22 + @NotNull
  23 + private String messageText;
  24 + private String exValue;//消息扩展字段
  25 + private String filePath;
  26 + private String fileUrl;
  27 + private String messageType;
  28 + private Integer sendState;//消息发送的状态 1未发送(或者null,不建议使用null) 2发送中 3发送成功 4发送失败
  29 +
  30 + @Generated(hash = 1293964777)
  31 + public PHMessage(Long id, Date date, String messageId, String sessionId,
  32 + @NotNull String messageText, String exValue, String filePath,
  33 + String fileUrl, String messageType, Integer sendState) {
  34 + this.id = id;
  35 + this.date = date;
  36 + this.messageId = messageId;
  37 + this.sessionId = sessionId;
  38 + this.messageText = messageText;
  39 + this.exValue = exValue;
  40 + this.filePath = filePath;
  41 + this.fileUrl = fileUrl;
  42 + this.messageType = messageType;
  43 + this.sendState = sendState;
  44 + }
  45 +
  46 + @Generated(hash = 1001489632)
  47 + public PHMessage() {
  48 + }
  49 +
  50 + public Long getId() {
  51 + return this.id;
  52 + }
  53 +
  54 + public void setId(Long id) {
  55 + this.id = id;
  56 + }
  57 +
  58 + public Date getDate() {
  59 + return this.date;
  60 + }
  61 +
  62 + public void setDate(Date date) {
  63 + this.date = date;
  64 + }
  65 +
  66 + public String getMessageId() {
  67 + return this.messageId;
  68 + }
  69 +
  70 + public void setMessageId(String messageId) {
  71 + this.messageId = messageId;
  72 + }
  73 +
  74 + public String getSessionId() {
  75 + return this.sessionId;
  76 + }
  77 +
  78 + public void setSessionId(String sessionId) {
  79 + this.sessionId = sessionId;
  80 + }
  81 +
  82 + public String getMessageText() {
  83 + return this.messageText;
  84 + }
  85 +
  86 + public void setMessageText(String messageText) {
  87 + this.messageText = messageText;
  88 + }
  89 +
  90 + public String getExValue() {
  91 + return this.exValue;
  92 + }
  93 +
  94 + public void setExValue(String exValue) {
  95 + this.exValue = exValue;
  96 + }
  97 +
  98 + public String getFilePath() {
  99 + return this.filePath;
  100 + }
  101 +
  102 + public void setFilePath(String filePath) {
  103 + this.filePath = filePath;
  104 + }
  105 +
  106 + public String getFileUrl() {
  107 + return this.fileUrl;
  108 + }
  109 +
  110 + public void setFileUrl(String fileUrl) {
  111 + this.fileUrl = fileUrl;
  112 + }
  113 +
  114 + public String getMessageType() {
  115 + return this.messageType;
  116 + }
  117 +
  118 + public void setMessageType(String messageType) {
  119 + this.messageType = messageType;
  120 + }
  121 +
  122 + public Integer getSendState() {
  123 + return this.sendState;
  124 + }
6 125  
7   -public class PHMessage {
  126 + public void setSendState(Integer sendState) {
  127 + this.sendState = sendState;
  128 + }
8 129 }
... ...
app/src/main/java/com/shunzhi/parent/bean/message/PHMessageSession.java 0 → 100644
... ... @@ -0,0 +1,127 @@
  1 +package com.shunzhi.parent.bean.message;
  2 +
  3 +import org.greenrobot.greendao.annotation.Entity;
  4 +import org.greenrobot.greendao.annotation.Id;
  5 +
  6 +import java.util.Date;
  7 +
  8 +import org.greenrobot.greendao.annotation.Generated;
  9 +
  10 +/**
  11 + * Created by 10501 on 2018/3/20.
  12 + */
  13 +@Entity(nameInDb = "messageSession")
  14 +public class PHMessageSession {
  15 + @Id(autoincrement = true)
  16 + private Long id;
  17 + private String sessionId;
  18 + private String sessionText;
  19 + private String sessionName;
  20 + private Date date;
  21 + private Integer sessionType;
  22 + private Integer newMessageCount;//接收和发送的消息总数
  23 + private Integer unReadMessageCount;//未读消息总数
  24 + private String exValues;
  25 + private Boolean isTop;
  26 +
  27 + @Generated(hash = 1156938953)
  28 + public PHMessageSession(Long id, String sessionId, String sessionText, String sessionName,
  29 + Date date, Integer sessionType, Integer newMessageCount, Integer unReadMessageCount,
  30 + String exValues, Boolean isTop) {
  31 + this.id = id;
  32 + this.sessionId = sessionId;
  33 + this.sessionText = sessionText;
  34 + this.sessionName = sessionName;
  35 + this.date = date;
  36 + this.sessionType = sessionType;
  37 + this.newMessageCount = newMessageCount;
  38 + this.unReadMessageCount = unReadMessageCount;
  39 + this.exValues = exValues;
  40 + this.isTop = isTop;
  41 + }
  42 +
  43 + @Generated(hash = 390248330)
  44 + public PHMessageSession() {
  45 + }
  46 +
  47 + public Long getId() {
  48 + return this.id;
  49 + }
  50 +
  51 + public void setId(Long id) {
  52 + this.id = id;
  53 + }
  54 +
  55 + public String getSessionId() {
  56 + return this.sessionId;
  57 + }
  58 +
  59 + public void setSessionId(String sessionId) {
  60 + this.sessionId = sessionId;
  61 + }
  62 +
  63 + public String getSessionText() {
  64 + return this.sessionText;
  65 + }
  66 +
  67 + public void setSessionText(String sessionText) {
  68 + this.sessionText = sessionText;
  69 + }
  70 +
  71 + public String getSessionName() {
  72 + return this.sessionName;
  73 + }
  74 +
  75 + public void setSessionName(String sessionName) {
  76 + this.sessionName = sessionName;
  77 + }
  78 +
  79 + public Integer getSessionType() {
  80 + return this.sessionType;
  81 + }
  82 +
  83 + public void setSessionType(Integer sessionType) {
  84 + this.sessionType = sessionType;
  85 + }
  86 +
  87 + public Integer getNewMessageCount() {
  88 + return this.newMessageCount;
  89 + }
  90 +
  91 + public void setNewMessageCount(Integer newMessageCount) {
  92 + this.newMessageCount = newMessageCount;
  93 + }
  94 +
  95 + public Integer getUnReadMessageCount() {
  96 + return this.unReadMessageCount;
  97 + }
  98 +
  99 + public void setUnReadMessageCount(Integer unReadMessageCount) {
  100 + this.unReadMessageCount = unReadMessageCount;
  101 + }
  102 +
  103 + public String getExValues() {
  104 + return this.exValues;
  105 + }
  106 +
  107 + public void setExValues(String exValues) {
  108 + this.exValues = exValues;
  109 + }
  110 +
  111 + public Boolean getIsTop() {
  112 + if (isTop == null) return false;
  113 + return this.isTop;
  114 + }
  115 +
  116 + public void setIsTop(Boolean isTop) {
  117 + this.isTop = isTop;
  118 + }
  119 +
  120 + public Date getDate() {
  121 + return this.date;
  122 + }
  123 +
  124 + public void setDate(Date date) {
  125 + this.date = date;
  126 + }
  127 +}
... ...
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
... ... @@ -95,9 +95,6 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter {
95 95 mIView.showChannel(channelList);
96 96 mIView.showContext(contextList);
97 97  
98   -
99   -
100   -
101 98 }
102 99 }, new Consumer<Throwable>() {
103 100 @Override
... ...
app/src/main/java/com/shunzhi/parent/ui/activity/MyChildActivity.java
... ... @@ -45,7 +45,7 @@ import java.util.List;
45 45 public class MyChildActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel>
46 46 implements MyChildContract.IMyChildView, View.OnClickListener {
47 47 SwipeMenuRecyclerView child_recycle;
48   - TextView center_title, add_child, go_buy;
  48 + TextView center_title, add_child, go_buy;
49 49 ImageView back;
50 50 ChildAdapter childAdapter;
51 51 List<ChildBean> currlist = new ArrayList<>();
... ... @@ -127,7 +127,7 @@ public class MyChildActivity extends BaseMVPCompatActivity&lt;MyChildContract.MyChi
127 127 Bundle bundle = new Bundle();
128 128 bundle.putString("url", AppConfig.BASE_URL_ORDER + "ParentOrderCenter.aspx?userid=" +
129 129 AppConfig.getAppConfig(this).get(AppConfig.USER_ID));
130   - bundle.putInt("type",AppConfig.ORDER_CENTER);
  130 + bundle.putInt("type", AppConfig.ORDER_CENTER);
131 131 startNewActivity(WebViewActivity.class, bundle);
132 132 }
133 133 }
... ... @@ -146,7 +146,7 @@ public class MyChildActivity extends BaseMVPCompatActivity&lt;MyChildContract.MyChi
146 146 }
147 147  
148 148 @Override
149   - public void addChildSuccess(String account,String password) {
  149 + public void addChildSuccess(String account, String password) {
150 150  
151 151 }
152 152  
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... ... @@ -174,7 +174,6 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
174 174 }
175 175 }
176 176  
177   -
178 177 private void initBroadCast() {
179 178  
180 179 IntentFilter intentFilter = new IntentFilter();
... ... @@ -240,7 +239,6 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
240 239 first = false;
241 240 }
242 241  
243   -
244 242 }
245 243  
246 244 @Override
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
... ... @@ -30,7 +30,9 @@ import com.shunzhi.parent.util.GlideUtils;
30 30  
31 31 public class MineFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter, LoginAndRegisterContract.ILoginModel>
32 32 implements MineContract.IMineView, View.OnClickListener {
  33 +
33 34 LinearLayout childlayout, personinfo, layout_orderDetail, layout_order, layout_cache, layout_about, layout_feedback,top_layout,layout_afterLogin;
  35 +
34 36 RoundedImageView user_photo;
35 37 TextView user_name, user_mobile, tvExit, binding_state;
36 38  
... ... @@ -94,6 +96,7 @@ public class MineFragment extends BaseMVPCompatFragment&lt;LoginAndRegisterContract
94 96 user_mobile.setVisibility(View.VISIBLE);
95 97 layout_afterLogin.setVisibility(View.VISIBLE);
96 98 tvExit.setVisibility(View.VISIBLE);
  99 +
97 100 } else {
98 101 user_name.setVisibility(View.VISIBLE);
99 102 user_mobile.setVisibility(View.GONE);
... ... @@ -134,8 +137,10 @@ public class MineFragment extends BaseMVPCompatFragment&lt;LoginAndRegisterContract
134 137 case R.id.layout_about:
135 138 WebViewActivity.getInstance(getActivity(), AppConfig.BASE_URL_ORDER + "About.html", -1);
136 139 break;
  140 +
137 141 case R.id.layout_feedback:
138 142 WebViewActivity.getInstance(getActivity(), AppConfig.BASE_URL_ORDER + "FeedBack.aspx?userid=" + AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.USER_ID), -1);
  143 +
139 144 break;
140 145 default:
141 146 break;
... ...
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
... ... @@ -5,6 +5,7 @@ import android.support.annotation.NonNull;
5 5 import android.support.annotation.Nullable;
6 6 import android.support.v7.widget.LinearLayoutManager;
7 7 import android.support.v7.widget.RecyclerView;
  8 +import android.text.TextUtils;
8 9 import android.view.LayoutInflater;
9 10 import android.view.View;
10 11 import android.view.ViewGroup;
... ... @@ -99,6 +100,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
99 100 }
100 101  
101 102 public void showSearchContent(String keyword) {
  103 + if (!TextUtils.isEmpty(keyword))
102 104 mPresenter.getInformationTopic(keyword, AppContext.getInstance().district, channel, "0", 1);
103 105 }
104 106  
... ...
app/src/main/res/layout/layout_consult_content.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3 android:layout_width="match_parent"
4   - android:layout_height="wrap_content"
  4 + android:layout_height="@dimen/size_dp_100"
5 5 android:layout_marginBottom="@dimen/size_dp_10"
6 6 android:orientation="vertical">
7 7  
... ... @@ -17,15 +17,17 @@
17 17 android:layout_weight="4"
18 18 android:elevation="@dimen/size_dp_3"
19 19 android:orientation="vertical"
20   - android:padding="@dimen/size_dp_5">
  20 + android:padding="@dimen/size_dp_4">
21 21  
22 22 <TextView
23 23 android:id="@+id/tvConsultTitle"
24 24 android:layout_width="match_parent"
25   - android:layout_height="wrap_content"
  25 + android:layout_height="0dp"
  26 + android:layout_weight="2"
26 27 android:ellipsize="end"
27 28 android:gravity="center_vertical"
28 29 android:maxLines="2"
  30 + android:layout_gravity="top"
29 31 android:text="学校初一段家长统一测试使用家长慧得到良好反馈评价"
30 32 android:textColor="@color/textColor"
31 33 android:textSize="@dimen/textSize14" />
... ... @@ -33,9 +35,11 @@
33 35 <TextView
34 36 android:id="@+id/tvConsultContent"
35 37 android:layout_width="match_parent"
36   - android:layout_height="wrap_content"
  38 + android:layout_height="0dp"
  39 + android:layout_weight="1"
37 40 android:layout_marginTop="@dimen/size_dp_5"
38 41 android:ellipsize="end"
  42 + android:layout_gravity="center_vertical"
39 43 android:gravity="center_vertical"
40 44 android:maxLines="2"
41 45 android:singleLine="true"
... ... @@ -44,15 +48,19 @@
44 48 android:textSize="@dimen/textSize14" />
45 49  
46 50 <FrameLayout
  51 + android:layout_gravity="bottom"
47 52 android:layout_width="match_parent"
48   - android:layout_height="wrap_content"
  53 + android:layout_height="0dp"
  54 + android:layout_weight="1"
49 55 android:layout_marginTop="@dimen/size_dp_5">
50 56  
51 57 <RelativeLayout
  58 + android:layout_gravity="bottom"
52 59 android:layout_width="match_parent"
53 60 android:layout_height="wrap_content">
54 61  
55 62 <TextView
  63 + android:layout_centerVertical="true"
56 64 android:id="@+id/tvPingLunNums"
57 65 style="@style/TextView_Wrap_16"
58 66 android:layout_gravity="center_vertical"
... ... @@ -75,9 +83,11 @@
75 83 android:id="@+id/iv_consult"
76 84 android:layout_width="0dp"
77 85 android:layout_height="match_parent"
78   - android:layout_margin="@dimen/size_dp_2"
  86 + android:layout_margin="@dimen/size_dp_4"
79 87 android:layout_weight="2"
  88 + android:scaleType="fitXY"
80 89 android:src="@color/xueqing_blue" />
  90 +
81 91 </LinearLayout>
82 92  
83 93 <FrameLayout
... ...
app/src/main/res/menu/bottom_navigationview.xml
... ... @@ -3,13 +3,13 @@
3 3  
4 4 <item android:id="@+id/menu_item_index"
5 5 android:icon="@drawable/selector_ceping"
6   - android:title="测评"
  6 + android:title="慧测慧练"
7 7 ></item>
8 8  
9 9  
10 10 <item android:id="@+id/menu_item_consult"
11 11 android:icon="@drawable/selector_consult"
12   - android:title="咨询频道"
  12 + android:title="资讯频道"
13 13 ></item>
14 14  
15 15  
... ...
app/src/main/res/values/strings.xml
... ... @@ -4,7 +4,7 @@
4 4 <!-- TODO: Remove or change this placeholder text -->
5 5 <string name="hello_blank_fragment">Hello blank fragment</string>
6 6  
7   - <string name="ceping">测评</string>
  7 + <string name="ceping">慧测慧练</string>
8 8 <string name="consult_huati">咨询话题</string>
9 9 <string name="order_detail">订单详情</string>
10 10 </resources>
... ...