Commit e3782ee968e11ed4d4c5ee3c0a6b9379da7fd94b
Exists in
yxb_dev
and in
1 other branch
no message
Showing
8 changed files
with
33 additions
and
29 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); |
| ... | ... | @@ -102,7 +98,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 102 | 98 | videoplayer.backButton.setVisibility(View.GONE); |
| 103 | 99 | |
| 104 | 100 | initBroadCast(); |
| 105 | - | |
| 101 | + initRecycler(); | |
| 106 | 102 | initListeners(); |
| 107 | 103 | |
| 108 | 104 | layout_consult.measure(0, 0); |
| ... | ... | @@ -125,7 +121,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 125 | 121 | //refresh data here |
| 126 | 122 | pageIndex = 1; |
| 127 | 123 | contextList.clear(); |
| 128 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 124 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 129 | 125 | recycler_context.refreshComplete(); |
| 130 | 126 | } |
| 131 | 127 | |
| ... | ... | @@ -133,12 +129,12 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 133 | 129 | public void onLoadMore() { |
| 134 | 130 | // load more data here |
| 135 | 131 | pageIndex = pageIndex + 1; |
| 136 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 132 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 137 | 133 | recycler_context.refreshComplete(); |
| 138 | 134 | } |
| 139 | 135 | }); |
| 140 | 136 | pageIndex = 1; |
| 141 | - mPresenter.getContextChannel(AppContext.getInstance().district, 0, 1, pageIndex); | |
| 137 | + mPresenter.getContextChannel(AppConfig.getAppConfig(AppContext.getInstance()).get(AppConfig.DISTRICT), 0, 1, pageIndex); | |
| 142 | 138 | } |
| 143 | 139 | |
| 144 | 140 | private void initListeners() { |
| ... | ... | @@ -207,7 +203,6 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 207 | 203 | } |
| 208 | 204 | |
| 209 | 205 | private void initBroadCast() { |
| 210 | - | |
| 211 | 206 | IntentFilter intentFilter = new IntentFilter(); |
| 212 | 207 | intentFilter.addAction(AppContext.LOCATION_CITYNAME + ""); |
| 213 | 208 | getActivity().registerReceiver(broadcastReceiver, intentFilter); |
| ... | ... | @@ -301,6 +296,7 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu |
| 301 | 296 | mPresenter.getContextChannel(name.split(" ")[2], 0, 1, 1); |
| 302 | 297 | AppContext.getInstance().cityName = name.split(" ")[1]; |
| 303 | 298 | AppContext.getInstance().district = name.split(" ")[2]; |
| 299 | + AppConfig.getAppConfig(getContext()).set(AppConfig.DISTRICT, name.split(" ")[2]); | |
| 304 | 300 | } |
| 305 | 301 | |
| 306 | 302 | public void refresh() { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
| ... | ... | @@ -233,7 +233,7 @@ public class ReportFragment extends BaseMVPCompatFragment<MyChildContract.MyChil |
| 233 | 233 | @Override |
| 234 | 234 | public CharSequence getPageTitle(int position) { |
| 235 | 235 | if (position==0){ |
| 236 | - return "成长"; | |
| 236 | + return "应用"; | |
| 237 | 237 | }else { |
| 238 | 238 | return "报告"; |
| 239 | 239 | } | ... | ... |
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" | ... | ... |