Commit c722502656e3d4e4cdbe668eeff356dbb4393c1e
Exists in
yxb_dev
and in
2 other branches
Merge branch 'yxb_dev' of http://git.shunzhi.net/taohd/parentwork into yxb_dev
Showing
24 changed files
with
623 additions
and
30 deletions
Show diff stats
app/src/main/AndroidManifest.xml
app/src/main/java/com/shunzhi/parent/contract/report/ReportContract.java
... | ... | @@ -17,11 +17,15 @@ public interface ReportContract { |
17 | 17 | abstract class ReportPresenter extends BasePresenter<IReportModel,IReportView> { |
18 | 18 | public abstract void reportResult(); |
19 | 19 | |
20 | + public abstract void getReports(); | |
20 | 21 | } |
21 | 22 | interface IReportModel extends IBaseModel{ |
22 | 23 | Observable<ReportBean> getReportResult(); |
24 | + void getReports(); | |
23 | 25 | } |
24 | 26 | interface IReportView extends IBaseView{ |
25 | 27 | void UpdateList(List<ReportBean>list); |
28 | + | |
29 | + void showReports(List<String> stringList); | |
26 | 30 | } |
27 | 31 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/model/report/ReportModel.java
app/src/main/java/com/shunzhi/parent/popu/ShaiXuanPop.java
0 → 100644
... | ... | @@ -0,0 +1,156 @@ |
1 | +package com.shunzhi.parent.popu; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.graphics.drawable.BitmapDrawable; | |
5 | +import android.graphics.drawable.Drawable; | |
6 | +import android.view.Gravity; | |
7 | +import android.view.View; | |
8 | +import android.view.ViewGroup; | |
9 | +import android.view.WindowManager; | |
10 | +import android.widget.BaseAdapter; | |
11 | +import android.widget.GridView; | |
12 | +import android.widget.PopupWindow; | |
13 | +import android.widget.TextView; | |
14 | + | |
15 | +import com.huxq17.handygridview.HandyGridView; | |
16 | +import com.share.mvpsdk.utils.DisplayUtils; | |
17 | +import com.shunzhi.parent.R; | |
18 | +import com.shunzhi.parent.popu.handygrid.TagView; | |
19 | + | |
20 | +import java.util.ArrayList; | |
21 | +import java.util.List; | |
22 | + | |
23 | +/** | |
24 | + * Created by ToaHanDong on 2018/3/15. | |
25 | + */ | |
26 | + | |
27 | +public class ShaiXuanPop extends PopupWindow { | |
28 | + | |
29 | + HandyGridView handyGridView = null; | |
30 | + | |
31 | + List<String> stringList = null; | |
32 | + | |
33 | + private Context mContext = null; | |
34 | + | |
35 | + MyGridAdapter myGridAdapter = null; | |
36 | + | |
37 | + TextView tvSubmit; | |
38 | + | |
39 | + public ShaiXuanPop(Context context) { | |
40 | + mContext = context; | |
41 | + | |
42 | + View view = View.inflate(context, R.layout.popu_shaixuan, null); | |
43 | + handyGridView = view.findViewById(R.id.handyGridView); | |
44 | + tvSubmit=view.findViewById(R.id.tvSubmit); | |
45 | + stringList = new ArrayList<>(); | |
46 | + | |
47 | + setWidth(WindowManager.LayoutParams.MATCH_PARENT); | |
48 | + setHeight(WindowManager.LayoutParams.WRAP_CONTENT); | |
49 | + | |
50 | + setOutsideTouchable(true); | |
51 | + setFocusable(true); | |
52 | + setBackgroundDrawable(new BitmapDrawable()); | |
53 | + | |
54 | + setContentView(view); | |
55 | + update(); | |
56 | + | |
57 | + tvSubmit.setOnClickListener(new View.OnClickListener() { | |
58 | + @Override | |
59 | + public void onClick(View view) { | |
60 | + | |
61 | + } | |
62 | + }); | |
63 | + | |
64 | + } | |
65 | + | |
66 | + public void show(View parent) { | |
67 | + showAsDropDown(parent); | |
68 | + } | |
69 | + | |
70 | + public void setDatas(List<String> strings) { | |
71 | + | |
72 | + if (null != stringList) { | |
73 | + stringList.clear(); | |
74 | + stringList.addAll(strings); | |
75 | + } | |
76 | + | |
77 | + if (null == myGridAdapter) myGridAdapter = new MyGridAdapter(); | |
78 | + if (null == handyGridView.getAdapter()) handyGridView.setAdapter(myGridAdapter); | |
79 | + myGridAdapter.notifyDataSetChanged(); | |
80 | + | |
81 | + } | |
82 | + | |
83 | + private class MyGridAdapter extends BaseAdapter { | |
84 | + | |
85 | + private GridView mGridView; | |
86 | + private boolean inEditMode = false;//设置是否可以编辑 | |
87 | + | |
88 | + public void setInEditMode(boolean inEditMode) { | |
89 | + this.inEditMode = inEditMode; | |
90 | + notifyDataSetChanged(); | |
91 | + } | |
92 | + | |
93 | + @Override | |
94 | + public int getCount() { | |
95 | + return stringList.size(); | |
96 | + } | |
97 | + | |
98 | + @Override | |
99 | + public Object getItem(int i) { | |
100 | + return stringList.get(i); | |
101 | + } | |
102 | + | |
103 | + @Override | |
104 | + public long getItemId(int i) { | |
105 | + return i; | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public View getView(int i, View convertView, ViewGroup viewGroup) { | |
110 | + | |
111 | + if (mGridView == null) { | |
112 | + mGridView = (GridView) viewGroup; | |
113 | + } | |
114 | + | |
115 | + TagView textView; | |
116 | + | |
117 | + if (convertView == null) { | |
118 | + textView = new TagView(mContext); | |
119 | + convertView = textView; | |
120 | + textView.setMaxLines(1); | |
121 | + textView.setHeight(DisplayUtils.dp2px(30)); | |
122 | + int id = mContext.getResources().getIdentifier("s_grid_item", "drawable", mContext.getPackageName()); | |
123 | + Drawable drawable = mContext.getResources().getDrawable(id); | |
124 | + textView.setBackgroundDrawable(drawable); | |
125 | + textView.setTextColor(mContext.getResources().getColor(R.color.huodong_blue)); | |
126 | + textView.setGravity(Gravity.CENTER); | |
127 | + textView.setTag(false); | |
128 | + } else { | |
129 | + textView = (TagView) convertView; | |
130 | + } | |
131 | + | |
132 | + textView.setOnClickListener(new View.OnClickListener() { | |
133 | + @Override | |
134 | + public void onClick(View view) { | |
135 | + boolean isSelect = (boolean) view.getTag(); | |
136 | + view.setTag(!isSelect); | |
137 | + notifyDataSetChanged(); | |
138 | + } | |
139 | + }); | |
140 | + | |
141 | + boolean isSelect = (boolean) textView.getTag(); | |
142 | + if (isSelect) { | |
143 | + textView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.shape_blue_select)); | |
144 | + textView.setTextColor(mContext.getResources().getColor(R.color.white)); | |
145 | + } else { | |
146 | + textView.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.shape_blue_normal)); | |
147 | + textView.setTextColor(mContext.getResources().getColor(R.color.huodong_blue)); | |
148 | + } | |
149 | + textView.showDeleteIcon(false); | |
150 | + textView.setText(getItem(i).toString()); | |
151 | + return convertView; | |
152 | + } | |
153 | + } | |
154 | + | |
155 | + | |
156 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/popu/handygrid/TagView.java
0 → 100644
... | ... | @@ -0,0 +1,116 @@ |
1 | +package com.shunzhi.parent.popu.handygrid; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.graphics.Canvas; | |
5 | +import android.graphics.Rect; | |
6 | +import android.graphics.drawable.Drawable; | |
7 | +import android.util.AttributeSet; | |
8 | +import android.util.Log; | |
9 | +import android.view.MotionEvent; | |
10 | +import android.view.View; | |
11 | + | |
12 | +import com.share.mvpsdk.utils.DisplayUtils; | |
13 | +import com.shunzhi.parent.R; | |
14 | + | |
15 | +/** | |
16 | + * Created by ToaHanDong on 2018/3/15. | |
17 | + */ | |
18 | + | |
19 | +public class TagView extends android.support.v7.widget.AppCompatTextView { | |
20 | + private Drawable deleteIcon; | |
21 | + private int iconWidth; | |
22 | + private int iconHeight; | |
23 | + private boolean showIcon = true; | |
24 | + private Rect mDelteRect; | |
25 | + private Rect mAssumeDelteRect; | |
26 | + | |
27 | + public TagView(Context context) { | |
28 | + super(context); | |
29 | +// int id = context.getResources().getIdentifier("ic_delete", "drawable", context.getPackageName()); | |
30 | + deleteIcon = context.getResources().getDrawable(R.drawable.ic_delete); | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + protected void onDraw(Canvas canvas) { | |
35 | + super.onDraw(canvas); | |
36 | + if (mAssumeDelteRect == null) { | |
37 | + setDeleteBounds(); | |
38 | + } | |
39 | + if (showIcon) { | |
40 | + deleteIcon.draw(canvas); | |
41 | + } | |
42 | + } | |
43 | + | |
44 | + private void setDeleteBounds() { | |
45 | + iconWidth = deleteIcon.getIntrinsicWidth(); | |
46 | + iconHeight = deleteIcon.getIntrinsicHeight(); | |
47 | + int left = getWidth() - iconWidth; | |
48 | + int top = 0; | |
49 | + mDelteRect = new Rect(left, top, left + iconWidth, top + iconHeight); | |
50 | + //padding扩大了icon的点击范围 | |
51 | + int padding = DisplayUtils.dp2px(10); | |
52 | + mAssumeDelteRect = new Rect(mDelteRect.left, mDelteRect.top, mDelteRect.left + iconWidth + padding, mDelteRect.top + iconHeight + padding); | |
53 | + deleteIcon.setBounds(mDelteRect); | |
54 | + } | |
55 | + | |
56 | + @Override | |
57 | + public boolean onTouchEvent(MotionEvent event) { | |
58 | + int action = event.getAction(); | |
59 | + int x = (int) event.getX(); | |
60 | + int y = (int) event.getY(); | |
61 | + boolean contains = mAssumeDelteRect.contains(x, y); | |
62 | + switch (action) { | |
63 | + case MotionEvent.ACTION_DOWN: | |
64 | + if (contains && showIcon) { | |
65 | + return true; | |
66 | + } | |
67 | + break; | |
68 | + case MotionEvent.ACTION_MOVE: | |
69 | + break; | |
70 | + case MotionEvent.ACTION_UP: | |
71 | + if (contains && showIcon) { | |
72 | + if (mListener != null) { | |
73 | + mListener.onDelete(this); | |
74 | + } | |
75 | + return true; | |
76 | + } | |
77 | + break; | |
78 | + } | |
79 | + return super.onTouchEvent(event); | |
80 | + } | |
81 | + | |
82 | + private void log(String msg) { | |
83 | + Log.e(getClass().getCanonicalName(), msg); | |
84 | + } | |
85 | + | |
86 | + public void showDeleteIcon(boolean show) { | |
87 | + showIcon = show; | |
88 | + invalidate(); | |
89 | + } | |
90 | + | |
91 | + private OnTagDeleteListener mListener; | |
92 | + | |
93 | + public void setOnTagDeleteListener(OnTagDeleteListener listener) { | |
94 | + mListener = listener; | |
95 | + } | |
96 | + | |
97 | + public interface OnTagDeleteListener { | |
98 | + /** | |
99 | + * Delete view. | |
100 | + * | |
101 | + * @param deleteView | |
102 | + */ | |
103 | + void onDelete(View deleteView); | |
104 | + } | |
105 | +// @Override | |
106 | +// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
107 | +//// int widthSize = 100; | |
108 | +// int heightSize = DensityUtil.dip2px(getContext(),40); | |
109 | +//// | |
110 | +//// widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.AT_MOST); | |
111 | +// heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.AT_MOST); | |
112 | +// setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); | |
113 | +//// super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
114 | +// Log.e("onmea","width="+getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec)+";height="+getDefaultSize(getSuggestedMinimumHeight(),heightMeasureSpec)); | |
115 | +// } | |
116 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/report/ReportPresenter.java
... | ... | @@ -32,4 +32,18 @@ public class ReportPresenter extends ReportContract.ReportPresenter{ |
32 | 32 | mIView.UpdateList(list); |
33 | 33 | |
34 | 34 | } |
35 | + | |
36 | + @Override | |
37 | + public void getReports() { | |
38 | + | |
39 | + List<String> stringList=new ArrayList<>(); | |
40 | + | |
41 | + stringList.add("全部"); | |
42 | + stringList.add("作业+"); | |
43 | + stringList.add("测评+"); | |
44 | + stringList.add("德育+"); | |
45 | + | |
46 | + mIView.showReports(stringList); | |
47 | + | |
48 | + } | |
35 | 49 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
... | ... | @@ -8,6 +8,7 @@ import android.os.Bundle; |
8 | 8 | import android.support.annotation.NonNull; |
9 | 9 | import android.support.annotation.Nullable; |
10 | 10 | import android.support.design.widget.FloatingActionButton; |
11 | +import android.util.Log; | |
11 | 12 | import android.view.View; |
12 | 13 | import android.widget.FrameLayout; |
13 | 14 | import android.widget.ImageView; |
... | ... | @@ -22,6 +23,7 @@ import com.shunzhi.parent.AppContext; |
22 | 23 | import com.shunzhi.parent.R; |
23 | 24 | import com.shunzhi.parent.contract.ceping.CepingContract; |
24 | 25 | import com.shunzhi.parent.presenter.ceping.CePingPresenter; |
26 | +import com.shunzhi.parent.views.DragFloatActionButton; | |
25 | 27 | import com.shunzhi.parent.views.TextAndImgShowView; |
26 | 28 | |
27 | 29 | import me.leefeng.citypicker.CityPicker; |
... | ... | @@ -63,6 +65,7 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
63 | 65 | |
64 | 66 | addTools(); |
65 | 67 | |
68 | + tvLocalAddress.setText(AppContext.getInstance().cityName); | |
66 | 69 | textAndImg_xqjc.setTextColor(R.color.white); |
67 | 70 | textAndImg_xqjc.setText("学情检测"); |
68 | 71 | textAndImg_xqjc.setImgs(R.drawable.xqjc,R.drawable.xqjc); |
... | ... | @@ -74,7 +77,18 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP |
74 | 77 | textAndImg_zxlx.setSelect(true); |
75 | 78 | |
76 | 79 | initListeners(view); |
77 | - floatingActionButton.setRippleColor(getResources().getColor(R.color.white)); | |
80 | + floatingActionButton.setOnClickListener(new View.OnClickListener() { | |
81 | + @Override | |
82 | + public void onClick(View view) { | |
83 | + | |
84 | + } | |
85 | + }); | |
86 | +// floatingActionButton.setOnClickListeners(new DragFloatActionButton.OnClickListeners() { | |
87 | +// @Override | |
88 | +// public void onClicks() { | |
89 | +// ToastUtils.showToast("dfafdaf"); | |
90 | +// } | |
91 | +// }); | |
78 | 92 | } |
79 | 93 | |
80 | 94 | private void addTools() { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
... | ... | @@ -84,7 +84,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
84 | 84 | } |
85 | 85 | |
86 | 86 | private void initBanners() { |
87 | - | |
87 | + tvLocalAddress.setText(AppContext.getInstance().cityName); | |
88 | 88 | InputStream inputStream = getClass().getResourceAsStream("/assets/banners.png"); |
89 | 89 | try { |
90 | 90 | imgesUrl.add(new String(InputStreamToByte(inputStream))); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
... | ... | @@ -7,26 +7,26 @@ import android.support.annotation.Nullable; |
7 | 7 | import android.support.v7.widget.LinearLayoutManager; |
8 | 8 | import android.support.v7.widget.RecyclerView; |
9 | 9 | import android.view.View; |
10 | +import android.widget.TextView; | |
10 | 11 | |
11 | 12 | import com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView; |
12 | 13 | import com.prolificinteractive.materialcalendarview.CalendarDay; |
13 | 14 | import com.prolificinteractive.materialcalendarview.MaterialCalendarView; |
14 | 15 | import com.share.mvpsdk.base.BasePresenter; |
15 | 16 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
16 | -import com.share.mvpsdk.utils.ToastUtils; | |
17 | 17 | import com.shunzhi.parent.R; |
18 | 18 | import com.shunzhi.parent.adapter.ReportAdapter; |
19 | 19 | import com.shunzhi.parent.bean.ReportBean; |
20 | 20 | import com.shunzhi.parent.contract.report.ReportContract; |
21 | +import com.shunzhi.parent.popu.ShaiXuanPop; | |
21 | 22 | import com.shunzhi.parent.presenter.report.ReportPresenter; |
22 | 23 | import com.shunzhi.parent.views.CustomLinearLayoutManager; |
23 | 24 | |
24 | -import java.util.Calendar; | |
25 | -import java.util.Date; | |
26 | 25 | import java.util.List; |
27 | 26 | |
28 | 27 | public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportPresenter, ReportContract.IReportModel> |
29 | - implements ReportContract.IReportView { | |
28 | + implements ReportContract.IReportView ,View.OnClickListener{ | |
29 | + | |
30 | 30 | RecyclerView recyclerView; |
31 | 31 | ReportAdapter reportAdapter; |
32 | 32 | |
... | ... | @@ -36,6 +36,10 @@ public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportP |
36 | 36 | |
37 | 37 | MaterialCalendarView calendarView_month_mode; |
38 | 38 | |
39 | + TextView tvDate,tvShaiXuan; | |
40 | + | |
41 | + ShaiXuanPop shaiXuanPop=null; | |
42 | + | |
39 | 43 | @NonNull |
40 | 44 | @Override |
41 | 45 | public BasePresenter initPresenter() { |
... | ... | @@ -50,7 +54,9 @@ public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportP |
50 | 54 | @Override |
51 | 55 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
52 | 56 | recyclerView = view.findViewById(R.id.recycle_report); |
53 | - calendarView_month_mode=view.findViewById(R.id.calendarView_month_mode); | |
57 | + calendarView_month_mode = view.findViewById(R.id.calendarView_month_mode); | |
58 | + tvDate = view.findViewById(R.id.tvDate); | |
59 | + tvShaiXuan=view.findViewById(R.id.tvShaiXuan); | |
54 | 60 | |
55 | 61 | LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); |
56 | 62 | layoutManager.setOrientation(LinearLayoutManager.VERTICAL); |
... | ... | @@ -64,33 +70,41 @@ public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportP |
64 | 70 | } |
65 | 71 | |
66 | 72 | private void initCalendarView() { |
67 | -// month_week_CalendarView.setMode(MonthWeekMaterialCalendarView.Mode.MONTH); | |
73 | + | |
68 | 74 | selectedDate = CalendarDay.today(); |
75 | + showDate(); | |
69 | 76 | monthWeekMaterialCalendarView.setMode(MonthWeekMaterialCalendarView.Mode.WEEK); |
70 | 77 | monthWeekMaterialCalendarView.setCurrentDate(selectedDate); |
71 | 78 | monthWeekMaterialCalendarView.setSelectedDate(selectedDate); |
72 | 79 | monthWeekMaterialCalendarView.state().edit().setSlideModeChangeListener(new MonthWeekMaterialCalendarView.SlideModeChangeListener() { |
73 | 80 | @Override |
74 | - public void modeChange(MonthWeekMaterialCalendarView.Mode mode) { | |
81 | + public void modeChange(MonthWeekMaterialCalendarView.Mode mode) { | |
75 | 82 | |
76 | 83 | } |
77 | 84 | }).setSlideDateSelectedlistener(new MonthWeekMaterialCalendarView.SlideDateSelectedlistener() { |
78 | 85 | @Override |
79 | 86 | public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { |
80 | 87 | selectedDate = date; |
88 | + showDate(); | |
81 | 89 | |
82 | 90 | } |
83 | 91 | }).setSlideOnMonthChangedListener(new MonthWeekMaterialCalendarView.SlideOnMonthChangedListener() { |
84 | 92 | @Override |
85 | 93 | public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { |
86 | - | |
94 | + selectedDate = date; | |
95 | + showDate(); | |
87 | 96 | } |
88 | 97 | }).commit(); |
89 | 98 | |
90 | 99 | } |
91 | 100 | |
101 | + private void showDate() { | |
102 | + tvDate.setText(selectedDate.getYear() + "年" + (selectedDate.getMonth() + 1) + "月"); | |
103 | + } | |
104 | + | |
92 | 105 | private void initReportList() { |
93 | 106 | mPresenter.reportResult(); |
107 | + tvShaiXuan.setOnClickListener(this); | |
94 | 108 | } |
95 | 109 | |
96 | 110 | @Override |
... | ... | @@ -99,4 +113,22 @@ public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportP |
99 | 113 | reportAdapter.addAll(list); |
100 | 114 | recyclerView.setAdapter(reportAdapter); |
101 | 115 | } |
116 | + | |
117 | + @Override | |
118 | + public void showReports(List<String> stringList) { | |
119 | + if (null!=shaiXuanPop){ | |
120 | + shaiXuanPop.setDatas(stringList); | |
121 | + shaiXuanPop.show(tvShaiXuan); | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + @Override | |
126 | + public void onClick(View view) { | |
127 | + switch (view.getId()){ | |
128 | + case R.id.tvShaiXuan: | |
129 | + if (null==shaiXuanPop)shaiXuanPop=new ShaiXuanPop(getActivity()); | |
130 | + mPresenter.getReports(); | |
131 | + break; | |
132 | + } | |
133 | + } | |
102 | 134 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
... | ... | @@ -5,7 +5,6 @@ import android.support.annotation.NonNull; |
5 | 5 | import android.support.annotation.Nullable; |
6 | 6 | import android.support.v7.widget.LinearLayoutManager; |
7 | 7 | import android.support.v7.widget.RecyclerView; |
8 | -import android.util.Log; | |
9 | 8 | import android.view.LayoutInflater; |
10 | 9 | import android.view.View; |
11 | 10 | import android.view.ViewGroup; | ... | ... |
app/src/main/java/com/shunzhi/parent/views/DragFloatActionButton.java
0 → 100644
... | ... | @@ -0,0 +1,115 @@ |
1 | +package com.shunzhi.parent.views; | |
2 | + | |
3 | +import android.animation.ObjectAnimator; | |
4 | +import android.content.Context; | |
5 | +import android.support.design.widget.FloatingActionButton; | |
6 | +import android.util.AttributeSet; | |
7 | +import android.util.Log; | |
8 | +import android.view.MotionEvent; | |
9 | +import android.view.ViewGroup; | |
10 | +import android.view.animation.DecelerateInterpolator; | |
11 | + | |
12 | + | |
13 | +/** | |
14 | + * Created by ToaHanDong on 2018/3/15. | |
15 | + */ | |
16 | + | |
17 | +public class DragFloatActionButton extends FloatingActionButton { | |
18 | + private int parentHeight; | |
19 | + private int parentWidth; | |
20 | + | |
21 | + public DragFloatActionButton(Context context) { | |
22 | + super(context); | |
23 | + } | |
24 | + | |
25 | + public DragFloatActionButton(Context context, AttributeSet attrs) { | |
26 | + super(context, attrs); | |
27 | + | |
28 | + } | |
29 | + | |
30 | + public DragFloatActionButton(Context context, AttributeSet attrs, int defStyleAttr) { | |
31 | + super(context, attrs, defStyleAttr); | |
32 | + } | |
33 | + | |
34 | + private int lastX; | |
35 | + private int lastY; | |
36 | + | |
37 | + private boolean isDrag; | |
38 | + | |
39 | + @Override | |
40 | + public boolean onTouchEvent(MotionEvent event) { | |
41 | + int rawX = (int) event.getRawX(); | |
42 | + int rawY = (int) event.getRawY(); | |
43 | + | |
44 | + switch (event.getAction() & MotionEvent.ACTION_MASK) { | |
45 | + case MotionEvent.ACTION_DOWN: | |
46 | + setPressed(true); | |
47 | + isDrag = false; | |
48 | + getParent().requestDisallowInterceptTouchEvent(true); | |
49 | + lastX = rawX; | |
50 | + lastY = rawY; | |
51 | + ViewGroup parent; | |
52 | + if (getParent() != null) { | |
53 | + parent = (ViewGroup) getParent(); | |
54 | + parentHeight = parent.getHeight(); | |
55 | + parentWidth = parent.getWidth(); | |
56 | + } | |
57 | + break; | |
58 | + | |
59 | + case MotionEvent.ACTION_MOVE: | |
60 | + if (parentHeight <= 0 || parentWidth == 0) { | |
61 | + isDrag = false; | |
62 | + break; | |
63 | + } else { | |
64 | + isDrag = true; | |
65 | + } | |
66 | + int dx = rawX - lastX; | |
67 | + int dy = rawY - lastY; | |
68 | + //这里修复一些华为手机无法触发点击事件 | |
69 | + int distance = (int) Math.sqrt(dx * dx + dy * dy); | |
70 | + if (distance == 0) { | |
71 | + isDrag = false; | |
72 | + break; | |
73 | + } | |
74 | + float x = getX() + dx; | |
75 | + float y = getY() + dy; | |
76 | + //检测是否到达边缘 左上右下 | |
77 | + x = x < 0 ? 0 : x > parentWidth - getWidth() ? parentWidth - getWidth() : x; | |
78 | + y = getY() < 0 ? 0 : getY() + getHeight() > parentHeight ? parentHeight - getHeight() : y; | |
79 | + setX(x); | |
80 | + setY(y); | |
81 | + lastX = rawX; | |
82 | + lastY = rawY; | |
83 | + break; | |
84 | + case MotionEvent.ACTION_UP: | |
85 | + if (!isNotDrag()) { | |
86 | + //恢复按压效果 | |
87 | + setPressed(false); | |
88 | + //Log.i("getX="+getX()+";screenWidthHalf="+screenWidthHalf); | |
89 | + if (rawX >= parentWidth / 2) { | |
90 | + //靠右吸附 | |
91 | + animate().setInterpolator(new DecelerateInterpolator()) | |
92 | + .setDuration(500) | |
93 | + .xBy(parentWidth - getWidth() - getX()) | |
94 | + .start(); | |
95 | + } else { | |
96 | + //靠左吸附 | |
97 | + ObjectAnimator oa = ObjectAnimator.ofFloat(this, "x", getX(), 0); | |
98 | + oa.setInterpolator(new DecelerateInterpolator()); | |
99 | + oa.setDuration(500); | |
100 | + oa.start(); | |
101 | + } | |
102 | + } | |
103 | + break; | |
104 | + | |
105 | + } | |
106 | + //如果是拖拽则消s耗事件,否则正常传递即可。!isNotDrag() || super.onTouchEvent(event); | |
107 | + return true; | |
108 | + } | |
109 | + | |
110 | + private boolean isNotDrag() { | |
111 | + return !isDrag && (getX() == 0 | |
112 | + || (getX() == parentWidth - getWidth())); | |
113 | + } | |
114 | + | |
115 | +} | ... | ... |
593 Bytes
... | ... | @@ -0,0 +1,15 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + <item android:state_focused="true"> | |
4 | + <color android:color="#DFDFDF" /> | |
5 | + </item> | |
6 | + <item android:state_pressed="true"> | |
7 | + <color android:color="#DFDFDF" /> | |
8 | + </item> | |
9 | + <item android:state_selected="true"> | |
10 | + <color android:color="#DFDFDF" /> | |
11 | + </item> | |
12 | + <item > | |
13 | + <color android:color="#ffffff" /> | |
14 | + </item> | |
15 | +</selector> | |
0 | 16 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,9 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + | |
4 | + <corners android:radius="@dimen/textSize20"/> | |
5 | + | |
6 | + <stroke android:color="@color/huodong_blue" | |
7 | + android:width="@dimen/size_dp_1"/> | |
8 | + | |
9 | +</shape> | |
0 | 10 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,7 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + | |
4 | + <stroke android:width="0.5dp" android:color="@color/gray"/> | |
5 | + <corners android:radius="@dimen/size_dp_8"/> | |
6 | + | |
7 | +</shape> | |
0 | 8 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_ce_ping.xml
... | ... | @@ -289,8 +289,11 @@ |
289 | 289 | android:layout_gravity="bottom|right" |
290 | 290 | android:layout_marginBottom="@dimen/size_dp_30" |
291 | 291 | android:layout_marginRight="@dimen/size_dp_30" |
292 | - app:backgroundTint="@color/xueqing_blue" | |
292 | + android:scaleType="center" | |
293 | + app:backgroundTint="@color/bg_gray_pressed" | |
293 | 294 | app:rippleColor="@color/xueqing_blue" |
294 | 295 | app:fabSize="normal" |
296 | + app:borderWidth="@dimen/size_dp_2" | |
297 | + app:elevation="@dimen/size_dp_10" | |
295 | 298 | android:src="@drawable/guanlianchild" /> |
296 | 299 | </FrameLayout> | ... | ... |
app/src/main/res/layout/fragment_report.xml
... | ... | @@ -30,11 +30,13 @@ |
30 | 30 | android:layout_gravity="center_vertical" |
31 | 31 | android:layout_weight="1" |
32 | 32 | android:gravity="center_horizontal" |
33 | + android:id="@+id/tvDate" | |
33 | 34 | android:text="2018年3月" |
34 | - android:textColor="@color/textColor" | |
35 | - android:textSize="@dimen/textSize16" /> | |
35 | + android:textColor="@color/white" | |
36 | + android:textSize="@dimen/textSize18" /> | |
36 | 37 | |
37 | 38 | <TextView |
39 | + android:id="@+id/tvShaiXuan" | |
38 | 40 | android:layout_width="wrap_content" |
39 | 41 | android:layout_height="wrap_content" |
40 | 42 | android:layout_gravity="center_vertical" | ... | ... |
app/src/main/res/layout/item_report.xml
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | android:layout_width="match_parent" |
4 | 4 | android:layout_height="match_parent"> |
5 | 5 | |
6 | - <LinearLayout | |
7 | - android:layout_marginTop="@dimen/size_dp_10" | |
6 | + <LinearLayout | |
8 | 7 | android:layout_width="match_parent" |
8 | + android:layout_marginTop="@dimen/size_dp_10" | |
9 | 9 | android:layout_height="250dp" |
10 | 10 | android:background="@drawable/report_white" |
11 | 11 | android:orientation="vertical"> |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | android:textColor="#20519f" |
21 | 21 | android:textSize="@dimen/sp_16" /> |
22 | 22 | |
23 | - <RelativeLayout | |
23 | + <RelativeLayout | |
24 | 24 | android:layout_width="match_parent" |
25 | 25 | android:layout_height="wrap_content" |
26 | 26 | android:layout_weight="1" |
... | ... | @@ -52,10 +52,10 @@ |
52 | 52 | <LinearLayout |
53 | 53 | android:layout_width="wrap_content" |
54 | 54 | android:layout_height="match_parent" |
55 | - android:layout_centerInParent="true" | |
56 | 55 | android:layout_weight="1" |
57 | - android:gravity="center_horizontal"> | |
58 | - | |
56 | + android:layout_centerInParent="true" | |
57 | + android:gravity="center_horizontal" | |
58 | + > | |
59 | 59 | <com.shunzhi.parent.views.ProgressView |
60 | 60 | android:id="@+id/ring" |
61 | 61 | android:layout_width="160dp" |
... | ... | @@ -66,8 +66,8 @@ |
66 | 66 | <LinearLayout |
67 | 67 | android:layout_width="80dp" |
68 | 68 | android:layout_height="match_parent" |
69 | - android:layout_alignParentRight="true" | |
70 | 69 | android:layout_marginTop="10dp" |
70 | + android:layout_alignParentRight="true" | |
71 | 71 | android:orientation="vertical"> |
72 | 72 | |
73 | 73 | <TextView | ... | ... |
app/src/main/res/layout/layout_consult_content.xml
... | ... | @@ -0,0 +1,90 @@ |
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 | + android:orientation="vertical" | |
6 | + android:padding="@dimen/size_dp_10" | |
7 | + android:layout_marginTop="@dimen/size_dp_10" | |
8 | + android:background="@color/white" | |
9 | + > | |
10 | + | |
11 | +<LinearLayout | |
12 | + android:layout_width="match_parent" | |
13 | + android:layout_height="wrap_content"> | |
14 | + | |
15 | + | |
16 | + <TextView | |
17 | + android:layout_gravity="center_horizontal" | |
18 | + android:layout_width="@dimen/size_dp_60" | |
19 | + android:textSize="@dimen/textSize16" | |
20 | + android:text="@string/report" | |
21 | + android:textStyle="bold" | |
22 | + android:textColor="@color/textColor" | |
23 | + android:layout_height="wrap_content" /> | |
24 | + | |
25 | + <com.huxq17.handygridview.HandyGridView | |
26 | + android:layout_marginLeft="@dimen/size_dp_10" | |
27 | + android:layout_width="match_parent" | |
28 | + android:layout_height="wrap_content" | |
29 | + android:id="@+id/handyGridView" | |
30 | + android:numColumns="3" | |
31 | + android:horizontalSpacing="@dimen/size_dp_15" | |
32 | + android:verticalSpacing="@dimen/size_dp_15" | |
33 | + android:gravity="center" | |
34 | + android:background="@color/white" | |
35 | + ></com.huxq17.handygridview.HandyGridView> | |
36 | + | |
37 | +</LinearLayout> | |
38 | + | |
39 | + | |
40 | + <LinearLayout | |
41 | + android:layout_marginTop="@dimen/size_dp_10" | |
42 | + android:layout_marginBottom="@dimen/size_dp_10" | |
43 | + android:focusable="true" | |
44 | + android:focusableInTouchMode="true" | |
45 | + android:gravity="center_vertical" | |
46 | + android:layout_width="match_parent" | |
47 | + android:layout_height="wrap_content"> | |
48 | + | |
49 | + | |
50 | + <TextView | |
51 | + android:layout_width="@dimen/size_dp_60" | |
52 | + android:textSize="@dimen/textSize16" | |
53 | + android:text="关键字" | |
54 | + android:textStyle="bold" | |
55 | + android:textColor="@color/textColor" | |
56 | + android:layout_height="wrap_content" /> | |
57 | + | |
58 | + <EditText | |
59 | + android:layout_width="match_parent" | |
60 | + android:layout_height="wrap_content" | |
61 | + android:hint="请输入要搜索的内容" | |
62 | + android:textSize="@dimen/textSize14" | |
63 | + android:textColor="@color/textColor" | |
64 | + android:background="@drawable/shape_edit_radius4_balck" | |
65 | + android:gravity="center" | |
66 | + android:padding="@dimen/size_dp_5" | |
67 | + android:layout_marginLeft="@dimen/size_dp_10" | |
68 | + /> | |
69 | + | |
70 | + | |
71 | + </LinearLayout> | |
72 | + | |
73 | + <TextView | |
74 | + android:id="@+id/tvSubmit" | |
75 | + android:layout_width="wrap_content" | |
76 | + android:layout_height="wrap_content" | |
77 | + android:textColor="@color/white" | |
78 | + android:textSize="@dimen/textSize16" | |
79 | + android:text="确定" | |
80 | + android:paddingLeft="@dimen/size_dp_60" | |
81 | + android:paddingRight="@dimen/size_dp_60" | |
82 | + android:background="@drawable/shape_blue_select" | |
83 | + android:paddingTop="@dimen/size_dp_5" | |
84 | + android:paddingBottom="@dimen/size_dp_5" | |
85 | + android:layout_gravity="center_horizontal" | |
86 | + android:layout_marginTop="@dimen/size_dp_10" | |
87 | + android:layout_marginBottom="@dimen/size_dp_10" | |
88 | + /> | |
89 | + | |
90 | +</LinearLayout> | |
0 | 91 | \ No newline at end of file | ... | ... |
app/src/main/res/values/dimens.xml
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | <dimen name="margin_only_txt">48dp</dimen> |
14 | 14 | |
15 | 15 | <!-- txtsize --> |
16 | - <dimen name="txtsize_display1">34sp</dimen> | |
17 | - <dimen name="txtsize_num">36sp</dimen> | |
18 | - <dimen name="txtsize_headline">24sp</dimen> | |
19 | - <dimen name="txtsize_title">20sp</dimen> | |
20 | - <dimen name="txtsize_subhead">16sp</dimen> | |
21 | - <dimen name="txtsize_body">14sp</dimen> | |
22 | - <dimen name="txtsize_caption">12sp</dimen> | |
16 | + <dimen name="txtsize_display1">34dp</dimen> | |
17 | + <dimen name="txtsize_num">36dp</dimen> | |
18 | + <dimen name="txtsize_headline">24dp</dimen> | |
19 | + <dimen name="txtsize_title">20dp</dimen> | |
20 | + <dimen name="txtsize_subhead">16dp</dimen> | |
21 | + <dimen name="txtsize_body">14dp</dimen> | |
22 | + <dimen name="txtsize_caption">12dp</dimen> | |
23 | 23 | |
24 | 24 | <!-- other size --> |
25 | 25 | <dimen name="corner_radius">2dp</dimen> |
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | |
42 | 42 | <dimen name="sp_12">12sp</dimen> |
43 | 43 | <dimen name="sp_14">14sp</dimen> |
44 | - <dimen name="sp_16">16sp</dimen> | |
44 | + <dimen name="sp_16">16dp</dimen> | |
45 | 45 | <dimen name="sp_18">18sp</dimen> |
46 | 46 | |
47 | 47 | <dimen name="textSize10">10dp</dimen> | ... | ... |
mvpsdk/build.gradle
... | ... | @@ -113,6 +113,9 @@ dependencies { |
113 | 113 | //日历控件 |
114 | 114 | compile 'com.github.idic779:monthweekmaterialcalendarview:1.7' |
115 | 115 | |
116 | + //标签拖动排序 | |
117 | + compile 'com.huxq17.handygridview:handygridview:1.1.0' | |
118 | + | |
116 | 119 | //悬浮窗 |
117 | 120 | // compile 'com.github.yhaolpz:FloatWindow:1.0.8' |
118 | 121 | ... | ... |
mvpsdk/src/main/res/values/strings.xml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <string name="loading">Loading……</string> |
5 | 5 | <string name="load_failed">Load failed. Please click me again</string> |
6 | 6 | <string name="press_again">Press again to exit</string> |
7 | - | |
7 | +<string name="report">报告</string> | |
8 | 8 | <!--历史数据界面--> |
9 | 9 | <string name="history_day">Day</string> |
10 | 10 | <string name="history_week">Week</string> | ... | ... |