@Override public void bindView(View view, Context context, Cursor cursor) { ImageButton b = (ImageButton) view.findViewById(R.id.btnRemove); b.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "Deleting Task", Toast.LENGTH_SHORT).show(); deleteTask(v); } }); CheckBox c1 = (CheckBox) view.findViewById(R.id.checkBox1); c1.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "checking Task", Toast.LENGTH_SHORT).show(); checkTask(v); } }); super.bindView(view, context, cursor); }
@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; }
public void disablePresenceClickEventHandler(View v) { EditText editTextServer = (EditText) findViewById(R.id.EditTextServer); EditText editTextApplicationKey = (EditText) findViewById(R.id.EditTextApplicationKey); EditText editTextChannel = (EditText) findViewById(R.id.EditTextChannel); CheckBox checkBoxIsCluster = (CheckBox) findViewById(R.id.CheckBoxIsCluster); Ortc.disablePresence( editTextServer.getText().toString(), checkBoxIsCluster.isChecked(), editTextApplicationKey.getText().toString(), defaultPrivateKey, editTextChannel.getText().toString(), new OnDisablePresence() { @Override public void run(Exception error, String result) { final Exception exception = error; final String resultText = result; runOnUiThread( new Runnable() { @Override public void run() { if (exception != null) { log(String.format("Error: %s", exception.getMessage())); } else { log(resultText); } } }); } }); }
@Override public void onItemClick(AdapterView parent, View view, int position, long id) { AreaDto areaDto = adapter.getItem(position); // CheckBoxのクリックを取得する CheckBox checkBox = (CheckBox) view.findViewById(R.id.area_checkBox); checkBox.setChecked(!areaDto.getDone()); }
private void confirmDeleteDialog(OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(this); View contents = View.inflate(this, R.layout.delete_thread_dialog_view, null); TextView msg = (TextView) contents.findViewById(R.id.message); msg.setText(R.string.confirm_delete_selected_messages); final CheckBox checkbox = (CheckBox) contents.findViewById(R.id.delete_locked); if (mSelectedLockedUris.size() == 0) { checkbox.setVisibility(View.GONE); } else { checkbox.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mIsDeleteLockChecked = checkbox.isChecked(); } }); } builder.setTitle(R.string.confirm_dialog_title); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setCancelable(true); builder.setPositiveButton(R.string.yes, listener); builder.setNegativeButton(R.string.no, null); builder.setView(contents); builder.show(); }
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(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) CurContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.option, parent, false); final int index = position; final CheckBox cboxView = (CheckBox) rowView.findViewById(R.id.optionCheckbox); cboxView.setText(Integer.toString(position + 1) + ". " + Values[position]); cboxView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (cboxView.isChecked() && !selectedOptions.contains(index)) { selectedOptions.add(index); Toast.makeText(CurContext, cboxView.getText(), Toast.LENGTH_SHORT).show(); } else if (!cboxView.isChecked() && selectedOptions.contains(index)) { selectedOptions.remove(index); } } }); return rowView; }
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("安全设置已关闭"); } } }); }
@Override public View getChildView( int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.custom_contact_list_filter_group, parent, false); } final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1); final TextView text2 = (TextView) convertView.findViewById(android.R.id.text2); final CheckBox checkbox = (CheckBox) convertView.findViewById(android.R.id.checkbox); final AccountDisplay account = mAccounts.get(groupPosition); final GroupDelta child = (GroupDelta) this.getChild(groupPosition, childPosition); if (child != null) { // Handle normal group, with title and checkbox final boolean groupVisible = child.getVisible(); checkbox.setVisibility(View.VISIBLE); checkbox.setChecked(groupVisible); final CharSequence groupTitle = child.getTitle(mContext); text1.setText(groupTitle); text2.setVisibility(View.GONE); } else { // When unknown child, this is "more" footer view checkbox.setVisibility(View.GONE); text1.setText(R.string.display_more_groups); text2.setVisibility(View.GONE); } return convertView; }
public int getValue() { int value = 0; if (during.isChecked()) value |= Task.NOTIFY_AT_DEADLINE; if (after.isChecked()) value |= Task.NOTIFY_AFTER_DEADLINE; if (mode.getSelectedItemPosition() == 1) value |= Task.NOTIFY_NONSTOP; return value; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ApplicationInfo applicationInfo = getApplicationInfo(position); if (applicationInfo == null) { Log.e(TAG, "Fail to retrieve application info for the entry: " + position); return null; } if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.enable_component_row, parent, false); } ImageView iconImageView = (ImageView) convertView.findViewById(R.id.pkg_icon); iconImageView.setImageDrawable(getApplicationIcon(applicationInfo)); TextView pkgNameTextView = (TextView) convertView.findViewById(R.id.pkg_name); pkgNameTextView.setText(getDisplayName(position)); CheckBox enableComponentCheckbox = (CheckBox) convertView.findViewById(R.id.enable_component_checkbox); enableComponentCheckbox.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // Only handles the onClick event if the component can be enabled or disabled. if (canModifyComponent(position)) { mIsComponentCheckedList.set(position, ((CheckBox) v).isChecked()); } else { ((CheckBox) v).setChecked(mIsComponentCheckedList.get(position)); } } }); enableComponentCheckbox.setChecked(mIsComponentCheckedList.get(position)); enableComponentCheckbox.setEnabled(canModifyComponent(position)); return convertView; }
@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; }
public void checkBoxClick(View view) { CheckBox checkBox = (CheckBox) view; String selectedOrDeselectedCB = ""; switch (checkBox.getId()) { case R.id.checkBoxEnglish: selectedOrDeselectedCB = getString(R.string.english); break; case R.id.checkBoxFrench: selectedOrDeselectedCB = getString(R.string.french); break; case R.id.checkBoxGerman: selectedOrDeselectedCB = getString(R.string.german); break; case R.id.checkBoxSpanish: selectedOrDeselectedCB = getString(R.string.spanish); break; } Utils.showShortToast( this, "La casilla " + selectedOrDeselectedCB + " está " + (checkBox.isChecked() ? "seleccionada" : "deseleccionada")); }
private void resetNetworkInfo() { int wifiState = wifiManager.getWifiState(); if (wifiState == WifiManager.WIFI_STATE_ENABLED) { setUIFromWifi(); wireRepoSwitchToWebServer(); repoSwitch.setVisibility(View.VISIBLE); enableWifiButton.setVisibility(View.GONE); } else { repoSwitch.setChecked(false); repoSwitch.setVisibility(View.GONE); enableWifiButton.setVisibility(View.VISIBLE); enableWifiButton.setText(R.string.enable_wifi); enableWifiButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { enableWifiButton.setText(R.string.enabling_wifi); wifiManager.setWifiEnabled(true); /* * Once the wifi is connected to a network, then * WifiStateChangeReceiver will receive notice, and kick off * the process of getting the info about the wifi * connection. */ } }); } }
/** 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 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(); } } }); }
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(); }
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 public void bindView(View view, Context context, Cursor cursor) { TextView calendarNameView = (TextView) view.findViewById(android.R.id.text1); calendarNameView.setText(cursor.getString(CalendarQuery.CALENDAR_DISPLAY_NAME)); TextView accountNameView = (TextView) view.findViewById(android.R.id.text2); accountNameView.setText(cursor.getString(CalendarQuery.ACCOUNT_NAME)); final String calendarId = cursor.getString(CalendarQuery.ID); final CheckBox checkBox = (CheckBox) view.findViewById(R.id.calendar_checkbox); checkBox.setChecked(mSelectedCalendars.contains(calendarId)); view.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mSelectedCalendars.contains(calendarId)) { mSelectedCalendars.remove(calendarId); checkBox.setChecked(false); } else { mSelectedCalendars.add(calendarId); checkBox.setChecked(true); } } }); }
/* * 在getView() 内部, * (1)adapter使用数组列表中指定位置的列表项,创建一个视图对象 * (2)将该对象返回给ListView * (3)ListView 将其设置为自己的子视图 * (4)ListView刷新,在屏幕上显示 * * ListView与Adapter 之间会话: * 调用 getCount() 获得总数,然后再调用 getView() 循环调用多次完成所有项目的显示 */ @Override public View getView(int position, View convertView, ViewGroup parent) { // if we weren't given a view , inflate on if (convertView == null) { convertView = getActivity() .getLayoutInflater() .inflate(R.layout.list_item_crime, null); // 使用新设计的R.layout.list_item_crime布局 } // configure the view for this Crime Crime c = getItem(position); // 可以不类型转换 TextView titleTextView = (TextView) convertView.findViewById(R.id.crime_list_item_titleTextView); titleTextView.setText(c.getmTitle()); TextView dateTextView = (TextView) convertView.findViewById(R.id.crime_list_item_dateTextView); dateTextView.setText(c.getmDate().toString()); CheckBox solvedCheckBox = (CheckBox) convertView.findViewById(R.id.crime_list_item_solvedCheckBox); solvedCheckBox.setChecked(c.isSolved()); return convertView; }
private void save() { final String oldName; final boolean oldHide; final Context context = this; Log.d(TAG, "Saving context!"); // Must have a name if (_name.length() <= 0) { Log.w(TAG, "Attempted to save with no name"); Toast.makeText(context, R.string.ERR_savecontext_baddata, Toast.LENGTH_LONG).show(); return; } if (_context == null) { Log.d(TAG, "Creating a new context"); _context = new TodoContext(_name.getText().toString(), 0, _hide.isChecked()); oldName = _context.getName(); oldHide = _context.isHidden(); } else { Log.d(TAG, "Updating an existing context"); oldName = _context.setName(_name.getText().toString()); oldHide = _context.setHidden(_hide.isChecked()); } final ProgressDialog p = ProgressDialog.show(context, "", getString(R.string.MSG_saving), true); TracksAction a = new TracksAction( TracksAction.ActionType.UPDATE_CONTEXT, _context, new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case TracksCommunicator.SUCCESS_CODE: Log.d(TAG, "Saved successfully"); _context.setOutdated(false); TodoContext.save(_context); p.dismiss(); setResult(SAVED); finish(); break; case TracksCommunicator.UPDATE_FAIL_CODE: Log.w(TAG, "Save failed"); _context.setOutdated(true); TodoContext.save(_context); p.dismiss(); // Toast.makeText(context, R.string.ERR_savecontext_general, // Toast.LENGTH_LONG).show(); // Reset task data to stay synced with server. // _context.setName(oldName); // _context.setHidden(oldHide); setResult(SAVED); finish(); break; } } }); _commHandler.obtainMessage(0, a).sendToTarget(); }
public void setupLocalViews(View view) { cameraSpinner = (SpinnerSelfSelect) view.findViewById(id.cameraFileSpinner); footprintCheckBox = (CheckBox) view.findViewById(id.CheckBoxFootprints); angleView = (SeekBarWithText) view.findViewById(id.angleView); overlapView = (SeekBarWithText) view.findViewById(id.overlapView); sidelapView = (SeekBarWithText) view.findViewById(id.sidelapView); altitudeView = (SeekBarWithText) view.findViewById(id.altitudeView); innerWPsCheckbox = (CheckBox) view.findViewById(id.checkBoxInnerWPs); areaTextView = (TextView) view.findViewById(id.areaTextView); distanceBetweenLinesTextView = (TextView) view.findViewById(id.distanceBetweenLinesTextView); footprintTextView = (TextView) view.findViewById(id.footprintTextView); groundResolutionTextView = (TextView) view.findViewById(id.groundResolutionTextView); distanceTextView = (TextView) view.findViewById(id.distanceTextView); numberOfPicturesView = (TextView) view.findViewById(id.numberOfPicturesTextView); numberOfStripsView = (TextView) view.findViewById(id.numberOfStripsTextView); lengthView = (TextView) view.findViewById(id.lengthTextView); cameraAdapter = new CamerasAdapter(getActivity(), android.R.layout.simple_spinner_dropdown_item); cameraSpinner.setAdapter(cameraAdapter); footprintCheckBox.setOnClickListener(this); angleView.setOnChangedListener(this); altitudeView.setOnChangedListener(this); overlapView.setOnChangedListener(this); sidelapView.setOnChangedListener(this); innerWPsCheckbox.setOnClickListener(this); cameraSpinner.setOnSpinnerItemSelectedListener(this); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_sub: String extend_msg = et_extend_msg.getText().toString(); String refund_amount = et_pay_price.getText().toString(); if (Double.valueOf(refund_amount) > Double.valueOf(goods_pay_price)) { Toast.makeText(E3_Activity_Returns.this, "金额输入错误", Toast.LENGTH_LONG).show(); } else { loadingPDialog.show(); HttpUtils.refund( res, order_id, rec_id, refund_type, refund_amount, goods_num, extend_msg); } break; case R.id.ll_check_1: check_1.setChecked(true); check_2.setChecked(false); refund_type = "1"; break; case R.id.ll_check_2: check_2.setChecked(true); check_1.setChecked(false); refund_type = "2"; break; case R.id.iv_back: this.finish(); break; default: break; } }
/** 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(); }
@Override public void cancelLongPress() { super.cancelLongPress(); for (CheckBox c : mCheckboxes) { c.cancelLongPress(); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_menu, container, false); // Make sure the two menu fragments are created. FragmentManager fm = getChildFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); mFragment1 = fm.findFragmentByTag("f1"); if (mFragment1 == null) { mFragment1 = new FragmentMenuSupport.MenuFragment(); ft.add(mFragment1, "f1"); } mFragment2 = fm.findFragmentByTag("f2"); if (mFragment2 == null) { mFragment2 = new FragmentMenuSupport.Menu2Fragment(); ft.add(mFragment2, "f2"); } ft.commit(); // Watch check box clicks. mCheckBox1 = (CheckBox) v.findViewById(R.id.menu1); mCheckBox1.setOnClickListener(mClickListener); mCheckBox2 = (CheckBox) v.findViewById(R.id.menu2); mCheckBox2.setOnClickListener(mClickListener); // Make sure fragments start out with correct visibility. updateFragmentVisibility(); return v; }
private void setVisibility(int visibility) { if (visibility == CONNECT_VIEW) { rootview.setVisibility(View.GONE); connect_button_view.setVisibility(View.VISIBLE); textViewShowTime.setVisibility(View.GONE); } else if (visibility == TREATMENT_SERVICE_NOT_FOUND) { rootview.setVisibility(View.VISIBLE); connect_button_view.setVisibility(View.GONE); buttonStartTime.setVisibility(View.GONE); textViewShowTime.setVisibility(View.GONE); mProgressBar.setVisibility(View.GONE); delayCheckBox.setVisibility(View.GONE); // create progressdialog while connecting to the services progressDialog = new ProgressDialog(this); // show message progressDialog.setMessage("Connecting to the services"); progressDialog.show(); } else if (visibility == TREATMENT_SERVICE_FOUND) { rootview.setVisibility(View.VISIBLE); connect_button_view.setVisibility(View.GONE); buttonStartTime.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE); delayCheckBox.setVisibility(View.VISIBLE); // dismiss the progressdialog progressDialog.dismiss(); } }
@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); }
public void setCheckBoxSelected(boolean sel) { user.selected = sel; chekbox.setChecked(user.selected); chekbox.invalidate(); Log.d(TAG, "setSelected select =" + user.selected); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); editor = preferences.edit(); wishFriendCheck = (CheckBox) getActivity().findViewById(R.id.wish_friend_check); String status = preferences.getString(GlobalConstant.KEY_WISH_FRIENDS_SERVICE, GlobalConstant.KEY_OFF); if (status.equals(GlobalConstant.KEY_ON)) wishFriendCheck.setChecked(true); else wishFriendCheck.setChecked(false); wishFriendCheck.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (wishFriendCheck.isChecked()) { MessageUtilities.confirmUser( getActivity(), "Do you really want to start auto wish your friend from contact list ?", yesStopClick, noStopClick); } else { editor.putString(GlobalConstant.KEY_WISH_FRIENDS_SERVICE, GlobalConstant.KEY_OFF); editor.commit(); Toast.makeText(getActivity(), "Friend wisher is disabled now", Toast.LENGTH_SHORT) .show(); } DualPaneSettingsRefresher.refreshListAdapter(getActivity()); } }); }