Commit 20641deb465757427fadb61be6f0bb0576a281c6
1 parent
d25fb468
Exists in
yxb_dev
and in
1 other branch
no message
Showing
8 changed files
with
33 additions
and
30 deletions
Show diff stats
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/AppContext.java
| ... | ... | @@ -5,6 +5,7 @@ import android.content.Context; |
| 5 | 5 | import android.content.Intent; |
| 6 | 6 | import android.content.SharedPreferences; |
| 7 | 7 | import android.text.TextUtils; |
| 8 | +import android.util.Log; | |
| 8 | 9 | |
| 9 | 10 | import com.amap.api.location.AMapLocation; |
| 10 | 11 | import com.amap.api.location.AMapLocationClient; |
| ... | ... | @@ -209,16 +210,22 @@ public class AppContext extends GlobalApplication { |
| 209 | 210 | @Override |
| 210 | 211 | public void onLocationChanged(AMapLocation aMapLocation) { |
| 211 | 212 | if (null != aMapLocation) { |
| 212 | - | |
| 213 | 213 | if (aMapLocation.getErrorCode() == 0) { |
| 214 | - cityName = aMapLocation.getCity(); | |
| 215 | - district = aMapLocation.getDistrict(); | |
| 216 | - aMapLocation.getCityCode(); | |
| 214 | + String currName = AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT); | |
| 215 | + Log.e("11111", currName); | |
| 216 | + if (currName != null && !"定位失败".equals(currName) &&! "".equals(currName)) { | |
| 217 | + district = AppConfig.getAppConfig(getContext()).get(AppConfig.DISTRICT); | |
| 218 | + } else { | |
| 219 | + cityName = aMapLocation.getCity(); | |
| 220 | + district = aMapLocation.getDistrict(); | |
| 221 | + aMapLocation.getCityCode(); | |
| 222 | + } | |
| 223 | + AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT, district); | |
| 217 | 224 | Intent intent = new Intent(); |
| 218 | 225 | intent.setAction(LOCATION_CITYNAME + ""); |
| 219 | 226 | sendBroadcast(intent); |
| 227 | + Log.e("11111", "222222"); | |
| 220 | 228 | stopLocation(); |
| 221 | - AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT, district); | |
| 222 | 229 | } else { |
| 223 | 230 | cityName = "定位失败"; |
| 224 | 231 | district = "定位失败"; | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/PersonInfoActivity.java
| ... | ... | @@ -6,6 +6,7 @@ import android.support.annotation.NonNull; |
| 6 | 6 | import android.text.TextUtils; |
| 7 | 7 | import android.view.View; |
| 8 | 8 | import android.widget.EditText; |
| 9 | +import android.widget.ImageView; | |
| 9 | 10 | import android.widget.RadioButton; |
| 10 | 11 | import android.widget.TextView; |
| 11 | 12 | |
| ... | ... | @@ -26,9 +27,10 @@ import com.shunzhi.parent.presenter.mine.PersonInfoPrasenter; |
| 26 | 27 | public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract.PersonInfoPresenter, PersonInfoContract.IPersonInfoModel> |
| 27 | 28 | implements PersonInfoContract.IPersonInfoView, View.OnClickListener { |
| 28 | 29 | RoundedImageView user_image; |
| 29 | - TextView user_name, user_mobile, change_info; | |
| 30 | + TextView user_name, user_mobile, change_info, center_title; | |
| 30 | 31 | EditText et_name; |
| 31 | 32 | RadioButton man, women; |
| 33 | + ImageView top_back; | |
| 32 | 34 | |
| 33 | 35 | |
| 34 | 36 | @NonNull |
| ... | ... | @@ -48,6 +50,11 @@ public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract |
| 48 | 50 | women = findViewById(R.id.women); |
| 49 | 51 | change_info = findViewById(R.id.change_info); |
| 50 | 52 | change_info.setOnClickListener(this); |
| 53 | + center_title = findViewById(R.id.center_title); | |
| 54 | + center_title.setText("个人资料"); | |
| 55 | + top_back = findViewById(R.id.back_top); | |
| 56 | + top_back.setOnClickListener(this); | |
| 57 | + | |
| 51 | 58 | initInfo(); |
| 52 | 59 | |
| 53 | 60 | |
| ... | ... | @@ -100,6 +107,9 @@ public class PersonInfoActivity extends BaseMVPCompatActivity<PersonInfoContract |
| 100 | 107 | |
| 101 | 108 | mPresenter.ChangeInfoResult(et_name.getText().toString().trim(), sex, user_mobile.getText().toString().trim()); |
| 102 | 109 | |
| 110 | + } else if (v == top_back) { | |
| 111 | + finish(); | |
| 112 | + | |
| 103 | 113 | } |
| 104 | 114 | } |
| 105 | 115 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -11,7 +11,6 @@ import android.support.annotation.Nullable; |
| 11 | 11 | import android.support.annotation.RequiresApi; |
| 12 | 12 | import android.support.v4.widget.NestedScrollView; |
| 13 | 13 | import android.text.TextUtils; |
| 14 | -import android.util.Log; | |
| 15 | 14 | import android.view.View; |
| 16 | 15 | import android.widget.EditText; |
| 17 | 16 | import android.widget.ImageView; |
| ... | ... | @@ -84,10 +83,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 84 | 83 | |
| 85 | 84 | @Override |
| 86 | 85 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
| 87 | - | |
| 88 | 86 | recycler_context = view.findViewById(R.id.recycler_content); |
| 89 | - initRecycler(); | |
| 90 | - | |
| 91 | 87 | nesteScrollView = view.findViewById(R.id.nesteScrollView); |
| 92 | 88 | ivSearch = view.findViewById(R.id.ivSearch); |
| 93 | 89 | xBanner = view.findViewById(R.id.xBanner); |
| ... | ... | @@ -100,11 +96,10 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 100 | 96 | videoplayer.batteryLevel.setVisibility(View.GONE); |
| 101 | 97 | videoplayer.replayTextView.setVisibility(View.GONE); |
| 102 | 98 | videoplayer.backButton.setVisibility(View.GONE); |
| 103 | - | |
| 104 | 99 | mPresenter.getBanners("2", AppContext.getInstance().district); |
| 105 | 100 | |
| 106 | 101 | initBroadCast(); |
| 107 | - | |
| 102 | + initRecycler(); | |
| 108 | 103 | initListeners(); |
| 109 | 104 | |
| 110 | 105 | layout_consult.measure(0, 0); |
| ... | ... | @@ -124,7 +119,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 124 | 119 | //refresh data here |
| 125 | 120 | pageIndex = 1; |
| 126 | 121 | contextList.clear(); |
| 127 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 122 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 128 | 123 | recycler_context.refreshComplete(); |
| 129 | 124 | } |
| 130 | 125 | |
| ... | ... | @@ -132,12 +127,12 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 132 | 127 | public void onLoadMore() { |
| 133 | 128 | // load more data here |
| 134 | 129 | pageIndex = pageIndex + 1; |
| 135 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 130 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 136 | 131 | recycler_context.refreshComplete(); |
| 137 | 132 | } |
| 138 | 133 | }); |
| 139 | 134 | pageIndex = 1; |
| 140 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 135 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 141 | 136 | } |
| 142 | 137 | |
| 143 | 138 | private void initListeners() { |
| ... | ... | @@ -206,7 +201,6 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 206 | 201 | } |
| 207 | 202 | |
| 208 | 203 | private void initBroadCast() { |
| 209 | - | |
| 210 | 204 | IntentFilter intentFilter = new IntentFilter(); |
| 211 | 205 | intentFilter.addAction(AppContext.LOCATION_CITYNAME + ""); |
| 212 | 206 | getActivity().registerReceiver(broadcastReceiver, intentFilter); |
| ... | ... | @@ -301,6 +295,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 301 | 295 | mPresenter.getContextChannel(name.split(" ")[2], 0, 1, 1); |
| 302 | 296 | AppContext.getInstance().cityName = name.split(" ")[1]; |
| 303 | 297 | AppContext.getInstance().district = name.split(" ")[2]; |
| 298 | + AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT, name.split(" ")[2]); | |
| 304 | 299 | } |
| 305 | 300 | |
| 306 | 301 | public void refresh() { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
| ... | ... | @@ -243,7 +243,7 @@ public class ReportFragment extends BaseMVPCompatFragment<MyChildContract.MyChil |
| 243 | 243 | @Override |
| 244 | 244 | public CharSequence getPageTitle(int position) { |
| 245 | 245 | if (position==0){ |
| 246 | - return "成长"; | |
| 246 | + return "应用"; | |
| 247 | 247 | }else { |
| 248 | 248 | return "报告"; |
| 249 | 249 | } | ... | ... |
app/src/main/res/layout/activity_personinfo.xml
| ... | ... | @@ -26,18 +26,9 @@ |
| 26 | 26 | android:layout_width="match_parent" |
| 27 | 27 | android:layout_height="200dp" |
| 28 | 28 | android:background="@drawable/backgroud_top" |
| 29 | - android:orientation="vertical" | |
| 30 | - > | |
| 29 | + android:orientation="vertical"> | |
| 31 | 30 | |
| 32 | - <TextView | |
| 33 | - android:layout_width="match_parent" | |
| 34 | - android:layout_height="?android:actionBarSize" | |
| 35 | - android:background="@color/back_top" | |
| 36 | - android:layout_gravity="center" | |
| 37 | - android:gravity="center" | |
| 38 | - android:text="个人资料" | |
| 39 | - android:textColor="@color/white" | |
| 40 | - android:textSize="@dimen/txtsize_headline" /> | |
| 31 | + <include layout="@layout/top" /> | |
| 41 | 32 | |
| 42 | 33 | |
| 43 | 34 | </LinearLayout> | ... | ... |
app/src/main/res/layout/fragment_mine.xml
app/src/main/res/layout/top.xml
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | android:text="主题" |
| 25 | 25 | android:gravity="center" |
| 26 | 26 | android:textColor="@color/white" |
| 27 | - android:textSize="@dimen/textSize16" /> | |
| 27 | + android:textSize="@dimen/textSize18" /> | |
| 28 | 28 | <TextView |
| 29 | 29 | android:layout_width="30dp" |
| 30 | 30 | android:layout_height="30dp" | ... | ... |