Commit b0b98d12fa764790db61a45619af7b618336b5b2
1 parent
a56f821a
Exists in
yxb_dev
and in
2 other branches
no message
Showing
9 changed files
with
220 additions
and
75 deletions
Show diff stats
app/src/main/AndroidManifest.xml
| ... | ... | @@ -96,6 +96,9 @@ |
| 96 | 96 | android:screenOrientation="portrait" |
| 97 | 97 | android:windowSoftInputMode="adjustPan|stateHidden" /> |
| 98 | 98 | <activity android:name=".ui.activity.consult.ConsultTwoLevelActivity"></activity> |
| 99 | + <activity android:name=".ui.MainActivity" | |
| 100 | + android:screenOrientation="portrait" | |
| 101 | + /> | |
| 99 | 102 | </application> |
| 100 | 103 | |
| 101 | 104 | </manifest> |
| 102 | 105 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/MyConsultBean.java
0 → 100644
| ... | ... | @@ -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/13. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +public class MyConsultBean implements Serializable { | |
| 10 | + | |
| 11 | + public String consultTitle; | |
| 12 | + | |
| 13 | + public String consultContent; | |
| 14 | + | |
| 15 | + public String consultCounts; | |
| 16 | + | |
| 17 | + public String consultZhuanfaCounts; | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public String toString() { | |
| 21 | + return "MyConsultBean{" + | |
| 22 | + "consultTitle='" + consultTitle + '\'' + | |
| 23 | + ", consultContent='" + consultContent + '\'' + | |
| 24 | + ", consultCounts='" + consultCounts + '\'' + | |
| 25 | + ", consultZhuanfaCounts='" + consultZhuanfaCounts + '\'' + | |
| 26 | + '}'; | |
| 27 | + } | |
| 28 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
| ... | ... | @@ -2,26 +2,40 @@ package com.shunzhi.parent.ui.activity.consult; |
| 2 | 2 | |
| 3 | 3 | import android.support.annotation.NonNull; |
| 4 | 4 | import android.support.annotation.Nullable; |
| 5 | -import android.support.v7.app.AppCompatActivity; | |
| 6 | 5 | import android.os.Bundle; |
| 6 | +import android.support.v7.widget.LinearLayoutManager; | |
| 7 | +import android.support.v7.widget.RecyclerView; | |
| 8 | +import android.view.LayoutInflater; | |
| 7 | 9 | import android.view.View; |
| 10 | +import android.view.ViewGroup; | |
| 8 | 11 | import android.widget.EditText; |
| 9 | 12 | import android.widget.ImageView; |
| 10 | 13 | import android.widget.TextView; |
| 11 | 14 | |
| 12 | 15 | import com.share.mvpsdk.base.BasePresenter; |
| 13 | -import com.share.mvpsdk.base.activity.BaseCompatActivity; | |
| 16 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | |
| 17 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | |
| 14 | 18 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
| 15 | 19 | import com.shunzhi.parent.R; |
| 20 | +import com.shunzhi.parent.bean.MyConsultBean; | |
| 16 | 21 | |
| 17 | -public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements View.OnClickListener{ | |
| 22 | +import java.util.ArrayList; | |
| 23 | +import java.util.List; | |
| 18 | 24 | |
| 19 | - ImageView ivBack,ivSearch; | |
| 25 | +public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements View.OnClickListener { | |
| 26 | + | |
| 27 | + ImageView ivBack, ivSearch; | |
| 20 | 28 | |
| 21 | 29 | EditText et_search; |
| 22 | 30 | |
| 23 | 31 | TextView tvContentName; |
| 24 | 32 | |
| 33 | + RecyclerView recyclerView; | |
| 34 | + | |
| 35 | + MyTwoLevelAdapter myTwoLevelAdapter = null; | |
| 36 | + | |
| 37 | + List<MyConsultBean> myConsultBeanList = new ArrayList<>(); | |
| 38 | + | |
| 25 | 39 | @Override |
| 26 | 40 | public int getLayoutId() { |
| 27 | 41 | return R.layout.activity_consult_two_level; |
| ... | ... | @@ -36,17 +50,35 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements Vi |
| 36 | 50 | |
| 37 | 51 | private void initViews(View view) { |
| 38 | 52 | |
| 39 | - ivBack=view.findViewById(R.id.ivBack); | |
| 53 | + ivBack = view.findViewById(R.id.ivBack); | |
| 40 | 54 | ivBack.setOnClickListener(this); |
| 41 | 55 | |
| 42 | - et_search=view.findViewById(R.id.et_search); | |
| 56 | + et_search = view.findViewById(R.id.et_search); | |
| 43 | 57 | |
| 44 | - ivSearch=view.findViewById(R.id.ivSearch); | |
| 58 | + ivSearch = view.findViewById(R.id.ivSearch); | |
| 45 | 59 | ivSearch.setOnClickListener(this); |
| 46 | 60 | |
| 47 | - tvContentName=view.findViewById(R.id.tvContentName); | |
| 61 | + tvContentName = view.findViewById(R.id.tvContentName); | |
| 48 | 62 | tvContentName.setText(""); |
| 49 | 63 | |
| 64 | + recyclerView = view.findViewById(R.id.recyclerView); | |
| 65 | + | |
| 66 | + initRecyclerView(); | |
| 67 | + } | |
| 68 | + | |
| 69 | + private void initRecyclerView() { | |
| 70 | + | |
| 71 | + if (null == myTwoLevelAdapter) myTwoLevelAdapter = new MyTwoLevelAdapter(); | |
| 72 | + for (int i = 0; i < 12; i++) { | |
| 73 | + MyConsultBean myConsultBean = new MyConsultBean(); | |
| 74 | + myConsultBean.consultCounts = i + ""; | |
| 75 | + myConsultBean.consultContent = "咨询内容" + i; | |
| 76 | + myConsultBean.consultTitle = "咨询标题" + i; | |
| 77 | + myConsultBean.consultZhuanfaCounts = "转发:" + i; | |
| 78 | + myConsultBeanList.add(myConsultBean); | |
| 79 | + } | |
| 80 | + myTwoLevelAdapter.addAll(myConsultBeanList); | |
| 81 | + recyclerView.setAdapter(myTwoLevelAdapter); | |
| 50 | 82 | } |
| 51 | 83 | |
| 52 | 84 | @NonNull |
| ... | ... | @@ -57,7 +89,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements Vi |
| 57 | 89 | |
| 58 | 90 | @Override |
| 59 | 91 | public void onClick(View view) { |
| 60 | - switch (view.getId()){ | |
| 92 | + switch (view.getId()) { | |
| 61 | 93 | case R.id.ivBack: |
| 62 | 94 | back(); |
| 63 | 95 | break; |
| ... | ... | @@ -66,4 +98,46 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatFragment implements Vi |
| 66 | 98 | break; |
| 67 | 99 | } |
| 68 | 100 | } |
| 101 | + | |
| 102 | + | |
| 103 | + private class MyTwoLevelAdapter extends BaseRecyclerViewAdapter { | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public void onAttachedToRecyclerView(RecyclerView recyclerView) { | |
| 107 | + super.onAttachedToRecyclerView(recyclerView); | |
| 108 | + LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); | |
| 109 | + recyclerView.setLayoutManager(layoutManager); | |
| 110 | + } | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
| 114 | + View view = LayoutInflater.from(getActivity()).inflate(R.layout.layout_consult_content, parent, false); | |
| 115 | + return new MyTwoLevelViewHolder(view); | |
| 116 | + } | |
| 117 | + | |
| 118 | + private class MyTwoLevelViewHolder extends BaseRecyclerViewHolder { | |
| 119 | + | |
| 120 | + TextView tvConsultTitle, tvConsultContent, tvPingLunNums, tvZhuanFaNums; | |
| 121 | + ImageView iv_consult; | |
| 122 | + | |
| 123 | + public MyTwoLevelViewHolder(View itemView) { | |
| 124 | + super(itemView); | |
| 125 | + | |
| 126 | + tvConsultTitle = itemView.findViewById(R.id.tvConsultTitle); | |
| 127 | + tvConsultContent = itemView.findViewById(R.id.tvConsultContent); | |
| 128 | + tvPingLunNums = itemView.findViewById(R.id.tvPingLunNums); | |
| 129 | + tvZhuanFaNums = itemView.findViewById(R.id.tvZhuanFaNums); | |
| 130 | + iv_consult = itemView.findViewById(R.id.iv_consult); | |
| 131 | + | |
| 132 | + } | |
| 133 | + | |
| 134 | + @Override | |
| 135 | + public void onBindViewHolder(Object object, int position) { | |
| 136 | + | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + | |
| 141 | + } | |
| 142 | + | |
| 69 | 143 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
| ... | ... | @@ -5,6 +5,7 @@ import android.net.Uri; |
| 5 | 5 | import android.os.Bundle; |
| 6 | 6 | import android.support.annotation.NonNull; |
| 7 | 7 | import android.support.annotation.Nullable; |
| 8 | +import android.support.design.widget.TabLayout; | |
| 8 | 9 | import android.support.v4.app.Fragment; |
| 9 | 10 | import android.support.v7.widget.LinearLayoutManager; |
| 10 | 11 | import android.support.v7.widget.RecyclerView; |
| ... | ... | @@ -13,6 +14,7 @@ import android.view.LayoutInflater; |
| 13 | 14 | import android.view.View; |
| 14 | 15 | import android.view.ViewGroup; |
| 15 | 16 | import android.widget.ImageView; |
| 17 | +import android.widget.LinearLayout; | |
| 16 | 18 | import android.widget.TextView; |
| 17 | 19 | |
| 18 | 20 | import com.bumptech.glide.Glide; |
| ... | ... | @@ -24,6 +26,7 @@ import com.share.mvpsdk.utils.ToastUtils; |
| 24 | 26 | import com.shunzhi.parent.AppContext; |
| 25 | 27 | import com.shunzhi.parent.R; |
| 26 | 28 | import com.shunzhi.parent.bean.GrallyBean; |
| 29 | +import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; | |
| 27 | 30 | import com.shunzhi.parent.views.TextAndImgShowView; |
| 28 | 31 | |
| 29 | 32 | import java.io.ByteArrayOutputStream; |
| ... | ... | @@ -42,6 +45,8 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements Vi |
| 42 | 45 | |
| 43 | 46 | List<GrallyBean> grallyBeanList = new ArrayList<>(); |
| 44 | 47 | |
| 48 | + LinearLayout layout_control; | |
| 49 | + | |
| 45 | 50 | @Override |
| 46 | 51 | public int getLayoutId() { |
| 47 | 52 | return R.layout.fragment_consult_one_level; |
| ... | ... | @@ -68,6 +73,17 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements Vi |
| 68 | 73 | |
| 69 | 74 | private void initViews(View view) { |
| 70 | 75 | |
| 76 | + 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 | + | |
| 71 | 87 | textAndImg1 = view.findViewById(R.id.textAndImg1); |
| 72 | 88 | textAndImg2 = view.findViewById(R.id.textAndImg2); |
| 73 | 89 | textAndImg3 = view.findViewById(R.id.textAndImg3); |
| ... | ... | @@ -111,7 +127,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment implements Vi |
| 111 | 127 | public void onClick(View view) { |
| 112 | 128 | switch (view.getId()) { |
| 113 | 129 | case R.id.textAndImg1: |
| 114 | - | |
| 130 | + startNewActivity(ConsultTwoLevelActivity.class); | |
| 115 | 131 | break; |
| 116 | 132 | case R.id.textAndImg2: |
| 117 | 133 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
| ... | ... | @@ -24,6 +24,7 @@ import com.share.mvpsdk.utils.ToastUtils; |
| 24 | 24 | import com.shunzhi.parent.R; |
| 25 | 25 | import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; |
| 26 | 26 | import com.shunzhi.parent.presenter.loginandregister.LoginAndRegisterPresenter; |
| 27 | +import com.shunzhi.parent.ui.MainActivity; | |
| 27 | 28 | import com.shunzhi.parent.ui.activity.LoginAndRegistActivity; |
| 28 | 29 | |
| 29 | 30 | |
| ... | ... | @@ -90,6 +91,13 @@ public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegist |
| 90 | 91 | tv_info.setText("已注册,直接登录"); |
| 91 | 92 | tv_goto.setText("登录"); |
| 92 | 93 | } |
| 94 | + | |
| 95 | + roundedImageView.setOnClickListener(new View.OnClickListener() { | |
| 96 | + @Override | |
| 97 | + public void onClick(View view) { | |
| 98 | + startNewActivity(MainActivity.class); | |
| 99 | + } | |
| 100 | + }); | |
| 93 | 101 | } |
| 94 | 102 | |
| 95 | 103 | ... | ... |
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
| ... | ... | @@ -3,6 +3,7 @@ package com.shunzhi.parent.views; |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.support.annotation.DrawableRes; |
| 5 | 5 | import android.support.annotation.Nullable; |
| 6 | +import android.text.Layout; | |
| 6 | 7 | import android.util.AttributeSet; |
| 7 | 8 | import android.view.View; |
| 8 | 9 | import android.widget.FrameLayout; |
| ... | ... | @@ -10,6 +11,7 @@ import android.widget.ImageView; |
| 10 | 11 | import android.widget.LinearLayout; |
| 11 | 12 | import android.widget.TextView; |
| 12 | 13 | |
| 14 | +import com.share.mvpsdk.utils.DisplayUtils; | |
| 13 | 15 | import com.shunzhi.parent.R; |
| 14 | 16 | |
| 15 | 17 | |
| ... | ... | @@ -68,4 +70,10 @@ public class TextAndImgShowView extends LinearLayout { |
| 68 | 70 | public void setTextColor(int color){ |
| 69 | 71 | text.setTextColor(color); |
| 70 | 72 | } |
| 73 | + | |
| 74 | + public void setWidth(int width) { | |
| 75 | + LayoutParams params=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | |
| 76 | + params.width= DisplayUtils.px2dp(width); | |
| 77 | + layout.setLayoutParams(params); | |
| 78 | + } | |
| 71 | 79 | } | ... | ... |
app/src/main/res/layout/fragment_zi_xun.xml
| ... | ... | @@ -28,71 +28,7 @@ |
| 28 | 28 | android:textColor="@color/xueqing_blue" |
| 29 | 29 | android:textSize="@dimen/textSize16" /> |
| 30 | 30 | |
| 31 | - <LinearLayout | |
| 32 | - android:layout_width="match_parent" | |
| 33 | - android:layout_height="match_parent" | |
| 34 | - android:layout_marginLeft="@dimen/size_dp_10" | |
| 35 | - android:layout_marginRight="@dimen/size_dp_10" | |
| 36 | - android:background="@color/white"> | |
| 37 | - | |
| 38 | - <LinearLayout | |
| 39 | - android:layout_width="0dp" | |
| 40 | - android:layout_height="match_parent" | |
| 41 | - android:layout_weight="4" | |
| 42 | - android:orientation="vertical" | |
| 43 | - android:padding="@dimen/size_dp_5"> | |
| 44 | - | |
| 45 | - <TextView | |
| 46 | - android:id="@+id/tvConsultTitle" | |
| 47 | - android:layout_width="match_parent" | |
| 48 | - android:layout_height="wrap_content" | |
| 49 | - android:ellipsize="end" | |
| 50 | - android:gravity="center_vertical" | |
| 51 | - android:maxLines="2" | |
| 52 | - android:text="学校初一段家长统一测试使用家长慧得到良好反馈评价" | |
| 53 | - android:textColor="@color/textColor" | |
| 54 | - android:textSize="@dimen/textSize14" /> | |
| 55 | - | |
| 56 | - <TextView | |
| 57 | - android:id="@+id/tvConsultContent" | |
| 58 | - android:layout_width="match_parent" | |
| 59 | - android:layout_height="wrap_content" | |
| 60 | - android:layout_marginTop="@dimen/size_dp_5" | |
| 61 | - android:ellipsize="end" | |
| 62 | - android:gravity="center_vertical" | |
| 63 | - android:maxLines="2" | |
| 64 | - android:singleLine="true" | |
| 65 | - android:text="家长表示对孩子学习情况更加了解" | |
| 66 | - android:textColor="@color/zxlx" | |
| 67 | - android:textSize="@dimen/textSize14" /> | |
| 68 | - | |
| 69 | - <FrameLayout | |
| 70 | - android:layout_width="match_parent" | |
| 71 | - android:layout_height="wrap_content" | |
| 72 | - android:layout_marginTop="@dimen/size_dp_5"> | |
| 73 | - | |
| 74 | - <TextView | |
| 75 | - android:id="@+id/tvPingLunNums" | |
| 76 | - style="@style/TextView_Wrap_16" | |
| 77 | - android:layout_gravity="center_vertical" | |
| 78 | - android:text="评论:30" | |
| 79 | - android:textSize="@dimen/textSize14" /> | |
| 80 | - | |
| 81 | - <TextView | |
| 82 | - android:id="@+id/tvZhuanFaNums" | |
| 83 | - style="@style/TextView_Wrap_16" | |
| 84 | - android:layout_gravity="right|center_vertical" | |
| 85 | - android:text="转发:50" | |
| 86 | - android:textSize="@dimen/textSize14" /> | |
| 87 | - </FrameLayout> | |
| 88 | - </LinearLayout> | |
| 89 | - | |
| 90 | - <ImageView | |
| 91 | - android:layout_width="0dp" | |
| 92 | - android:layout_height="match_parent" | |
| 93 | - android:layout_weight="2" | |
| 94 | - android:src="@color/xueqing_blue" /> | |
| 95 | - </LinearLayout> | |
| 31 | + <include layout="@layout/layout_consult_content"/> | |
| 96 | 32 | |
| 97 | 33 | </LinearLayout> |
| 98 | 34 | ... | ... |
| ... | ... | @@ -0,0 +1,71 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:layout_height="wrap_content"> | |
| 5 | + <LinearLayout | |
| 6 | + android:layout_width="match_parent" | |
| 7 | + android:layout_height="match_parent" | |
| 8 | + android:layout_marginLeft="@dimen/size_dp_10" | |
| 9 | + android:layout_marginRight="@dimen/size_dp_10" | |
| 10 | + android:background="@color/white"> | |
| 11 | + | |
| 12 | + <LinearLayout | |
| 13 | + android:layout_width="0dp" | |
| 14 | + android:layout_height="match_parent" | |
| 15 | + android:layout_weight="4" | |
| 16 | + android:orientation="vertical" | |
| 17 | + android:padding="@dimen/size_dp_5"> | |
| 18 | + | |
| 19 | + <TextView | |
| 20 | + android:id="@+id/tvConsultTitle" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="wrap_content" | |
| 23 | + android:ellipsize="end" | |
| 24 | + android:gravity="center_vertical" | |
| 25 | + android:maxLines="2" | |
| 26 | + android:text="学校初一段家长统一测试使用家长慧得到良好反馈评价" | |
| 27 | + android:textColor="@color/textColor" | |
| 28 | + android:textSize="@dimen/textSize14" /> | |
| 29 | + | |
| 30 | + <TextView | |
| 31 | + android:id="@+id/tvConsultContent" | |
| 32 | + android:layout_width="match_parent" | |
| 33 | + android:layout_height="wrap_content" | |
| 34 | + android:layout_marginTop="@dimen/size_dp_5" | |
| 35 | + android:ellipsize="end" | |
| 36 | + android:gravity="center_vertical" | |
| 37 | + android:maxLines="2" | |
| 38 | + android:singleLine="true" | |
| 39 | + android:text="家长表示对孩子学习情况更加了解" | |
| 40 | + android:textColor="@color/zxlx" | |
| 41 | + android:textSize="@dimen/textSize14" /> | |
| 42 | + | |
| 43 | + <FrameLayout | |
| 44 | + android:layout_width="match_parent" | |
| 45 | + android:layout_height="wrap_content" | |
| 46 | + android:layout_marginTop="@dimen/size_dp_5"> | |
| 47 | + | |
| 48 | + <TextView | |
| 49 | + android:id="@+id/tvPingLunNums" | |
| 50 | + style="@style/TextView_Wrap_16" | |
| 51 | + android:layout_gravity="center_vertical" | |
| 52 | + android:text="评论:30" | |
| 53 | + android:textSize="@dimen/textSize14" /> | |
| 54 | + | |
| 55 | + <TextView | |
| 56 | + android:id="@+id/tvZhuanFaNums" | |
| 57 | + style="@style/TextView_Wrap_16" | |
| 58 | + android:layout_gravity="right|center_vertical" | |
| 59 | + android:text="转发:50" | |
| 60 | + android:textSize="@dimen/textSize14" /> | |
| 61 | + </FrameLayout> | |
| 62 | + </LinearLayout> | |
| 63 | + | |
| 64 | + <ImageView | |
| 65 | + android:id="@+id/iv_consult" | |
| 66 | + android:layout_width="0dp" | |
| 67 | + android:layout_height="match_parent" | |
| 68 | + android:layout_weight="2" | |
| 69 | + android:src="@color/xueqing_blue" /> | |
| 70 | + </LinearLayout> | |
| 71 | +</LinearLayout> | |
| 0 | 72 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/layout_textandimgshow.xml