Commit 1ff2fc66642bf59d0a572e6b05a3caeaa30f72bb
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' into yxb_dev
Showing
5 changed files
with
64 additions
and
15 deletions
Show diff stats
.idea/misc.xml
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </value> | 24 | </value> |
25 | </option> | 25 | </option> |
26 | </component> | 26 | </component> |
27 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 27 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
28 | <output url="file://$PROJECT_DIR$/build/classes" /> | 28 | <output url="file://$PROJECT_DIR$/build/classes" /> |
29 | </component> | 29 | </component> |
30 | <component name="ProjectType"> | 30 | <component name="ProjectType"> |
.idea/modules.xml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | <modules> | 4 | <modules> |
5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | 5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> | 6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> |
7 | + <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" /> | ||
7 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> | 8 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> |
8 | - <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" /> | ||
9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> | 9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> |
10 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> | 10 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> |
11 | </modules> | 11 | </modules> |
app/src/main/java/com/shunzhi/parent/AppContext.java
1 | package com.shunzhi.parent; | 1 | package com.shunzhi.parent; |
2 | 2 | ||
3 | +import android.app.ActivityManager; | ||
3 | import android.content.Context; | 4 | import android.content.Context; |
4 | import android.content.Intent; | 5 | import android.content.Intent; |
5 | import android.content.SharedPreferences; | 6 | import android.content.SharedPreferences; |
7 | +import android.text.TextUtils; | ||
6 | 8 | ||
7 | import com.amap.api.location.AMapLocation; | 9 | import com.amap.api.location.AMapLocation; |
8 | import com.amap.api.location.AMapLocationClient; | 10 | import com.amap.api.location.AMapLocationClient; |
@@ -53,19 +55,22 @@ public class AppContext extends GlobalApplication { | @@ -53,19 +55,22 @@ public class AppContext extends GlobalApplication { | ||
53 | public AMapLocationClientOption mLocationOption = null; | 55 | public AMapLocationClientOption mLocationOption = null; |
54 | 56 | ||
55 | private MessageManager messageManager; | 57 | private MessageManager messageManager; |
58 | + | ||
56 | @Override | 59 | @Override |
57 | public void onCreate() { | 60 | public void onCreate() { |
58 | appContext = this; | 61 | appContext = this; |
59 | super.onCreate(); | 62 | super.onCreate(); |
60 | - //开启地图地位 | ||
61 | - initMapLocal(); | ||
62 | NIMClient.init(this, loginInfo(), options()); | 63 | NIMClient.init(this, loginInfo(), options()); |
63 | - initDB(); | ||
64 | - RetrofitCreateHelper.getInstance().setAuthorization(AppConfig.getAppConfig(this).get(AppConfig.ACCESS_TOKEN)); | ||
65 | - messageManager = MessageManager.getInstance(); | 64 | + if (inMainProcess(this)) { |
65 | + //开启地图地位 | ||
66 | + initMapLocal(); | ||
67 | + initDB(); | ||
68 | + RetrofitCreateHelper.getInstance().setAuthorization(AppConfig.getAppConfig(this).get(AppConfig.ACCESS_TOKEN)); | ||
69 | + messageManager = MessageManager.getInstance(); | ||
70 | + } | ||
66 | } | 71 | } |
67 | 72 | ||
68 | - public MessageManager getMessageManager(){ | 73 | + public MessageManager getMessageManager() { |
69 | return messageManager; | 74 | return messageManager; |
70 | } | 75 | } |
71 | 76 | ||
@@ -105,6 +110,46 @@ public class AppContext extends GlobalApplication { | @@ -105,6 +110,46 @@ public class AppContext extends GlobalApplication { | ||
105 | return null; | 110 | return null; |
106 | } | 111 | } |
107 | 112 | ||
113 | + public static boolean inMainProcess(Context context) { | ||
114 | + String packageName = context.getPackageName(); | ||
115 | + String processName = getProcessName(context); | ||
116 | + return packageName.equals(processName); | ||
117 | + } | ||
118 | + | ||
119 | + /** | ||
120 | + * 获取当前进程名 | ||
121 | + * | ||
122 | + * @param context | ||
123 | + * @return 进程名 | ||
124 | + */ | ||
125 | + public static final String getProcessName(Context context) { | ||
126 | + String processName = null; | ||
127 | + | ||
128 | + // ActivityManager | ||
129 | + ActivityManager am = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)); | ||
130 | + | ||
131 | + while (true) { | ||
132 | + for (ActivityManager.RunningAppProcessInfo info : am.getRunningAppProcesses()) { | ||
133 | + if (info.pid == android.os.Process.myPid()) { | ||
134 | + processName = info.processName; | ||
135 | + break; | ||
136 | + } | ||
137 | + } | ||
138 | + | ||
139 | + // go home | ||
140 | + if (!TextUtils.isEmpty(processName)) { | ||
141 | + return processName; | ||
142 | + } | ||
143 | + | ||
144 | + // take a rest and again | ||
145 | + try { | ||
146 | + Thread.sleep(100L); | ||
147 | + } catch (InterruptedException ex) { | ||
148 | + ex.printStackTrace(); | ||
149 | + } | ||
150 | + } | ||
151 | + } | ||
152 | + | ||
108 | private void initMapLocal() { | 153 | private void initMapLocal() { |
109 | //初始化定位 | 154 | //初始化定位 |
110 | mLocationClient = new AMapLocationClient(getApplicationContext()); | 155 | mLocationClient = new AMapLocationClient(getApplicationContext()); |
@@ -172,7 +217,8 @@ public class AppContext extends GlobalApplication { | @@ -172,7 +217,8 @@ public class AppContext extends GlobalApplication { | ||
172 | sendBroadcast(intent); | 217 | sendBroadcast(intent); |
173 | stopLocation(); | 218 | stopLocation(); |
174 | } else { | 219 | } else { |
175 | - cityName = "定位失败";district="定位失败"; | 220 | + cityName = "定位失败"; |
221 | + district = "定位失败"; | ||
176 | 222 | ||
177 | // Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); | 223 | // Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); |
178 | } | 224 | } |
app/src/main/java/com/shunzhi/parent/manager/MessageManager.java
@@ -105,6 +105,7 @@ public class MessageManager { | @@ -105,6 +105,7 @@ public class MessageManager { | ||
105 | session.setSessionName("作业通知"); | 105 | session.setSessionName("作业通知"); |
106 | session.setDate(new Date(customNotification.getTime())); | 106 | session.setDate(new Date(customNotification.getTime())); |
107 | session.setSessionText(json.optString("title")); | 107 | session.setSessionText(json.optString("title")); |
108 | + ToastUtils.showToast(json.optString("title")+"uuid="+uuid); | ||
108 | 109 | ||
109 | PHMessage message = new PHMessage(); | 110 | PHMessage message = new PHMessage(); |
110 | PHMessageDao messageDao = AppContext.getInstance().getDaoSession().getPHMessageDao(); | 111 | PHMessageDao messageDao = AppContext.getInstance().getDaoSession().getPHMessageDao(); |
@@ -116,7 +117,6 @@ public class MessageManager { | @@ -116,7 +117,6 @@ public class MessageManager { | ||
116 | Long id = messageDao.insert(message); | 117 | Long id = messageDao.insert(message); |
117 | notifyNotification(uuid, id, "收到一条作业通知"); | 118 | notifyNotification(uuid, id, "收到一条作业通知"); |
118 | } | 119 | } |
119 | - | ||
120 | } catch (JSONException e) { | 120 | } catch (JSONException e) { |
121 | e.printStackTrace(); | 121 | e.printStackTrace(); |
122 | } | 122 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
@@ -20,6 +20,7 @@ import com.shunzhi.parent.bean.channel.ChannelContextBean; | @@ -20,6 +20,7 @@ import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
20 | import com.shunzhi.parent.contract.consult.ConsultContract; | 20 | import com.shunzhi.parent.contract.consult.ConsultContract; |
21 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; | 21 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
22 | import com.shunzhi.parent.ui.MainActivity; | 22 | import com.shunzhi.parent.ui.MainActivity; |
23 | +import com.shunzhi.parent.ui.activity.StartActivity; | ||
23 | import com.shunzhi.parent.util.GlideUtils; | 24 | import com.shunzhi.parent.util.GlideUtils; |
24 | import com.stx.xhb.xbanner.XBanner; | 25 | import com.stx.xhb.xbanner.XBanner; |
25 | 26 | ||
@@ -75,7 +76,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -75,7 +76,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
75 | 76 | ||
76 | if (isQidong)mPresenter.getBanners("0", ""); | 77 | if (isQidong)mPresenter.getBanners("0", ""); |
77 | else mPresenter.getBanners("1", ""); | 78 | else mPresenter.getBanners("1", ""); |
78 | -// showVideos(); | 79 | + showVideos(); |
79 | 80 | ||
80 | tvJump=view.findViewById(R.id.tvJump); | 81 | tvJump=view.findViewById(R.id.tvJump); |
81 | 82 | ||
@@ -98,7 +99,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -98,7 +99,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
98 | } else { | 99 | } else { |
99 | jiecaoVideo.setVisibility(View.GONE); | 100 | jiecaoVideo.setVisibility(View.GONE); |
100 | xBanner.setVisibility(View.VISIBLE); | 101 | xBanner.setVisibility(View.VISIBLE); |
101 | - mPresenter.getBanners("1", ""); | 102 | +// mPresenter.getBanners("1", ""); |
102 | // mPresenter.getBanners("1", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); | 103 | // mPresenter.getBanners("1", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district); |
103 | } | 104 | } |
104 | } | 105 | } |
@@ -134,6 +135,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -134,6 +135,7 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
134 | try { | 135 | try { |
135 | imgUrl = new ArrayList<>(); | 136 | imgUrl = new ArrayList<>(); |
136 | describeList = new ArrayList<>(); | 137 | describeList = new ArrayList<>(); |
138 | +// Log.d("66666","isQidong="+isQidong); | ||
137 | if (isQidong) { | 139 | if (isQidong) { |
138 | AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); | 140 | AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); |
139 | String fileUrl = "", describe = ""; | 141 | String fileUrl = "", describe = ""; |
@@ -148,14 +150,15 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -148,14 +150,15 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
148 | describeList.add(guangGaoBeanList.get(i).describe); | 150 | describeList.add(guangGaoBeanList.get(i).describe); |
149 | } | 151 | } |
150 | } | 152 | } |
151 | -// Log.d("66666","fileUrl="+guangGaoBeanList); | 153 | + Log.d("66666","fileUrl="+fileUrl); |
152 | if (!TextUtils.isEmpty(fileUrl)){ | 154 | if (!TextUtils.isEmpty(fileUrl)){ |
153 | jiecaoVideo.setUp(fileUrl, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, describe); | 155 | jiecaoVideo.setUp(fileUrl, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, describe); |
154 | jiecaoVideo.startVideo(); | 156 | jiecaoVideo.startVideo(); |
155 | }else { | 157 | }else { |
156 | isQidong=false; | 158 | isQidong=false; |
157 | - showVideos(); | ||
158 | - showBanners(); | 159 | + startNewActivity(StartActivity.class); |
160 | +// showVideos(); | ||
161 | +// showBanners(); | ||
159 | } | 162 | } |
160 | 163 | ||
161 | } else { | 164 | } else { |