Commit 02c439f84eef711db0e08b15e2f40ba52b56eb54
Exists in
yxb_dev
and in
2 other branches
Merge branch 'yxb_dev' of http://git.shunzhi.net/taohd/parentwork into yxb_dev
Showing
13 changed files
with
206 additions
and
93 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/adapter/MyConsultAdapter.java
0 → 100644
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +package com.shunzhi.parent.adapter; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.support.v7.widget.LinearLayoutManager; | ||
5 | +import android.support.v7.widget.RecyclerView; | ||
6 | +import android.view.LayoutInflater; | ||
7 | +import android.view.View; | ||
8 | +import android.view.ViewGroup; | ||
9 | +import android.widget.ImageView; | ||
10 | +import android.widget.TextView; | ||
11 | + | ||
12 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | ||
13 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | ||
14 | +import com.shunzhi.parent.R; | ||
15 | +import com.shunzhi.parent.bean.MyConsultBean; | ||
16 | +import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; | ||
17 | + | ||
18 | +/** | ||
19 | + * Created by ToaHanDong on 2018/3/14. | ||
20 | + */ | ||
21 | + | ||
22 | +public class MyConsultAdapter extends BaseRecyclerViewAdapter<MyConsultBean> { | ||
23 | + | ||
24 | + private Context mContext=null; | ||
25 | + | ||
26 | + public MyConsultAdapter(Context context){ | ||
27 | + mContext=context; | ||
28 | + } | ||
29 | + | ||
30 | + @Override | ||
31 | + public void onAttachedToRecyclerView(RecyclerView recyclerView) { | ||
32 | + super.onAttachedToRecyclerView(recyclerView); | ||
33 | + LinearLayoutManager layoutManager=new LinearLayoutManager(mContext); | ||
34 | + layoutManager.setOrientation(LinearLayoutManager.VERTICAL); | ||
35 | + recyclerView.setLayoutManager(layoutManager); | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
40 | + View view = LayoutInflater.from(mContext).inflate(R.layout.layout_consult_content, parent, false); | ||
41 | + return new MyConsultViewHolder(view); | ||
42 | + } | ||
43 | + | ||
44 | + private class MyConsultViewHolder extends BaseRecyclerViewHolder<MyConsultBean>{ | ||
45 | + | ||
46 | + TextView tvConsultTitle, tvConsultContent, tvPingLunNums, tvZhuanFaNums; | ||
47 | + ImageView iv_consult; | ||
48 | + public MyConsultViewHolder(View itemView) { | ||
49 | + super(itemView); | ||
50 | + tvConsultTitle = itemView.findViewById(R.id.tvConsultTitle); | ||
51 | + tvConsultContent = itemView.findViewById(R.id.tvConsultContent); | ||
52 | + tvPingLunNums = itemView.findViewById(R.id.tvPingLunNums); | ||
53 | + tvZhuanFaNums = itemView.findViewById(R.id.tvZhuanFaNums); | ||
54 | + iv_consult = itemView.findViewById(R.id.iv_consult); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public void onBindViewHolder(MyConsultBean object, int position) { | ||
59 | + tvConsultContent.setText(object.consultContent); | ||
60 | + tvConsultTitle.setText(object.consultTitle); | ||
61 | + tvPingLunNums.setText(object.consultCounts); | ||
62 | + tvZhuanFaNums.setText(object.consultZhuanfaCounts); | ||
63 | + } | ||
64 | + } | ||
65 | +} |
app/src/main/java/com/shunzhi/parent/presenter/ceping/CePingPresenter.java
1 | package com.shunzhi.parent.presenter.ceping; | 1 | package com.shunzhi.parent.presenter.ceping; |
2 | 2 | ||
3 | -import android.content.res.TypedArray; | ||
4 | -import android.util.TypedValue; | ||
5 | import android.view.View; | 3 | import android.view.View; |
6 | import android.widget.LinearLayout; | 4 | import android.widget.LinearLayout; |
7 | 5 | ||
@@ -9,6 +7,7 @@ import com.shunzhi.parent.R; | @@ -9,6 +7,7 @@ import com.shunzhi.parent.R; | ||
9 | import com.shunzhi.parent.bean.ToolBean; | 7 | import com.shunzhi.parent.bean.ToolBean; |
10 | import com.shunzhi.parent.contract.ceping.CepingContract; | 8 | import com.shunzhi.parent.contract.ceping.CepingContract; |
11 | import com.shunzhi.parent.model.CePingModel; | 9 | import com.shunzhi.parent.model.CePingModel; |
10 | +import com.shunzhi.parent.util.AttrsUtils; | ||
12 | import com.shunzhi.parent.views.TextAndImgShowView; | 11 | import com.shunzhi.parent.views.TextAndImgShowView; |
13 | 12 | ||
14 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
@@ -26,11 +25,6 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | @@ -26,11 +25,6 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | ||
26 | toolBeanList.add(new ToolBean(R.drawable.zycx+"","专业查询")); | 25 | toolBeanList.add(new ToolBean(R.drawable.zycx+"","专业查询")); |
27 | toolBeanList.add(new ToolBean(R.drawable.cmyk+"","传媒艺考")); | 26 | toolBeanList.add(new ToolBean(R.drawable.cmyk+"","传媒艺考")); |
28 | toolBeanList.add(new ToolBean(R.drawable.phb+"","排行榜")); | 27 | 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++) { | 28 | for (int i = 0; i < toolBeanList.size(); i++) { |
35 | TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | 29 | TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); |
36 | textAndImgShowView.setTextColor(R.color.textColor); | 30 | textAndImgShowView.setTextColor(R.color.textColor); |
@@ -38,11 +32,7 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | @@ -38,11 +32,7 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | ||
38 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 32 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); |
39 | textAndImgShowView.setSelect(true); | 33 | textAndImgShowView.setSelect(true); |
40 | textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | 34 | 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)); | 35 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); |
46 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 36 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
47 | @Override | 37 | @Override |
48 | public void onClick(View view) { | 38 | public void onClick(View view) { |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
@@ -10,6 +10,7 @@ import com.shunzhi.parent.bean.ToolBean; | @@ -10,6 +10,7 @@ import com.shunzhi.parent.bean.ToolBean; | ||
10 | import com.shunzhi.parent.contract.consult.ConsultContract; | 10 | import com.shunzhi.parent.contract.consult.ConsultContract; |
11 | import com.shunzhi.parent.model.consult.ConsultModel; | 11 | import com.shunzhi.parent.model.consult.ConsultModel; |
12 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | 12 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
13 | +import com.shunzhi.parent.util.AttrsUtils; | ||
13 | import com.shunzhi.parent.views.TextAndImgShowView; | 14 | import com.shunzhi.parent.views.TextAndImgShowView; |
14 | 15 | ||
15 | import java.util.ArrayList; | 16 | import java.util.ArrayList; |
@@ -34,11 +35,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | @@ -34,11 +35,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | ||
34 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 35 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); |
35 | textAndImgShowView.setSelect(true); | 36 | textAndImgShowView.setSelect(true); |
36 | textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | 37 | 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)); | 38 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); |
42 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 39 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
43 | @Override | 40 | @Override |
44 | public void onClick(View view) { | 41 | public void onClick(View view) { |
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
1 | package com.shunzhi.parent.presenter.consult.consultone; | 1 | package com.shunzhi.parent.presenter.consult.consultone; |
2 | 2 | ||
3 | +import android.view.View; | ||
3 | import android.widget.LinearLayout; | 4 | import android.widget.LinearLayout; |
4 | 5 | ||
5 | import com.shunzhi.parent.R; | 6 | import com.shunzhi.parent.R; |
6 | import com.shunzhi.parent.bean.ToolBean; | 7 | import com.shunzhi.parent.bean.ToolBean; |
7 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | 8 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; |
8 | import com.shunzhi.parent.model.consult.consultone.ConsultOneModel; | 9 | import com.shunzhi.parent.model.consult.consultone.ConsultOneModel; |
10 | +import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; | ||
11 | +import com.shunzhi.parent.util.AttrsUtils; | ||
9 | import com.shunzhi.parent.views.TextAndImgShowView; | 12 | import com.shunzhi.parent.views.TextAndImgShowView; |
10 | 13 | ||
11 | import java.util.ArrayList; | 14 | import java.util.ArrayList; |
@@ -31,7 +34,14 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | @@ -31,7 +34,14 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | ||
31 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 34 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); |
32 | textAndImgShowView.setSelect(true); | 35 | textAndImgShowView.setSelect(true); |
33 | textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | 36 | textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); |
37 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | ||
34 | layout_control.addView(textAndImgShowView); | 38 | layout_control.addView(textAndImgShowView); |
39 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | ||
40 | + @Override | ||
41 | + public void onClick(View view) { | ||
42 | + ConsultTwoLevelActivity.getInstance(mIView.getBindActivity()); | ||
43 | + } | ||
44 | + }); | ||
35 | } | 45 | } |
36 | mIView.showTools(); | 46 | mIView.showTools(); |
37 | } | 47 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/binding/SelectSchoolActivity.java
@@ -27,12 +27,15 @@ import java.util.Collections; | @@ -27,12 +27,15 @@ import java.util.Collections; | ||
27 | import java.util.Comparator; | 27 | import java.util.Comparator; |
28 | import java.util.List; | 28 | import java.util.List; |
29 | 29 | ||
30 | +import me.leefeng.citypicker.CityPicker; | ||
31 | +import me.leefeng.citypicker.CityPickerListener; | ||
32 | + | ||
30 | /** | 33 | /** |
31 | * Created by Administrator on 2018/3/12 0012. | 34 | * Created by Administrator on 2018/3/12 0012. |
32 | */ | 35 | */ |
33 | 36 | ||
34 | public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContract.SchoolListPrasenter, SchoolListContract.ISchoolListModel> implements | 37 | public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContract.SchoolListPrasenter, SchoolListContract.ISchoolListModel> implements |
35 | - View.OnClickListener, SchoolListContract.ISchoolListView { | 38 | + View.OnClickListener, SchoolListContract.ISchoolListView,CityPickerListener { |
36 | 39 | ||
37 | private SideBar sideBar; | 40 | private SideBar sideBar; |
38 | private TextView dialog, go_next, tvLocalAddress; | 41 | private TextView dialog, go_next, tvLocalAddress; |
@@ -40,6 +43,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -40,6 +43,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
40 | private List<String> list = new ArrayList<>(); | 43 | private List<String> list = new ArrayList<>(); |
41 | SchoolListAdapter schoolListAdapter; | 44 | SchoolListAdapter schoolListAdapter; |
42 | 45 | ||
46 | + CityPicker cityPicker=null; | ||
43 | @NonNull | 47 | @NonNull |
44 | @Override | 48 | @Override |
45 | public BasePresenter initPresenter() { | 49 | public BasePresenter initPresenter() { |
@@ -53,6 +57,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -53,6 +57,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
53 | go_next = findViewById(R.id.go_next); | 57 | go_next = findViewById(R.id.go_next); |
54 | go_next.setOnClickListener(this); | 58 | go_next.setOnClickListener(this); |
55 | tvLocalAddress = findViewById(R.id.tvLocalAddress); | 59 | tvLocalAddress = findViewById(R.id.tvLocalAddress); |
60 | + tvLocalAddress.setOnClickListener(this); | ||
56 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 61 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
57 | setSchoolList(); | 62 | setSchoolList(); |
58 | 63 | ||
@@ -159,6 +164,10 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -159,6 +164,10 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
159 | } else { | 164 | } else { |
160 | ToastUtils.showToast("请选择学校"); | 165 | ToastUtils.showToast("请选择学校"); |
161 | } | 166 | } |
167 | + }else if (v==tvLocalAddress){ | ||
168 | + if (null==cityPicker)cityPicker=new CityPicker(SelectSchoolActivity.this,this); | ||
169 | + if (cityPicker.isShow())cityPicker.close(); | ||
170 | + else cityPicker.show(); | ||
162 | } | 171 | } |
163 | 172 | ||
164 | } | 173 | } |
@@ -224,4 +233,15 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | @@ -224,4 +233,15 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | ||
224 | schoolListAdapter.addAll(schoolList); | 233 | schoolListAdapter.addAll(schoolList); |
225 | schoollist.setAdapter(schoolListAdapter); | 234 | schoollist.setAdapter(schoolListAdapter); |
226 | } | 235 | } |
236 | + | ||
237 | + @Override | ||
238 | + protected void onDestroy() { | ||
239 | + super.onDestroy(); | ||
240 | + if (null!=cityPicker)cityPicker.cancle(); | ||
241 | + } | ||
242 | + | ||
243 | + @Override | ||
244 | + public void getCity(String name) { | ||
245 | + | ||
246 | + } | ||
227 | } | 247 | } |
app/src/main/java/com/shunzhi/parent/ui/activity/consult/ConsultTwoLevelActivity.java
1 | package com.shunzhi.parent.ui.activity.consult; | 1 | package com.shunzhi.parent.ui.activity.consult; |
2 | 2 | ||
3 | +import android.content.Context; | ||
4 | +import android.content.Intent; | ||
3 | import android.support.annotation.NonNull; | 5 | import android.support.annotation.NonNull; |
4 | -import android.support.annotation.Nullable; | ||
5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
6 | -import android.support.v7.widget.LinearLayoutManager; | ||
7 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
8 | -import android.view.LayoutInflater; | ||
9 | import android.view.View; | 8 | import android.view.View; |
10 | -import android.view.ViewGroup; | ||
11 | import android.widget.EditText; | 9 | import android.widget.EditText; |
12 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
13 | import android.widget.TextView; | 11 | import android.widget.TextView; |
14 | 12 | ||
15 | import com.share.mvpsdk.base.BasePresenter; | 13 | import com.share.mvpsdk.base.BasePresenter; |
16 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | 14 | import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; |
17 | -import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | ||
18 | -import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | ||
19 | -import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
20 | import com.shunzhi.parent.R; | 15 | import com.shunzhi.parent.R; |
16 | +import com.shunzhi.parent.adapter.MyConsultAdapter; | ||
21 | import com.shunzhi.parent.bean.MyConsultBean; | 17 | import com.shunzhi.parent.bean.MyConsultBean; |
22 | 18 | ||
23 | import java.util.ArrayList; | 19 | import java.util.ArrayList; |
@@ -25,6 +21,11 @@ import java.util.List; | @@ -25,6 +21,11 @@ import java.util.List; | ||
25 | 21 | ||
26 | public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener { | 22 | public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements View.OnClickListener { |
27 | 23 | ||
24 | + public static void getInstance(Context context){ | ||
25 | + Intent intent=new Intent(context,ConsultTwoLevelActivity.class); | ||
26 | + context.startActivity(intent); | ||
27 | + } | ||
28 | + | ||
28 | ImageView ivBack, ivSearch; | 29 | ImageView ivBack, ivSearch; |
29 | 30 | ||
30 | EditText et_search; | 31 | EditText et_search; |
@@ -33,7 +34,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | @@ -33,7 +34,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | ||
33 | 34 | ||
34 | RecyclerView recyclerView; | 35 | RecyclerView recyclerView; |
35 | 36 | ||
36 | - MyTwoLevelAdapter myTwoLevelAdapter = null; | 37 | + MyConsultAdapter myConsultAdapter = null; |
37 | 38 | ||
38 | List<MyConsultBean> myConsultBeanList = new ArrayList<>(); | 39 | List<MyConsultBean> myConsultBeanList = new ArrayList<>(); |
39 | 40 | ||
@@ -68,7 +69,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | @@ -68,7 +69,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | ||
68 | 69 | ||
69 | private void initRecyclerView() { | 70 | private void initRecyclerView() { |
70 | 71 | ||
71 | - if (null == myTwoLevelAdapter) myTwoLevelAdapter = new MyTwoLevelAdapter(); | 72 | + if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(this); |
72 | for (int i = 0; i < 12; i++) { | 73 | for (int i = 0; i < 12; i++) { |
73 | MyConsultBean myConsultBean = new MyConsultBean(); | 74 | MyConsultBean myConsultBean = new MyConsultBean(); |
74 | myConsultBean.consultCounts = i + ""; | 75 | myConsultBean.consultCounts = i + ""; |
@@ -77,8 +78,8 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | @@ -77,8 +78,8 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | ||
77 | myConsultBean.consultZhuanfaCounts = "转发:" + i; | 78 | myConsultBean.consultZhuanfaCounts = "转发:" + i; |
78 | myConsultBeanList.add(myConsultBean); | 79 | myConsultBeanList.add(myConsultBean); |
79 | } | 80 | } |
80 | - myTwoLevelAdapter.addAll(myConsultBeanList); | ||
81 | - recyclerView.setAdapter(myTwoLevelAdapter); | 81 | + myConsultAdapter.addAll(myConsultBeanList); |
82 | + recyclerView.setAdapter(myConsultAdapter); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | @NonNull | 85 | @NonNull |
@@ -100,44 +101,5 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | @@ -100,44 +101,5 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | ||
100 | } | 101 | } |
101 | 102 | ||
102 | 103 | ||
103 | - private class MyTwoLevelAdapter extends BaseRecyclerViewAdapter { | ||
104 | - | ||
105 | - @Override | ||
106 | - public void onAttachedToRecyclerView(RecyclerView recyclerView) { | ||
107 | - super.onAttachedToRecyclerView(recyclerView); | ||
108 | - LinearLayoutManager layoutManager = new LinearLayoutManager(ConsultTwoLevelActivity.this); | ||
109 | - recyclerView.setLayoutManager(layoutManager); | ||
110 | - } | ||
111 | - | ||
112 | - @Override | ||
113 | - public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
114 | - View view = LayoutInflater.from(ConsultTwoLevelActivity.this).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 | 104 | ||
143 | } | 105 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
@@ -24,9 +24,12 @@ import com.shunzhi.parent.contract.ceping.CepingContract; | @@ -24,9 +24,12 @@ import com.shunzhi.parent.contract.ceping.CepingContract; | ||
24 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; | 24 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; |
25 | import com.shunzhi.parent.views.TextAndImgShowView; | 25 | import com.shunzhi.parent.views.TextAndImgShowView; |
26 | 26 | ||
27 | +import me.leefeng.citypicker.CityPicker; | ||
28 | +import me.leefeng.citypicker.CityPickerListener; | ||
29 | + | ||
27 | 30 | ||
28 | public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter,CepingContract.ICePingModel> implements CepingContract.ICePingView | 31 | public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter,CepingContract.ICePingModel> implements CepingContract.ICePingView |
29 | - ,View.OnClickListener{ | 32 | + ,View.OnClickListener,CityPickerListener{ |
30 | 33 | ||
31 | TextView tvLocalAddress; | 34 | TextView tvLocalAddress; |
32 | 35 | ||
@@ -40,6 +43,8 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -40,6 +43,8 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
40 | 43 | ||
41 | LinearLayout layout_control; | 44 | LinearLayout layout_control; |
42 | 45 | ||
46 | + CityPicker cityPicker=null; | ||
47 | + | ||
43 | @Override | 48 | @Override |
44 | public int getLayoutId() { | 49 | public int getLayoutId() { |
45 | return R.layout.fragment_ce_ping; | 50 | return R.layout.fragment_ce_ping; |
@@ -122,6 +127,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -122,6 +127,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
122 | break; | 127 | break; |
123 | case R.id.tvLocalAddress: | 128 | case R.id.tvLocalAddress: |
124 | AppContext.getInstance().startLocation(); | 129 | AppContext.getInstance().startLocation(); |
130 | + if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | ||
131 | + if (cityPicker.isShow())cityPicker.close(); | ||
132 | + else cityPicker.show(); | ||
125 | break; | 133 | break; |
126 | case R.id.ivCamera: | 134 | case R.id.ivCamera: |
127 | ToastUtils.showToast("功能暂未上线"); | 135 | ToastUtils.showToast("功能暂未上线"); |
@@ -142,10 +150,16 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | @@ -142,10 +150,16 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | ||
142 | public void onDestroy() { | 150 | public void onDestroy() { |
143 | super.onDestroy(); | 151 | super.onDestroy(); |
144 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | 152 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); |
153 | + if (null!=cityPicker)cityPicker.cancle(); | ||
145 | } | 154 | } |
146 | 155 | ||
147 | @Override | 156 | @Override |
148 | public void getTools() { | 157 | public void getTools() { |
149 | 158 | ||
150 | } | 159 | } |
160 | + | ||
161 | + @Override | ||
162 | + public void getCity(String name) { | ||
163 | + ToastUtils.showToast(name); | ||
164 | + } | ||
151 | } | 165 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -33,9 +33,11 @@ import java.util.ArrayList; | @@ -33,9 +33,11 @@ import java.util.ArrayList; | ||
33 | import java.util.List; | 33 | import java.util.List; |
34 | 34 | ||
35 | import cn.jzvd.JZVideoPlayerStandard; | 35 | import cn.jzvd.JZVideoPlayerStandard; |
36 | +import me.leefeng.citypicker.CityPicker; | ||
37 | +import me.leefeng.citypicker.CityPickerListener; | ||
36 | 38 | ||
37 | public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter,ConsultContract.IConsultModel> implements View.OnClickListener | 39 | public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter,ConsultContract.IConsultModel> implements View.OnClickListener |
38 | -,ConsultContract.IConsultView{ | 40 | +,ConsultContract.IConsultView,CityPickerListener{ |
39 | 41 | ||
40 | ImageView ivSearch; | 42 | ImageView ivSearch; |
41 | 43 | ||
@@ -48,6 +50,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -48,6 +50,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
48 | TextView tvLocalAddress; | 50 | TextView tvLocalAddress; |
49 | 51 | ||
50 | LinearLayout layout_control; | 52 | LinearLayout layout_control; |
53 | + | ||
54 | + CityPicker cityPicker=null; | ||
51 | @Override | 55 | @Override |
52 | public int getLayoutId() { | 56 | public int getLayoutId() { |
53 | return R.layout.fragment_zi_xun; | 57 | return R.layout.fragment_zi_xun; |
@@ -136,6 +140,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -136,6 +140,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
136 | switch (view.getId()) { | 140 | switch (view.getId()) { |
137 | case R.id.tvLocalAddress: | 141 | case R.id.tvLocalAddress: |
138 | AppContext.getInstance().startLocation(); | 142 | AppContext.getInstance().startLocation(); |
143 | + if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | ||
144 | + if (cityPicker.isShow())cityPicker.close(); | ||
145 | + else cityPicker.show(); | ||
139 | break; | 146 | break; |
140 | case R.id.ivSearch://搜索按钮 | 147 | case R.id.ivSearch://搜索按钮 |
141 | 148 | ||
@@ -165,10 +172,16 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -165,10 +172,16 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
165 | public void onDestroy() { | 172 | public void onDestroy() { |
166 | super.onDestroy(); | 173 | super.onDestroy(); |
167 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | 174 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); |
175 | + if (null!=cityPicker)cityPicker.cancle(); | ||
168 | } | 176 | } |
169 | 177 | ||
170 | @Override | 178 | @Override |
171 | public void showTools() { | 179 | public void showTools() { |
172 | 180 | ||
173 | } | 181 | } |
182 | + | ||
183 | + @Override | ||
184 | + public void getCity(String name) { | ||
185 | + | ||
186 | + } | ||
174 | } | 187 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
1 | package com.shunzhi.parent.ui.fragment.consult; | 1 | package com.shunzhi.parent.ui.fragment.consult; |
2 | 2 | ||
3 | -import android.content.Context; | ||
4 | -import android.net.Uri; | ||
5 | import android.os.Bundle; | 3 | import android.os.Bundle; |
6 | import android.support.annotation.NonNull; | 4 | import android.support.annotation.NonNull; |
7 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
8 | -import android.support.design.widget.TabLayout; | ||
9 | -import android.support.v4.app.Fragment; | ||
10 | import android.support.v7.widget.LinearLayoutManager; | 6 | import android.support.v7.widget.LinearLayoutManager; |
11 | import android.support.v7.widget.RecyclerView; | 7 | import android.support.v7.widget.RecyclerView; |
12 | import android.util.Log; | 8 | import android.util.Log; |
13 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
14 | import android.view.View; | 10 | import android.view.View; |
15 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
12 | +import android.widget.FrameLayout; | ||
16 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
17 | import android.widget.LinearLayout; | 14 | import android.widget.LinearLayout; |
18 | import android.widget.TextView; | 15 | import android.widget.TextView; |
19 | 16 | ||
20 | -import com.bumptech.glide.Glide; | ||
21 | import com.share.mvpsdk.base.BasePresenter; | 17 | import com.share.mvpsdk.base.BasePresenter; |
22 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | 18 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
23 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | 19 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
24 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 20 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
25 | import com.share.mvpsdk.utils.DisplayUtils; | 21 | import com.share.mvpsdk.utils.DisplayUtils; |
26 | -import com.share.mvpsdk.utils.ToastUtils; | ||
27 | -import com.shunzhi.parent.AppContext; | ||
28 | import com.shunzhi.parent.R; | 22 | import com.shunzhi.parent.R; |
23 | +import com.shunzhi.parent.adapter.MyConsultAdapter; | ||
29 | import com.shunzhi.parent.bean.GrallyBean; | 24 | import com.shunzhi.parent.bean.GrallyBean; |
30 | -import com.shunzhi.parent.contract.consult.ConsultContract; | 25 | +import com.shunzhi.parent.bean.MyConsultBean; |
31 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | 26 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; |
32 | import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; | 27 | import com.shunzhi.parent.presenter.consult.consultone.ConsultOnePresenter; |
33 | -import com.shunzhi.parent.ui.activity.consult.ConsultTwoLevelActivity; | ||
34 | -import com.shunzhi.parent.views.TextAndImgShowView; | ||
35 | - | ||
36 | -import java.io.ByteArrayOutputStream; | ||
37 | -import java.io.IOException; | ||
38 | -import java.io.InputStream; | ||
39 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
40 | import java.util.List; | 29 | import java.util.List; |
41 | 30 | ||
42 | -public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter,ConsultOneContract.IConsultOneModel> | ||
43 | - implements View.OnClickListener,ConsultOneContract.IConsultOneView { | 31 | +public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneContract.ConsultOnePresenter, ConsultOneContract.IConsultOneModel> |
32 | + implements View.OnClickListener, ConsultOneContract.IConsultOneView { | ||
44 | 33 | ||
45 | 34 | ||
46 | - RecyclerView recyclerViewGrally; | 35 | + RecyclerView recyclerViewGrally, recyclerViewConsultOne; |
47 | 36 | ||
48 | MyGrallyAdapter myGrallyAdapter = null; | 37 | MyGrallyAdapter myGrallyAdapter = null; |
49 | 38 | ||
39 | + MyConsultAdapter myConsultAdapter = null; | ||
40 | + | ||
50 | List<GrallyBean> grallyBeanList = new ArrayList<>(); | 41 | List<GrallyBean> grallyBeanList = new ArrayList<>(); |
51 | 42 | ||
52 | LinearLayout layout_control; | 43 | LinearLayout layout_control; |
53 | 44 | ||
45 | + List<MyConsultBean> myConsultBeanList=null; | ||
46 | + | ||
54 | @Override | 47 | @Override |
55 | public int getLayoutId() { | 48 | public int getLayoutId() { |
56 | return R.layout.fragment_consult_one_level; | 49 | return R.layout.fragment_consult_one_level; |
@@ -62,7 +55,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -62,7 +55,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
62 | initViews(view); | 55 | initViews(view); |
63 | } catch (Exception e) { | 56 | } catch (Exception e) { |
64 | e.printStackTrace(); | 57 | e.printStackTrace(); |
65 | - Log.d("exception:",e.toString()); | 58 | + Log.d("exception:", e.toString()); |
66 | } | 59 | } |
67 | } | 60 | } |
68 | 61 | ||
@@ -73,16 +66,38 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -73,16 +66,38 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
73 | if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); | 66 | if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); |
74 | myGrallyAdapter.addAll(grallyBeanList); | 67 | myGrallyAdapter.addAll(grallyBeanList); |
75 | recyclerViewGrally.setAdapter(myGrallyAdapter); | 68 | recyclerViewGrally.setAdapter(myGrallyAdapter); |
69 | + | ||
70 | + | ||
76 | } | 71 | } |
77 | 72 | ||
78 | private void initViews(View view) { | 73 | private void initViews(View view) { |
79 | 74 | ||
80 | - layout_control=view.findViewById(R.id.layout_control); | ||
81 | - layout_control.measure(0,0); | 75 | + layout_control = view.findViewById(R.id.layout_control); |
76 | + layout_control.measure(0, 0); | ||
82 | mPresenter.getTools(layout_control); | 77 | mPresenter.getTools(layout_control); |
83 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); | 78 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); |
79 | + recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); | ||
84 | 80 | ||
85 | initRecyclerView(); | 81 | initRecyclerView(); |
82 | + | ||
83 | + initRecyclerViewConsult(); | ||
84 | + } | ||
85 | + | ||
86 | + private void initRecyclerViewConsult() { | ||
87 | + if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(getActivity()); | ||
88 | + if (null==myConsultBeanList)myConsultBeanList=new ArrayList<>(); | ||
89 | + else myConsultBeanList.clear(); | ||
90 | + for (int i = 0; i < 12; i++) { | ||
91 | + MyConsultBean myConsultBean = new MyConsultBean(); | ||
92 | + myConsultBean.consultCounts = i + ""; | ||
93 | + myConsultBean.consultContent = "咨询内容" + i; | ||
94 | + myConsultBean.consultTitle = "咨询标题" + i; | ||
95 | + myConsultBean.consultZhuanfaCounts = "转发:" + i; | ||
96 | + myConsultBeanList.add(myConsultBean); | ||
97 | + } | ||
98 | + myConsultAdapter.addAll(myConsultBeanList); | ||
99 | + recyclerViewConsultOne.setAdapter(myConsultAdapter); | ||
100 | + | ||
86 | } | 101 | } |
87 | 102 | ||
88 | @NonNull | 103 | @NonNull |
@@ -121,11 +136,16 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -121,11 +136,16 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
121 | 136 | ||
122 | ImageView iv_grally; | 137 | ImageView iv_grally; |
123 | TextView tv_grally_title; | 138 | TextView tv_grally_title; |
139 | + FrameLayout frame_root; | ||
124 | 140 | ||
125 | public MyGrallyViewHolder(View itemView) { | 141 | public MyGrallyViewHolder(View itemView) { |
126 | super(itemView); | 142 | super(itemView); |
127 | iv_grally = itemView.findViewById(R.id.iv_grally); | 143 | iv_grally = itemView.findViewById(R.id.iv_grally); |
128 | tv_grally_title = itemView.findViewById(R.id.tv_grally_title); | 144 | tv_grally_title = itemView.findViewById(R.id.tv_grally_title); |
145 | + frame_root = itemView.findViewById(R.id.frame_root); | ||
146 | + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-1, -1); | ||
147 | + params.width = DisplayUtils.getScreenWidthPixels(getActivity()) - 40; | ||
148 | + frame_root.setLayoutParams(params); | ||
129 | } | 149 | } |
130 | 150 | ||
131 | @Override | 151 | @Override |
app/src/main/java/com/shunzhi/parent/util/AttrsUtils.java
0 → 100644
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +package com.shunzhi.parent.util; | ||
2 | + | ||
3 | +import android.app.Activity; | ||
4 | +import android.content.res.TypedArray; | ||
5 | +import android.util.TypedValue; | ||
6 | + | ||
7 | +/** | ||
8 | + * Created by ToaHanDong on 2018/3/14. | ||
9 | + */ | ||
10 | + | ||
11 | +public class AttrsUtils { | ||
12 | + | ||
13 | + public static TypedArray getAttrs(Activity activity){ | ||
14 | + TypedValue typedValue=new TypedValue(); | ||
15 | + activity.getTheme().resolveAttribute(android.R.attr.selectableItemBackground,typedValue,true); | ||
16 | + int[] sttrides=new int[]{android.R.attr.selectableItemBackground}; | ||
17 | + TypedArray typedArray=activity.getTheme().obtainStyledAttributes(sttrides); | ||
18 | + return typedArray; | ||
19 | + } | ||
20 | + | ||
21 | +} |
app/src/main/res/layout/fragment_consult_one_level.xml
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
25 | android:layout_height="0dp" | 25 | android:layout_height="0dp" |
26 | android:layout_weight="3" | 26 | android:layout_weight="3" |
27 | - android:background="@color/white" | 27 | + android:id="@+id/recyclerViewConsultOne" |
28 | ></android.support.v7.widget.RecyclerView> | 28 | ></android.support.v7.widget.RecyclerView> |
29 | 29 | ||
30 | </LinearLayout> | 30 | </LinearLayout> |
app/src/main/res/layout/item_grally.xml
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | android:layout_height="match_parent" | 4 | android:layout_height="match_parent" |
5 | android:layout_margin="@dimen/size_dp_10" | 5 | android:layout_margin="@dimen/size_dp_10" |
6 | + android:id="@+id/frame_root" | ||
6 | android:background="@color/txt_black"> | 7 | android:background="@color/txt_black"> |
7 | 8 | ||
8 | 9 |
app/src/main/res/layout/layout_textandimgshow.xml
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | android:orientation="horizontal" | 21 | android:orientation="horizontal" |
22 | android:padding="@dimen/size_dp_10"> | 22 | android:padding="@dimen/size_dp_10"> |
23 | 23 | ||
24 | - <LinearLayout | 24 | + <!-- <LinearLayout |
25 | android:visibility="gone" | 25 | android:visibility="gone" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | android:background="?android:selectableItemBackground"> | 62 | android:background="?android:selectableItemBackground"> |
63 | 63 | ||
64 | </com.shunzhi.parent.views.TextAndImgShowView> | 64 | </com.shunzhi.parent.views.TextAndImgShowView> |
65 | - </LinearLayout> | 65 | + </LinearLayout>--> |
66 | </LinearLayout> | 66 | </LinearLayout> |
67 | </HorizontalScrollView> | 67 | </HorizontalScrollView> |
68 | </android.support.design.widget.CoordinatorLayout> | 68 | </android.support.design.widget.CoordinatorLayout> |
69 | \ No newline at end of file | 69 | \ No newline at end of file |