Exemple #1
0
 @Override
 public void onCheckedChanged(RadioGroup group, int checkedId) {
   TabInfo newTab = mTabs.get("" + checkedId);
   if (mLastTab != newTab) {
     FragmentTransaction ft = mFragmentManager.beginTransaction();
     if (mLastTab != null) {
       if (mLastTab.fragment != null) {
         ft.detach(mLastTab.fragment);
       }
     }
     if (newTab != null) {
       if (newTab.fragment == null) {
         newTab.fragment =
             (BaseFragment)
                 Fragment.instantiate(group.getContext(), newTab.clss.getName(), newTab.args);
         ft.add(mContainerId, newTab.fragment, newTab.tag);
       } else {
         ft.attach(newTab.fragment);
       }
     }
     mLastTab = newTab;
     ft.commit();
     mFragmentManager.executePendingTransactions();
   }
 }
 @Override
 public void onError(ValidationFailure[] failures) {
   RadioButton radio = (RadioButton) view.findViewById(view.getCheckedRadioButtonId());
   if (radio != null) {
     mColor = radio.getCurrentTextColor();
     radio.setTextColor(view.getContext().getResources().getColor(R.color.error));
   }
 }
Exemple #3
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case AppConstants.OK:
              Bundle bundle = msg.getData();

              ProCodeArr = bundle.getStringArray(columns[0]);
              ProNameArr = bundle.getStringArray(columns[1]);
              projectsMap = new HashMap<String, String>();

              rgProInfo = (RadioGroup) findViewById(R.id.rgProjects);

              RadioButton rb = null;

              for (int i = 0; i < ProNameArr.length; i++) {
                rb = new RadioButton(rgProInfo.getContext());

                rb.setText(ProNameArr[i]);
                rb.setTextSize(20);
                // 选中其次选中的数据
                if (ProCodeArr[i].equals(selectedProCode)) {
                  rb.setChecked(true);
                  // 直接点击返回按钮后,将其次选择的数据返回
                  selectedProName = ProNameArr[i];
                }

                rgProInfo.addView(rb);

                projectsMap.put(ProNameArr[i], ProCodeArr[i]);
              }

              dataListLayout.setVisibility(View.VISIBLE);
              break;
            case AppConstants.NG:
              Toast.makeText(
                      appContext,
                      appContext.getString(R.string.error_select_result_zero),
                      Toast.LENGTH_LONG)
                  .show();
              break;
            case AppConstants.ERROR1:
              Toast.makeText(
                      appContext,
                      appContext.getString(R.string.error_network_connected),
                      Toast.LENGTH_LONG)
                  .show();
              break;
            case AppConstants.ERROR2:
              Toast.makeText(
                      appContext, appContext.getString(R.string.system_error), Toast.LENGTH_LONG)
                  .show();
              break;
            default:
              break;
          }

          loadingLayout.setVisibility(View.GONE);
        }