Commit 75be5d9a65c65f6e12a9ee2107a76f75ad924f1d
1 parent
dcf53e4f
Exists in
yxb_dev
and in
2 other branches
no message
Showing
27 changed files
with
501 additions
and
202 deletions
Show diff stats
app/build.gradle
| ... | ... | @@ -5,7 +5,7 @@ android { |
| 5 | 5 | config { |
| 6 | 6 | keyAlias 'key0' |
| 7 | 7 | keyPassword '123456' |
| 8 | - storeFile file('E:/parentwork/app/parent.jks') | |
| 8 | + storeFile file('../app/parent.jks') | |
| 9 | 9 | storePassword '123456' |
| 10 | 10 | } |
| 11 | 11 | } |
| ... | ... | @@ -24,6 +24,11 @@ android { |
| 24 | 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 25 | 25 | signingConfig signingConfigs.config |
| 26 | 26 | } |
| 27 | + debug { | |
| 28 | + signingConfig signingConfigs.config | |
| 29 | + } | |
| 30 | + } | |
| 31 | + productFlavors { | |
| 27 | 32 | } |
| 28 | 33 | } |
| 29 | 34 | ... | ... |
app/src/main/AndroidManifest.xml
| ... | ... | @@ -48,9 +48,9 @@ |
| 48 | 48 | <application |
| 49 | 49 | android:name=".AppContext" |
| 50 | 50 | android:allowBackup="true" |
| 51 | - android:icon="@mipmap/ic_launcher" | |
| 51 | + android:icon="@drawable/logo" | |
| 52 | 52 | android:label="@string/app_name" |
| 53 | - android:roundIcon="@mipmap/ic_launcher_round" | |
| 53 | + android:roundIcon="@drawable/logo" | |
| 54 | 54 | android:supportsRtl="true" |
| 55 | 55 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
| 56 | 56 | ... | ... |
app/src/main/java/com/shunzhi/parent/AppContext.java
| ... | ... | @@ -105,8 +105,8 @@ public class AppContext extends GlobalApplication { |
| 105 | 105 | sendBroadcast(intent); |
| 106 | 106 | stopLocation(); |
| 107 | 107 | }else { |
| 108 | - Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); | |
| 109 | 108 | cityName="定位失败"; |
| 109 | + Log.d("mlocation:","errorCode="+aMapLocation.getErrorCode()+"errorInfo="+aMapLocation.getErrorInfo()); | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } | ... | ... |
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +package com.shunzhi.parent.bean; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by ToaHanDong on 2018/3/14. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +public class ToolBean implements Serializable { | |
| 10 | + | |
| 11 | + public ToolBean(String toolImg,String toolName){ | |
| 12 | + this.toolImg=toolImg; | |
| 13 | + this.toolName=toolName; | |
| 14 | + } | |
| 15 | + | |
| 16 | + | |
| 17 | + public String toolImg; | |
| 18 | + | |
| 19 | + public String toolName; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public String toString() { | |
| 23 | + return "ToolBean{" + | |
| 24 | + "toolImg='" + toolImg + '\'' + | |
| 25 | + ", toolName='" + toolName + '\'' + | |
| 26 | + '}'; | |
| 27 | + } | |
| 28 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/ceping/CepingContract.java
0 → 100644
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +package com.shunzhi.parent.contract.ceping; | |
| 2 | + | |
| 3 | +import android.view.View; | |
| 4 | +import android.widget.LinearLayout; | |
| 5 | + | |
| 6 | +import com.share.mvpsdk.base.BasePresenter; | |
| 7 | +import com.share.mvpsdk.base.IBaseFragment; | |
| 8 | +import com.share.mvpsdk.base.IBaseModel; | |
| 9 | +import com.shunzhi.parent.bean.ToolBean; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by ToaHanDong on 2018/3/14. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +public interface CepingContract { | |
| 18 | + | |
| 19 | + abstract class CePingPresenter extends BasePresenter<ICePingModel,ICePingView>{ | |
| 20 | + public abstract void getTools(LinearLayout view); | |
| 21 | + } | |
| 22 | + | |
| 23 | + | |
| 24 | + interface ICePingModel extends IBaseModel{ | |
| 25 | + void getTools(); | |
| 26 | + } | |
| 27 | + | |
| 28 | + | |
| 29 | + interface ICePingView extends IBaseFragment{ | |
| 30 | + void getTools(); | |
| 31 | + } | |
| 32 | + | |
| 33 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/consult/ConsultContract.java
0 → 100644
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +package com.shunzhi.parent.contract.consult; | |
| 2 | + | |
| 3 | +import android.widget.LinearLayout; | |
| 4 | + | |
| 5 | +import com.share.mvpsdk.base.BasePresenter; | |
| 6 | +import com.share.mvpsdk.base.IBaseFragment; | |
| 7 | +import com.share.mvpsdk.base.IBaseModel; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by ToaHanDong on 2018/3/14. | |
| 11 | + */ | |
| 12 | + | |
| 13 | +public interface ConsultContract { | |
| 14 | + | |
| 15 | + abstract class ConsultPresenter extends BasePresenter<IConsultModel,IConsultView>{ | |
| 16 | + public abstract void getTools(LinearLayout linearLayout); | |
| 17 | + } | |
| 18 | + | |
| 19 | + | |
| 20 | + interface IConsultModel extends IBaseModel{ | |
| 21 | + void getTools(); | |
| 22 | + } | |
| 23 | + | |
| 24 | + interface IConsultView extends IBaseFragment{ | |
| 25 | + void showTools(); | |
| 26 | + } | |
| 27 | + | |
| 28 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/consult/consultone/ConsultOneContract.java
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +package com.shunzhi.parent.contract.consult.consultone; | |
| 2 | + | |
| 3 | +import android.widget.LinearLayout; | |
| 4 | + | |
| 5 | +import com.share.mvpsdk.base.BasePresenter; | |
| 6 | +import com.share.mvpsdk.base.IBaseFragment; | |
| 7 | +import com.share.mvpsdk.base.IBaseModel; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by ToaHanDong on 2018/3/14. | |
| 11 | + */ | |
| 12 | + | |
| 13 | +public interface ConsultOneContract { | |
| 14 | + | |
| 15 | + abstract class ConsultOnePresenter extends BasePresenter<IConsultOneModel,IConsultOneView>{ | |
| 16 | + public abstract void getTools(LinearLayout linearLayout); | |
| 17 | + } | |
| 18 | + | |
| 19 | + interface IConsultOneModel extends IBaseModel{ | |
| 20 | + void getTools(); | |
| 21 | + } | |
| 22 | + | |
| 23 | + interface IConsultOneView extends IBaseFragment{ | |
| 24 | + void showTools(); | |
| 25 | + } | |
| 26 | + | |
| 27 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/model/CePingModel.java
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +package com.shunzhi.parent.model; | |
| 2 | + | |
| 3 | +import com.share.mvpsdk.base.BaseModel; | |
| 4 | +import com.shunzhi.parent.contract.ceping.CepingContract; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by ToaHanDong on 2018/3/14. | |
| 8 | + */ | |
| 9 | +//获取测评数据 | |
| 10 | +public class CePingModel extends BaseModel implements CepingContract.ICePingModel { | |
| 11 | + | |
| 12 | +public static CePingModel newInstance(){ | |
| 13 | + return new CePingModel(); | |
| 14 | +} | |
| 15 | + @Override | |
| 16 | + public void getTools() { | |
| 17 | + | |
| 18 | + } | |
| 19 | + | |
| 20 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/model/consult/ConsultModel.java
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +package com.shunzhi.parent.model.consult; | |
| 2 | + | |
| 3 | +import com.share.mvpsdk.base.BaseModel; | |
| 4 | +import com.shunzhi.parent.contract.consult.ConsultContract; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by ToaHanDong on 2018/3/14. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +public class ConsultModel extends BaseModel implements ConsultContract.IConsultModel{ | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + public void getTools() { | |
| 14 | + | |
| 15 | + } | |
| 16 | + | |
| 17 | + public static ConsultContract.IConsultModel newInstance() { | |
| 18 | + return new ConsultModel(); | |
| 19 | + } | |
| 20 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/model/consult/consultone/ConsultOneModel.java
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +package com.shunzhi.parent.model.consult.consultone; | |
| 2 | + | |
| 3 | +import com.share.mvpsdk.base.BaseModel; | |
| 4 | +import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by ToaHanDong on 2018/3/14. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +public class ConsultOneModel extends BaseModel implements ConsultOneContract.IConsultOneModel{ | |
| 11 | + | |
| 12 | + public static ConsultOneModel newInstance(){ | |
| 13 | + return new ConsultOneModel(); | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void getTools() { | |
| 18 | + | |
| 19 | + } | |
| 20 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
0 → 100644
| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | +package com.shunzhi.parent.presenter.ceping; | |
| 2 | + | |
| 3 | +import android.content.res.TypedArray; | |
| 4 | +import android.util.TypedValue; | |
| 5 | +import android.view.View; | |
| 6 | +import android.widget.LinearLayout; | |
| 7 | + | |
| 8 | +import com.shunzhi.parent.R; | |
| 9 | +import com.shunzhi.parent.bean.ToolBean; | |
| 10 | +import com.shunzhi.parent.contract.ceping.CepingContract; | |
| 11 | +import com.shunzhi.parent.model.CePingModel; | |
| 12 | +import com.shunzhi.parent.views.TextAndImgShowView; | |
| 13 | + | |
| 14 | +import java.util.ArrayList; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Created by ToaHanDong on 2018/3/14. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +public class CePingPresenter extends CepingContract.CePingPresenter { | |
| 22 | + @Override | |
| 23 | + public void getTools(LinearLayout layout_control) { | |
| 24 | + List<ToolBean> toolBeanList=new ArrayList<>(); | |
| 25 | + toolBeanList.add(new ToolBean(R.drawable.gxzt+"","高校直通")); | |
| 26 | + toolBeanList.add(new ToolBean(R.drawable.zycx+"","专业查询")); | |
| 27 | + toolBeanList.add(new ToolBean(R.drawable.cmyk+"","传媒艺考")); | |
| 28 | + toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | |
| 29 | + toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | |
| 30 | + toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | |
| 31 | + toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | |
| 32 | + toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | |
| 33 | + | |
| 34 | + for (int i = 0; i < toolBeanList.size(); i++) { | |
| 35 | + TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | |
| 36 | + textAndImgShowView.setTextColor(R.color.textColor); | |
| 37 | + textAndImgShowView.setText(toolBeanList.get(i).toolName); | |
| 38 | + textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | |
| 39 | + textAndImgShowView.setSelect(true); | |
| 40 | + textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | |
| 41 | + TypedValue typedValue=new TypedValue(); | |
| 42 | + mIView.getBindActivity().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,typedValue,true); | |
| 43 | + int[] sttrides=new int[]{android.R.attr.selectableItemBackground}; | |
| 44 | + TypedArray typedArray=mIView.getBindActivity().getTheme().obtainStyledAttributes(sttrides); | |
| 45 | + textAndImgShowView.setBackground(typedArray.getDrawable(0)); | |
| 46 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | |
| 47 | + @Override | |
| 48 | + public void onClick(View view) { | |
| 49 | + | |
| 50 | + } | |
| 51 | + }); | |
| 52 | + layout_control.addView(textAndImgShowView); | |
| 53 | + } | |
| 54 | + mIView.getTools(); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public CepingContract.ICePingModel getModel() { | |
| 59 | + return CePingModel.newInstance(); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void onStart() { | |
| 64 | + | |
| 65 | + } | |
| 66 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
0 → 100644
| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | +package com.shunzhi.parent.presenter.consult; | |
| 2 | + | |
| 3 | +import android.content.res.TypedArray; | |
| 4 | +import android.util.TypedValue; | |
| 5 | +import android.view.View; | |
| 6 | +import android.widget.LinearLayout; | |
| 7 | + | |
| 8 | +import com.shunzhi.parent.R; | |
| 9 | +import com.shunzhi.parent.bean.ToolBean; | |
| 10 | +import com.shunzhi.parent.contract.consult.ConsultContract; | |
| 11 | +import com.shunzhi.parent.model.consult.ConsultModel; | |
| 12 | +import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | |
| 13 | +import com.shunzhi.parent.views.TextAndImgShowView; | |
| 14 | + | |
| 15 | +import java.util.ArrayList; | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by ToaHanDong on 2018/3/14. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +public class ConsultPresenter extends ConsultContract.ConsultPresenter { | |
| 23 | + @Override | |
| 24 | + public void getTools(LinearLayout layout_control) { | |
| 25 | + List<ToolBean> toolBeanList=new ArrayList<>(); | |
| 26 | + toolBeanList.add(new ToolBean(R.drawable.xiaoxue+"","小学")); | |
| 27 | + toolBeanList.add(new ToolBean(R.drawable.zhongxue+"","中学")); | |
| 28 | + toolBeanList.add(new ToolBean(R.drawable.gaozhong+"","高中")); | |
| 29 | + toolBeanList.add(new ToolBean(R.drawable.parent+"","家长")); | |
| 30 | + for (int i = 0; i < toolBeanList.size(); i++) { | |
| 31 | + TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | |
| 32 | + textAndImgShowView.setTextColor(R.color.textColor); | |
| 33 | + textAndImgShowView.setText(toolBeanList.get(i).toolName); | |
| 34 | + textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | |
| 35 | + textAndImgShowView.setSelect(true); | |
| 36 | + textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | |
| 37 | + TypedValue typedValue=new TypedValue(); | |
| 38 | + mIView.getBindActivity().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,typedValue,true); | |
| 39 | + int[] sttrides=new int[]{android.R.attr.selectableItemBackground}; | |
| 40 | + TypedArray typedArray=mIView.getBindActivity().getTheme().obtainStyledAttributes(sttrides); | |
| 41 | + textAndImgShowView.setBackground(typedArray.getDrawable(0)); | |
| 42 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | |
| 43 | + @Override | |
| 44 | + public void onClick(View view) { | |
| 45 | + ConsultOneLevelActivity.getInstance(mIView.getBindActivity()); | |
| 46 | + } | |
| 47 | + }); | |
| 48 | + layout_control.addView(textAndImgShowView); | |
| 49 | + } | |
| 50 | + mIView.showTools(); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public ConsultContract.IConsultModel getModel() { | |
| 55 | + return ConsultModel.newInstance(); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + public void onStart() { | |
| 60 | + | |
| 61 | + } | |
| 62 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
0 → 100644
| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | +package com.shunzhi.parent.presenter.consult.consultone; | |
| 2 | + | |
| 3 | +import android.widget.LinearLayout; | |
| 4 | + | |
| 5 | +import com.shunzhi.parent.R; | |
| 6 | +import com.shunzhi.parent.bean.ToolBean; | |
| 7 | +import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | |
| 8 | +import com.shunzhi.parent.model.consult.consultone.ConsultOneModel; | |
| 9 | +import com.shunzhi.parent.views.TextAndImgShowView; | |
| 10 | + | |
| 11 | +import java.util.ArrayList; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Created by ToaHanDong on 2018/3/14. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | |
| 19 | + @Override | |
| 20 | + public void getTools(LinearLayout layout_control) { | |
| 21 | + List<ToolBean> toolBeanList=new ArrayList<>(); | |
| 22 | + toolBeanList.add(new ToolBean(R.drawable.xiaoxue+"","政策咨询")); | |
| 23 | + toolBeanList.add(new ToolBean(R.drawable.gbxx+"","公办/民办小学")); | |
| 24 | + toolBeanList.add(new ToolBean(R.drawable.xsc+"","小升初")); | |
| 25 | + toolBeanList.add(new ToolBean(R.drawable.xxk+"","学校库")); | |
| 26 | + toolBeanList.add(new ToolBean(R.drawable.zhuanti+"","专题")); | |
| 27 | + for (int i = 0; i < toolBeanList.size(); i++) { | |
| 28 | + TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | |
| 29 | + textAndImgShowView.setTextColor(R.color.textColor); | |
| 30 | + textAndImgShowView.setText(toolBeanList.get(i).toolName); | |
| 31 | + textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | |
| 32 | + textAndImgShowView.setSelect(true); | |
| 33 | + textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | |
| 34 | + layout_control.addView(textAndImgShowView); | |
| 35 | + } | |
| 36 | + mIView.showTools(); | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public ConsultOneContract.IConsultOneModel getModel() { | |
| 41 | + return ConsultOneModel.newInstance(); | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void onStart() { | |
| 46 | + | |
| 47 | + } | |
| 48 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
| ... | ... | @@ -13,6 +13,7 @@ import android.widget.ImageView; |
| 13 | 13 | import android.widget.TextView; |
| 14 | 14 | |
| 15 | 15 | import com.share.mvpsdk.base.BasePresenter; |
| 16 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | |
| 16 | 17 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
| 17 | 18 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
| 18 | 19 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| ... | ... | @@ -22,7 +23,7 @@ import com.shunzhi.parent.bean.MyConsultBean; |
| 22 | 23 | import java.util.ArrayList; |
| 23 | 24 | import java.util.List; |
| 24 | 25 | |
| 25 | -public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements View.OnClickListener { | |
| 26 | +public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener { | |
| 26 | 27 | |
| 27 | 28 | ImageView ivBack, ivSearch; |
| 28 | 29 | |
| ... | ... | @@ -37,31 +38,30 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements Vi |
| 37 | 38 | List<MyConsultBean> myConsultBeanList = new ArrayList<>(); |
| 38 | 39 | |
| 39 | 40 | @Override |
| 40 | - public int getLayoutId() { | |
| 41 | - return R.layout.activity_consult_two_level; | |
| 41 | + protected void initView(Bundle savedInstanceState) { | |
| 42 | + initViews(); | |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | @Override |
| 45 | - public void initUI(View view, @Nullable Bundle savedInstanceState) { | |
| 46 | - | |
| 47 | - initViews(view); | |
| 48 | - | |
| 46 | + public int getLayoutId() { | |
| 47 | + return R.layout.activity_consult_two_level; | |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | - private void initViews(View view) { | |
| 52 | 50 | |
| 53 | - ivBack = view.findViewById(R.id.ivBack); | |
| 51 | + private void initViews() { | |
| 52 | + | |
| 53 | + ivBack = findViewById(R.id.ivBack); | |
| 54 | 54 | ivBack.setOnClickListener(this); |
| 55 | 55 | |
| 56 | - et_search = view.findViewById(R.id.et_search); | |
| 56 | + et_search = findViewById(R.id.et_search); | |
| 57 | 57 | |
| 58 | - ivSearch = view.findViewById(R.id.ivSearch); | |
| 58 | + ivSearch = findViewById(R.id.ivSearch); | |
| 59 | 59 | ivSearch.setOnClickListener(this); |
| 60 | 60 | |
| 61 | - tvContentName = view.findViewById(R.id.tvContentName); | |
| 61 | + tvContentName = findViewById(R.id.tvContentName); | |
| 62 | 62 | tvContentName.setText(""); |
| 63 | 63 | |
| 64 | - recyclerView = view.findViewById(R.id.recyclerView); | |
| 64 | + recyclerView = findViewById(R.id.recyclerView); | |
| 65 | 65 | |
| 66 | 66 | initRecyclerView(); |
| 67 | 67 | } |
| ... | ... | @@ -105,13 +105,13 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements Vi |
| 105 | 105 | @Override |
| 106 | 106 | public void onAttachedToRecyclerView(RecyclerView recyclerView) { |
| 107 | 107 | super.onAttachedToRecyclerView(recyclerView); |
| 108 | - LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); | |
| 108 | + LinearLayoutManager layoutManager = new LinearLayoutManager(ConsultTwoLevelActivity.this); | |
| 109 | 109 | recyclerView.setLayoutManager(layoutManager); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | @Override |
| 113 | 113 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 114 | - View view = LayoutInflater.from(getActivity()).inflate(R.layout.layout_consult_content, parent, false); | |
| 114 | + View view = LayoutInflater.from(ConsultTwoLevelActivity.this).inflate(R.layout.layout_consult_content, parent, false); | |
| 115 | 115 | return new MyTwoLevelViewHolder(view); |
| 116 | 116 | } |
| 117 | 117 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
| ... | ... | @@ -11,27 +11,35 @@ import android.support.design.widget.FloatingActionButton; |
| 11 | 11 | import android.view.View; |
| 12 | 12 | import android.widget.FrameLayout; |
| 13 | 13 | import android.widget.ImageView; |
| 14 | +import android.widget.LinearLayout; | |
| 14 | 15 | import android.widget.TextView; |
| 15 | 16 | |
| 16 | 17 | import com.share.mvpsdk.base.BasePresenter; |
| 17 | 18 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 19 | +import com.share.mvpsdk.utils.DisplayUtils; | |
| 18 | 20 | import com.share.mvpsdk.utils.ToastUtils; |
| 19 | 21 | import com.shunzhi.parent.AppContext; |
| 20 | 22 | import com.shunzhi.parent.R; |
| 23 | +import com.shunzhi.parent.contract.ceping.CepingContract; | |
| 24 | +import com.shunzhi.parent.presenter.ceping.CePingPresenter; | |
| 21 | 25 | import com.shunzhi.parent.views.TextAndImgShowView; |
| 22 | 26 | |
| 23 | -public class CePingFragment extends BaseMVPCompatFragment implements View.OnClickListener{ | |
| 27 | + | |
| 28 | +public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter,CepingContract.ICePingModel> implements CepingContract.ICePingView | |
| 29 | + ,View.OnClickListener{ | |
| 24 | 30 | |
| 25 | 31 | TextView tvLocalAddress; |
| 26 | 32 | |
| 27 | 33 | ImageView ivCamera; |
| 28 | 34 | |
| 29 | - TextAndImgShowView textAndImg1,textAndImg2,textAndImg3,textAndImg4,textAndImg_xqjc,textAndImg_zxlx; | |
| 35 | + TextAndImgShowView textAndImg_xqjc,textAndImg_zxlx; | |
| 30 | 36 | |
| 31 | 37 | FrameLayout frame_hot1; |
| 32 | 38 | |
| 33 | 39 | FloatingActionButton floatingActionButton; |
| 34 | 40 | |
| 41 | + LinearLayout layout_control; | |
| 42 | + | |
| 35 | 43 | @Override |
| 36 | 44 | public int getLayoutId() { |
| 37 | 45 | return R.layout.fragment_ce_ping; |
| ... | ... | @@ -39,36 +47,16 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 39 | 47 | |
| 40 | 48 | @Override |
| 41 | 49 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 50 | + | |
| 42 | 51 | ivCamera=view.findViewById(R.id.ivCamera); |
| 43 | 52 | tvLocalAddress=view.findViewById(R.id.tvLocalAddress); |
| 44 | - textAndImg1=view.findViewById(R.id.textAndImg1); | |
| 45 | - textAndImg2=view.findViewById(R.id.textAndImg2); | |
| 46 | - textAndImg3=view.findViewById(R.id.textAndImg3); | |
| 47 | - textAndImg4=view.findViewById(R.id.textAndImg4); | |
| 48 | 53 | textAndImg_xqjc=view.findViewById(R.id.textAndImg_xqjc); |
| 49 | 54 | textAndImg_zxlx=view.findViewById(R.id.textAndImg_zxlx); |
| 50 | 55 | frame_hot1=view.findViewById(R.id.frame_hot1); |
| 56 | + layout_control=view.findViewById(R.id.layout_control); | |
| 51 | 57 | floatingActionButton=view.findViewById(R.id.floatingActionButton); |
| 52 | 58 | |
| 53 | - textAndImg1.setTextColor(R.color.textColor); | |
| 54 | - textAndImg1.setText("高校直通"); | |
| 55 | - textAndImg1.setImgs(R.drawable.play,R.drawable.gxzt); | |
| 56 | - textAndImg1.setSelect(true); | |
| 57 | - | |
| 58 | - textAndImg2.setTextColor(R.color.textColor); | |
| 59 | - textAndImg2.setText("专业查询"); | |
| 60 | - textAndImg2.setImgs(R.drawable.play,R.drawable.zycx); | |
| 61 | - textAndImg2.setSelect(true); | |
| 62 | - | |
| 63 | - textAndImg3.setTextColor(R.color.textColor); | |
| 64 | - textAndImg3.setText("传媒艺考"); | |
| 65 | - textAndImg3.setImgs(R.drawable.play,R.drawable.cmyk); | |
| 66 | - textAndImg3.setSelect(true); | |
| 67 | - | |
| 68 | - textAndImg4.setTextColor(R.color.textColor); | |
| 69 | - textAndImg4.setText("排行榜"); | |
| 70 | - textAndImg4.setImgs(R.drawable.play,R.drawable.phb); | |
| 71 | - textAndImg4.setSelect(true); | |
| 59 | + addTools(); | |
| 72 | 60 | |
| 73 | 61 | textAndImg_xqjc.setTextColor(R.color.white); |
| 74 | 62 | textAndImg_xqjc.setText("学情检测"); |
| ... | ... | @@ -84,6 +72,12 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 84 | 72 | floatingActionButton.setRippleColor(getResources().getColor(R.color.white)); |
| 85 | 73 | } |
| 86 | 74 | |
| 75 | + private void addTools() { | |
| 76 | + layout_control.measure(0,0); | |
| 77 | + mPresenter.getTools(layout_control); | |
| 78 | + | |
| 79 | + } | |
| 80 | + | |
| 87 | 81 | @Override |
| 88 | 82 | public void onResume() { |
| 89 | 83 | super.onResume(); |
| ... | ... | @@ -94,10 +88,6 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 94 | 88 | view.findViewById(R.id.frame_hot2).setOnClickListener(this); |
| 95 | 89 | view.findViewById(R.id.frame_hot3).setOnClickListener(this); |
| 96 | 90 | tvLocalAddress.setOnClickListener(this); |
| 97 | - textAndImg1.setOnClickListener(this); | |
| 98 | - textAndImg2.setOnClickListener(this); | |
| 99 | - textAndImg3.setOnClickListener(this); | |
| 100 | - textAndImg4.setOnClickListener(this); | |
| 101 | 91 | ivCamera.setOnClickListener(this); |
| 102 | 92 | |
| 103 | 93 | initBroadCast(); |
| ... | ... | @@ -114,7 +104,7 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 114 | 104 | @NonNull |
| 115 | 105 | @Override |
| 116 | 106 | public BasePresenter initPresenter() { |
| 117 | - return null; | |
| 107 | + return new CePingPresenter(); | |
| 118 | 108 | } |
| 119 | 109 | |
| 120 | 110 | |
| ... | ... | @@ -133,18 +123,6 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 133 | 123 | case R.id.tvLocalAddress: |
| 134 | 124 | AppContext.getInstance().startLocation(); |
| 135 | 125 | break; |
| 136 | - case R.id.textAndImg1: | |
| 137 | - | |
| 138 | - break; | |
| 139 | - case R.id.textAndImg2: | |
| 140 | - | |
| 141 | - break; | |
| 142 | - case R.id.textAndImg3: | |
| 143 | - | |
| 144 | - break; | |
| 145 | - case R.id.textAndImg4: | |
| 146 | - | |
| 147 | - break; | |
| 148 | 126 | case R.id.ivCamera: |
| 149 | 127 | ToastUtils.showToast("功能暂未上线"); |
| 150 | 128 | break; |
| ... | ... | @@ -165,4 +143,9 @@ public class CePingFragment extends BaseMVPCompatFragment implements View.OnClic |
| 165 | 143 | super.onDestroy(); |
| 166 | 144 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); |
| 167 | 145 | } |
| 146 | + | |
| 147 | + @Override | |
| 148 | + public void getTools() { | |
| 149 | + | |
| 150 | + } | |
| 168 | 151 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -12,6 +12,7 @@ import android.support.annotation.Nullable; |
| 12 | 12 | import android.util.Log; |
| 13 | 13 | import android.view.View; |
| 14 | 14 | import android.widget.ImageView; |
| 15 | +import android.widget.LinearLayout; | |
| 15 | 16 | import android.widget.TextView; |
| 16 | 17 | |
| 17 | 18 | import com.bumptech.glide.Glide; |
| ... | ... | @@ -19,6 +20,8 @@ import com.share.mvpsdk.base.BasePresenter; |
| 19 | 20 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 20 | 21 | import com.shunzhi.parent.AppContext; |
| 21 | 22 | import com.shunzhi.parent.R; |
| 23 | +import com.shunzhi.parent.contract.consult.ConsultContract; | |
| 24 | +import com.shunzhi.parent.presenter.consult.ConsultPresenter; | |
| 22 | 25 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
| 23 | 26 | import com.shunzhi.parent.views.TextAndImgShowView; |
| 24 | 27 | import com.stx.xhb.xbanner.XBanner; |
| ... | ... | @@ -31,12 +34,11 @@ import java.util.List; |
| 31 | 34 | |
| 32 | 35 | import cn.jzvd.JZVideoPlayerStandard; |
| 33 | 36 | |
| 34 | -public class ConsultFragment extends BaseMVPCompatFragment implements View.OnClickListener { | |
| 37 | +public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter,ConsultContract.IConsultModel> implements View.OnClickListener | |
| 38 | +,ConsultContract.IConsultView{ | |
| 35 | 39 | |
| 36 | 40 | ImageView ivSearch; |
| 37 | 41 | |
| 38 | - TextAndImgShowView textAndImg1, textAndImg2, textAndImg3, textAndImg4; | |
| 39 | - | |
| 40 | 42 | XBanner xBanner; |
| 41 | 43 | |
| 42 | 44 | List<String> imgesUrl = new ArrayList<>(); |
| ... | ... | @@ -45,6 +47,7 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 45 | 47 | |
| 46 | 48 | TextView tvLocalAddress; |
| 47 | 49 | |
| 50 | + LinearLayout layout_control; | |
| 48 | 51 | @Override |
| 49 | 52 | public int getLayoutId() { |
| 50 | 53 | return R.layout.fragment_zi_xun; |
| ... | ... | @@ -54,38 +57,16 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 54 | 57 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 55 | 58 | |
| 56 | 59 | ivSearch = view.findViewById(R.id.ivSearch); |
| 57 | - textAndImg1 = view.findViewById(R.id.textAndImg1); | |
| 58 | - textAndImg2 = view.findViewById(R.id.textAndImg2); | |
| 59 | - textAndImg3 = view.findViewById(R.id.textAndImg3); | |
| 60 | - textAndImg4 = view.findViewById(R.id.textAndImg4); | |
| 61 | 60 | xBanner = view.findViewById(R.id.xBanner); |
| 62 | 61 | videoplayer = view.findViewById(R.id.videoplayer); |
| 63 | 62 | tvLocalAddress = view.findViewById(R.id.tvLocalAddress); |
| 63 | + layout_control=view.findViewById(R.id.layout_control); | |
| 64 | 64 | |
| 65 | 65 | videoplayer.batteryLevel.setVisibility(View.GONE); |
| 66 | 66 | videoplayer.replayTextView.setVisibility(View.GONE); |
| 67 | 67 | videoplayer.backButton.setVisibility(View.GONE); |
| 68 | 68 | |
| 69 | - textAndImg1.setTextColor(R.color.textColor); | |
| 70 | - textAndImg1.setText("小学"); | |
| 71 | - textAndImg1.setImgs(R.drawable.play, R.drawable.xiaoxue); | |
| 72 | - textAndImg1.setSelect(true); | |
| 73 | - | |
| 74 | - textAndImg2.setTextColor(R.color.textColor); | |
| 75 | - textAndImg2.setText("中学"); | |
| 76 | - textAndImg2.setImgs(R.drawable.play, R.drawable.zhongxue); | |
| 77 | - textAndImg2.setSelect(true); | |
| 78 | - | |
| 79 | - textAndImg3.setTextColor(R.color.textColor); | |
| 80 | - textAndImg3.setText("高中"); | |
| 81 | - textAndImg3.setImgs(R.drawable.play, R.drawable.gaozhong); | |
| 82 | - textAndImg3.setSelect(true); | |
| 83 | - | |
| 84 | - textAndImg4.setTextColor(R.color.textColor); | |
| 85 | - textAndImg4.setText("家长"); | |
| 86 | - textAndImg4.setImgs(R.drawable.play, R.drawable.parent); | |
| 87 | - textAndImg4.setSelect(true); | |
| 88 | - | |
| 69 | + mPresenter.getTools(layout_control); | |
| 89 | 70 | initBanners(); |
| 90 | 71 | |
| 91 | 72 | initBroadCast(); |
| ... | ... | @@ -94,10 +75,6 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 94 | 75 | } |
| 95 | 76 | |
| 96 | 77 | private void initListeners() { |
| 97 | - textAndImg1.setOnClickListener(this); | |
| 98 | - textAndImg2.setOnClickListener(this); | |
| 99 | - textAndImg3.setOnClickListener(this); | |
| 100 | - textAndImg4.setOnClickListener(this); | |
| 101 | 78 | ivSearch.setOnClickListener(this); |
| 102 | 79 | tvLocalAddress.setOnClickListener(this); |
| 103 | 80 | } |
| ... | ... | @@ -127,7 +104,7 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 127 | 104 | @NonNull |
| 128 | 105 | @Override |
| 129 | 106 | public BasePresenter initPresenter() { |
| 130 | - return null; | |
| 107 | + return new ConsultPresenter(); | |
| 131 | 108 | } |
| 132 | 109 | |
| 133 | 110 | private byte[] InputStreamToByte(InputStream is) throws IOException { |
| ... | ... | @@ -160,18 +137,6 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 160 | 137 | case R.id.tvLocalAddress: |
| 161 | 138 | AppContext.getInstance().startLocation(); |
| 162 | 139 | break; |
| 163 | - case R.id.textAndImg1: | |
| 164 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 165 | - break; | |
| 166 | - case R.id.textAndImg2: | |
| 167 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 168 | - break; | |
| 169 | - case R.id.textAndImg3: | |
| 170 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 171 | - break; | |
| 172 | - case R.id.textAndImg4: | |
| 173 | - ConsultOneLevelActivity.getInstance(getActivity()); | |
| 174 | - break; | |
| 175 | 140 | case R.id.ivSearch://搜索按钮 |
| 176 | 141 | |
| 177 | 142 | break; |
| ... | ... | @@ -201,4 +166,9 @@ public class ConsultFragment extends BaseMVPCompatFragment implements View.OnCli |
| 201 | 166 | super.onDestroy(); |
| 202 | 167 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); |
| 203 | 168 | } |
| 169 | + | |
| 170 | + @Override | |
| 171 | + public void showTools() { | |
| 172 | + | |
| 173 | + } | |
| 204 | 174 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
| ... | ... | @@ -22,10 +22,14 @@ import com.share.mvpsdk.base.BasePresenter; |
| 22 | 22 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
| 23 | 23 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
| 24 | 24 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 25 | +import com.share.mvpsdk.utils.DisplayUtils; | |
| 25 | 26 | import com.share.mvpsdk.utils.ToastUtils; |
| 26 | 27 | import com.shunzhi.parent.AppContext; |
| 27 | 28 | import com.shunzhi.parent.R; |
| 28 | 29 | import com.shunzhi.parent.bean.GrallyBean; |
| 30 | +import com.shunzhi.parent.contract.consult.ConsultContract; | |
| 31 | +import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | |
| 32 | +import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; | |
| 29 | 33 | import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; |
| 30 | 34 | import com.shunzhi.parent.views.TextAndImgShowView; |
| 31 | 35 | |
| ... | ... | @@ -35,9 +39,9 @@ import java.io.InputStream; |
| 35 | 39 | import java.util.ArrayList; |
| 36 | 40 | import java.util.List; |
| 37 | 41 | |
| 38 | -public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements View.OnClickListener { | |
| 42 | +public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter,ConsultOneContract.IConsultOneModel> | |
| 43 | + implements View.OnClickListener,ConsultOneContract.IConsultOneView { | |
| 39 | 44 | |
| 40 | - TextAndImgShowView textAndImg1, textAndImg2, textAndImg3, textAndImg4; | |
| 41 | 45 | |
| 42 | 46 | RecyclerView recyclerViewGrally; |
| 43 | 47 | |
| ... | ... | @@ -74,71 +78,28 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements Vi |
| 74 | 78 | private void initViews(View view) { |
| 75 | 79 | |
| 76 | 80 | layout_control=view.findViewById(R.id.layout_control); |
| 77 | - for (int i = 0; i < 10; i++) { | |
| 78 | - TextAndImgShowView textAndImgShowView=new TextAndImgShowView(getContext()); | |
| 79 | - textAndImgShowView.setTextColor(R.color.textColor); | |
| 80 | - textAndImgShowView.setText("政策咨询"); | |
| 81 | - textAndImgShowView.setImgs(R.drawable.play, R.drawable.zczx); | |
| 82 | - textAndImgShowView.setSelect(true); | |
| 83 | - textAndImgShowView.setWidth(1); | |
| 84 | - layout_control.addView(textAndImgShowView); | |
| 85 | - } | |
| 86 | - | |
| 87 | - textAndImg1 = view.findViewById(R.id.textAndImg1); | |
| 88 | - textAndImg2 = view.findViewById(R.id.textAndImg2); | |
| 89 | - textAndImg3 = view.findViewById(R.id.textAndImg3); | |
| 90 | - textAndImg4 = view.findViewById(R.id.textAndImg4); | |
| 81 | + layout_control.measure(0,0); | |
| 82 | + mPresenter.getTools(layout_control); | |
| 91 | 83 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); |
| 92 | 84 | |
| 93 | - textAndImg1.setTextColor(R.color.textColor); | |
| 94 | - textAndImg1.setText("政策咨询"); | |
| 95 | - textAndImg1.setImgs(R.drawable.play, R.drawable.zczx); | |
| 96 | - textAndImg1.setSelect(true); | |
| 97 | - | |
| 98 | - textAndImg2.setTextColor(R.color.textColor); | |
| 99 | - textAndImg2.setText("公办/民办小学"); | |
| 100 | - textAndImg2.setImgs(R.drawable.play, R.drawable.gbxx); | |
| 101 | - textAndImg2.setSelect(true); | |
| 102 | - | |
| 103 | - textAndImg3.setTextColor(R.color.textColor); | |
| 104 | - textAndImg3.setText("学校库"); | |
| 105 | - textAndImg3.setImgs(R.drawable.play, R.drawable.xxk); | |
| 106 | - textAndImg3.setSelect(true); | |
| 107 | - | |
| 108 | - textAndImg4.setTextColor(R.color.textColor); | |
| 109 | - textAndImg4.setText("专题"); | |
| 110 | - textAndImg4.setImgs(R.drawable.play, R.drawable.zhuanti); | |
| 111 | - textAndImg4.setSelect(true); | |
| 112 | - | |
| 113 | - textAndImg1.setOnClickListener(this); | |
| 114 | - textAndImg2.setOnClickListener(this); | |
| 115 | - textAndImg3.setOnClickListener(this); | |
| 116 | - textAndImg4.setOnClickListener(this); | |
| 117 | 85 | initRecyclerView(); |
| 118 | 86 | } |
| 119 | 87 | |
| 120 | 88 | @NonNull |
| 121 | 89 | @Override |
| 122 | 90 | public BasePresenter initPresenter() { |
| 123 | - return null; | |
| 91 | + return new ConsultOnePresenter(); | |
| 124 | 92 | } |
| 125 | 93 | |
| 126 | 94 | @Override |
| 127 | 95 | public void onClick(View view) { |
| 128 | 96 | switch (view.getId()) { |
| 129 | - case R.id.textAndImg1: | |
| 130 | - startNewActivity(ConsultTwoLevelActivity.class); | |
| 131 | - break; | |
| 132 | - case R.id.textAndImg2: | |
| 133 | - | |
| 134 | - break; | |
| 135 | - case R.id.textAndImg3: | |
| 97 | + } | |
| 98 | + } | |
| 136 | 99 | |
| 137 | - break; | |
| 138 | - case R.id.textAndImg4: | |
| 100 | + @Override | |
| 101 | + public void showTools() { | |
| 139 | 102 | |
| 140 | - break; | |
| 141 | - } | |
| 142 | 103 | } |
| 143 | 104 | |
| 144 | 105 | private class MyGrallyAdapter extends BaseRecyclerViewAdapter<GrallyBean> { | ... | ... |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
| 1 | 1 | package com.shunzhi.parent.views; |
| 2 | 2 | |
| 3 | +import android.app.Activity; | |
| 3 | 4 | import android.content.Context; |
| 4 | 5 | import android.support.annotation.DrawableRes; |
| 5 | 6 | import android.support.annotation.Nullable; |
| 6 | 7 | import android.text.Layout; |
| 7 | 8 | import android.util.AttributeSet; |
| 9 | +import android.util.Log; | |
| 8 | 10 | import android.view.View; |
| 9 | 11 | import android.widget.FrameLayout; |
| 10 | 12 | import android.widget.ImageView; |
| ... | ... | @@ -67,13 +69,16 @@ public class TextAndImgShowView extends LinearLayout { |
| 67 | 69 | text.setText(content); |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | - public void setTextColor(int color){ | |
| 72 | + public void setTextColor(int color) { | |
| 71 | 73 | text.setTextColor(color); |
| 72 | 74 | } |
| 73 | 75 | |
| 74 | - public void setWidth(int width) { | |
| 75 | - LayoutParams params=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | |
| 76 | - params.width= DisplayUtils.px2dp(width); | |
| 76 | + public void setWidth(Activity activity, View layout_control) { | |
| 77 | + Log.d("66666", "layout_control=" + layout_control.getMeasuredWidth()); | |
| 78 | + LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | |
| 79 | + params.width = (DisplayUtils.getScreenWidthPixels(activity) - | |
| 80 | + DisplayUtils.dp2px(layout_control.getPaddingLeft() + layout_control.getPaddingRight() | |
| 81 | + )) / 4; | |
| 77 | 82 | layout.setLayoutParams(params); |
| 78 | 83 | } |
| 79 | 84 | } | ... | ... |
33.9 KB
4.81 KB
33.9 KB
app/src/main/res/layout/fragment_consult_one_level.xml
| ... | ... | @@ -4,6 +4,9 @@ |
| 4 | 4 | android:layout_height="match_parent" |
| 5 | 5 | android:orientation="vertical" |
| 6 | 6 | android:background="@color/bgColor" |
| 7 | + android:paddingTop="@dimen/size_dp_10" | |
| 8 | + android:paddingRight="@dimen/size_dp_10" | |
| 9 | + android:paddingLeft="@dimen/size_dp_10" | |
| 7 | 10 | tools:context="com.shunzhi.parent.ui.fragment.consult.ConsultOneLevelFragment"> |
| 8 | 11 | |
| 9 | 12 | <android.support.v7.widget.RecyclerView |
| ... | ... | @@ -11,20 +14,17 @@ |
| 11 | 14 | android:layout_width="match_parent" |
| 12 | 15 | android:layout_height="0dp" |
| 13 | 16 | android:layout_weight="1" |
| 14 | - android:layout_marginRight="@dimen/size_dp_10" | |
| 15 | - android:layout_marginTop="@dimen/size_dp_10" | |
| 16 | - android:layout_marginLeft="@dimen/size_dp_10" | |
| 17 | + android:layout_marginBottom="@dimen/size_dp_10" | |
| 17 | 18 | ></android.support.v7.widget.RecyclerView> |
| 18 | 19 | |
| 19 | 20 | <include layout="@layout/layout_textandimgshow"/> |
| 20 | 21 | |
| 21 | 22 | <android.support.v7.widget.RecyclerView |
| 23 | + android:layout_marginTop="@dimen/size_dp_10" | |
| 22 | 24 | android:layout_width="match_parent" |
| 23 | 25 | android:layout_height="0dp" |
| 24 | 26 | android:layout_weight="3" |
| 25 | 27 | android:background="@color/white" |
| 26 | - android:layout_marginLeft="@dimen/size_dp_10" | |
| 27 | - android:layout_marginRight="@dimen/size_dp_10" | |
| 28 | 28 | ></android.support.v7.widget.RecyclerView> |
| 29 | 29 | |
| 30 | 30 | </LinearLayout> | ... | ... |
app/src/main/res/layout/layout_consult_content.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 | android:layout_width="match_parent" |
| 4 | + android:layout_marginBottom="@dimen/size_dp_10" | |
| 4 | 5 | android:layout_height="wrap_content"> |
| 5 | 6 | <LinearLayout |
| 6 | 7 | android:layout_width="match_parent" | ... | ... |
app/src/main/res/layout/layout_textandimgshow.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | 3 | android:layout_width="match_parent" |
| 4 | 4 | android:layout_height="wrap_content" |
| 5 | - android:layout_margin="@dimen/size_dp_10" | |
| 6 | - android:layout_marginBottom="@dimen/size_dp_5" | |
| 7 | - android:layout_marginTop="@dimen/size_dp_5" | |
| 8 | - android:background="@color/white" | |
| 9 | 5 | android:orientation="horizontal" |
| 10 | - android:id="@+id/layout_control" | |
| 11 | - android:padding="@dimen/size_dp_10"> | |
| 6 | + android:scrollbars="none"> | |
| 12 | 7 | |
| 8 | + <HorizontalScrollView | |
| 9 | + android:layout_width="match_parent" | |
| 10 | + android:layout_height="wrap_content" | |
| 11 | + android:scrollbars="none" | |
| 13 | 12 | |
| 14 | - <com.shunzhi.parent.views.TextAndImgShowView | |
| 15 | - android:id="@+id/textAndImg1" | |
| 16 | - android:layout_width="0dp" | |
| 13 | + > | |
| 14 | + <LinearLayout | |
| 15 | + android:id="@+id/layout_control" | |
| 16 | + android:layout_width="match_parent" | |
| 17 | + android:layout_height="wrap_content" | |
| 18 | + android:layout_marginBottom="@dimen/size_dp_5" | |
| 19 | + android:layout_marginTop="@dimen/size_dp_5" | |
| 20 | + android:background="@color/white" | |
| 21 | + android:orientation="horizontal" | |
| 22 | + android:padding="@dimen/size_dp_10"> | |
| 23 | + | |
| 24 | + <LinearLayout | |
| 25 | + android:visibility="gone" | |
| 26 | + android:layout_width="wrap_content" | |
| 17 | 27 | android:layout_height="wrap_content" |
| 18 | - android:layout_weight="1" | |
| 19 | - android:background="?android:selectableItemBackground"> | |
| 28 | + android:orientation="horizontal"> | |
| 20 | 29 | |
| 21 | - </com.shunzhi.parent.views.TextAndImgShowView> | |
| 30 | + <com.shunzhi.parent.views.TextAndImgShowView | |
| 31 | + android:id="@+id/textAndImg1" | |
| 32 | + android:layout_width="0dp" | |
| 33 | + android:layout_height="wrap_content" | |
| 34 | + android:layout_weight="1" | |
| 35 | + android:background="?android:selectableItemBackground"> | |
| 22 | 36 | |
| 23 | - <com.shunzhi.parent.views.TextAndImgShowView | |
| 24 | - android:id="@+id/textAndImg2" | |
| 25 | - android:layout_width="0dp" | |
| 26 | - android:layout_height="wrap_content" | |
| 27 | - android:layout_weight="1" | |
| 28 | - android:background="?android:selectableItemBackground"> | |
| 37 | + </com.shunzhi.parent.views.TextAndImgShowView> | |
| 29 | 38 | |
| 30 | - </com.shunzhi.parent.views.TextAndImgShowView> | |
| 39 | + <com.shunzhi.parent.views.TextAndImgShowView | |
| 40 | + android:id="@+id/textAndImg2" | |
| 41 | + android:layout_width="0dp" | |
| 42 | + android:layout_height="wrap_content" | |
| 43 | + android:layout_weight="1" | |
| 44 | + android:background="?android:selectableItemBackground"> | |
| 31 | 45 | |
| 32 | - <com.shunzhi.parent.views.TextAndImgShowView | |
| 33 | - android:id="@+id/textAndImg3" | |
| 34 | - android:layout_width="0dp" | |
| 35 | - android:layout_height="wrap_content" | |
| 36 | - android:layout_weight="1" | |
| 37 | - android:background="?android:selectableItemBackground"> | |
| 46 | + </com.shunzhi.parent.views.TextAndImgShowView> | |
| 38 | 47 | |
| 39 | - </com.shunzhi.parent.views.TextAndImgShowView> | |
| 48 | + <com.shunzhi.parent.views.TextAndImgShowView | |
| 49 | + android:id="@+id/textAndImg3" | |
| 50 | + android:layout_width="0dp" | |
| 51 | + android:layout_height="wrap_content" | |
| 52 | + android:layout_weight="1" | |
| 53 | + android:background="?android:selectableItemBackground"> | |
| 40 | 54 | |
| 41 | - <com.shunzhi.parent.views.TextAndImgShowView | |
| 42 | - android:id="@+id/textAndImg4" | |
| 43 | - android:layout_width="0dp" | |
| 44 | - android:layout_height="wrap_content" | |
| 45 | - android:layout_weight="1" | |
| 46 | - android:background="?android:selectableItemBackground"> | |
| 55 | + </com.shunzhi.parent.views.TextAndImgShowView> | |
| 47 | 56 | |
| 48 | - </com.shunzhi.parent.views.TextAndImgShowView> | |
| 57 | + <com.shunzhi.parent.views.TextAndImgShowView | |
| 58 | + android:id="@+id/textAndImg4" | |
| 59 | + android:layout_width="0dp" | |
| 60 | + android:layout_height="wrap_content" | |
| 61 | + android:layout_weight="1" | |
| 62 | + android:background="?android:selectableItemBackground"> | |
| 49 | 63 | |
| 50 | -</LinearLayout> | |
| 51 | 64 | \ No newline at end of file |
| 65 | + </com.shunzhi.parent.views.TextAndImgShowView> | |
| 66 | + </LinearLayout> | |
| 67 | + </LinearLayout> | |
| 68 | + </HorizontalScrollView> | |
| 69 | +</android.support.design.widget.CoordinatorLayout> | |
| 52 | 70 | \ No newline at end of file | ... | ... |
mvpsdk/build.gradle
mvpsdk/src/main/java/com/share/mvpsdk/utils/DBUtils.java
| ... | ... | @@ -2,6 +2,7 @@ package com.share.mvpsdk.utils; |
| 2 | 2 | |
| 3 | 3 | import android.content.ContentValues; |
| 4 | 4 | import android.content.Context; |
| 5 | +import android.content.SharedPreferences; | |
| 5 | 6 | import android.database.Cursor; |
| 6 | 7 | import android.database.sqlite.SQLiteDatabase; |
| 7 | 8 | import android.database.sqlite.SQLiteOpenHelper; | ... | ... |