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 @@ | 
| 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 | 1 | package com.shunzhi.parent.presenter.ceping; | 
| 2 | 2 | |
| 3 | -import android.content.res.TypedArray; | |
| 4 | -import android.util.TypedValue; | |
| 5 | 3 | import android.view.View; | 
| 6 | 4 | import android.widget.LinearLayout; | 
| 7 | 5 | |
| ... | ... | @@ -9,6 +7,7 @@ import com.shunzhi.parent.R; | 
| 9 | 7 | import com.shunzhi.parent.bean.ToolBean; | 
| 10 | 8 | import com.shunzhi.parent.contract.ceping.CepingContract; | 
| 11 | 9 | import com.shunzhi.parent.model.CePingModel; | 
| 10 | +import com.shunzhi.parent.util.AttrsUtils; | |
| 12 | 11 | import com.shunzhi.parent.views.TextAndImgShowView; | 
| 13 | 12 | |
| 14 | 13 | import java.util.ArrayList; | 
| ... | ... | @@ -26,11 +25,6 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | 
| 26 | 25 | toolBeanList.add(new ToolBean(R.drawable.zycx+"","专业查询")); | 
| 27 | 26 | toolBeanList.add(new ToolBean(R.drawable.cmyk+"","传媒艺考")); | 
| 28 | 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 | 28 | for (int i = 0; i < toolBeanList.size(); i++) { | 
| 35 | 29 | TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | 
| 36 | 30 | textAndImgShowView.setTextColor(R.color.textColor); | 
| ... | ... | @@ -38,11 +32,7 @@ public class CePingPresenter extends CepingContract.CePingPresenter { | 
| 38 | 32 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 
| 39 | 33 | textAndImgShowView.setSelect(true); | 
| 40 | 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 | 36 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 
| 47 | 37 | @Override | 
| 48 | 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 | 10 | import com.shunzhi.parent.contract.consult.ConsultContract; | 
| 11 | 11 | import com.shunzhi.parent.model.consult.ConsultModel; | 
| 12 | 12 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | 
| 13 | +import com.shunzhi.parent.util.AttrsUtils; | |
| 13 | 14 | import com.shunzhi.parent.views.TextAndImgShowView; | 
| 14 | 15 | |
| 15 | 16 | import java.util.ArrayList; | 
| ... | ... | @@ -34,11 +35,7 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | 
| 34 | 35 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 
| 35 | 36 | textAndImgShowView.setSelect(true); | 
| 36 | 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 | 39 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 
| 43 | 40 | @Override | 
| 44 | 41 | public void onClick(View view) { | ... | ... | 
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
| 1 | 1 | package com.shunzhi.parent.presenter.consult.consultone; | 
| 2 | 2 | |
| 3 | +import android.view.View; | |
| 3 | 4 | import android.widget.LinearLayout; | 
| 4 | 5 | |
| 5 | 6 | import com.shunzhi.parent.R; | 
| 6 | 7 | import com.shunzhi.parent.bean.ToolBean; | 
| 7 | 8 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | 
| 8 | 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 | 12 | import com.shunzhi.parent.views.TextAndImgShowView; | 
| 10 | 13 | |
| 11 | 14 | import java.util.ArrayList; | 
| ... | ... | @@ -31,7 +34,14 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | 
| 31 | 34 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImg)); | 
| 32 | 35 | textAndImgShowView.setSelect(true); | 
| 33 | 36 | textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | 
| 37 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | |
| 34 | 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 | 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 | 27 | import java.util.Comparator; | 
| 28 | 28 | import java.util.List; | 
| 29 | 29 | |
| 30 | +import me.leefeng.citypicker.CityPicker; | |
| 31 | +import me.leefeng.citypicker.CityPickerListener; | |
| 32 | + | |
| 30 | 33 | /** | 
| 31 | 34 | * Created by Administrator on 2018/3/12 0012. | 
| 32 | 35 | */ | 
| 33 | 36 | |
| 34 | 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 | 40 | private SideBar sideBar; | 
| 38 | 41 | private TextView dialog, go_next, tvLocalAddress; | 
| ... | ... | @@ -40,6 +43,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | 
| 40 | 43 | private List<String> list = new ArrayList<>(); | 
| 41 | 44 | SchoolListAdapter schoolListAdapter; | 
| 42 | 45 | |
| 46 | + CityPicker cityPicker=null; | |
| 43 | 47 | @NonNull | 
| 44 | 48 | @Override | 
| 45 | 49 | public BasePresenter initPresenter() { | 
| ... | ... | @@ -53,6 +57,7 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | 
| 53 | 57 | go_next = findViewById(R.id.go_next); | 
| 54 | 58 | go_next.setOnClickListener(this); | 
| 55 | 59 | tvLocalAddress = findViewById(R.id.tvLocalAddress); | 
| 60 | + tvLocalAddress.setOnClickListener(this); | |
| 56 | 61 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 
| 57 | 62 | setSchoolList(); | 
| 58 | 63 | |
| ... | ... | @@ -159,6 +164,10 @@ public class SelectSchoolActivity extends BaseMVPCompatActivity<SchoolListContra | 
| 159 | 164 | } else { | 
| 160 | 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 | 233 | schoolListAdapter.addAll(schoolList); | 
| 225 | 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 | 1 | package com.shunzhi.parent.ui.activity.consult; | 
| 2 | 2 | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.Intent; | |
| 3 | 5 | import android.support.annotation.NonNull; | 
| 4 | -import android.support.annotation.Nullable; | |
| 5 | 6 | import android.os.Bundle; | 
| 6 | -import android.support.v7.widget.LinearLayoutManager; | |
| 7 | 7 | import android.support.v7.widget.RecyclerView; | 
| 8 | -import android.view.LayoutInflater; | |
| 9 | 8 | import android.view.View; | 
| 10 | -import android.view.ViewGroup; | |
| 11 | 9 | import android.widget.EditText; | 
| 12 | 10 | import android.widget.ImageView; | 
| 13 | 11 | import android.widget.TextView; | 
| 14 | 12 | |
| 15 | 13 | import com.share.mvpsdk.base.BasePresenter; | 
| 16 | 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 | 15 | import com.shunzhi.parent.R; | 
| 16 | +import com.shunzhi.parent.adapter.MyConsultAdapter; | |
| 21 | 17 | import com.shunzhi.parent.bean.MyConsultBean; | 
| 22 | 18 | |
| 23 | 19 | import java.util.ArrayList; | 
| ... | ... | @@ -25,6 +21,11 @@ import java.util.List; | 
| 25 | 21 | |
| 26 | 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 | 29 | ImageView ivBack, ivSearch; | 
| 29 | 30 | |
| 30 | 31 | EditText et_search; | 
| ... | ... | @@ -33,7 +34,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | 
| 33 | 34 | |
| 34 | 35 | RecyclerView recyclerView; | 
| 35 | 36 | |
| 36 | - MyTwoLevelAdapter myTwoLevelAdapter = null; | |
| 37 | + MyConsultAdapter myConsultAdapter = null; | |
| 37 | 38 | |
| 38 | 39 | List<MyConsultBean> myConsultBeanList = new ArrayList<>(); | 
| 39 | 40 | |
| ... | ... | @@ -68,7 +69,7 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | 
| 68 | 69 | |
| 69 | 70 | private void initRecyclerView() { | 
| 70 | 71 | |
| 71 | - if (null == myTwoLevelAdapter) myTwoLevelAdapter = new MyTwoLevelAdapter(); | |
| 72 | + if (null == myConsultAdapter) myConsultAdapter = new MyConsultAdapter(this); | |
| 72 | 73 | for (int i = 0; i < 12; i++) { | 
| 73 | 74 | MyConsultBean myConsultBean = new MyConsultBean(); | 
| 74 | 75 | myConsultBean.consultCounts = i + ""; | 
| ... | ... | @@ -77,8 +78,8 @@ public class ConsultTwoLevelActivity extends BaseMVPCompatActivity implements Vi | 
| 77 | 78 | myConsultBean.consultZhuanfaCounts = "转发:" + i; | 
| 78 | 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 | 85 | @NonNull | 
| ... | ... | @@ -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 | 24 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; | 
| 25 | 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 | 31 | public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingPresenter,CepingContract.ICePingModel> implements CepingContract.ICePingView | 
| 29 | - ,View.OnClickListener{ | |
| 32 | + ,View.OnClickListener,CityPickerListener{ | |
| 30 | 33 | |
| 31 | 34 | TextView tvLocalAddress; | 
| 32 | 35 | |
| ... | ... | @@ -40,6 +43,8 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | 
| 40 | 43 | |
| 41 | 44 | LinearLayout layout_control; | 
| 42 | 45 | |
| 46 | + CityPicker cityPicker=null; | |
| 47 | + | |
| 43 | 48 | @Override | 
| 44 | 49 | public int getLayoutId() { | 
| 45 | 50 | return R.layout.fragment_ce_ping; | 
| ... | ... | @@ -122,6 +127,9 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | 
| 122 | 127 | break; | 
| 123 | 128 | case R.id.tvLocalAddress: | 
| 124 | 129 | AppContext.getInstance().startLocation(); | 
| 130 | + if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | |
| 131 | + if (cityPicker.isShow())cityPicker.close(); | |
| 132 | + else cityPicker.show(); | |
| 125 | 133 | break; | 
| 126 | 134 | case R.id.ivCamera: | 
| 127 | 135 | ToastUtils.showToast("功能暂未上线"); | 
| ... | ... | @@ -142,10 +150,16 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP | 
| 142 | 150 | public void onDestroy() { | 
| 143 | 151 | super.onDestroy(); | 
| 144 | 152 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | 
| 153 | + if (null!=cityPicker)cityPicker.cancle(); | |
| 145 | 154 | } | 
| 146 | 155 | |
| 147 | 156 | @Override | 
| 148 | 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 | 33 | import java.util.List; | 
| 34 | 34 | |
| 35 | 35 | import cn.jzvd.JZVideoPlayerStandard; | 
| 36 | +import me.leefeng.citypicker.CityPicker; | |
| 37 | +import me.leefeng.citypicker.CityPickerListener; | |
| 36 | 38 | |
| 37 | 39 | public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter,ConsultContract.IConsultModel> implements View.OnClickListener | 
| 38 | -,ConsultContract.IConsultView{ | |
| 40 | +,ConsultContract.IConsultView,CityPickerListener{ | |
| 39 | 41 | |
| 40 | 42 | ImageView ivSearch; | 
| 41 | 43 | |
| ... | ... | @@ -48,6 +50,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 48 | 50 | TextView tvLocalAddress; | 
| 49 | 51 | |
| 50 | 52 | LinearLayout layout_control; | 
| 53 | + | |
| 54 | + CityPicker cityPicker=null; | |
| 51 | 55 | @Override | 
| 52 | 56 | public int getLayoutId() { | 
| 53 | 57 | return R.layout.fragment_zi_xun; | 
| ... | ... | @@ -136,6 +140,9 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 136 | 140 | switch (view.getId()) { | 
| 137 | 141 | case R.id.tvLocalAddress: | 
| 138 | 142 | AppContext.getInstance().startLocation(); | 
| 143 | + if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | |
| 144 | + if (cityPicker.isShow())cityPicker.close(); | |
| 145 | + else cityPicker.show(); | |
| 139 | 146 | break; | 
| 140 | 147 | case R.id.ivSearch://搜索按钮 | 
| 141 | 148 | |
| ... | ... | @@ -165,10 +172,16 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 165 | 172 | public void onDestroy() { | 
| 166 | 173 | super.onDestroy(); | 
| 167 | 174 | if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | 
| 175 | + if (null!=cityPicker)cityPicker.cancle(); | |
| 168 | 176 | } | 
| 169 | 177 | |
| 170 | 178 | @Override | 
| 171 | 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 | 1 | package com.shunzhi.parent.ui.fragment.consult; | 
| 2 | 2 | |
| 3 | -import android.content.Context; | |
| 4 | -import android.net.Uri; | |
| 5 | 3 | import android.os.Bundle; | 
| 6 | 4 | import android.support.annotation.NonNull; | 
| 7 | 5 | import android.support.annotation.Nullable; | 
| 8 | -import android.support.design.widget.TabLayout; | |
| 9 | -import android.support.v4.app.Fragment; | |
| 10 | 6 | import android.support.v7.widget.LinearLayoutManager; | 
| 11 | 7 | import android.support.v7.widget.RecyclerView; | 
| 12 | 8 | import android.util.Log; | 
| 13 | 9 | import android.view.LayoutInflater; | 
| 14 | 10 | import android.view.View; | 
| 15 | 11 | import android.view.ViewGroup; | 
| 12 | +import android.widget.FrameLayout; | |
| 16 | 13 | import android.widget.ImageView; | 
| 17 | 14 | import android.widget.LinearLayout; | 
| 18 | 15 | import android.widget.TextView; | 
| 19 | 16 | |
| 20 | -import com.bumptech.glide.Glide; | |
| 21 | 17 | import com.share.mvpsdk.base.BasePresenter; | 
| 22 | 18 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | 
| 23 | 19 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | 
| 24 | 20 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 
| 25 | 21 | import com.share.mvpsdk.utils.DisplayUtils; | 
| 26 | -import com.share.mvpsdk.utils.ToastUtils; | |
| 27 | -import com.shunzhi.parent.AppContext; | |
| 28 | 22 | import com.shunzhi.parent.R; | 
| 23 | +import com.shunzhi.parent.adapter.MyConsultAdapter; | |
| 29 | 24 | import com.shunzhi.parent.bean.GrallyBean; | 
| 30 | -import com.shunzhi.parent.contract.consult.ConsultContract; | |
| 25 | +import com.shunzhi.parent.bean.MyConsultBean; | |
| 31 | 26 | import com.shunzhi.parent.contract.consult.consultone.ConsultOneContract; | 
| 32 | 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 | 28 | import java.util.ArrayList; | 
| 40 | 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 | 37 | MyGrallyAdapter myGrallyAdapter = null; | 
| 49 | 38 | |
| 39 | + MyConsultAdapter myConsultAdapter = null; | |
| 40 | + | |
| 50 | 41 | List<GrallyBean> grallyBeanList = new ArrayList<>(); | 
| 51 | 42 | |
| 52 | 43 | LinearLayout layout_control; | 
| 53 | 44 | |
| 45 | + List<MyConsultBean> myConsultBeanList=null; | |
| 46 | + | |
| 54 | 47 | @Override | 
| 55 | 48 | public int getLayoutId() { | 
| 56 | 49 | return R.layout.fragment_consult_one_level; | 
| ... | ... | @@ -62,7 +55,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | 
| 62 | 55 | initViews(view); | 
| 63 | 56 | } catch (Exception e) { | 
| 64 | 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 | 66 | if (null == myGrallyAdapter) myGrallyAdapter = new MyGrallyAdapter(); | 
| 74 | 67 | myGrallyAdapter.addAll(grallyBeanList); | 
| 75 | 68 | recyclerViewGrally.setAdapter(myGrallyAdapter); | 
| 69 | + | |
| 70 | + | |
| 76 | 71 | } | 
| 77 | 72 | |
| 78 | 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 | 77 | mPresenter.getTools(layout_control); | 
| 83 | 78 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); | 
| 79 | + recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); | |
| 84 | 80 | |
| 85 | 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 | 103 | @NonNull | 
| ... | ... | @@ -121,11 +136,16 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | 
| 121 | 136 | |
| 122 | 137 | ImageView iv_grally; | 
| 123 | 138 | TextView tv_grally_title; | 
| 139 | + FrameLayout frame_root; | |
| 124 | 140 | |
| 125 | 141 | public MyGrallyViewHolder(View itemView) { | 
| 126 | 142 | super(itemView); | 
| 127 | 143 | iv_grally = itemView.findViewById(R.id.iv_grally); | 
| 128 | 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 | 151 | @Override | ... | ... | 
app/src/main/java/com/shunzhi/parent/util/AttrsUtils.java
0 → 100644
| ... | ... | @@ -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 | 24 | android:layout_width="match_parent" | 
| 25 | 25 | android:layout_height="0dp" | 
| 26 | 26 | android:layout_weight="3" | 
| 27 | - android:background="@color/white" | |
| 27 | + android:id="@+id/recyclerViewConsultOne" | |
| 28 | 28 | ></android.support.v7.widget.RecyclerView> | 
| 29 | 29 | |
| 30 | 30 | </LinearLayout> | ... | ... | 
app/src/main/res/layout/item_grally.xml
app/src/main/res/layout/layout_textandimgshow.xml
| ... | ... | @@ -21,7 +21,7 @@ | 
| 21 | 21 | android:orientation="horizontal" | 
| 22 | 22 | android:padding="@dimen/size_dp_10"> | 
| 23 | 23 | |
| 24 | - <LinearLayout | |
| 24 | + <!-- <LinearLayout | |
| 25 | 25 | android:visibility="gone" | 
| 26 | 26 | android:layout_width="wrap_content" | 
| 27 | 27 | android:layout_height="wrap_content" | 
| ... | ... | @@ -62,7 +62,7 @@ | 
| 62 | 62 | android:background="?android:selectableItemBackground"> | 
| 63 | 63 | |
| 64 | 64 | </com.shunzhi.parent.views.TextAndImgShowView> | 
| 65 | - </LinearLayout> | |
| 65 | + </LinearLayout>--> | |
| 66 | 66 | </LinearLayout> | 
| 67 | 67 | </HorizontalScrollView> | 
| 68 | 68 | </android.support.design.widget.CoordinatorLayout> | 
| 69 | 69 | \ No newline at end of file | ... | ... |