private void showPopupWindow() {
   if (mPopupWindow == null) {
     /** 性别可以全选 年龄会过滤,小于10或者大于99都会进行过滤 排序只能选择一个 */
     View view =
         LayoutInflater.from(this)
             .inflate(R.layout.popupwindow_invitation_filter, mCoordinatorLayout, false);
     // find view
     mEtMinAge = (TextView) view.findViewById(R.id.etMinAge);
     mEtMaxAge = (TextView) view.findViewById(R.id.etMaxAge);
     mCbNearest = (android.widget.CheckBox) view.findViewById(R.id.cbNearest);
     mCbNewly = (android.widget.CheckBox) view.findViewById(R.id.cbNewly);
     mCbMan = (CheckBox) view.findViewById(R.id.cbMan);
     mCbWomen = (CheckBox) view.findViewById(R.id.cbWomen);
     ButtonFlat btnReset = (ButtonFlat) view.findViewById(R.id.btnReset);
     ButtonFlat btnOk = (ButtonFlat) view.findViewById(R.id.btnOk);
     mPopupWindow =
         PopupWindowManager.getPopupWindow(
             view,
             ViewGroup.LayoutParams.MATCH_PARENT,
             ViewGroup.LayoutParams.WRAP_CONTENT,
             viewDim);
     mPopupWindow.setAnimationStyle(R.style.category_filter_popupwindow_anim);
     // init event
     btnReset.setOnClickListener(this);
     btnOk.setOnClickListener(this);
     mCbNearest.setOnCheckedChangeListener(this);
     mCbNewly.setOnCheckedChangeListener(this);
   }
   mPopupWindow.showAsDropDown(mToolBar, 0, 0);
   PopupWindowManager.toggleLight(true, viewDim);
 }
  // @Override
  protected void onBindDialogView(View view) {
    PasswordPreference preference = ((PasswordPreference) getPreference());
    password1 = (EditText) view.findViewById(R.id.password1);
    password2 = (EditText) view.findViewById(R.id.password2);
    protect = (CheckBox) view.findViewById(R.id.performProtection);
    change = (CheckBox) view.findViewById(R.id.changePassword);
    password2Wrapper = (TextInputLayout) view.findViewById(R.id.password2Wrapper);
    String warning =
        ContribFeature.SECURITY_QUESTION.hasAccess()
            ? getContext().getString(R.string.warning_password_contrib)
            : (getContext().getString(R.string.warning_password_no_contrib)
                + " "
                + ContribFeature.SECURITY_QUESTION.buildRequiresString(getContext()));
    ((TextView) view.findViewById(R.id.password_warning)).setText(warning);
    main = (LinearLayout) view.findViewById(R.id.layoutMain);
    edit = (LinearLayout) view.findViewById(R.id.layoutPasswordEdit);
    boolProtectOrig = preference.getValue();
    boolProtect = boolProtectOrig;
    protect.setChecked(boolProtect);
    if (boolProtect) {
      main.setVisibility(View.VISIBLE);
      view.findViewById(R.id.layoutChangePasswordCheckBox).setVisibility(View.VISIBLE);
      edit.setVisibility(View.GONE);
    }

    password1.addTextChangedListener(this);
    password2.addTextChangedListener(this);
    protect.setOnCheckedChangeListener(this);
    change.setOnCheckedChangeListener(this);
    super.onBindDialogView(view);
  }
 /** Initialize widgets of the main panel. */
 private void attrInit() {
   submitSpeedBtn = (Button) findViewById(R.id.submitEntrSpeed);
   submitSpeedBtn.setOnClickListener(new SubSpeedButtonListener());
   submitIntervalBtn = (Button) findViewById(R.id.submitExitSpeed);
   submitIntervalBtn.setOnClickListener(new SubIntervalButtonListener());
   editSwitchSpeed = (EditText) findViewById(R.id.editEntrSpeed);
   editInterval = (EditText) findViewById(R.id.editExitSpeed);
   // Set default values, for users.
   // editSwitchSpeed.setText("20");
   // editInterval.setText("30");
   // Set default values, for testing.
   editSwitchSpeed.setText("20");
   editInterval.setText("1");
   auto.setSwitchSpeed(Integer.valueOf(editSwitchSpeed.getText().toString()).intValue());
   auto.setInterval(Integer.valueOf(editInterval.getText().toString()).intValue());
   cbSwi = (CheckBox) findViewById(R.id.cbSwitch);
   cbSwi.setOnCheckedChangeListener(new SwiCBListener());
   cbRib = (CheckBox) findViewById(R.id.cbRib);
   cbRib.setOnCheckedChangeListener(new RibCBListener());
   tvSSTitle = (TextView) findViewById(R.id.tvSSTile);
   tvITitle = (TextView) findViewById(R.id.tvITile);
   tvExit = (TextView) findViewById(R.id.tvExit);
   tvSSTitle.setOnClickListener(new TextViewListener());
   tvITitle.setOnClickListener(new TextViewListener());
   tvExit.setOnClickListener(new TextViewListener());
 }
  // Other
  // ==============================================================================================
  private void displayOptions() {
    final AlertDialog.Builder alertDialog = new AlertDialog.Builder(FlightControlsActivity.this);
    LayoutInflater inflater = getLayoutInflater();
    View convertView = (View) inflater.inflate(R.layout.popup_flight_options, null);
    alertDialog.setView(convertView);
    alertDialog.setTitle("Options:");
    alertDialog.setPositiveButton(
        "Continue",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {}
        });

    final AlertDialog alert = alertDialog.create();
    alert.show();

    final CheckBox chkDirectional = (CheckBox) alert.findViewById(R.id.chkDirectional);
    final CheckBox chkRotation = (CheckBox) alert.findViewById(R.id.chkRotation);
    final CheckBox chkAltitude = (CheckBox) alert.findViewById(R.id.chkAltitude);

    chkDirectional.setOnCheckedChangeListener(this);
    chkRotation.setOnCheckedChangeListener(this);
    chkAltitude.setOnCheckedChangeListener(this);

    chkDirectional.setChecked(controls_directional);
    chkRotation.setChecked(controls_rotation);
    chkAltitude.setChecked(controls_altitude);
  }
 private void setView() {
   try {
     mBtnChoose = (Button) findViewById(R.id.btn_show_choose);
     mBtnBack = (Button) findViewById(R.id.btn_back_to_pre);
     mChkSephiroth = (CheckBox) findViewById(R.id.chk_sephiroth);
     mChkSephiroth.setOnCheckedChangeListener(chkLeader);
     mChkKefka = (CheckBox) findViewById(R.id.chk_kefka);
     mChkKefka.setOnCheckedChangeListener(chkLeader);
     mChkExdeath = (CheckBox) findViewById(R.id.chk_exdeath);
     mChkExdeath.setOnCheckedChangeListener(chkLeader);
     mLlMoogles = (LinearLayout) findViewById(R.id.ll_moogles);
     mMoogles = getResources().getStringArray(R.array.moogles);
     mTxtCounter = (TextView) findViewById(R.id.txt_counter);
     mTxtLeader = (TextView) findViewById(R.id.txt_leader);
     for (int i = 0; i < mMoogles.length; i++) {
       CheckBox chkMoogle = new CheckBox(this);
       chkMoogle.setId(i);
       chkMoogle.setText(mMoogles[i]);
       chkMoogle.setOnCheckedChangeListener(chkMoogles);
       mLlMoogles.addView(chkMoogle);
     }
   } catch (Exception _ex) {
     Log.e("aaaaaaa", _ex.getMessage());
   }
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    this.game = new Game(new Team(teamAName), new Team(teamBName), MAX_TOSSUPS);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button back = (Button) findViewById(R.id.backbutton);
    back.setOnClickListener(prevButtonClicked);
    Button forward = (Button) findViewById(R.id.forwardbutton);
    forward.setOnClickListener(nextButtonClicked);

    RadioGroup lhs = (RadioGroup) findViewById(R.id.teamaradiogroup);
    lhs.setOnCheckedChangeListener(teamPointsSelected);
    RadioGroup rhs = (RadioGroup) findViewById(R.id.teambradiogroup);
    rhs.setOnCheckedChangeListener(teamPointsSelected);

    CheckBox bbox1 = (CheckBox) findViewById(R.id.bonuscheck1);
    CheckBox bbox2 = (CheckBox) findViewById(R.id.bonuscheck2);
    CheckBox bbox3 = (CheckBox) findViewById(R.id.bonuscheck3);
    bbox1.setOnCheckedChangeListener(bonusBoxChecked);
    bbox2.setOnCheckedChangeListener(bonusBoxChecked);
    bbox3.setOnCheckedChangeListener(bonusBoxChecked);

    Spinner spinnerA = (Spinner) findViewById(R.id.teamaplayerspinner);
    spinnerA.setOnItemSelectedListener(playerSpinnerSelected);
    Spinner spinnerB = (Spinner) findViewById(R.id.teambplayerspinner);
    spinnerB.setOnItemSelectedListener(playerSpinnerSelected);
    this.updatePlayerSpinner();

    TextView teamAName = (TextView) findViewById(R.id.teama);
    TextView teamBName = (TextView) findViewById(R.id.teamb);
    teamAName.setOnClickListener(teamANameClicked);
    teamBName.setOnClickListener(teamBNameClicked);
  }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      long t = System.currentTimeMillis();
      View view = mAdapter.getView(position, convertView, parent);
      if (view == null) {
        return null;
      }

      // 表示分隔线
      if (getItem(position) == null) {
        bindNormalRecordSelector(view);
        return view;
      }

      CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
      checkBox.setVisibility(View.VISIBLE);
      checkBox.setOnCheckedChangeListener(null);
      checkBox.setChecked(isItemSelected(position));
      checkBox.setOnCheckedChangeListener(
          new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              setItemSelected(position, isChecked);
            }
          });
      t = System.currentTimeMillis() - t;
      LogUtil.d("getView time = " + t);
      return view;
    }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    getPrefs();
    savePrefs();
    pwdText = (EditText) findViewById(R.id.passwordText1);
    enableCheckBox = (CheckBox) findViewById(R.id.enableCheckBox);
    timeOutText = (EditText) findViewById(R.id.timeOutText);
    useGPSCheckBox = (CheckBox) findViewById(R.id.useGPSCheckBox);
    setFormValues();

    // Enable the testButton
    Button testButton = (Button) findViewById(R.id.testButton);
    testButton.setOnClickListener(this);

    // Save the data when the enter or TAB key is pressed
    pwdText.setOnKeyListener(
        new View.OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && ((keyCode == KeyEvent.KEYCODE_ENTER) || (keyCode == KeyEvent.KEYCODE_TAB))) {
              msgBox("Saving Data");
              getFormValues();
              savePrefs();
              return true;
            }
            return false;
          }
        });

    pwdText.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });

    enableCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton v, boolean b) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });

    useGPSCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton v, boolean b) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });
  }
  private void fillView(@Nonnull View root, @Nonnull final Context context) {
    root.setTag(tag);

    final CalculatorPlotter plotter = Locator.getInstance().getPlotter();

    final TextView expressionTextView =
        (TextView) root.findViewById(R.id.cpp_plot_function_expression_textview);
    expressionTextView.setText(plotFunction.getXyFunction().getExpressionString());

    final CheckBox pinnedCheckBox =
        (CheckBox) root.findViewById(R.id.cpp_plot_function_pinned_checkbox);
    pinnedCheckBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean pin) {
            if (pin) {
              if (!plotFunction.isPinned()) {
                plotFunction = plotter.pin(plotFunction);
              }
            } else {
              if (plotFunction.isPinned()) {
                plotFunction = plotter.unpin(plotFunction);
              }
            }
          }
        });
    pinnedCheckBox.setChecked(plotFunction.isPinned());

    final CheckBox visibleCheckBox =
        (CheckBox) root.findViewById(R.id.cpp_plot_function_visible_checkbox);
    visibleCheckBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean show) {
            if (show) {
              if (!plotFunction.isVisible()) {
                plotFunction = plotter.show(plotFunction);
              }
            } else {
              if (plotFunction.isVisible()) {
                plotFunction = plotter.hide(plotFunction);
              }
            }
          }
        });
    visibleCheckBox.setChecked(plotFunction.isVisible());

    final ImageButton settingsButton =
        (ImageButton) root.findViewById(R.id.cpp_plot_function_settings_button);
    settingsButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            CalculatorPlotFunctionSettingsActivity.startActivity(context, plotFunction);
          }
        });
  }
 private void updateSelectButton() {
   if (!mShouldUpdateSelectButton) {
     return;
   }
   if (mSelectButton != null) {
     mSelectButton.setOnCheckedChangeListener(null);
     mSelectButton.setChecked(((RecordItemListAdapter) mAdapter).areAllItemSelected());
     mSelectButton.setOnCheckedChangeListener(mSelectedBtnCheckedChangeListener);
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_work_mapping_activity);
    //
    Intent recieve = getIntent();
    buildingImg = recieve.getByteArrayExtra("img");
    z = recieve.getDoubleExtra("z", 0);
    scale = recieve.getDoubleExtra("scale", 0.05);
    savedPoint = new xy();
    curPoint = new xy();
    //
    getWindowSize();
    drawer = (SlidingDrawer) findViewById(R.id.activity_work_mapping_drawer);
    menulayer =
        (LinearLayout) findViewById(R.id.activity_work_mapping_draggable_containmenubuttonlayout);
    map_frame = (FrameLayout) findViewById(R.id.activity_work_mapping_draggable_frame);
    DimageView = (DraggableImageView) findViewById(R.id.activity_work_mapping_draggable_imageview);
    //
    BitmapFactory.Options option = new BitmapFactory.Options();
    option.inScaled = false;
    //

    Bitmap backgroudImage = getMapBitmap(option);
    createOverlayView(backgroudImage.getWidth(), backgroudImage.getHeight(), backgroudImage);
    setImageHandler();
    DimageView.setHandler(handler);
    DimageView.setDmetric(getDispaymetric());
    DimageView.setImageBitmap(backgroudImage);
    arr_button_menu = new Button[8];

    measureCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_measure);
    measureCheckBox.setOnCheckedChangeListener(checkboxListener);
    measureCheckBox.setTag(1);
    measureCheckBox.setChecked(true);
    poiCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_poi);
    poiCheckBox.setOnCheckedChangeListener(checkboxListener);
    poiCheckBox.setTag(2);
    poiCheckBox.setChecked(true);
    wayCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_way);
    wayCheckBox.setOnCheckedChangeListener(checkboxListener);
    wayCheckBox.setTag(3);
    wayCheckBox.setChecked(true);
    UpdateButton = (Button) findViewById(R.id.activity_work_mapping_drawer_button_update);
    UpdateButton.setOnClickListener(l);

    createPOIInputDialog();
    createMeasureDialog();
    setInputHandler();

    init();
  }
 private void bindNormalRecordSelector(View view) {
   CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
   checkBox.setVisibility(onlyHaveNormalRecords() ? View.GONE : View.VISIBLE);
   checkBox.setOnCheckedChangeListener(null);
   checkBox.setChecked(areAllNormalRecordSelected());
   checkBox.setOnCheckedChangeListener(
       new OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
           selectAllNormalRecords(isChecked);
         }
       });
 }
Beispiel #13
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    rbMale = (RadioButton) findViewById(R.id.radioMale);
    rbFemale = (RadioButton) findViewById(R.id.radioFemale);
    rgGender = (RadioGroup) findViewById(R.id.radioGroup1);
    rgGender.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            if (checkedId == rbMale.getId()) {
              gender = rbMale.getText().toString();
            } else {
              gender = rbFemale.getText().toString();
            }
          }
        });

    CompoundButton.OnCheckedChangeListener lsnr =
        new CompoundButton.OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            String hobby = buttonView.getText().toString();
            if (isChecked) {
              hobbies.add(hobby);
              String msg = "ÎÒÊÇ" + gender + "ÈË£¬ÎÒϲ»¶";
              for (String s : hobbies) {
                msg = msg + s + " ";
              }
              Toast t = Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT);
              t.show();
            } else {
              hobbies.remove(hobby);
            }
          }
        };
    cbMath = (CheckBox) findViewById(R.id.checkBoxMath);
    cbIT = (CheckBox) findViewById(R.id.checkBoxIT);
    cbMusic = (CheckBox) findViewById(R.id.checkBoxMusic);
    cbMath.setOnCheckedChangeListener(lsnr);
    cbIT.setOnCheckedChangeListener(lsnr);
    cbMusic.setOnCheckedChangeListener(lsnr);
  }
Beispiel #14
0
  private void set_audio_flag() {
    TextView audio_text = (TextView) findViewById(R.id.need_audio_txt);
    audio_text.setText(Html.fromHtml(N("FW_AUDIO_ENBALE_TXT")));

    CheckBox box = (CheckBox) findViewById(R.id.need_audio_box);
    box.setChecked(GetNeedAudio() == 0 ? false : true);

    box.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SetNeedAudio(isChecked ? 1 : 0);
          }
        });

    TextView select_audio_text = (TextView) findViewById(R.id.select_audio_text);
    select_audio_text.setText(N("FW_AUDIO_SELECT_FILE"));

    Button button = (Button) findViewById(R.id.select_audio_file);
    button.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            /* "1" for fastwiki.audio file */
            startIntentForClass(201, FileBrowse.class, "1", N("FW_AUDIO_SELECT_TITLE"));
          }
        });

    m_audio_path = (TextView) findViewById(R.id.audio_path);

    show_audio_path();
    set_data_path_flag();
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // set up preferences about talking or not
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    talkOrNot = preferences.getBoolean("talking", true);

    // update the Combobox item as it must be changed due to preferences
    talkingCheckbox = (CheckBox) findViewById(R.id.checkbox);
    talkingCheckbox.setChecked(talkOrNot);

    // update the preferences from the Combobox item
    talkingCheckbox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            Editor edit = preferences.edit();
            edit.putBoolean("talking", isChecked);
            edit.commit();
          }
        });

    // Check if the application must talk and talk or not
    if (talkOrNot) {
      whatIam(); // na ginei me mediaplayer class kai service
    }
  }
  @Override
  protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    mSeekBar = getSeekBar(view);
    mSeekBar.setMax(MAXIMUM_BACKLIGHT); // - mScreenBrightnessDim);

    try {
      this.loadPreference();
    } catch (InvalidPreferencesFormatException e) {
      e.printStackTrace();

      // Set some default
      this.brightness = 255;
      this.brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
    }

    mOldBrightness = getBrightness(0);
    mSeekBar.setProgress(mOldBrightness); // - mScreenBrightnessDim);

    mCheckBox = (CheckBox) view.findViewById(R.id.automatic_mode);
    if (mAutomaticAvailable) {
      mCheckBox.setOnCheckedChangeListener(this);
      mOldAutomatic = getBrightnessMode(0);
      mCheckBox.setChecked(mOldAutomatic != 0);
    } else {
      mCheckBox.setVisibility(View.GONE);
    }
    mSeekBar.setOnSeekBarChangeListener(this);
  }
 private void setUiListener() {
   mAlreadyHaveTag.setOnCheckedChangeListener(
       new CompoundButton.OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
           if (isChecked) {
             mTagName.setHint(R.string.already_have_tag_hint);
             mTagName.setAdapter(
                 new ArrayAdapter<>(
                     IntroductionActivity.this,
                     android.R.layout.simple_dropdown_item_1line,
                     mTagList));
             mTagName.setThreshold(1);
           } else {
             mTagName.setHint(R.string.new_tag_hint);
             mTagName.setAdapter(null);
           }
         }
       });
   mContinue.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           if (mFirstName.getText().toString().trim().length() > 0
               && mLastName.getText().toString().trim().length() > 0
               && mTagName.getText().toString().trim().length() > 0)
             if (mTagList == null || mTagList.size() == 0) savePersonalDetails(true);
             else if (mTagList.contains(mTagName.getText().toString().trim()))
               savePersonalDetails(false);
             else showCreateNewTagAlert();
         }
       });
 }
  /** Called when the activity is first created. Responsible for initializing the UI. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.v(TAG, "Activity State: onCreate()");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contact_manager);

    // Obtain handles to UI objects
    mAddAccountButton = (Button) findViewById(R.id.addContactButton);
    mContactList = (ListView) findViewById(R.id.contactList);
    mShowInvisibleControl = (CheckBox) findViewById(R.id.showInvisible);

    // Initialize class properties
    mShowInvisible = false;
    mShowInvisibleControl.setChecked(mShowInvisible);

    // Register handler for UI elements
    mAddAccountButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Log.d(TAG, "mAddAccountButton clicked");
            launchContactAdder();
          }
        });
    mShowInvisibleControl.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Log.d(TAG, "mShowInvisibleControl changed: " + isChecked);
            mShowInvisible = isChecked;
            populateContactList();
          }
        });

    // Populate the contact list
    populateContactList();
  }
  public void setAllPlayers(List<Player> allPlayers) {
    allPlayersTable.removeAllViews();
    for (final Player player : allPlayers) {
      TableRow playerRow = new TableRow(context);
      playerRow.setLayoutParams(
          new TableRow.LayoutParams(
              TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
      allPlayersTable.addView(playerRow);

      CheckBox playerSelection = new CheckBox(context);
      playerSelection.setChecked(player.isSelected());
      playerSelection.setOnCheckedChangeListener(
          new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              isCurrentPlayerSelected = isChecked;
              currentPlayerId = player.getId();
              selectedPlayersChangedListenerManager.notifyListeners();
            }
          });
      playerRow.addView(playerSelection);

      TextView playerName = new TextView(context);
      playerName.setText(player.getName());
      playerName.setTextSize(UIConstants.TEXT_NORMAL_SIZE);
      playerName.setTextColor(UIConstants.TEXT_COLOR);
      playerRow.addView(playerName);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setup4);
    mCheck = (CheckBox) findViewById(R.id.cb_protect);

    boolean protect = mPref.getBoolean("protect", false);
    // 当check发生改变时,回掉此方法
    if (protect) {
      mCheck.setText("防盗保护已经开启");
      mCheck.setChecked(true);
    } else {
      mCheck.setText("防盗保护没有开启");
      mCheck.setChecked(false);
    }
    mCheck.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              mCheck.setText("防盗保护已经开启");
              mPref.edit().putBoolean("protect", true).commit();
            } else {
              mCheck.setText("防盗保护没有开启");
              mPref.edit().putBoolean("protect", false).commit();
            }
          }
        });
  }
Beispiel #21
0
  public void performUpdate() {
    controlLayout.removeAllViews();

    for (iotnode n : foobar.getNodes()) {
      CheckBox cb = new CheckBox(this);
      n.index = foobar.getNodes().indexOf(n);
      cb.setText(n.toString());
      cb.setChecked(n.getState());
      final int idx = n.index;
      cb.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              // foobar.setState(idx, isChecked);
              Log.d("box", "" + idx);
              try {
                foobar.setState(idx, isChecked);
                foobar.pushState();
              } catch (Exception e) {
                e.printStackTrace();
              }
              Toast.makeText(getApplicationContext(), buttonView.getText(), Toast.LENGTH_SHORT)
                  .show();
            }
          });
      controlLayout.addView(cb);
    }
  }
Beispiel #22
0
  private void set_body_image() {
    TextView use_body_image = (TextView) findViewById(R.id.use_body_image);
    use_body_image.setText(N("FW_FB_ENABLE_BODY_IMAGE"));

    m_body_image_box = (CheckBox) findViewById(R.id.body_image_box);
    m_body_image_box.setChecked(GetBodyImageFlag() == 0 ? false : true);

    m_body_image_box.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SetBodyImageFlag(isChecked ? 1 : 0);
          }
        });

    TextView select_body_image_text = (TextView) findViewById(R.id.select_body_image_text);
    select_body_image_text.setText(N("FW_FB_SELECT_BODY_IMAGE"));

    Button m_body_button = (Button) findViewById(R.id.select_body_image);
    m_body_button.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            // "0" for image file
            startIntentForClass(200, FileBrowse.class, "0", N("FW_FB_BODY_IMAGE"));
          }
        });

    m_body_image_path = (TextView) findViewById(R.id.body_image_path);

    show_body_image_path();
  }
Beispiel #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.posttweet);

    twitter = (Twitter) getIntent().getSerializableExtra("twitter");

    Button but = (Button) findViewById(R.id.but_post_tweet);
    but.setOnClickListener(this);

    CheckBox checkbox = (CheckBox) findViewById(R.id.post_check_box);
    checkbox.setOnCheckedChangeListener(this);
    // startLocationPositioning();

    TextWatcher tw =
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {
            TextView text = (TextView) findViewById(R.id.post_text_view_1);
            text.setText("" + (140 - s.length()));
          }
        };
    EditText ed = (EditText) findViewById(R.id.posttweet_edit_text1);
    ed.addTextChangedListener(tw);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;

    setContentView(R.layout.fingerprint_viewer);
    integrator = new IntentIntegrator(this);
    Intent intent = getIntent();
    account = getAccount(intent);
    user = getUser(intent);
    if (AccountManager.getInstance().getAccount(account) == null || user == null) {
      Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
      finish();
      return;
    }
    if (savedInstanceState != null) {
      remoteFingerprint = savedInstanceState.getString(SAVED_REMOTE_FINGERPRINT);
      localFingerprint = savedInstanceState.getString(SAVED_LOCAL_FINGERPRINT);
    } else {
      remoteFingerprint = OTRManager.getInstance().getRemoteFingerprint(account, user);
      localFingerprint = OTRManager.getInstance().getLocalFingerprint(account);
    }
    verifiedView = (CheckBox) findViewById(R.id.verified);
    verifiedView.setOnCheckedChangeListener(this);
    scanView = findViewById(R.id.scan);
    scanView.setOnClickListener(this);
    showView = findViewById(R.id.show);
    showView.setOnClickListener(this);
    copyView = findViewById(R.id.copy);
    copyView.setOnClickListener(this);
    isUpdating = false;
  }
Beispiel #25
0
  // пункт списка
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // используем созданные, но не используемые view
    view = convertView;
    if (view == null) {
      view = lInflater.inflate(R.layout.item, parent, false);
    }

    VoiceRecords p = getProduct(position);

    // заполняем View в пункте списка данными из товаров: наименование, цена
    // и картинка
    ((TextView) view.findViewById(R.id.tvDescr)).setText(p.name);
    ((TextView) view.findViewById(R.id.tvPrice)).setText(p.price + "");
    ((ImageView) view.findViewById(R.id.ivImage)).setImageResource(p.image);
    //    ((ImageView)view.findViewById(R.id.ivImage)).setOnClickListener(new View.OnClickListener()
    // {
    //
    //  		@Override
    //  		public void onClick(View v) {
    //  			// TODO Auto-generated method stub
    //  			Log.v("F**K","A");
    //  		}
    //  	});

    CheckBox cbBuy = (CheckBox) view.findViewById(R.id.cbBox);
    // присваиваем чекбоксу обработчик
    cbBuy.setOnCheckedChangeListener(myCheckChangList);
    // пишем позицию
    cbBuy.setTag(position);
    // заполняем данными из товаров: в корзине или нет
    cbBuy.setChecked(p.box);

    return view;
  }
  @Override
  public void convert(ViewHolder viewHolder, final String item, int position) {
    ImageView ivPhoto = viewHolder.getView(R.id.iv_photo);
    CheckBox checkBox = viewHolder.getView(R.id.checkbox);
    // 先设置为默认图片
    ivPhoto.setImageResource(R.mipmap.icon_empty_photo);
    // 再根据路径异步加载相册中的照片
    imageLoader.loadImage(item, ivPhoto);

    checkBox.setTag(R.id.tag_position, position);
    checkBox.setTag(R.id.tag_photo, ivPhoto);
    checkBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            int position = (Integer) buttonView.getTag(R.id.tag_position);
            ImageView photo = (ImageView) buttonView.getTag(R.id.tag_photo);

            if (isChecked) {
              selectMap.put(position, item);
              photo.setColorFilter(Color.parseColor("#66000000"));
            } else {
              selectMap.remove(position);
              photo.setColorFilter(null);
            }
          }
        });
    checkBox.setChecked(item.equals(selectMap.get(position)));
  }
Beispiel #27
0
  private void initUI() {
    cb_box = (CheckBox) findViewById(R.id.cb_box);
    // 1,是否选中状态的回显
    boolean open_security = SpUtil.getBoolean(this, ConstantValue.OPEN_SECURITY, false);
    // 2,根据状态,修改checkbox后续的文字显示
    cb_box.setChecked(open_security);
    if (open_security) {
      cb_box.setText("安全设置已开启");
    } else {
      cb_box.setText("安全设置已关闭");
    }

    //		cb_box.setChecked(!cb_box.isChecked());
    // 3,点击过程中,监听选中状态发生改变过程,
    cb_box.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // 4,isChecked点击后的状态,存储点击后状态
            SpUtil.putBoolean(getApplicationContext(), ConstantValue.OPEN_SECURITY, isChecked);
            // 5,根据开启关闭状态,去修改显示的文字
            if (isChecked) {
              cb_box.setText("安全设置已开启");
            } else {
              cb_box.setText("安全设置已关闭");
            }
          }
        });
  }
  private void findViews() {
    gridView = (GridView) this.findViewById(R.id.gridView);
    deleteCheckBox = (CheckBox) this.findViewById(R.id.deleteCheckBox);

    deleteCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              deleteCheckBox.setText("完成");
              adapter.showDeleteTag(true);
            } else {
              deleteCheckBox.setText("删除");
              adapter.showDeleteTag(false);

              new DialogAlertBill(BillTempleteSelectActivity.this, listener, "您确定删除所选择的模版吗?")
                  .show();
            }
          }
        });

    gridView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            intent = new Intent(BillTempleteSelectActivity.this, BillInputActivity.class);
            intent.putExtra("flag", "template");
            intent.putExtra("template", templates.get(position));
            startActivity(intent);
            overridePendingTransition(R.anim.activity_up, R.anim.activity_steady);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Retrieve preferences
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    isBalanced = sp.getBoolean(MainActivity.CHECKBOX_BALANCE, false);

    // Get and initialize views
    View v = inflater.inflate(R.layout.control, container, false);
    textViewLevel = (TextView) v.findViewById(R.id.textView_level);
    textViewLevelRight = (TextView) v.findViewById(R.id.textView_levelRight);
    seekBarMain = (SeekBar) v.findViewById(R.id.seekBar_main);
    seekBarMainRight = (SeekBar) v.findViewById(R.id.seekBar_mainRight);
    CheckBox checkBoxBalance = (CheckBox) v.findViewById(R.id.checkBox_Balance);
    checkBoxBalance.setChecked(isBalanced);

    // Set view listeners
    seekBarMain.setOnSeekBarChangeListener(this);
    seekBarMainRight.setOnSeekBarChangeListener(this);
    checkBoxBalance.setOnCheckedChangeListener(this);

    rebuildSeekbar();

    // Set up idle kill timer
    idleKillTimer = new Handler(); // Make your Main UIWorker Thread to execute this statement
    idleTimerRunnable = new IdleTimer();
    if (getActivity().getClass() == DialogActivity.class) {
      idleKillTimer.postDelayed(idleTimerRunnable, FINISH_DELAY);
    }

    return v;
  }
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      final View v = inflater.inflate(R.layout.fragment_ssh_keygen, container, false);
      Typeface monoTypeface =
          Typeface.createFromAsset(getActivity().getAssets(), "fonts/sourcecodepro.ttf");

      Spinner spinner = (Spinner) v.findViewById(R.id.length);
      Integer[] lengths = new Integer[] {2048, 4096};
      ArrayAdapter<Integer> adapter =
          new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, lengths);
      spinner.setAdapter(adapter);

      ((EditText) v.findViewById(R.id.passphrase)).setTypeface(monoTypeface);

      CheckBox checkbox = (CheckBox) v.findViewById(R.id.show_passphrase);
      checkbox.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              EditText editText = (EditText) v.findViewById(R.id.passphrase);
              int selection = editText.getSelectionEnd();
              if (isChecked) {
                editText.setInputType(
                    InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
              } else {
                editText.setInputType(
                    InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
              }
              editText.setSelection(selection);
            }
          });

      return v;
    }