Commit 252d2ee02c7e951394147eb0a20db1a0d201843a

Authored by 姚旭斌
1 parent de5c40dd

no message

app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
... ... @@ -93,7 +93,7 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP
93 93  
94 94 private void addTools() {
95 95 layout_control.measure(0, 0);
96   - mPresenter.getTools(layout_control, AppContext.getInstance().district);
  96 + mPresenter.getTools(layout_control, "余杭区");
97 97  
98 98 }
99 99  
... ... @@ -101,8 +101,8 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP
101 101 public void onResume() {
102 102 super.onResume();
103 103 // if (!tvLocalAddress.getText().toString().equals(AppContext.getInstance().cityName)){
104   - tvLocalAddress.setText(AppContext.getInstance().district);
105   - addTools();
  104 + tvLocalAddress.setText(AppContext.getInstance().district);
  105 + addTools();
106 106 // }
107 107 }
108 108  
... ... @@ -134,16 +134,16 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP
134 134 public void onClick(View view) {
135 135 switch (view.getId()) {
136 136 case R.id.frame_hot1://热门课程
137   - if (tvCourse1.getTag()!=null)
138   - WebViewActivity.getInstance(getActivity(),tvCourse1.getTag().toString(),-1);
  137 + if (tvCourse1.getTag() != null)
  138 + WebViewActivity.getInstance(getActivity(), tvCourse1.getTag().toString(), -1);
139 139 break;
140 140 case R.id.frame_hot2:
141   - if (tvCourse2.getTag()!=null)
142   - WebViewActivity.getInstance(getActivity(),tvCourse2.getTag().toString(),-1);
  141 + if (tvCourse2.getTag() != null)
  142 + WebViewActivity.getInstance(getActivity(), tvCourse2.getTag().toString(), -1);
143 143 break;
144 144 case R.id.frame_hot3:
145   - if (tvCourse3.getTag()!=null)
146   - WebViewActivity.getInstance(getActivity(),tvCourse3.getTag().toString(),-1);
  145 + if (tvCourse3.getTag() != null)
  146 + WebViewActivity.getInstance(getActivity(), tvCourse3.getTag().toString(), -1);
147 147 break;
148 148 case R.id.tvLocalAddress:
149 149 // AppContext.getInstance().startLocation();
... ... @@ -185,30 +185,27 @@ public class CePingFragment extends BaseMVPCompatFragment<CepingContract.CePingP
185 185 public void getCity(String name) {
186 186 tvLocalAddress.setText(name.split(" ")[2]);
187 187 mPresenter.getTools(layout_control, name.split(" ")[2]);
188   - AppContext.getInstance().cityName=name.split(" ")[1];
189   - AppContext.getInstance().district=name.split(" ")[2];
  188 + AppContext.getInstance().cityName = name.split(" ")[1];
  189 + AppContext.getInstance().district = name.split(" ")[2];
190 190 }
191 191  
192 192 @Override
193 193 public void showTools(List<ToolBean> toolBeanList) {
194   -
195 194 if (toolBeanList.size() > 0) {
196 195 tvCourse1.setText(toolBeanList.get(0).toolName);
197   - GlideUtils.showImg(getActivity(),ivCourse1,toolBeanList.get(0).toolImage);
198   -
  196 + GlideUtils.showImg(getActivity(), ivCourse1, toolBeanList.get(0).toolImage);
199 197 tvCourse1.setTag(toolBeanList.get(0).toolUrl);
200 198 }
201 199  
202 200 if (toolBeanList.size() > 1) {
203 201 tvCourse2.setText(toolBeanList.get(1).toolName);
204   -
205   - GlideUtils.showImg(getActivity(),ivCourse2,toolBeanList.get(1).toolImage);
  202 + GlideUtils.showImg(getActivity(), ivCourse2, toolBeanList.get(1).toolImage);
206 203 tvCourse2.setTag(toolBeanList.get(1).toolUrl);
207 204 }
208 205  
209 206 if (toolBeanList.size() > 2) {
210 207 tvCourse3.setText(toolBeanList.get(2).toolName);
211   - GlideUtils.showImg(getActivity(),ivCourse3,toolBeanList.get(2).toolImage);
  208 + GlideUtils.showImg(getActivity(), ivCourse3, toolBeanList.get(2).toolImage);
212 209 tvCourse3.setTag(toolBeanList.get(2).toolUrl);
213 210 }
214 211 }
... ...
app/src/main/java/com/shunzhi/parent/views/TextAndImgShowView.java
... ... @@ -5,7 +5,6 @@ import android.content.Context;
5 5 import android.support.annotation.DrawableRes;
6 6 import android.support.annotation.Nullable;
7 7 import android.util.AttributeSet;
8   -import android.util.Log;
9 8 import android.view.View;
10 9 import android.widget.FrameLayout;
11 10 import android.widget.ImageView;
... ... @@ -15,9 +14,7 @@ import android.widget.TextView;
15 14 import com.bumptech.glide.Glide;
16 15 import com.share.mvpsdk.utils.DisplayUtils;
17 16 import com.shunzhi.parent.AppConfig;
18   -import com.shunzhi.parent.AppContext;
19 17 import com.shunzhi.parent.R;
20   -import com.shunzhi.parent.util.GlideUtils;
21 18  
22 19  
23 20 /**
... ... @@ -84,10 +81,12 @@ public class TextAndImgShowView extends LinearLayout {
84 81  
85 82 public void setWidth(Activity activity, View layout_control) {
86 83 // Log.d("66666", "layout_control=" + layout_control.getMeasuredWidth());
87   - LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  84 + LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
88 85 params.width = (DisplayUtils.getScreenWidthPixels(activity) -
89 86 DisplayUtils.dp2px(layout_control.getPaddingLeft() + layout_control.getPaddingRight()
90 87 )) / 4;
91 88 layout.setLayoutParams(params);
  89 + LayoutParams params1 = new LayoutParams(52,52);
  90 + image.setLayoutParams(params1);
92 91 }
93 92 }
... ...