|
|
|
@ -87,13 +87,15 @@ public class HomeActivity extends BaseActivity implements View.OnFocusChangeList |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
mViewPager.setCurrentItem(0); |
|
|
|
|
LiveDataBus.get().with(Constants.CITY_SELECT,String.class).observe(this, new Observer<String>() { |
|
|
|
|
LiveDataBus.get().with(Constants.CITY_SELECT, String.class).observe(this, new Observer<String>() { |
|
|
|
|
@Override |
|
|
|
|
public void onChanged(String s) { |
|
|
|
|
tv_city.setText(CacheUtil.getIpAddress() == null ? "选择城市" : CacheUtil.getIpAddress().getMemo()); |
|
|
|
|
if (fragments.get(mViewPager.getCurrentItem()) instanceof MyDoctorFragment) { |
|
|
|
|
MyDoctorFragment currentFragment = (MyDoctorFragment) fragments.get(mViewPager.getCurrentItem()); |
|
|
|
|
currentFragment.loadData(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -142,7 +144,7 @@ public class HomeActivity extends BaseActivity implements View.OnFocusChangeList |
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) { |
|
|
|
|
if (System.currentTimeMillis() - exitTime > 2000) { |
|
|
|
|
ToastUtils.showLong("在按一次退出程序"); |
|
|
|
|
exitTime=System.currentTimeMillis(); |
|
|
|
|
exitTime = System.currentTimeMillis(); |
|
|
|
|
} else { |
|
|
|
|
finish(); |
|
|
|
|
System.exit(0); |
|
|
|
|