Commit 0cbb05545786a34eb8698732e66672f593da352d

Authored by 陶汉栋
1 parent a0178454

no message

app/build.gradle
@@ -16,8 +16,8 @@ android { @@ -16,8 +16,8 @@ android {
16 applicationId "com.shunzhi.parent" 16 applicationId "com.shunzhi.parent"
17 minSdkVersion 16 17 minSdkVersion 16
18 targetSdkVersion 26 18 targetSdkVersion 26
19 - versionCode 1  
20 - versionName "1.0" 19 + versionCode 102
  20 + versionName "1.0.2"
21 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 21 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
22 javaCompileOptions { 22 javaCompileOptions {
23 annotationProcessorOptions { 23 annotationProcessorOptions {
app/src/main/AndroidManifest.xml
@@ -117,6 +117,17 @@ @@ -117,6 +117,17 @@
117 android:name="com.amap.api.v2.apikey" 117 android:name="com.amap.api.v2.apikey"
118 android:value="1d130afb822d8a1019e6592cbaf10bcc" /> 118 android:value="1d130afb822d8a1019e6592cbaf10bcc" />
119 119
  120 +
  121 + <provider
  122 + android:authorities="com.shunzhi.parent.fileprovider"
  123 + android:name="android.support.v4.content.FileProvider"
  124 + android:grantUriPermissions="true"
  125 + android:exported="false">
  126 + <meta-data
  127 + android:name="android.support.FILE_PROVIDER_PATHS"
  128 + android:resource="@xml/filepaths"/>
  129 + </provider>
  130 +
120 <activity 131 <activity
121 android:name=".ui.activity.StartActivity" 132 android:name=".ui.activity.StartActivity"
122 android:launchMode="singleInstance" 133 android:launchMode="singleInstance"
app/src/main/java/com/shunzhi/parent/AppConfig.java
@@ -38,15 +38,15 @@ public class AppConfig { @@ -38,15 +38,15 @@ public class AppConfig {
38 public static String APP_IS_START = "app_is_start"; 38 public static String APP_IS_START = "app_is_start";
39 39
40 //http://campus.myjxt.com/ 40 //http://campus.myjxt.com/
41 - public static String BASE_URL="http://60.190.202.57:1000/";  
42 - public static String BASE_URL_ORDER="http://60.190.202.57:8101/";  
43 - public static String BASE_URL_FILE="http://60.190.202.57:8196"; 41 +// public static String BASE_URL="http://60.190.202.57:1000/";
  42 +// public static String BASE_URL_ORDER="http://60.190.202.57:8101/";
  43 +// public static String BASE_URL_FILE="http://60.190.202.57:8196";
44 44
45 45
46 //正式 46 //正式
47 -// public static String BASE_URL="http://campus.myjxt.com/";  
48 -// public static String BASE_URL_ORDER="http://parent.myjxt.com/";  
49 -// public static String BASE_URL_FILE="http://manage.myjxt.com"; 47 + public static String BASE_URL="http://campus.myjxt.com/";
  48 + public static String BASE_URL_ORDER="http://parent.myjxt.com/";
  49 + public static String BASE_URL_FILE="http://manage.myjxt.com";
50 // public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3"; 50 // public static final String url_version = BASE_URL + "api/Common/AppVersion?appType=3";
51 51
52 52
app/src/main/java/com/shunzhi/parent/manager/UpdateManager.java
@@ -148,7 +148,7 @@ public class UpdateManager { @@ -148,7 +148,7 @@ public class UpdateManager {
148 Timber.d("66666%s","currentVersion="+currentVersion+"serviceCode="+serviceCode+"versionCode="+versionCode); 148 Timber.d("66666%s","currentVersion="+currentVersion+"serviceCode="+serviceCode+"versionCode="+versionCode);
149 if ((serviceCode > versionCode) && ischeckingForUpdate && !isChechingInterrupted) { 149 if ((serviceCode > versionCode) && ischeckingForUpdate && !isChechingInterrupted) {
150 showNoticeDialog(currentVersion, version.content, isChechingInterrupted); 150 showNoticeDialog(currentVersion, version.content, isChechingInterrupted);
151 - } else if (!(serviceCode > versionCode) && shouldInterruptDialogShow && !isChechingInterrupted) { 151 + } else if (!(serviceCode > versionCode) && !isChechingInterrupted) {
152 Toast.makeText(mContext, "已经是最新版本啦!", Toast.LENGTH_SHORT).show(); 152 Toast.makeText(mContext, "已经是最新版本啦!", Toast.LENGTH_SHORT).show();
153 mContext = null; 153 mContext = null;
154 } 154 }
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -41,6 +41,7 @@ import java.util.List; @@ -41,6 +41,7 @@ import java.util.List;
41 import cn.jzvd.JZVideoPlayerStandard; 41 import cn.jzvd.JZVideoPlayerStandard;
42 import me.leefeng.citypicker.CityPicker; 42 import me.leefeng.citypicker.CityPicker;
43 import me.leefeng.citypicker.CityPickerListener; 43 import me.leefeng.citypicker.CityPickerListener;
  44 +import timber.log.Timber;
44 45
45 public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> implements View.OnClickListener 46 public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> implements View.OnClickListener
46 , ConsultContract.IConsultView, CityPickerListener { 47 , ConsultContract.IConsultView, CityPickerListener {
@@ -54,6 +55,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu @@ -54,6 +55,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
54 MyConsultAdapter contextAdapter; 55 MyConsultAdapter contextAdapter;
55 56
56 List<String> imgesUrl = new ArrayList<>(); 57 List<String> imgesUrl = new ArrayList<>();
  58 + List<String> imgWebUrl=new ArrayList<>();//跳转的连接
57 List<String> describeList = new ArrayList<>(); 59 List<String> describeList = new ArrayList<>();
58 List<GuangGaoBean> guanggaoList = new ArrayList<>(); 60 List<GuangGaoBean> guanggaoList = new ArrayList<>();
59 List<ChannelContextBean> contextList = new ArrayList<>(); 61 List<ChannelContextBean> contextList = new ArrayList<>();
@@ -148,7 +150,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu @@ -148,7 +150,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
148 xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() { 150 xBanner.setOnItemClickListener(new XBanner.OnItemClickListener() {
149 @Override 151 @Override
150 public void onItemClick(XBanner banner, int position) { 152 public void onItemClick(XBanner banner, int position) {
151 - WebViewActivity.getInstance(getContext(), imgesUrl.get(position), -1); 153 + WebViewActivity.getInstance(getContext(), imgWebUrl.get(position), -1);
152 } 154 }
153 }); 155 });
154 } 156 }
@@ -234,6 +236,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu @@ -234,6 +236,7 @@ public class ConsultFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consu
234 for (int i = 0; i < guangGaoBeanList.size(); i++) { 236 for (int i = 0; i < guangGaoBeanList.size(); i++) {
235 imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); 237 imgesUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc);
236 describeList.add(guangGaoBeanList.get(i).describe); 238 describeList.add(guangGaoBeanList.get(i).describe);
  239 + imgWebUrl.add(guangGaoBeanList.get(i).url);
237 } 240 }
238 initBanners(); 241 initBanners();
239 } 242 }
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
@@ -175,7 +175,7 @@ public class MineFragment extends BaseMVPCompatFragment&lt;LoginAndRegisterContract @@ -175,7 +175,7 @@ public class MineFragment extends BaseMVPCompatFragment&lt;LoginAndRegisterContract
175 175
176 break; 176 break;
177 case R.id.layout_update: 177 case R.id.layout_update:
178 - UpdateManager.getInstance().setContext(getContext()).isUpdate(true); 178 + UpdateManager.getInstance().setContext(getContext()).isUpdate(false);
179 break; 179 break;
180 default: 180 default:
181 break; 181 break;
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
1 package com.shunzhi.parent.ui.fragment; 1 package com.shunzhi.parent.ui.fragment;
2 2
  3 +import android.media.MediaMetadataRetriever;
3 import android.os.Bundle; 4 import android.os.Bundle;
4 import android.os.CountDownTimer; 5 import android.os.CountDownTimer;
5 import android.support.annotation.NonNull; 6 import android.support.annotation.NonNull;
@@ -12,6 +13,7 @@ import android.widget.TextView; @@ -12,6 +13,7 @@ import android.widget.TextView;
12 13
13 import com.share.mvpsdk.base.BasePresenter; 14 import com.share.mvpsdk.base.BasePresenter;
14 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; 15 import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment;
  16 +import com.share.mvpsdk.view.MyVieoView;
15 import com.shunzhi.parent.AppConfig; 17 import com.shunzhi.parent.AppConfig;
16 import com.shunzhi.parent.R; 18 import com.shunzhi.parent.R;
17 import com.shunzhi.parent.bean.GuangGaoBean; 19 import com.shunzhi.parent.bean.GuangGaoBean;
@@ -28,6 +30,7 @@ import java.util.ArrayList; @@ -28,6 +30,7 @@ import java.util.ArrayList;
28 import java.util.List; 30 import java.util.List;
29 31
30 import cn.jzvd.JZVideoPlayerStandard; 32 import cn.jzvd.JZVideoPlayerStandard;
  33 +import timber.log.Timber;
31 34
32 public class StartFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> 35 public class StartFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel>
33 implements ConsultContract.IConsultView { 36 implements ConsultContract.IConsultView {
@@ -38,13 +41,15 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -38,13 +41,15 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
38 41
39 boolean isQidong = false; 42 boolean isQidong = false;
40 43
41 - JZVideoPlayerStandard jiecaoVideo; 44 +// JZVideoPlayerStandard jiecaoVideo;
42 45
  46 + MyVieoView myVideoView = null;
43 47
44 - CountDownTimer countDownTimer=new CountDownTimer(5*1000,1000) { 48 +
  49 + CountDownTimer countDownTimer = new CountDownTimer(5 * 1000, 1000) {
45 @Override 50 @Override
46 public void onTick(long l) { 51 public void onTick(long l) {
47 - tvJump.setText("跳转"+l/1000+"s"); 52 + tvJump.setText("跳转" + l / 1000 + "s");
48 } 53 }
49 54
50 @Override 55 @Override
@@ -64,21 +69,13 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -64,21 +69,13 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
64 69
65 xBanner = view.findViewById(R.id.xBanner); 70 xBanner = view.findViewById(R.id.xBanner);
66 tvJump = view.findViewById(R.id.tvJump); 71 tvJump = view.findViewById(R.id.tvJump);
67 - jiecaoVideo = view.findViewById(R.id.jiecaoVideo);  
68 - jiecaoVideo.tinyBackImageView.setVisibility(View.GONE);  
69 - jiecaoVideo.backButton.setVisibility(View.GONE);  
70 - jiecaoVideo.replayTextView.setVisibility(View.GONE);  
71 - jiecaoVideo.batteryLevel.setVisibility(View.GONE);  
72 - jiecaoVideo.thumbImageView.setVisibility(View.GONE);  
73 - jiecaoVideo.loadingProgressBar.setVisibility(View.GONE);  
74 - countDownTimer.start(); 72 + myVideoView = view.findViewById(R.id.myVideoView);
75 isQidong = TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START)); 73 isQidong = TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START));
76 -  
77 - if (isQidong)mPresenter.getBanners("0", ""); 74 + if (isQidong) mPresenter.getBanners("0", "");
78 else mPresenter.getBanners("1", ""); 75 else mPresenter.getBanners("1", "");
79 showVideos(); 76 showVideos();
80 77
81 - tvJump=view.findViewById(R.id.tvJump); 78 + tvJump = view.findViewById(R.id.tvJump);
82 79
83 tvJump.setOnClickListener(new View.OnClickListener() { 80 tvJump.setOnClickListener(new View.OnClickListener() {
84 @Override 81 @Override
@@ -90,17 +87,12 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -90,17 +87,12 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
90 87
91 } 88 }
92 89
93 - private void showVideos(){ 90 + private void showVideos() {
94 if (isQidong) { 91 if (isQidong) {
95 - jiecaoVideo.setVisibility(View.VISIBLE);  
96 xBanner.setVisibility(View.GONE); 92 xBanner.setVisibility(View.GONE);
97 -// mPresenter.getBanners("0", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district);  
98 mPresenter.getBanners("0", ""); 93 mPresenter.getBanners("0", "");
99 } else { 94 } else {
100 - jiecaoVideo.setVisibility(View.GONE);  
101 xBanner.setVisibility(View.VISIBLE); 95 xBanner.setVisibility(View.VISIBLE);
102 -// mPresenter.getBanners("1", "");  
103 -// mPresenter.getBanners("1", AppContext.getInstance().district==""?"余杭区":AppContext.getInstance().district);  
104 } 96 }
105 } 97 }
106 98
@@ -129,12 +121,15 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -129,12 +121,15 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
129 public void showContext(List<ChannelContextBean> list) { 121 public void showContext(List<ChannelContextBean> list) {
130 122
131 } 123 }
132 - List<String> imgUrl = new ArrayList<>(); 124 +
  125 + List<String> imgUrl = new ArrayList<>();
133 List<String> describeList = new ArrayList<>(); 126 List<String> describeList = new ArrayList<>();
  127 +
134 private void initBannes(List<GuangGaoBean> guangGaoBeanList) { 128 private void initBannes(List<GuangGaoBean> guangGaoBeanList) {
135 try { 129 try {
136 imgUrl = new ArrayList<>(); 130 imgUrl = new ArrayList<>();
137 describeList = new ArrayList<>(); 131 describeList = new ArrayList<>();
  132 +// Timber.d("66666%s","guangGaoBeanList="+guangGaoBeanList);
138 if (isQidong) { 133 if (isQidong) {
139 AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); 134 AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1");
140 String fileUrl = "", describe = ""; 135 String fileUrl = "", describe = "";
@@ -144,16 +139,17 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -144,16 +139,17 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
144 describe = guangGaoBeanList.get(i).describe; 139 describe = guangGaoBeanList.get(i).describe;
145 imgUrl.add(fileUrl); 140 imgUrl.add(fileUrl);
146 describeList.add(describe); 141 describeList.add(describe);
147 - }else { 142 + } else {
148 imgUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc); 143 imgUrl.add(AppConfig.BASE_URL_FILE + guangGaoBeanList.get(i).fileSrc);
149 describeList.add(guangGaoBeanList.get(i).describe); 144 describeList.add(guangGaoBeanList.get(i).describe);
150 } 145 }
151 } 146 }
152 - if (!TextUtils.isEmpty(fileUrl)){  
153 - jiecaoVideo.setUp(fileUrl, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, describe);  
154 - jiecaoVideo.startVideo();  
155 - }else {  
156 - isQidong=false; 147 + if (!TextUtils.isEmpty(fileUrl)) {
  148 + myVideoView.setVideoPath(fileUrl);
  149 + myVideoView.start();
  150 + myVideoView.requestFocus();
  151 + } else {
  152 + isQidong = false;
157 startNewActivity(StartActivity.class); 153 startNewActivity(StartActivity.class);
158 // showVideos(); 154 // showVideos();
159 // showBanners(); 155 // showBanners();
@@ -166,13 +162,14 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -166,13 +162,14 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
166 } 162 }
167 showBanners(); 163 showBanners();
168 } 164 }
169 - 165 + countDownTimer.start();
170 } catch (Exception e) { 166 } catch (Exception e) {
171 e.printStackTrace(); 167 e.printStackTrace();
  168 + countDownTimer.start();
172 } 169 }
173 } 170 }
174 171
175 - private void showBanners(){ 172 + private void showBanners() {
176 xBanner.setData(imgUrl, describeList); 173 xBanner.setData(imgUrl, describeList);
177 xBanner.stopAutoPlay(); 174 xBanner.stopAutoPlay();
178 xBanner.setmAutoPalyTime(10000); 175 xBanner.setmAutoPalyTime(10000);
@@ -188,6 +185,6 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult @@ -188,6 +185,6 @@ public class StartFragment extends BaseMVPCompatFragment&lt;ConsultContract.Consult
188 @Override 185 @Override
189 public void onDestroy() { 186 public void onDestroy() {
190 super.onDestroy(); 187 super.onDestroy();
191 - if (null!=countDownTimer)countDownTimer.cancel(); 188 + if (null != countDownTimer) countDownTimer.cancel();
192 } 189 }
193 } 190 }
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
@@ -6,6 +6,7 @@ import android.support.annotation.Nullable; @@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
6 import android.support.v7.widget.LinearLayoutManager; 6 import android.support.v7.widget.LinearLayoutManager;
7 import android.support.v7.widget.RecyclerView; 7 import android.support.v7.widget.RecyclerView;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
  9 +import android.util.Log;
9 import android.view.LayoutInflater; 10 import android.view.LayoutInflater;
10 import android.view.View; 11 import android.view.View;
11 import android.view.ViewGroup; 12 import android.view.ViewGroup;
@@ -130,7 +131,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -130,7 +131,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
130 } 131 }
131 132
132 private void initRecyclerView(List<GuangGaoBean> guangGaoBeanList) { 133 private void initRecyclerView(List<GuangGaoBean> guangGaoBeanList) {
133 -  
134 if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); 134 if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter();
135 myGrallyAdapter.addAll(guangGaoBeanList); 135 myGrallyAdapter.addAll(guangGaoBeanList);
136 recyclerViewGrally.setAdapter(myGrallyAdapter); 136 recyclerViewGrally.setAdapter(myGrallyAdapter);
@@ -150,7 +150,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -150,7 +150,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
150 150
151 @Override 151 @Override
152 public void showConsultContent(List<ChannelContextBean> list) { 152 public void showConsultContent(List<ChannelContextBean> list) {
153 -// Log.d("66666", "ChannelContextBean=" + list);  
154 if (null != list) { 153 if (null != list) {
155 myConsultBeanList.addAll(list); 154 myConsultBeanList.addAll(list);
156 if (myConsultAdapter == null) { 155 if (myConsultAdapter == null) {
@@ -216,8 +215,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon @@ -216,8 +215,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment&lt;ConsultOneCon
216 tv_grally_title = itemView.findViewById(R.id.tv_grally_title); 215 tv_grally_title = itemView.findViewById(R.id.tv_grally_title);
217 frame_root = itemView.findViewById(R.id.frame_root); 216 frame_root = itemView.findViewById(R.id.frame_root);
218 FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1, -1); 217 FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1, -1);
219 -// params.width = DisplayUtils.getScreenWidthPixels(getActivity()) - 100;  
220 -// params.setMargins(10, 0, 10, 0); 218 + params.width = DisplayUtils.getScreenWidthPixels(getActivity()) - 100;
  219 + params.setMargins(10, 0, 10, 0);
221 frame_root.setLayoutParams(params); 220 frame_root.setLayoutParams(params);
222 } 221 }
223 222
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ChengZhangFragment.java
@@ -166,7 +166,7 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep @@ -166,7 +166,7 @@ public class ChengZhangFragment extends BaseMVPCompatFragment&lt;ReportContract.Rep
166 Handler handler = null; 166 Handler handler = null;
167 167
168 public void showShaixuan(Handler handler) { 168 public void showShaixuan(Handler handler) {
169 - mPresenter.getReports();  
170 this.handler = handler; 169 this.handler = handler;
  170 + mPresenter.getReports();
171 } 171 }
172 } 172 }
app/src/main/java/com/shunzhi/parent/util/SystemHelper.java
@@ -23,6 +23,7 @@ import android.net.NetworkInfo.State; @@ -23,6 +23,7 @@ import android.net.NetworkInfo.State;
23 import android.net.Uri; 23 import android.net.Uri;
24 import android.os.Build; 24 import android.os.Build;
25 import android.support.v4.app.ActivityCompat; 25 import android.support.v4.app.ActivityCompat;
  26 +import android.support.v4.content.FileProvider;
26 import android.telephony.TelephonyManager; 27 import android.telephony.TelephonyManager;
27 import android.util.DisplayMetrics; 28 import android.util.DisplayMetrics;
28 import android.view.Window; 29 import android.view.Window;
@@ -41,6 +42,7 @@ import timber.log.Timber; @@ -41,6 +42,7 @@ import timber.log.Timber;
41 42
42 /** 43 /**
43 * 获取系统信息的工具类 44 * 获取系统信息的工具类
  45 + *
44 * @author hjgang 46 * @author hjgang
45 */ 47 */
46 public class SystemHelper { 48 public class SystemHelper {
@@ -50,6 +52,7 @@ public class SystemHelper { @@ -50,6 +52,7 @@ public class SystemHelper {
50 /** 52 /**
51 * 创建本应用的桌面快捷方式<br/> 53 * 创建本应用的桌面快捷方式<br/>
52 * 注意:需要添加权限&lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/&gt; 54 * 注意:需要添加权限&lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/&gt;
  55 + *
53 * @param 56 * @param
54 */ 57 */
55 public static void createShortcut(Context context, Class<?> clazz) { 58 public static void createShortcut(Context context, Class<?> clazz) {
@@ -74,6 +77,7 @@ public class SystemHelper { @@ -74,6 +77,7 @@ public class SystemHelper {
74 77
75 /** 78 /**
76 * 字符串转换成date 79 * 字符串转换成date
  80 + *
77 * @param time 81 * @param time
78 * @return 82 * @return
79 */ 83 */
@@ -92,6 +96,7 @@ public class SystemHelper { @@ -92,6 +96,7 @@ public class SystemHelper {
92 96
93 /** 97 /**
94 * 将字符串转为 时间戳 98 * 将字符串转为 时间戳
  99 + *
95 * @param time 100 * @param time
96 * @return 101 * @return
97 */ 102 */
@@ -111,7 +116,7 @@ public class SystemHelper { @@ -111,7 +116,7 @@ public class SystemHelper {
111 /** 116 /**
112 * 将时间戳转为 字符串 117 * 将时间戳转为 字符串
113 * yyyy-MM-dd HH:mm 118 * yyyy-MM-dd HH:mm
114 - * */ 119 + */
115 public static String getTimeStr(String time) { 120 public static String getTimeStr(String time) {
116 121
117 String newtime = null; 122 String newtime = null;
@@ -125,7 +130,7 @@ public class SystemHelper { @@ -125,7 +130,7 @@ public class SystemHelper {
125 /** 130 /**
126 * 将时间戳转为 字符串 131 * 将时间戳转为 字符串
127 * yyyy-MM-dd 132 * yyyy-MM-dd
128 - * */ 133 + */
129 public static String getTimeStr3(String time) { 134 public static String getTimeStr3(String time) {
130 String newtime = null; 135 String newtime = null;
131 SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd"); 136 SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -177,11 +182,11 @@ public class SystemHelper { @@ -177,11 +182,11 @@ public class SystemHelper {
177 } 182 }
178 183
179 /** 184 /**
180 - * @author LuoB.  
181 * @param oldTime 较小的时间 185 * @param oldTime 较小的时间
182 * @param newTime 较大的时间 (如果为空 默认当前时间 ,表示和当前时间相比) 186 * @param newTime 较大的时间 (如果为空 默认当前时间 ,表示和当前时间相比)
183 * @return -1 :同一天. 0:昨天 . 1 :至少是前天. 187 * @return -1 :同一天. 0:昨天 . 1 :至少是前天.
184 * @throws ParseException 转换异常 188 * @throws ParseException 转换异常
  189 + * @author LuoB.
185 */ 190 */
186 public static int isYeaterday(Date oldTime, Date newTime) throws ParseException { 191 public static int isYeaterday(Date oldTime, Date newTime) throws ParseException {
187 if (newTime == null) { 192 if (newTime == null) {
@@ -204,6 +209,7 @@ public class SystemHelper { @@ -204,6 +209,7 @@ public class SystemHelper {
204 /** 209 /**
205 * 检查是否已经创建了桌面快捷方式<br/> 210 * 检查是否已经创建了桌面快捷方式<br/>
206 * 注意:需要添加权限&lt;uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/&gt; 211 * 注意:需要添加权限&lt;uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/&gt;
  212 + *
207 * @param context 213 * @param context
208 * @return 214 * @return
209 */ 215 */
@@ -336,6 +342,7 @@ public class SystemHelper { @@ -336,6 +342,7 @@ public class SystemHelper {
336 342
337 /** 343 /**
338 * 返回当前程序版本代码,如:1 344 * 返回当前程序版本代码,如:1
  345 + *
339 * @param context 346 * @param context
340 * @return 当前程序版本代码 347 * @return 当前程序版本代码
341 */ 348 */
@@ -347,7 +354,7 @@ public class SystemHelper { @@ -347,7 +354,7 @@ public class SystemHelper {
347 versionCode = pi.versionCode; 354 versionCode = pi.versionCode;
348 355
349 } catch (Exception e) { 356 } catch (Exception e) {
350 - Timber.d("66666%s" ,e.toString()+ ""); 357 + Timber.d("66666%s", e.toString() + "");
351 } 358 }
352 return versionCode; 359 return versionCode;
353 } 360 }
@@ -375,13 +382,20 @@ public class SystemHelper { @@ -375,13 +382,20 @@ public class SystemHelper {
375 * 安装指定的APK文件,主要用于本应用程序的更新 382 * 安装指定的APK文件,主要用于本应用程序的更新
376 * 383 *
377 * @param context 384 * @param context
378 - * @param apk  
379 - * apk文件的全路径名 385 + * @param apk apk文件的全路径名
380 */ 386 */
381 public static void installAPK(Context context, String apk) { 387 public static void installAPK(Context context, String apk) {
382 Intent intent = new Intent(Intent.ACTION_VIEW); 388 Intent intent = new Intent(Intent.ACTION_VIEW);
383 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 389 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
384 - intent.setDataAndType(Uri.fromFile(new File(apk)), "application/vnd.android.package-archive"); 390 + Uri data;
  391 +
  392 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
  393 + data = FileProvider.getUriForFile(context, "com.shunzhi.parent.fileprovider", new File(apk));
  394 +// 给目标应用一个临时授权
  395 + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  396 + } else data = Uri.fromFile(new File(apk));
  397 +
  398 + intent.setDataAndType(data, "application/vnd.android.package-archive");
385 context.startActivity(intent); 399 context.startActivity(intent);
386 android.os.Process.killProcess(android.os.Process.myPid()); 400 android.os.Process.killProcess(android.os.Process.myPid());
387 } 401 }
app/src/main/res/layout/fragment_cheng_zhang.xml
@@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/white" 5 android:background="@color/white"
6 - android:padding="@dimen/size_dp_10"  
7 tools:context="com.shunzhi.parent.ui.fragment.report.ChengZhangFragment"> 6 tools:context="com.shunzhi.parent.ui.fragment.report.ChengZhangFragment">
8 7
9 <include layout="@layout/layout_chengzhang"/> 8 <include layout="@layout/layout_chengzhang"/>
10 9
11 <LinearLayout 10 <LinearLayout
  11 + android:layout_margin="@dimen/size_dp_10"
12 android:id="@+id/layout_report" 12 android:id="@+id/layout_report"
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 android:layout_height="match_parent" 14 android:layout_height="match_parent"
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 android:layout_width="match_parent" 49 android:layout_width="match_parent"
50 android:layout_height="match_parent" 50 android:layout_height="match_parent"
51 android:background="@color/bgColor" 51 android:background="@color/bgColor"
52 - android:padding="@dimen/size_dp_10"> 52 + >
53 53
54 </android.support.v7.widget.RecyclerView> 54 </android.support.v7.widget.RecyclerView>
55 55
app/src/main/res/layout/fragment_consult_one_level.xml
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 android:id="@+id/recyclerViewGrally" 10 android:id="@+id/recyclerViewGrally"
11 android:layout_width="match_parent" 11 android:layout_width="match_parent"
12 android:layout_height="180dp" 12 android:layout_height="180dp"
  13 + android:background="@color/bgColor"
13 ></android.support.v7.widget.RecyclerView> 14 ></android.support.v7.widget.RecyclerView>
14 15
15 <include layout="@layout/layout_textandimgshow"/> 16 <include layout="@layout/layout_textandimgshow"/>
app/src/main/res/layout/fragment_report.xml
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 android:layout_width="match_parent" 69 android:layout_width="match_parent"
70 android:layout_height="match_parent" 70 android:layout_height="match_parent"
71 android:background="@color/white" 71 android:background="@color/white"
72 - android:visibility="gone" 72 + android:visibility="visible"
73 73
74 > 74 >
75 75
app/src/main/res/layout/fragment_start.xml
1 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:app="http://schemas.android.com/apk/res-auto"
2 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 4 android:layout_width="match_parent"
4 android:layout_height="match_parent" 5 android:layout_height="match_parent"
5 android:background="@color/bgColor" 6 android:background="@color/bgColor"
6 - xmlns:app="http://schemas.android.com/apk/res-auto"  
7 tools:context="com.shunzhi.parent.ui.fragment.StartFragment"> 7 tools:context="com.shunzhi.parent.ui.fragment.StartFragment">
8 8
9 - <com.stx.xhb.xbanner.XBanner 9 + <LinearLayout
10 android:layout_width="match_parent" 10 android:layout_width="match_parent"
11 android:layout_height="match_parent" 11 android:layout_height="match_parent"
12 - android:id="@+id/xBanner"  
13 - ></com.stx.xhb.xbanner.XBanner> 12 + android:orientation="vertical">
14 13
15 - <cn.jzvd.JZVideoPlayerStandard  
16 - android:id="@+id/jiecaoVideo"  
17 - android:visibility="gone"  
18 - android:layout_width="match_parent"  
19 - android:layout_height="match_parent"></cn.jzvd.JZVideoPlayerStandard> 14 + <com.stx.xhb.xbanner.XBanner
  15 + android:id="@+id/xBanner"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="match_parent"></com.stx.xhb.xbanner.XBanner>
  18 +
  19 + <com.share.mvpsdk.view.MyVieoView
  20 + android:id="@+id/myVideoView"
  21 + android:layout_width="match_parent"
  22 + android:layout_height="match_parent"
  23 + android:visibility="visible" />
  24 + </LinearLayout>
20 25
21 <TextView 26 <TextView
22 android:id="@+id/tvJump" 27 android:id="@+id/tvJump"
23 android:layout_width="@dimen/size_dp_50" 28 android:layout_width="@dimen/size_dp_50"
24 android:layout_height="@dimen/size_dp_50" 29 android:layout_height="@dimen/size_dp_50"
25 - android:text="跳过"  
26 - android:gravity="center"  
27 - android:textColor="@color/white"  
28 - android:textSize="@dimen/size_dp_12"  
29 android:layout_gravity="right" 30 android:layout_gravity="right"
30 android:layout_margin="@dimen/size_dp_10" 31 android:layout_margin="@dimen/size_dp_10"
31 android:background="@drawable/shape_xueqing_radius25" 32 android:background="@drawable/shape_xueqing_radius25"
32 - /> 33 + android:gravity="center"
  34 + android:text="跳过"
  35 + android:textColor="@color/white"
  36 + android:textSize="@dimen/size_dp_12" />
33 </FrameLayout> 37 </FrameLayout>
app/src/main/res/layout/item_grally.xml
@@ -2,9 +2,8 @@ @@ -2,9 +2,8 @@
2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="wrap_content" 3 android:layout_width="wrap_content"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 - android:layout_margin="@dimen/size_dp_10"  
6 android:id="@+id/frame_root" 5 android:id="@+id/frame_root"
7 - android:background="@color/txt_black"> 6 + android:background="@color/white">
8 7
9 8
10 <ImageView 9 <ImageView
@@ -22,8 +21,8 @@ @@ -22,8 +21,8 @@
22 android:paddingBottom="@dimen/size_dp_3" 21 android:paddingBottom="@dimen/size_dp_3"
23 android:paddingLeft="@dimen/size_dp_10" 22 android:paddingLeft="@dimen/size_dp_10"
24 android:paddingTop="@dimen/size_dp_3" 23 android:paddingTop="@dimen/size_dp_3"
25 - android:text="撒飞洒发发"  
26 - android:textColor="@color/white" 24 + android:text=""
  25 + android:textColor="@color/textColor"
27 android:textSize="@dimen/textSize16" /> 26 android:textSize="@dimen/textSize16" />
28 27
29 </FrameLayout> 28 </FrameLayout>
30 \ No newline at end of file 29 \ No newline at end of file
app/src/main/res/layout/item_report_deyu.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 - android:layout_height="wrap_content"> 4 + android:layout_height="wrap_content"
  5 + android:background="@color/bgColor">
5 6
6 <LinearLayout 7 <LinearLayout
7 android:layout_width="match_parent" 8 android:layout_width="match_parent"
app/src/main/res/layout/layout_chengzhang.xml
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 android:layout_width="match_parent" 4 android:layout_width="match_parent"
5 android:layout_height="match_parent" 5 android:layout_height="match_parent"
6 android:background="@color/white" 6 android:background="@color/white"
  7 + android:layout_margin="@dimen/size_dp_10"
7 android:orientation="vertical"> 8 android:orientation="vertical">
8 9
9 <TextView 10 <TextView
@@ -20,8 +21,8 @@ @@ -20,8 +21,8 @@
20 android:id="@+id/layout_kaoqin" 21 android:id="@+id/layout_kaoqin"
21 android:layout_width="match_parent" 22 android:layout_width="match_parent"
22 android:layout_height="?android:actionBarSize" 23 android:layout_height="?android:actionBarSize"
23 - android:layout_marginLeft="@dimen/size_dp_15"  
24 - android:layout_marginRight="@dimen/size_dp_15" 24 + android:layout_marginLeft="@dimen/size_dp_10"
  25 + android:layout_marginRight="@dimen/size_dp_10"
25 android:layout_marginTop="@dimen/size_dp_10" 26 android:layout_marginTop="@dimen/size_dp_10"
26 android:background="@drawable/shape_corner_bg" 27 android:background="@drawable/shape_corner_bg"
27 android:orientation="horizontal"> 28 android:orientation="horizontal">
@@ -50,8 +51,8 @@ @@ -50,8 +51,8 @@
50 android:id="@+id/layout_buka" 51 android:id="@+id/layout_buka"
51 android:layout_width="match_parent" 52 android:layout_width="match_parent"
52 android:layout_height="?android:actionBarSize" 53 android:layout_height="?android:actionBarSize"
53 - android:layout_marginLeft="@dimen/size_dp_15"  
54 - android:layout_marginRight="@dimen/size_dp_15" 54 + android:layout_marginLeft="@dimen/size_dp_10"
  55 + android:layout_marginRight="@dimen/size_dp_10"
55 android:layout_marginTop="@dimen/size_dp_10" 56 android:layout_marginTop="@dimen/size_dp_10"
56 android:background="@drawable/shape_corner_bg" 57 android:background="@drawable/shape_corner_bg"
57 android:orientation="horizontal"> 58 android:orientation="horizontal">
@@ -79,8 +80,8 @@ @@ -79,8 +80,8 @@
79 android:id="@+id/layout_qingjia" 80 android:id="@+id/layout_qingjia"
80 android:layout_width="match_parent" 81 android:layout_width="match_parent"
81 android:layout_height="?android:actionBarSize" 82 android:layout_height="?android:actionBarSize"
82 - android:layout_marginLeft="@dimen/size_dp_15"  
83 - android:layout_marginRight="@dimen/size_dp_15" 83 + android:layout_marginLeft="@dimen/size_dp_10"
  84 + android:layout_marginRight="@dimen/size_dp_10"
84 android:layout_marginTop="@dimen/size_dp_10" 85 android:layout_marginTop="@dimen/size_dp_10"
85 android:background="@drawable/shape_corner_bg" 86 android:background="@drawable/shape_corner_bg"
86 android:orientation="horizontal"> 87 android:orientation="horizontal">
app/src/main/res/values/strings.xml
@@ -5,6 +5,6 @@ @@ -5,6 +5,6 @@
5 <string name="hello_blank_fragment">Hello blank fragment</string> 5 <string name="hello_blank_fragment">Hello blank fragment</string>
6 6
7 <string name="ceping">慧测慧练</string> 7 <string name="ceping">慧测慧练</string>
8 - <string name="consult_huati">咨询话题</string> 8 + <string name="consult_huati">热门资讯</string>
9 <string name="order_detail">订单详情</string> 9 <string name="order_detail">订单详情</string>
10 </resources> 10 </resources>
app/src/main/res/xml/filepaths.xml 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<path>
  3 + <external-path path="download/" name="files_path"/>
  4 +</path>
0 \ No newline at end of file 5 \ No newline at end of file
mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java 0 → 100644
@@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
  1 +package com.share.mvpsdk.view;
  2 +
  3 +import android.content.Context;
  4 +import android.media.MediaMetadataRetriever;
  5 +import android.media.MediaPlayer;
  6 +import android.net.Uri;
  7 +import android.text.TextUtils;
  8 +import android.util.AttributeSet;
  9 +import android.util.Log;
  10 +import android.widget.MediaController;
  11 +import android.widget.VideoView;
  12 +
  13 +/**
  14 + * Created by ToaHanDong on 2018/4/10.
  15 + */
  16 +
  17 +public class MyVieoView extends VideoView {
  18 +
  19 + private Context mContext = null;
  20 +
  21 + //最终的视频资源宽度
  22 + private int mVideoWidth = 480;
  23 +
  24 + //最终视频资源高度
  25 + private int mVideoHeight = 480;
  26 +
  27 + //视频资源原始宽度
  28 + private int videoRealW = 1;
  29 +
  30 + //视频资源原始高度
  31 + private int videoRealH = 1;
  32 +
  33 + private String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
  34 +
  35 + public MyVieoView(Context context) {
  36 + super(context);
  37 + mContext = context;
  38 + }
  39 +
  40 + public MyVieoView(Context context, AttributeSet attrs) {
  41 + super(context, attrs);
  42 + mContext = context;
  43 + }
  44 +
  45 + public MyVieoView(Context context, AttributeSet attrs, int defStyleAttr) {
  46 + super(context, attrs, defStyleAttr);
  47 + mContext = context;
  48 + }
  49 +
  50 + public void setVideoPath(String urlPath) {
  51 +
  52 +// if (TextUtils.isEmpty(urlPath)) urlPath = url;
  53 + setVideoURI(Uri.parse(urlPath));
  54 + //创建视频播放时的控制器,这个控制器可以自定义。此处是默认的实现
  55 + setMediaController(null);
  56 + //请求焦点
  57 + requestFocus();
  58 + //设置播放监听
  59 + setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
  60 + @Override
  61 + public void onPrepared(MediaPlayer mediaPlayer) {
  62 + // optional need Vitamio 4.0
  63 + //设置重放速度
  64 +// mediaPlayer.setPlaybackSpeed(1.0f);
  65 + }
  66 + });
  67 + //加载结束后开始播放,这行代码可以控制视频的播放。
  68 + start();
  69 +
  70 + }
  71 +
  72 +
  73 + @Override
  74 + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  75 + int width = getDefaultSize(0, widthMeasureSpec);
  76 + int height = getDefaultSize(0, heightMeasureSpec);
  77 + if (height > width) {
  78 + //竖屏
  79 + if (videoRealH > videoRealW) {
  80 + //如果视频资源是竖屏
  81 + //占满屏幕
  82 + mVideoHeight = height;
  83 + mVideoWidth = width;
  84 + } else {
  85 + //如果视频资源是横屏
  86 + //宽度占满,高度保存比例
  87 + mVideoWidth = width;
  88 + float r = videoRealH / (float) videoRealW;
  89 +// mVideoHeight = (int) (mVideoWidth * r);
  90 + mVideoHeight=height;
  91 + }
  92 + } else {
  93 + //横屏
  94 + if (videoRealH > videoRealW) {
  95 + //如果视频资源是竖屏
  96 + //宽度占满,高度保存比例
  97 + mVideoHeight = height;
  98 + float r = videoRealW / (float) videoRealH;
  99 + mVideoWidth = (int) (mVideoHeight * r);
  100 + } else {
  101 + //如果视频资源是横屏
  102 + //占满屏幕
  103 + mVideoHeight = height;
  104 + mVideoWidth = width;
  105 + }
  106 + }
  107 + setMeasuredDimension(mVideoWidth, mVideoHeight);
  108 +// if (videoRealH == videoRealW && videoRealH == 1) {
  109 +// //没能获取到视频真实的宽高,自适应就可以了,什么也不用做
  110 +// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  111 +// } else {
  112 +// setMeasuredDimension(mVideoWidth, mVideoHeight);
  113 +// }
  114 + }
  115 +}