Пример #1
0
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          switch (buttonView.getId()) {
              // 龙城太原
            case R.id.main_footbar_lcty:
              // 改变按钮状态
              if (buttonView.isChecked()) {
                radioButton_wzty.setChecked(false);
                radioButton_xzty.setChecked(false);
                // 改变标题
                title.setText(R.string.mian_lcty);
                // 设置主图标显示的适配器
                gridView.setAdapter(adapter_lcty);
              }

              break;
              // 玩在太原
            case R.id.main_footbar_wzty:
              if (buttonView.isChecked()) {
                radioButton_lcty.setChecked(false);
                radioButton_xzty.setChecked(false);
                title.setText(R.string.mian_wzty);
                gridView.setAdapter(adapter_wzty);
              }

              break;
              // 学在太原
            case R.id.main_footbar_xzty:
              if (buttonView.isChecked()) {
                radioButton_lcty.setChecked(false);
                radioButton_wzty.setChecked(false);
                title.setText(R.string.mian_xzty);
                gridView.setAdapter(adapter_xzty);
              }

              break;
              // 摇我喜欢
            case R.id.main_footbar_shake_i_like:
              // 改变按钮状态
              if (buttonView.isChecked()) {
                radioButton_shak_i_like.setChecked(false); // 防止回退时是按下状态

                Intent intent = new Intent(MainActivity.this, ShakeILikeActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.fade_in, R.anim.hold); // 淡入
              }

              break;
            default:
              break;
          }
        }
 @Override
 public void onClick(View convertView) {
   LogHelper.d("test", "test item clicked: ");
   ViewHolder holder = (ViewHolder) convertView.getTag();
   CompoundButton b = holder.cbFilter;
   b.setChecked(!b.isChecked());
 }
  private void updateDoneButtonState() {
    if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
      mDoneButton.setEnabled(true);
      return;
    }

    if (mInterval.getText().toString().length() == 0) {
      mDoneButton.setEnabled(false);
      return;
    }

    if (mEndCount.getVisibility() == View.VISIBLE && mEndCount.getText().toString().length() == 0) {
      mDoneButton.setEnabled(false);
      return;
    }

    if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) {
      for (CompoundButton b : mWeekByDayButtons) {
        if (b.isChecked()) {
          mDoneButton.setEnabled(true);
          return;
        }
      }
      mDoneButton.setEnabled(false);
      return;
    }

    mDoneButton.setEnabled(true);
  }
Пример #4
0
  Intent buildServiceIntent() {
    Intent result = null;

    if (verify.isChecked()) {
      PackageManager mgr = getPackageManager();

      for (ResolveInfo info : mgr.queryIntentServices(INTENT_SERVICE, 0)) {
        try {
          if (validate(info.serviceInfo.packageName, R.raw.valid_signature)) {
            result = new Intent(INTENT_SERVICE);
            result.setComponent(
                new ComponentName(info.serviceInfo.packageName, info.serviceInfo.name));

            break;
          }
        } catch (Exception e) {
          Log.e(getClass().getSimpleName(), "Exception finding valid service", e);
        }
      }
    } else {
      result = INTENT_SERVICE;
    }

    return (result);
  }
Пример #5
0
 public boolean isChecked() {
   boolean checked = false;
   if (view instanceof CompoundButton) {
     CompoundButton cb = (CompoundButton) view;
     checked = cb.isChecked();
   }
   return checked;
 }
Пример #6
0
 public void setJavascriptEnabled(boolean jsEnabled) {
   Log.d(L.TAG, "Control bar: Javascript " + (jsEnabled ? "enabled" : "disabled"));
   if (jsToggle.isChecked() != jsEnabled) {
     jsToggle.setOnCheckedChangeListener(null);
     jsToggle.setChecked(jsEnabled);
     jsToggle.setOnCheckedChangeListener(this);
   }
   jsToggle.setEnabled(true);
 }
 @Override
 public void onClick(View v) {
   CompoundButton compoundButton = (CompoundButton) v;
   if (compoundButton.isChecked()) {
     compoundButton.startAnimation(tl_preview_show);
   } else {
     compoundButton.startAnimation(tl_preview_hide);
   }
 }
Пример #8
0
  public void onClick(View v) {
    CompoundButton btn = (ToggleButton) v;
    if (btn.getId() == R.id.MSWMfullscreen) {
      new runCmd().execute(Consts.VIDEO_FULLSCREEN_TOGGLE, "");

    } else if (btn.getId() == R.id.MSWMplaypause) {

      if (btn.isChecked()) {
        if (firstPlay) {
          String rootPath = json.getRootPath();
          if (rootPath == null) {
            json.set_context(getApplicationContext(), DEVICE_ID);
            rootPath = json.getRootPath();
          }
          try {
            loc = loc.replace("/mnt/raid/", rootPath);
            new runCmd().execute(Consts.VIDEO_OPEN, loc);
            Thread.sleep(500);
            firstPlay = false;
          } catch (Exception e) {
            Log.e(Consts.LOG_TAG, "Problem with playing " + loc, e);
          }
        }
        try {
          json.UpdateSongInfo();
          if (json.getIsPlaying()) {
            Log.v(Consts.LOG_TAG, "Stopping Music to play Video");
            new runCmd().execute(Consts.MUSIC_STOP, "");
            Thread.sleep(500);
          }
        } catch (Exception e) {
        }
        new runCmd().execute(Consts.VIDEO_PLAY, "");
      } else {
        new runCmd().execute(Consts.VIDEO_PAUSE, "");
      }
    }
  };
Пример #9
0
 public boolean isJavascriptEnabled() {
   return jsToggle.isChecked();
 }
Пример #10
0
 public Integer getImportance() {
   for (CompoundButton b : buttons) if (b.isChecked()) return (Integer) b.getTag();
   return null;
 }
 @Override
 public boolean isChecked() {
   return _checkbox != null && _checkbox.isChecked();
 }