From 0cbb05545786a34eb8698732e66672f593da352d Mon Sep 17 00:00:00 2001
From: 陶汉栋 <2821744554@qq.com>
Date: Tue, 10 Apr 2018 17:24:33 +0800
Subject: [PATCH] no message
---
app/build.gradle | 4 ++--
app/src/main/AndroidManifest.xml | 11 +++++++++++
app/src/main/java/com/shunzhi/parent/AppConfig.java | 12 ++++++------
app/src/main/java/com/shunzhi/parent/manager/UpdateManager.java | 2 +-
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java | 5 ++++-
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java | 2 +-
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java | 57 +++++++++++++++++++++++++++------------------------------
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java | 7 +++----
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ChengZhangFragment.java | 2 +-
app/src/main/java/com/shunzhi/parent/util/SystemHelper.java | 28 +++++++++++++++++++++-------
app/src/main/res/layout/fragment_cheng_zhang.xml | 4 ++--
app/src/main/res/layout/fragment_consult_one_level.xml | 1 +
app/src/main/res/layout/fragment_report.xml | 2 +-
app/src/main/res/layout/fragment_start.xml | 32 ++++++++++++++++++--------------
app/src/main/res/layout/item_grally.xml | 7 +++----
app/src/main/res/layout/item_report_deyu.xml | 3 ++-
app/src/main/res/layout/layout_chengzhang.xml | 13 +++++++------
app/src/main/res/values/strings.xml | 2 +-
app/src/main/res/xml/filepaths.xml | 4 ++++
mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 files changed, 231 insertions(+), 82 deletions(-)
create mode 100644 app/src/main/res/xml/filepaths.xml
create mode 100644 mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java
diff --git a/app/build.gradle b/app/build.gradle
index 247614b..4a5efcf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,8 +16,8 @@ android {
applicationId "com.shunzhi.parent"
minSdkVersion 16
targetSdkVersion 26
- versionCode 1
- versionName "1.0"
+ versionCode 102
+ versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9ee7b74..d50dfc0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -117,6 +117,17 @@
android:name="com.amap.api.v2.apikey"
android:value="1d130afb822d8a1019e6592cbaf10bcc" />
+
+
+
+
+
versionCode) && ischeckingForUpdate && !isChechingInterrupted) {
showNoticeDialog(currentVersion, version.content, isChechingInterrupted);
- } else if (!(serviceCode > versionCode) && shouldInterruptDialogShow && !isChechingInterrupted) {
+ } else if (!(serviceCode > versionCode) && !isChechingInterrupted) {
Toast.makeText(mContext, "已经是最新版本啦!", Toast.LENGTH_SHORT).show();
mContext = null;
}
diff --git a/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java b/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
index f97756f..264d4dc 100644
--- a/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
+++ b/app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -41,6 +41,7 @@ import java.util.List;
import cn.jzvd.JZVideoPlayerStandard;
import me.leefeng.citypicker.CityPicker;
import me.leefeng.citypicker.CityPickerListener;
+import timber.log.Timber;
public class ConsultFragment extends BaseMVPCompatFragment implements View.OnClickListener
, ConsultContract.IConsultView, CityPickerListener {
@@ -54,6 +55,7 @@ public class ConsultFragment extends BaseMVPCompatFragment imgesUrl = new ArrayList<>();
+ List imgWebUrl=new ArrayList<>();//跳转的连接
List describeList = new ArrayList<>();
List guanggaoList = new ArrayList<>();
List contextList = new ArrayList<>();
@@ -148,7 +150,7 @@ public class ConsultFragment extends BaseMVPCompatFragment
implements ConsultContract.IConsultView {
@@ -38,13 +41,15 @@ public class StartFragment extends BaseMVPCompatFragment list) {
}
- List imgUrl = new ArrayList<>();
+
+ List imgUrl = new ArrayList<>();
List describeList = new ArrayList<>();
+
private void initBannes(List guangGaoBeanList) {
try {
imgUrl = new ArrayList<>();
describeList = new ArrayList<>();
+// Timber.d("66666%s","guangGaoBeanList="+guangGaoBeanList);
if (isQidong) {
AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1");
String fileUrl = "", describe = "";
@@ -144,16 +139,17 @@ public class StartFragment extends BaseMVPCompatFragment guangGaoBeanList) {
-
if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter();
myGrallyAdapter.addAll(guangGaoBeanList);
recyclerViewGrally.setAdapter(myGrallyAdapter);
@@ -150,7 +150,6 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment list) {
-// Log.d("66666", "ChannelContextBean=" + list);
if (null != list) {
myConsultBeanList.addAll(list);
if (myConsultAdapter == null) {
@@ -216,8 +215,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment
* 注意:需要添加权限<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
+ *
* @param
*/
public static void createShortcut(Context context, Class> clazz) {
@@ -74,6 +77,7 @@ public class SystemHelper {
/**
* 字符串转换成date
+ *
* @param time
* @return
*/
@@ -92,6 +96,7 @@ public class SystemHelper {
/**
* 将字符串转为 时间戳
+ *
* @param time
* @return
*/
@@ -111,7 +116,7 @@ public class SystemHelper {
/**
* 将时间戳转为 字符串
* yyyy-MM-dd HH:mm
- * */
+ */
public static String getTimeStr(String time) {
String newtime = null;
@@ -125,7 +130,7 @@ public class SystemHelper {
/**
* 将时间戳转为 字符串
* yyyy-MM-dd
- * */
+ */
public static String getTimeStr3(String time) {
String newtime = null;
SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -177,11 +182,11 @@ public class SystemHelper {
}
/**
- * @author LuoB.
* @param oldTime 较小的时间
* @param newTime 较大的时间 (如果为空 默认当前时间 ,表示和当前时间相比)
* @return -1 :同一天. 0:昨天 . 1 :至少是前天.
* @throws ParseException 转换异常
+ * @author LuoB.
*/
public static int isYeaterday(Date oldTime, Date newTime) throws ParseException {
if (newTime == null) {
@@ -204,6 +209,7 @@ public class SystemHelper {
/**
* 检查是否已经创建了桌面快捷方式
* 注意:需要添加权限<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/>
+ *
* @param context
* @return
*/
@@ -336,6 +342,7 @@ public class SystemHelper {
/**
* 返回当前程序版本代码,如:1
+ *
* @param context
* @return 当前程序版本代码
*/
@@ -347,7 +354,7 @@ public class SystemHelper {
versionCode = pi.versionCode;
} catch (Exception e) {
- Timber.d("66666%s" ,e.toString()+ "");
+ Timber.d("66666%s", e.toString() + "");
}
return versionCode;
}
@@ -375,13 +382,20 @@ public class SystemHelper {
* 安装指定的APK文件,主要用于本应用程序的更新
*
* @param context
- * @param apk
- * apk文件的全路径名
+ * @param apk apk文件的全路径名
*/
public static void installAPK(Context context, String apk) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.setDataAndType(Uri.fromFile(new File(apk)), "application/vnd.android.package-archive");
+ Uri data;
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ data = FileProvider.getUriForFile(context, "com.shunzhi.parent.fileprovider", new File(apk));
+// 给目标应用一个临时授权
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ } else data = Uri.fromFile(new File(apk));
+
+ intent.setDataAndType(data, "application/vnd.android.package-archive");
context.startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
}
diff --git a/app/src/main/res/layout/fragment_cheng_zhang.xml b/app/src/main/res/layout/fragment_cheng_zhang.xml
index 8beca5b..3636389 100644
--- a/app/src/main/res/layout/fragment_cheng_zhang.xml
+++ b/app/src/main/res/layout/fragment_cheng_zhang.xml
@@ -3,12 +3,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
- android:padding="@dimen/size_dp_10"
tools:context="com.shunzhi.parent.ui.fragment.report.ChengZhangFragment">
+ >
diff --git a/app/src/main/res/layout/fragment_consult_one_level.xml b/app/src/main/res/layout/fragment_consult_one_level.xml
index 86772ae..e27a65e 100644
--- a/app/src/main/res/layout/fragment_consult_one_level.xml
+++ b/app/src/main/res/layout/fragment_consult_one_level.xml
@@ -10,6 +10,7 @@
android:id="@+id/recyclerViewGrally"
android:layout_width="match_parent"
android:layout_height="180dp"
+ android:background="@color/bgColor"
>
diff --git a/app/src/main/res/layout/fragment_report.xml b/app/src/main/res/layout/fragment_report.xml
index aed0799..ea22c27 100644
--- a/app/src/main/res/layout/fragment_report.xml
+++ b/app/src/main/res/layout/fragment_report.xml
@@ -69,7 +69,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
- android:visibility="gone"
+ android:visibility="visible"
>
diff --git a/app/src/main/res/layout/fragment_start.xml b/app/src/main/res/layout/fragment_start.xml
index 735040c..37f66d2 100644
--- a/app/src/main/res/layout/fragment_start.xml
+++ b/app/src/main/res/layout/fragment_start.xml
@@ -1,33 +1,37 @@
-
+ android:orientation="vertical">
-
+
+
+
+
+ android:gravity="center"
+ android:text="跳过"
+ android:textColor="@color/white"
+ android:textSize="@dimen/size_dp_12" />
diff --git a/app/src/main/res/layout/item_grally.xml b/app/src/main/res/layout/item_grally.xml
index 7b4bc53..8fc4f02 100644
--- a/app/src/main/res/layout/item_grally.xml
+++ b/app/src/main/res/layout/item_grally.xml
@@ -2,9 +2,8 @@
+ android:background="@color/white">
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_report_deyu.xml b/app/src/main/res/layout/item_report_deyu.xml
index 9c53772..2ef866d 100644
--- a/app/src/main/res/layout/item_report_deyu.xml
+++ b/app/src/main/res/layout/item_report_deyu.xml
@@ -1,7 +1,8 @@
+ android:layout_height="wrap_content"
+ android:background="@color/bgColor">
@@ -50,8 +51,8 @@
android:id="@+id/layout_buka"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
- android:layout_marginLeft="@dimen/size_dp_15"
- android:layout_marginRight="@dimen/size_dp_15"
+ android:layout_marginLeft="@dimen/size_dp_10"
+ android:layout_marginRight="@dimen/size_dp_10"
android:layout_marginTop="@dimen/size_dp_10"
android:background="@drawable/shape_corner_bg"
android:orientation="horizontal">
@@ -79,8 +80,8 @@
android:id="@+id/layout_qingjia"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
- android:layout_marginLeft="@dimen/size_dp_15"
- android:layout_marginRight="@dimen/size_dp_15"
+ android:layout_marginLeft="@dimen/size_dp_10"
+ android:layout_marginRight="@dimen/size_dp_10"
android:layout_marginTop="@dimen/size_dp_10"
android:background="@drawable/shape_corner_bg"
android:orientation="horizontal">
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 50f49aa..0e6b462 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,6 +5,6 @@
Hello blank fragment
慧测慧练
- 咨询话题
+ 热门资讯
订单详情
diff --git a/app/src/main/res/xml/filepaths.xml b/app/src/main/res/xml/filepaths.xml
new file mode 100644
index 0000000..d2aa924
--- /dev/null
+++ b/app/src/main/res/xml/filepaths.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java b/mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java
new file mode 100644
index 0000000..90bf6b2
--- /dev/null
+++ b/mvpsdk/src/main/java/com/share/mvpsdk/view/MyVieoView.java
@@ -0,0 +1,115 @@
+package com.share.mvpsdk.view;
+
+import android.content.Context;
+import android.media.MediaMetadataRetriever;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.MediaController;
+import android.widget.VideoView;
+
+/**
+ * Created by ToaHanDong on 2018/4/10.
+ */
+
+public class MyVieoView extends VideoView {
+
+ private Context mContext = null;
+
+ //最终的视频资源宽度
+ private int mVideoWidth = 480;
+
+ //最终视频资源高度
+ private int mVideoHeight = 480;
+
+ //视频资源原始宽度
+ private int videoRealW = 1;
+
+ //视频资源原始高度
+ private int videoRealH = 1;
+
+ private String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
+
+ public MyVieoView(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ public MyVieoView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ }
+
+ public MyVieoView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ mContext = context;
+ }
+
+ public void setVideoPath(String urlPath) {
+
+// if (TextUtils.isEmpty(urlPath)) urlPath = url;
+ setVideoURI(Uri.parse(urlPath));
+ //创建视频播放时的控制器,这个控制器可以自定义。此处是默认的实现
+ setMediaController(null);
+ //请求焦点
+ requestFocus();
+ //设置播放监听
+ setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+ @Override
+ public void onPrepared(MediaPlayer mediaPlayer) {
+ // optional need Vitamio 4.0
+ //设置重放速度
+// mediaPlayer.setPlaybackSpeed(1.0f);
+ }
+ });
+ //加载结束后开始播放,这行代码可以控制视频的播放。
+ start();
+
+ }
+
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int width = getDefaultSize(0, widthMeasureSpec);
+ int height = getDefaultSize(0, heightMeasureSpec);
+ if (height > width) {
+ //竖屏
+ if (videoRealH > videoRealW) {
+ //如果视频资源是竖屏
+ //占满屏幕
+ mVideoHeight = height;
+ mVideoWidth = width;
+ } else {
+ //如果视频资源是横屏
+ //宽度占满,高度保存比例
+ mVideoWidth = width;
+ float r = videoRealH / (float) videoRealW;
+// mVideoHeight = (int) (mVideoWidth * r);
+ mVideoHeight=height;
+ }
+ } else {
+ //横屏
+ if (videoRealH > videoRealW) {
+ //如果视频资源是竖屏
+ //宽度占满,高度保存比例
+ mVideoHeight = height;
+ float r = videoRealW / (float) videoRealH;
+ mVideoWidth = (int) (mVideoHeight * r);
+ } else {
+ //如果视频资源是横屏
+ //占满屏幕
+ mVideoHeight = height;
+ mVideoWidth = width;
+ }
+ }
+ setMeasuredDimension(mVideoWidth, mVideoHeight);
+// if (videoRealH == videoRealW && videoRealH == 1) {
+// //没能获取到视频真实的宽高,自适应就可以了,什么也不用做
+// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+// } else {
+// setMeasuredDimension(mVideoWidth, mVideoHeight);
+// }
+ }
+}
--
libgit2 0.21.0