Exemplo n.º 1
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == 1 && resultCode == 1) {
     ((MainActivity) getActivity()).writePreference("selected_city", data.getStringExtra("city"));
     if (readPreference("selected_city").length() > 4) {
       tvRight.setText(readPreference("selected_city").substring(0, 4) + "...");
     } else {
       tvRight.setText(readPreference("selected_city"));
     }
   }
   switch (resultCode) {
     case 1001: // 喜欢一起去
       mTab01.modifyLikeView(requestCode, true);
       break;
     case 1002: // 不喜欢一起去
       mTab01.modifyLikeView(requestCode, false);
       break;
     case 1003: // 喜欢秒旅团
       mTab02.modifyLikeView(requestCode, true);
       break;
     case 1004: // 不喜欢秒旅团
       mTab02.modifyLikeView(requestCode, false);
       break;
   }
 }
Exemplo n.º 2
0
 public void refreshCity() {
   try {
     if (tvRight == null) {
       return;
     }
     if (!StringUtil.isEmpty(readPreference("selected_city"))) {
       if (readPreference("selected_city").length() > 4) {
         tvRight.setText(readPreference("selected_city").substring(0, 3) + "...");
       } else {
         tvRight.setText(readPreference("selected_city"));
       }
     } else
     //            if(!StringUtil.isEmpty(readPreference("located_city"))){
     //                if(readPreference("located_city").length()>4){
     //                    tvRight.setText(readPreference("located_city").substring(0,3)+"...");
     //                }else{
     //                    tvRight.setText(readPreference("located_city"));
     //                }
     //            }else
     {
       tvRight.setText("定位中...");
     }
     mTab02.getTogether(false);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }