From 1ca679e0724c8471b087524ff747707fe7f96387 Mon Sep 17 00:00:00 2001 From: 陶汉栋 <2821744554@qq.com> Date: Tue, 13 Mar 2018 08:08:35 +0800 Subject: [PATCH] no message --- .gitignore | 1 + app/build.gradle | 11 ++++++++++- app/libs/AMap_Location_V3.8.0_20180201.jar | Bin 0 -> 346622 bytes app/parent.jks | Bin 0 -> 2059 bytes app/release/output.json | 1 + app/src/main/AndroidManifest.xml | 46 +++++++++++++++++++++++++++++++++------------- app/src/main/java/com/shunzhi/parent/AppContext.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- app/src/main/java/com/shunzhi/parent/bean/GrallyBean.java | 29 +++++++++++++++++++++++++++++ app/src/main/java/com/shunzhi/parent/ui/MainActivity.java | 18 ++++++++++++++---- app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java | 23 ++++++++++++++++++----- app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/drawable-xhdpi/back.png | Bin 0 -> 469 bytes app/src/main/res/drawable-xhdpi/gbxx.png | Bin 0 -> 4976 bytes app/src/main/res/drawable-xhdpi/guanlianchild.png | Bin 0 -> 7247 bytes app/src/main/res/drawable-xhdpi/shaixuan.png | Bin 0 -> 395 bytes app/src/main/res/drawable-xhdpi/xxk.png | Bin 0 -> 4391 bytes app/src/main/res/drawable-xhdpi/zczx.png | Bin 0 -> 5597 bytes app/src/main/res/drawable-xhdpi/zhuanti.png | Bin 0 -> 2953 bytes app/src/main/res/layout/activity_consult_one_level.xml | 20 ++++++++++++++++++++ app/src/main/res/layout/fragment_ce_ping.xml | 436 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- app/src/main/res/layout/fragment_consult_one_level.xml | 30 ++++++++++++++++++++++++++++++ app/src/main/res/layout/fragment_report.xml | 44 ++++++++++++++++++++++++++++++++++++++------ app/src/main/res/layout/fragment_zi_xun.xml | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------- app/src/main/res/layout/item_grally.xml | 28 ++++++++++++++++++++++++++++ app/src/main/res/layout/layout_search.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/layout/layout_textandimgshow.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ build.gradle | 1 + mvpsdk/build.gradle | 3 +++ mvpsdk/src/main/java/com/share/mvpsdk/base/activity/BaseCompatActivity.java | 1 + mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java | 1 - mvpsdk/src/main/java/com/share/mvpsdk/utils/StatusBarUtils.java | 5 +++-- mvpsdk/src/main/res/values/colors.xml | 1 + 35 files changed, 1100 insertions(+), 437 deletions(-) create mode 100644 app/libs/AMap_Location_V3.8.0_20180201.jar create mode 100644 app/parent.jks create mode 100644 app/release/output.json create mode 100644 app/src/main/java/com/shunzhi/parent/bean/GrallyBean.java create mode 100644 app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java create mode 100644 app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java create mode 100644 app/src/main/res/drawable-xhdpi/back.png create mode 100644 app/src/main/res/drawable-xhdpi/gbxx.png create mode 100644 app/src/main/res/drawable-xhdpi/guanlianchild.png create mode 100644 app/src/main/res/drawable-xhdpi/shaixuan.png create mode 100644 app/src/main/res/drawable-xhdpi/xxk.png create mode 100644 app/src/main/res/drawable-xhdpi/zczx.png create mode 100644 app/src/main/res/drawable-xhdpi/zhuanti.png create mode 100644 app/src/main/res/layout/activity_consult_one_level.xml create mode 100644 app/src/main/res/layout/fragment_consult_one_level.xml create mode 100644 app/src/main/res/layout/item_grally.xml create mode 100644 app/src/main/res/layout/layout_search.xml create mode 100644 app/src/main/res/layout/layout_textandimgshow.xml diff --git a/.gitignore b/.gitignore index 39fb081..1dac1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /build /captures .externalNativeBuild +app/release/app-release.apk diff --git a/app/build.gradle b/app/build.gradle index 6ac7633..57f6623 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,14 @@ apply plugin: 'com.android.application' android { + signingConfigs { + config { + keyAlias 'key0' + keyPassword '123456' + storeFile file('E:/parentwork/app/parent.jks') + storePassword '123456' + } + } compileSdkVersion 26 defaultConfig { applicationId "com.shunzhi.parent" @@ -14,6 +22,7 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.config } } } @@ -28,5 +37,5 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation project(':mvpsdk') implementation project(':roundedimageview-2.2.1') - + implementation files('libs/AMap_Location_V3.8.0_20180201.jar') } diff --git a/app/libs/AMap_Location_V3.8.0_20180201.jar b/app/libs/AMap_Location_V3.8.0_20180201.jar new file mode 100644 index 0000000..b1cbf59 Binary files /dev/null and b/app/libs/AMap_Location_V3.8.0_20180201.jar differ diff --git a/app/parent.jks b/app/parent.jks new file mode 100644 index 0000000..979681a Binary files /dev/null and b/app/parent.jks differ diff --git a/app/release/output.json b/app/release/output.json new file mode 100644 index 0000000..6f88d3b --- /dev/null +++ b/app/release/output.json @@ -0,0 +1 @@ +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.shunzhi.parent","split":"","minSdkVersion":"16"}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ade44f9..7ae60d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,17 +2,27 @@ + + + + - + + + + + + + @@ -31,10 +41,9 @@ - - - - + + + + + + + + + + + @@ -52,14 +71,15 @@ - - - - + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/shunzhi/parent/AppContext.java b/app/src/main/java/com/shunzhi/parent/AppContext.java index 84fc4c8..9fa58ee 100644 --- a/app/src/main/java/com/shunzhi/parent/AppContext.java +++ b/app/src/main/java/com/shunzhi/parent/AppContext.java @@ -1,6 +1,14 @@ package com.shunzhi.parent; +import android.content.Intent; +import android.util.Log; + +import com.amap.api.location.AMapLocation; +import com.amap.api.location.AMapLocationClient; +import com.amap.api.location.AMapLocationClientOption; +import com.amap.api.location.AMapLocationListener; import com.share.mvpsdk.global.GlobalApplication; +import com.amap.api.location.AMapLocationClientOption.AMapLocationMode; /** * Created by Administrator on 2018/3/7 0007. @@ -9,17 +17,108 @@ import com.share.mvpsdk.global.GlobalApplication; public class AppContext extends GlobalApplication { private static AppContext appContext; + public final static int LOCATION_CITYNAME=0x00; + + public String cityName=""; + + public static AppContext getInstance() { + return appContext; + } + + //声明AMapLocationClient类对象 + public AMapLocationClient mLocationClient = null; + + //声明AMapLocationClientOption对象 + public AMapLocationClientOption mLocationOption=null; @Override public void onCreate() { appContext=this; super.onCreate(); + //开启地图地位 + initMapLocal(); } - public static AppContext getInstance() { - return appContext; + private void initMapLocal() { + //初始化定位 + mLocationClient = new AMapLocationClient(getApplicationContext()); +//设置定位回调监听 + mLocationClient.setLocationListener(mLocationListener); + + //初始化AMapLocationClientOption对象 + mLocationOption = new AMapLocationClientOption(); + /** + * 设置定位场景,目前支持三种场景(签到、出行、运动,默认无场景) + */ + mLocationOption.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn); + //设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。 + mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy); + //设置定位模式为AMapLocationMode.Battery_Saving,低功耗模式。 +// mLocationOption.setLocationMode(AMapLocationMode.Battery_Saving); + //设置定位模式为AMapLocationMode.Device_Sensors,仅设备模式。 +// mLocationOption.setLocationMode(AMapLocationMode.Device_Sensors); + + //设置定位间隔,单位毫秒,默认为2000ms,最低1000ms。 + mLocationOption.setInterval(1000); + //设置是否允许模拟位置,默认为true,允许模拟位置 + mLocationOption.setMockEnable(true); + //单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。 + mLocationOption.setHttpTimeOut(20000); + //关闭缓存机制 + mLocationOption.setLocationCacheEnable(false); + if (null!=mLocationClient) + mLocationClient.setLocationOption(mLocationOption); + //启动定位 + startLocation(); + + } + + public void startLocation(){ + //启动定位 + if (null!=mLocationClient){ +// mLocationClient.setLocationOption(mLocationOption); + //设置场景模式后最好调用一次stop,再调用start以保证场景模式生效 + stopLocation(); + mLocationClient.startLocation(); + }else initMapLocal(); + } + + public void stopLocation(){ + if (null!=mLocationClient)mLocationClient.stopLocation(); + } + + public void destoryLocation(){ + if (null!=mLocationClient)mLocationClient.onDestroy(); } + //声明定位回调监听器 + public AMapLocationListener mLocationListener = new AMapLocationListener() { + @Override + public void onLocationChanged(AMapLocation aMapLocation) { + if(null!=aMapLocation){ + + if (aMapLocation.getErrorCode()==0){ + cityName=aMapLocation.getCity(); + Log.d("mlocation:","handler="+handler); + Intent intent=new Intent(); + intent.setAction(LOCATION_CITYNAME+""); + sendBroadcast(intent); + stopLocation(); + }else { + Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); + cityName="定位失败"; + } + + } + } + }; + @Override + public void onLowMemory() { + super.onLowMemory(); + //设置定位模式为AMapLocationMode.Battery_Saving,低功耗模式。 + mLocationOption.setLocationMode(AMapLocationMode.Battery_Saving); + + } } diff --git a/app/src/main/java/com/shunzhi/parent/bean/GrallyBean.java b/app/src/main/java/com/shunzhi/parent/bean/GrallyBean.java new file mode 100644 index 0000000..4067db4 --- /dev/null +++ b/app/src/main/java/com/shunzhi/parent/bean/GrallyBean.java @@ -0,0 +1,29 @@ +package com.shunzhi.parent.bean; + +import android.view.Gravity; + +import java.io.Serializable; + +/** + * Created by ToaHanDong on 2018/3/10. + */ + +public class GrallyBean implements Serializable{ + + public GrallyBean(String imgUrl,String imgTitle){ + this.imgUrl=imgUrl; + this.imgTitle=imgTitle; + } + + public String imgUrl; + + public String imgTitle; + + @Override + public String toString() { + return "GrallyBean{" + + "imgUrl='" + imgUrl + '\'' + + ", imgTitle='" + imgTitle + '\'' + + '}'; + } +} diff --git a/app/src/main/java/com/shunzhi/parent/ui/MainActivity.java b/app/src/main/java/com/shunzhi/parent/ui/MainActivity.java index 418bace..d155675 100644 --- a/app/src/main/java/com/shunzhi/parent/ui/MainActivity.java +++ b/app/src/main/java/com/shunzhi/parent/ui/MainActivity.java @@ -9,15 +9,15 @@ import android.view.MenuItem; import com.share.mvpsdk.base.activity.BaseCompatActivity; import com.share.mvpsdk.helper.BottomNavigationViewHelper; +import com.share.mvpsdk.utils.PermissionUtils; +import com.shunzhi.parent.AppContext; import com.shunzhi.parent.R; import com.shunzhi.parent.ui.fragment.CePingFragment; import com.shunzhi.parent.ui.fragment.ConsultFragment; import com.shunzhi.parent.ui.fragment.MineFragment; import com.shunzhi.parent.ui.fragment.ReportFragment; -import butterknife.BindView; - -public class MainActivity extends BaseCompatActivity { +public class MainActivity extends BaseCompatActivity implements PermissionUtils.PermissionGrant { BottomNavigationView bottom_navigationView; @@ -37,7 +37,7 @@ public class MainActivity extends BaseCompatActivity { @Override protected void initView(Bundle savedInstanceState) { - + PermissionUtils.requestMultiPermissions(this, this); bottom_navigationView = findViewById(R.id.bottom_navigationView); BottomNavigationViewHelper.disableShiftMode(bottom_navigationView); @@ -104,4 +104,14 @@ public class MainActivity extends BaseCompatActivity { return R.layout.activity_main; } + @Override + protected void onDestroy() { + super.onDestroy(); + AppContext.getInstance().destoryLocation(); + } + + @Override + public void onPermissionGranted(int requestCode) { + + } } diff --git a/app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java b/app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java new file mode 100644 index 0000000..546ad6b --- /dev/null +++ b/app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultOneLevelActivity.java @@ -0,0 +1,60 @@ +package com.shunzhi.parent.ui.activity.consult; + +import android.content.Context; +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import com.share.mvpsdk.base.activity.BaseCompatActivity; +import com.shunzhi.parent.R; + +public class ConsultOneLevelActivity extends BaseCompatActivity implements View.OnClickListener{ + + + public static void getInstance(Context context){ + Intent intent=new Intent(context,ConsultOneLevelActivity.class); + context.startActivity(intent); + } + + TextView tvLocalAddress; + + EditText et_search; + + ImageView ivSearch; + @Override + protected void initView(Bundle savedInstanceState) { + + initViews(); + + } + + private void initViews() { + + tvLocalAddress=findViewById(R.id.tvLocalAddress); + et_search=findViewById(R.id.et_search); + ivSearch=findViewById(R.id.ivSearch); + + ivSearch.setOnClickListener(this); + tvLocalAddress.setBackgroundResource(R.drawable.back); + tvLocalAddress.setText(""); + + } + + @Override + protected int getLayoutId() { + return R.layout.activity_consult_one_level; + } + + @Override + public void onClick(View view) { + switch (view.getId()){ + case R.id.ivSearch: + + break; + } + } +} diff --git a/app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java b/app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java index b64b874..38aca8a 100644 --- a/app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java +++ b/app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java @@ -1,8 +1,13 @@ package com.shunzhi.parent.ui.fragment; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.design.widget.FloatingActionButton; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; @@ -10,12 +15,12 @@ import android.widget.TextView; import com.share.mvpsdk.base.BasePresenter; import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; +import com.share.mvpsdk.utils.ToastUtils; +import com.shunzhi.parent.AppContext; import com.shunzhi.parent.R; import com.shunzhi.parent.views.TextAndImgShowView; -import butterknife.OnClick; - -public class CePingFragment extends BaseMVPCompatFragment { +public class CePingFragment extends BaseMVPCompatFragment implements View.OnClickListener{ TextView tvLocalAddress; @@ -25,6 +30,8 @@ public class CePingFragment extends BaseMVPCompatFragment { FrameLayout frame_hot1; + FloatingActionButton floatingActionButton; + @Override public int getLayoutId() { return R.layout.fragment_ce_ping; @@ -41,7 +48,7 @@ public class CePingFragment extends BaseMVPCompatFragment { textAndImg_xqjc=view.findViewById(R.id.textAndImg_xqjc); textAndImg_zxlx=view.findViewById(R.id.textAndImg_zxlx); frame_hot1=view.findViewById(R.id.frame_hot1); - + floatingActionButton=view.findViewById(R.id.floatingActionButton); textAndImg1.setTextColor(R.color.textColor); textAndImg1.setText("高校直通"); @@ -72,6 +79,36 @@ public class CePingFragment extends BaseMVPCompatFragment { textAndImg_zxlx.setTextColor(R.color.white); textAndImg_zxlx.setImgs(R.drawable.zxlx,R.drawable.zxlx); textAndImg_zxlx.setSelect(true); + + initListeners(view); + floatingActionButton.setRippleColor(getResources().getColor(R.color.white)); + } + + @Override + public void onResume() { + super.onResume(); + } + + private void initListeners(View view) { + view.findViewById(R.id.frame_hot1).setOnClickListener(this); + view.findViewById(R.id.frame_hot2).setOnClickListener(this); + view.findViewById(R.id.frame_hot3).setOnClickListener(this); + tvLocalAddress.setOnClickListener(this); + textAndImg1.setOnClickListener(this); + textAndImg2.setOnClickListener(this); + textAndImg3.setOnClickListener(this); + textAndImg4.setOnClickListener(this); + ivCamera.setOnClickListener(this); + + initBroadCast(); + } + + private void initBroadCast() { + + IntentFilter intentFilter=new IntentFilter(); + intentFilter.addAction(AppContext.LOCATION_CITYNAME+""); + getActivity().registerReceiver(broadcastReceiver,intentFilter); + } @NonNull @@ -80,19 +117,52 @@ public class CePingFragment extends BaseMVPCompatFragment { return null; } - @OnClick({R.id.frame_hot1,R.id.frame_hot2,R.id.frame_hot3}) - void click(View view){ + + @Override + public void onClick(View view) { switch (view.getId()){ case R.id.frame_hot1://热门课程 - + ToastUtils.showToast("remen1"); break; case R.id.frame_hot2: - + ToastUtils.showToast("remen2"); break; case R.id.frame_hot3: + ToastUtils.showToast("remen3"); + break; + case R.id.tvLocalAddress: + AppContext.getInstance().startLocation(); + break; + case R.id.textAndImg1: + + break; + case R.id.textAndImg2: + + break; + case R.id.textAndImg3: break; + case R.id.textAndImg4: + + break; + case R.id.ivCamera: + ToastUtils.showToast("功能暂未上线"); + break; } } + private BroadcastReceiver broadcastReceiver=new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(AppContext.LOCATION_CITYNAME+"")){ + tvLocalAddress.setText(AppContext.getInstance().cityName); + } + } + }; + + @Override + public void onDestroy() { + super.onDestroy(); + if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); + } } 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 5a2b305..afdeeb4 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 @@ -1,18 +1,25 @@ package com.shunzhi.parent.ui.fragment; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Bundle; +import android.os.Handler; +import android.os.Message; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; +import android.util.Log; import android.view.View; -import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.TextView; import com.bumptech.glide.Glide; import com.share.mvpsdk.base.BasePresenter; import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; +import com.shunzhi.parent.AppContext; import com.shunzhi.parent.R; +import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; import com.shunzhi.parent.views.TextAndImgShowView; import com.stx.xhb.xbanner.XBanner; @@ -22,16 +29,22 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; -public class ConsultFragment extends BaseMVPCompatFragment { +import cn.jzvd.JZVideoPlayerStandard; + +public class ConsultFragment extends BaseMVPCompatFragment implements View.OnClickListener { ImageView ivSearch; - TextAndImgShowView textAndImg1,textAndImg2,textAndImg3,textAndImg4; + TextAndImgShowView textAndImg1, textAndImg2, textAndImg3, textAndImg4; XBanner xBanner; List imgesUrl = new ArrayList<>(); + JZVideoPlayerStandard videoplayer; + + TextView tvLocalAddress; + @Override public int getLayoutId() { return R.layout.fragment_zi_xun; @@ -40,39 +53,58 @@ public class ConsultFragment extends BaseMVPCompatFragment { @Override public void initUI(View view, @Nullable Bundle savedInstanceState) { - ivSearch=view.findViewById(R.id.ivSearch); - textAndImg1=view.findViewById(R.id.textAndImg1); - textAndImg2=view.findViewById(R.id.textAndImg2); - textAndImg3=view.findViewById(R.id.textAndImg3); - textAndImg4=view.findViewById(R.id.textAndImg4); - xBanner=view.findViewById(R.id.xBanner); + ivSearch = view.findViewById(R.id.ivSearch); + textAndImg1 = view.findViewById(R.id.textAndImg1); + textAndImg2 = view.findViewById(R.id.textAndImg2); + textAndImg3 = view.findViewById(R.id.textAndImg3); + textAndImg4 = view.findViewById(R.id.textAndImg4); + xBanner = view.findViewById(R.id.xBanner); + videoplayer = view.findViewById(R.id.videoplayer); + tvLocalAddress = view.findViewById(R.id.tvLocalAddress); + + videoplayer.batteryLevel.setVisibility(View.GONE); + videoplayer.replayTextView.setVisibility(View.GONE); + videoplayer.backButton.setVisibility(View.GONE); textAndImg1.setTextColor(R.color.textColor); textAndImg1.setText("小学"); - textAndImg1.setImgs(R.drawable.play,R.drawable.xiaoxue); + textAndImg1.setImgs(R.drawable.play, R.drawable.xiaoxue); textAndImg1.setSelect(true); textAndImg2.setTextColor(R.color.textColor); textAndImg2.setText("中学"); - textAndImg2.setImgs(R.drawable.play,R.drawable.zhongxue); + textAndImg2.setImgs(R.drawable.play, R.drawable.zhongxue); textAndImg2.setSelect(true); textAndImg3.setTextColor(R.color.textColor); textAndImg3.setText("高中"); - textAndImg3.setImgs(R.drawable.play,R.drawable.gaozhong); + textAndImg3.setImgs(R.drawable.play, R.drawable.gaozhong); textAndImg3.setSelect(true); textAndImg4.setTextColor(R.color.textColor); textAndImg4.setText("家长"); - textAndImg4.setImgs(R.drawable.play,R.drawable.parent); + textAndImg4.setImgs(R.drawable.play, R.drawable.parent); textAndImg4.setSelect(true); initBanners(); + + initBroadCast(); + + initListeners(); + } + + private void initListeners() { + textAndImg1.setOnClickListener(this); + textAndImg2.setOnClickListener(this); + textAndImg3.setOnClickListener(this); + textAndImg4.setOnClickListener(this); + ivSearch.setOnClickListener(this); + tvLocalAddress.setOnClickListener(this); } private void initBanners() { - InputStream inputStream=getClass().getResourceAsStream("/assets/banners.png"); + InputStream inputStream = getClass().getResourceAsStream("/assets/banners.png"); try { imgesUrl.add(new String(InputStreamToByte(inputStream))); imgesUrl.add(new String(InputStreamToByte(inputStream))); @@ -80,8 +112,8 @@ public class ConsultFragment extends BaseMVPCompatFragment { imgesUrl.add(new String(InputStreamToByte(inputStream))); } catch (IOException e) { e.printStackTrace(); - } - xBanner.setData(imgesUrl,null); + } + xBanner.setData(imgesUrl, null); xBanner.setmAdapter(new XBanner.XBannerAdapter() { @Override public void loadBanner(XBanner banner, Object model, View view, int position) { @@ -121,4 +153,52 @@ public class ConsultFragment extends BaseMVPCompatFragment { super.onStop(); xBanner.stopAutoPlay(); } + + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.tvLocalAddress: + AppContext.getInstance().startLocation(); + break; + case R.id.textAndImg1: + ConsultOneLevelActivity.getInstance(getActivity()); + break; + case R.id.textAndImg2: + ConsultOneLevelActivity.getInstance(getActivity()); + break; + case R.id.textAndImg3: + ConsultOneLevelActivity.getInstance(getActivity()); + break; + case R.id.textAndImg4: + ConsultOneLevelActivity.getInstance(getActivity()); + break; + case R.id.ivSearch://搜索按钮 + + break; + } + } + + + private void initBroadCast() { + + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(AppContext.LOCATION_CITYNAME + ""); + getActivity().registerReceiver(broadcastReceiver, intentFilter); + + } + + private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(AppContext.LOCATION_CITYNAME + "")) { + tvLocalAddress.setText(AppContext.getInstance().cityName); + } + } + }; + + @Override + public void onDestroy() { + super.onDestroy(); + if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); + } } diff --git a/app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java b/app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java index e9beb34..637e552 100644 --- a/app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java +++ b/app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java @@ -3,21 +3,34 @@ package com.shunzhi.parent.ui.fragment; import android.content.Context; import android.net.Uri; import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.share.mvpsdk.base.BasePresenter; +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; import com.shunzhi.parent.R; -public class ReportFragment extends Fragment { +public class ReportFragment extends BaseMVPCompatFragment { + @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_report, container, false); + public int getLayoutId() { + return R.layout.fragment_report; } + @Override + public void initUI(View view, @Nullable Bundle savedInstanceState) { + + } + + @NonNull + @Override + public BasePresenter initPresenter() { + return null; + } } diff --git a/app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java b/app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java new file mode 100644 index 0000000..e27c8d9 --- /dev/null +++ b/app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java @@ -0,0 +1,162 @@ +package com.shunzhi.parent.ui.fragment.consult; + +import android.content.Context; +import android.net.Uri; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.share.mvpsdk.base.BasePresenter; +import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; +import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; +import com.share.mvpsdk.utils.ToastUtils; +import com.shunzhi.parent.AppContext; +import com.shunzhi.parent.R; +import com.shunzhi.parent.bean.GrallyBean; +import com.shunzhi.parent.views.TextAndImgShowView; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements View.OnClickListener { + + TextAndImgShowView textAndImg1, textAndImg2, textAndImg3, textAndImg4; + + RecyclerView recyclerViewGrally; + + MyGrallyAdapter myGrallyAdapter = null; + + List grallyBeanList = new ArrayList<>(); + + @Override + public int getLayoutId() { + return R.layout.fragment_consult_one_level; + } + + @Override + public void initUI(View view, @Nullable Bundle savedInstanceState) { + try { + initViews(view); + } catch (Exception e) { + e.printStackTrace(); + Log.d("exception:",e.toString()); + } + } + + private void initRecyclerView() { + for (int i = 0; i < 4; i++) { + grallyBeanList.add(new GrallyBean(" ", "家长表示对孩子的情况更加了解")); + } + if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); + myGrallyAdapter.addAll(grallyBeanList); + recyclerViewGrally.setAdapter(myGrallyAdapter); + } + + private void initViews(View view) { + textAndImg1 = view.findViewById(R.id.textAndImg1); + textAndImg2 = view.findViewById(R.id.textAndImg2); + textAndImg3 = view.findViewById(R.id.textAndImg3); + textAndImg4 = view.findViewById(R.id.textAndImg4); + recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); + + textAndImg1.setTextColor(R.color.textColor); + textAndImg1.setText("政策咨询"); + textAndImg1.setImgs(R.drawable.play, R.drawable.zczx); + textAndImg1.setSelect(true); + + textAndImg2.setTextColor(R.color.textColor); + textAndImg2.setText("公办/民办小学"); + textAndImg2.setImgs(R.drawable.play, R.drawable.gbxx); + textAndImg2.setSelect(true); + + textAndImg3.setTextColor(R.color.textColor); + textAndImg3.setText("学校库"); + textAndImg3.setImgs(R.drawable.play, R.drawable.xxk); + textAndImg3.setSelect(true); + + textAndImg4.setTextColor(R.color.textColor); + textAndImg4.setText("专题"); + textAndImg4.setImgs(R.drawable.play, R.drawable.zhuanti); + textAndImg4.setSelect(true); + + textAndImg1.setOnClickListener(this); + textAndImg2.setOnClickListener(this); + textAndImg3.setOnClickListener(this); + textAndImg4.setOnClickListener(this); + initRecyclerView(); + } + + @NonNull + @Override + public BasePresenter initPresenter() { + return null; + } + + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.textAndImg1: + + break; + case R.id.textAndImg2: + + break; + case R.id.textAndImg3: + + break; + case R.id.textAndImg4: + + break; + } + } + + private class MyGrallyAdapter extends BaseRecyclerViewAdapter { + @Override + public void onAttachedToRecyclerView(RecyclerView recyclerView) { + super.onAttachedToRecyclerView(recyclerView); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); + linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); + recyclerView.setLayoutManager(linearLayoutManager); + } + + @Override + public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(getActivity()).inflate(R.layout.item_grally, parent, false); + return new MyGrallyViewHolder(view); + } + + private class MyGrallyViewHolder extends BaseRecyclerViewHolder { + + ImageView iv_grally; + TextView tv_grally_title; + + public MyGrallyViewHolder(View itemView) { + super(itemView); + iv_grally = itemView.findViewById(R.id.iv_grally); + tv_grally_title = itemView.findViewById(R.id.tv_grally_title); + } + + @Override + public void onBindViewHolder(GrallyBean object, int position) { +// Glide.with(getActivity()).load(object.imgUrl).error(R.drawable.ic_launcher_foreground).into(iv_grally); + iv_grally.setImageResource(R.drawable.ic_launcher_background); + tv_grally_title.setText(object.imgTitle); + } + } + } + +} diff --git a/app/src/main/res/drawable-xhdpi/back.png b/app/src/main/res/drawable-xhdpi/back.png new file mode 100644 index 0000000..07c4e60 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/back.png differ diff --git a/app/src/main/res/drawable-xhdpi/gbxx.png b/app/src/main/res/drawable-xhdpi/gbxx.png new file mode 100644 index 0000000..89be04e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/gbxx.png differ diff --git a/app/src/main/res/drawable-xhdpi/guanlianchild.png b/app/src/main/res/drawable-xhdpi/guanlianchild.png new file mode 100644 index 0000000..50d7214 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/guanlianchild.png differ diff --git a/app/src/main/res/drawable-xhdpi/shaixuan.png b/app/src/main/res/drawable-xhdpi/shaixuan.png new file mode 100644 index 0000000..591bc98 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/shaixuan.png differ diff --git a/app/src/main/res/drawable-xhdpi/xxk.png b/app/src/main/res/drawable-xhdpi/xxk.png new file mode 100644 index 0000000..fbb0b7b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/xxk.png differ diff --git a/app/src/main/res/drawable-xhdpi/zczx.png b/app/src/main/res/drawable-xhdpi/zczx.png new file mode 100644 index 0000000..fb15dbb Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/zczx.png differ diff --git a/app/src/main/res/drawable-xhdpi/zhuanti.png b/app/src/main/res/drawable-xhdpi/zhuanti.png new file mode 100644 index 0000000..c129967 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/zhuanti.png differ diff --git a/app/src/main/res/layout/activity_consult_one_level.xml b/app/src/main/res/layout/activity_consult_one_level.xml new file mode 100644 index 0000000..a13f874 --- /dev/null +++ b/app/src/main/res/layout/activity_consult_one_level.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_ce_ping.xml b/app/src/main/res/layout/fragment_ce_ping.xml index 0eec214..1c7618a 100644 --- a/app/src/main/res/layout/fragment_ce_ping.xml +++ b/app/src/main/res/layout/fragment_ce_ping.xml @@ -1,245 +1,165 @@ - - - - - - - - - - - - + + + + + + + + + + - + android:layout_height="0dp" + android:layout_margin="@dimen/size_dp_10" + android:layout_weight="3" + android:background="@drawable/shape_bg_radius8" + android:orientation="vertical"> - - + + - + - + + + + + - + - + + + - + - + - + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/size_dp_10" + android:layout_marginRight="@dimen/size_dp_10" + android:gravity="center_vertical"> - + android:background="@color/huodong_blue"> - + + /> - - - - - + android:background="@color/huodong_blue"> - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_margin="@dimen/size_dp_10" + android:layout_weight="2"> @@ -273,44 +193,102 @@ - + android:orientation="vertical"> - + android:layout_marginRight="@dimen/size_dp_5" + android:layout_weight="1" + android:background="@drawable/shape_xueqing_radius8"> - + android:layout_gravity="bottom|left" + android:layout_marginBottom="@dimen/size_dp_5" + android:layout_marginLeft="@dimen/size_dp_5" + android:orientation="vertical"> + + + + + + + + + + - - - - - + android:layout_gravity="bottom|left" + android:layout_marginBottom="@dimen/size_dp_5" + android:layout_marginLeft="@dimen/size_dp_5" + android:orientation="vertical"> + + + + + + + + + - + + + diff --git a/app/src/main/res/layout/fragment_consult_one_level.xml b/app/src/main/res/layout/fragment_consult_one_level.xml new file mode 100644 index 0000000..4b422d7 --- /dev/null +++ b/app/src/main/res/layout/fragment_consult_one_level.xml @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_report.xml b/app/src/main/res/layout/fragment_report.xml index f97eea6..f7e0053 100644 --- a/app/src/main/res/layout/fragment_report.xml +++ b/app/src/main/res/layout/fragment_report.xml @@ -1,13 +1,45 @@ - - - + android:layout_height="?android:actionBarSize" + android:background="@color/titleColor"> - + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_zi_xun.xml b/app/src/main/res/layout/fragment_zi_xun.xml index 6e5869b..e0f62a0 100644 --- a/app/src/main/res/layout/fragment_zi_xun.xml +++ b/app/src/main/res/layout/fragment_zi_xun.xml @@ -2,186 +2,88 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" android:background="@color/bgColor" + android:orientation="vertical" tools:context="com.shunzhi.parent.ui.fragment.ConsultFragment"> - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - + android:layout_height="0dp" + android:layout_weight="2"> + + android:layout_height="wrap_content" + android:orientation="vertical"> + android:text="@string/consult_huati" + android:textColor="@color/xueqing_blue" + android:textSize="@dimen/textSize16" /> + android:background="@color/white"> + android:padding="@dimen/size_dp_5"> + android:text="学校初一段家长统一测试使用家长慧得到良好反馈评价" + android:textColor="@color/textColor" + android:textSize="@dimen/textSize14" /> + + android:textColor="@color/zxlx" + android:textSize="@dimen/textSize14" /> - + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/size_dp_5"> + + + + style="@style/TextView_Wrap_16" + android:layout_gravity="right|center_vertical" + android:text="转发:50" + android:textSize="@dimen/textSize14" /> @@ -189,8 +91,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" - android:src="@color/xueqing_blue" - /> + android:src="@color/xueqing_blue" /> @@ -199,14 +100,31 @@ + android:layout_weight="2"> + + android:layout_height="match_parent"> + + + + diff --git a/app/src/main/res/layout/item_grally.xml b/app/src/main/res/layout/item_grally.xml new file mode 100644 index 0000000..18b8965 --- /dev/null +++ b/app/src/main/res/layout/item_grally.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_search.xml b/app/src/main/res/layout/layout_search.xml new file mode 100644 index 0000000..81efc86 --- /dev/null +++ b/app/src/main/res/layout/layout_search.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_textandimgshow.xml b/app/src/main/res/layout/layout_textandimgshow.xml new file mode 100644 index 0000000..390f670 --- /dev/null +++ b/app/src/main/res/layout/layout_textandimgshow.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 43d23d9..e5a403e 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ allprojects { repositories { google() jcenter() +// maven { url 'https://jitpack.io' } } } diff --git a/mvpsdk/build.gradle b/mvpsdk/build.gradle index a4e76aa..382f398 100644 --- a/mvpsdk/build.gradle +++ b/mvpsdk/build.gradle @@ -107,4 +107,7 @@ dependencies { //轮播图XBanner compile 'com.xhb:xbanner:1.3.1' + //悬浮窗 +// compile 'com.github.yhaolpz:FloatWindow:1.0.8' + } diff --git a/mvpsdk/src/main/java/com/share/mvpsdk/base/activity/BaseCompatActivity.java b/mvpsdk/src/main/java/com/share/mvpsdk/base/activity/BaseCompatActivity.java index bfaabc0..18dfb71 100644 --- a/mvpsdk/src/main/java/com/share/mvpsdk/base/activity/BaseCompatActivity.java +++ b/mvpsdk/src/main/java/com/share/mvpsdk/base/activity/BaseCompatActivity.java @@ -65,6 +65,7 @@ public abstract class BaseCompatActivity extends SupportActivity { setContentView(getLayoutId()); ButterKnife.bind(this); // StatusBarUtils.setTransparent(this); + StatusBarUtils.setBarColor(this,getResources().getColor(R.color.titleColor)); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); initData(); initView(savedInstanceState); diff --git a/mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java b/mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java index 1bfecb1..b48edf3 100644 --- a/mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java +++ b/mvpsdk/src/main/java/com/share/mvpsdk/utils/OkHttpExceptionUtil.java @@ -21,7 +21,6 @@ public class OkHttpExceptionUtil { if (responseBody==null)return; try { JSONObject json = new JSONObject(responseBody.string()); - Log.d("77777",json.toString()); ToastUtils.showToast(json.optString("error")); } catch (Exception e1) { e1.printStackTrace(); diff --git a/mvpsdk/src/main/java/com/share/mvpsdk/utils/StatusBarUtils.java b/mvpsdk/src/main/java/com/share/mvpsdk/utils/StatusBarUtils.java index 2abc82c..a9263e3 100644 --- a/mvpsdk/src/main/java/com/share/mvpsdk/utils/StatusBarUtils.java +++ b/mvpsdk/src/main/java/com/share/mvpsdk/utils/StatusBarUtils.java @@ -48,8 +48,9 @@ public class StatusBarUtils { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//android5.0以上设置透明效果 win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//清除flag,为了android5.0以上也全透明效果 //让应用的主体内容占用系统状态栏的空间 - int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; +// int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +// | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; + int option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE; decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | option); win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); win.setStatusBarColor(color);//设置状态栏背景色 diff --git a/mvpsdk/src/main/res/values/colors.xml b/mvpsdk/src/main/res/values/colors.xml index 488c181..c0c896d 100644 --- a/mvpsdk/src/main/res/values/colors.xml +++ b/mvpsdk/src/main/res/values/colors.xml @@ -3,6 +3,7 @@ #ffeeeeee + #C6DAFF #ffeeeeee #ff303030 -- libgit2 0.21.0