private void setupCheckBoxes() { Log.d(TAG, "setupCheckBoxes "); final CheckBox newCustomer = (CheckBox) findViewById(R.id.newCustomer); newCustomer.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { newCustomerDiscount = newCustomer.isChecked(); } }); final CheckBox normal = (CheckBox) findViewById(R.id.normal); normal.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { normalDiscount = normal.isChecked(); } }); final CheckBox allStamps2 = (CheckBox) findViewById(R.id.allStamps); allStamps2.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { allStamps = allStamps2.isChecked(); } }); }
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 View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fr_settings_chat, container, false); final CheckBox sendByEnter = (CheckBox) res.findViewById(R.id.sendByEnter); sendByEnter.setChecked(messenger().isSendByEnterEnabled()); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { messenger().changeSendByEnter(!messenger().isSendByEnterEnabled()); sendByEnter.setChecked(messenger().isSendByEnterEnabled()); } }; sendByEnter.setOnClickListener(listener); res.findViewById(R.id.sendByEnterCont).setOnClickListener(listener); final CheckBox markDown = (CheckBox) res.findViewById(R.id.markdown); markDown.setChecked(messenger().isMarkdownEnabled()); View.OnClickListener markDownListener = new View.OnClickListener() { @Override public void onClick(View v) { messenger().changeMarkdown(!messenger().isMarkdownEnabled()); markDown.setChecked(messenger().isMarkdownEnabled()); } }; markDown.setOnClickListener(markDownListener); res.findViewById(R.id.markdownCont).setOnClickListener(markDownListener); return res; }
@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; }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.world_info); gameModeText = (TextView) findViewById(R.id.world_info_gamemode); gameModeChangeButton = (Button) findViewById(R.id.world_info_gamemode_change); gameModeChangeButton.setOnClickListener(this); worldTimeText = (EditText) findViewById(R.id.world_info_time_text); worldTimeText.setOnFocusChangeListener(this); spawnToPlayerButton = (Button) findViewById(R.id.world_info_spawn_to_player_button); spawnToPlayerButton.setOnClickListener(this); warpToSpawnButton = (Button) findViewById(R.id.world_info_warp_to_spawn_button); warpToSpawnButton.setOnClickListener(this); timeToMorningButton = (Button) findViewById(R.id.world_info_time_to_morning); timeToMorningButton.setOnClickListener(this); timeToNightButton = (Button) findViewById(R.id.world_info_time_to_night); timeToNightButton.setOnClickListener(this); playerXText = (TextView) findViewById(R.id.world_info_player_x); playerYText = (TextView) findViewById(R.id.world_info_player_y); playerZText = (TextView) findViewById(R.id.world_info_player_z); healthText = (EditText) findViewById(R.id.world_info_health); fullHealthButton = (Button) findViewById(R.id.world_info_full_health); infiniteHealthButton = (Button) findViewById(R.id.world_info_infinite_health); healthText.setOnFocusChangeListener(this); fullHealthButton.setOnClickListener(this); infiniteHealthButton.setOnClickListener(this); sidewaysOnButton = (Button) findViewById(R.id.world_info_sideways_on); sidewaysOffButton = (Button) findViewById(R.id.world_info_sideways_off); sidewaysOnButton.setOnClickListener(this); sidewaysOffButton.setOnClickListener(this); worldNameText = (TextView) findViewById(R.id.world_info_name); worldNameText.setOnFocusChangeListener(this); worldFolderNameText = (TextView) findViewById(R.id.world_info_folder_name); worldFolderNameText.setOnFocusChangeListener(this); movePlayerButton = (Button) findViewById(R.id.world_info_move_player); movePlayerButton.setOnClickListener(this); flyingBox = (CheckBox) findViewById(R.id.world_info_flying); flyingBox.setOnClickListener(this); invulnerableBox = (CheckBox) findViewById(R.id.world_info_invulnerable); invulnerableBox.setOnClickListener(this); instaBuildBox = (CheckBox) findViewById(R.id.world_info_insta_build); instaBuildBox.setOnClickListener(this); mayFlyBox = (CheckBox) findViewById(R.id.world_info_may_fly); mayFlyBox.setOnClickListener(this); dayCycleStopTimeText = (TextView) findViewById(R.id.world_info_day_cycle_stop_time_text); dayCycleStopTimeText.setOnFocusChangeListener(this); spawnMobsBox = (CheckBox) findViewById(R.id.world_info_spawn_mobs); spawnMobsBox.setOnClickListener(this); // if (EditorActivity.level != null) { // onLevelDataLoad(); // } else { // } }
public ViewHolder(View itemView) { super(itemView); name = (TextView) itemView.findViewById(R.id.name); check = (CheckBox) itemView.findViewById(R.id.check); check.setOnClickListener(onCheckClickListener); }
/** Returns the view for a specific item on the list */ @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; final ToDoItem currentItem = getItem(position); if (row == null) { LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); row = inflater.inflate(mLayoutResourceId, parent, false); } row.setTag(currentItem); final CheckBox checkBox = (CheckBox) row.findViewById(R.id.checkToDoItem); checkBox.setText(currentItem.getText()); checkBox.setChecked(false); checkBox.setEnabled(true); checkBox.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { if (checkBox.isChecked()) { checkBox.setEnabled(false); if (mContext instanceof ToDoActivity) { ToDoActivity activity = (ToDoActivity) mContext; activity.checkItem(currentItem); } } } }); return row; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.input_withdraw_row, null); } TeamMemberRecord item = getItem(position); if (item != null) { TextView tvMember = (TextView) view.findViewById(R.id.inputWithdrawRow_memberTextView); CheckBox checkWithdraw = (CheckBox) view.findViewById(R.id.inputWithdrawRow_withdrawCheckBox); TextView tvAlreadyWithdrawn = (TextView) view.findViewById(R.id.inputWithdrawRow_withdrawTextView); if (tvMember != null) tvMember.setText(item.getMemberName()); if (checkWithdraw != null) { if (item.isPrevWithdrawn()) { checkWithdraw.setEnabled(false); } else { checkWithdraw.setChecked(currentState.isCurrWithdrawn(item.getMember())); checkWithdraw.setOnClickListener(new WithdrawClickListener(item.getMember())); } } if (tvAlreadyWithdrawn != null) { if (!item.isPrevWithdrawn()) tvAlreadyWithdrawn.setText(""); } } return view; }
public ExportOptionsDialog(final List<cgCache> caches, final Activity activity) { super(activity); View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null); setView(layout); final TextView text = (TextView) layout.findViewById(R.id.info); text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir())); final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share); shareOption.setChecked(Settings.getShareAfterExport()); shareOption.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Settings.setShareAfterExport(shareOption.isChecked()); } }); layout .findViewById(R.id.export) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); new ExportTask(caches, activity).execute((Void) null); } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_to_do, container, false); titleField = (EditText) v.findViewById(R.id.title_field); titleField.addTextChangedListener(new TitleListener()); dateButton = (Button) v.findViewById(R.id.due_date_button); dateButton.setOnClickListener(new OnDateButtonClick()); prioritySpinner = (Spinner) v.findViewById(R.id.priority_spinner); prioritySpinner.setOnItemSelectedListener(new PriorityListener()); completeCheckbox = (CheckBox) v.findViewById(R.id.complete_checkbox); completeCheckbox.setOnClickListener(new CompleteCheckListener()); // set view components to display detail titleField.setText(toDo.getTitle()); dateButton.setText(toDo.getDueDate().toString()); prioritySpinner.setSelection(toDo.getPriority()); completeCheckbox.setChecked(toDo.isComplete()); return v; }
private void addListenerOnCheckBox() { checkBoxEditAll.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (checkBoxEditAll.isChecked()) { Helper.isEditAllChecked = true; llMobile.setVisibility(View.VISIBLE); llBloodGroup.setVisibility(View.VISIBLE); llAddress.setVisibility(View.VISIBLE); llPreferredArea.setVisibility(View.VISIBLE); llComment.setVisibility(View.VISIBLE); etName.setVisibility(View.VISIBLE); tvDisplayName.setVisibility(View.GONE); } else { Helper.isEditAllChecked = false; llMobile.setVisibility(View.GONE); llBloodGroup.setVisibility(View.GONE); llAddress.setVisibility(View.GONE); llPreferredArea.setVisibility(View.GONE); llComment.setVisibility(View.GONE); etName.setVisibility(View.GONE); tvDisplayName.setVisibility(View.VISIBLE); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.mipmap.ic_launcher); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#024265"))); btnSwitch = (ImageButton) findViewById(R.id.btnSwitch); preferences = this.getPreferences(Context.MODE_PRIVATE); prefEditor = preferences.edit(); flashState = false; endWhenPaused = preferences.getBoolean("closeOnPause", false); CheckBox pauseState = (CheckBox) findViewById(R.id.cbPause); pauseState.setChecked(endWhenPaused); pauseState.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { endWhenPaused = !endWhenPaused; prefEditor.putBoolean("closeOnPause", endWhenPaused); prefEditor.commit(); } }); if (!isConnected) init(); }
private void init() { inflate(getContext(), R.layout.tag_lv_item, this); mTitleTv = (TextView) findViewById(R.id.tv_tag_title); mDetailTv = (TextView) findViewById(R.id.tv_tag_detail); mInterestedCb = (CheckBox) findViewById(R.id.cb_tag_interest); mInterestedCb.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_activities); findID(); SessionManager sessionManager = new SessionManager(this); HashMap<String, String> emailid = sessionManager.getUserDetails(); aciviityuserId = emailid.get(SessionManager.KEY_EMAIL); activitysearch_url = "http://rsmile.quaeretech.com/RealtorSmile.svc/GetContactRecords/" + aciviityuserId; new ActitivityAsyncTask().execute(activitysearch_url); if (isNotAdded) { checkBox_header1.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < activitycustomSearchlist.size(); i++) { mChecked.put(i, checkBox_header1.isChecked()); } activityadapter.notifyDataSetChanged(); } }); isNotAdded = false; } }
@AfterViews void crateData() { this.titleButton.setText("用户登录"); this.titleButton.setVisibility(View.VISIBLE); this.rightButton.setVisibility(View.INVISIBLE); this.backButton.setVisibility(View.VISIBLE); this.backButton.setText("返回"); this.backButton.setTextColor(Color.WHITE); SpannableString span = new SpannableString(this.registerButton.getText()); ForegroundColorSpan fgcs = new ForegroundColorSpan(getResources().getColor(R.color.second_red)); span.setSpan(fgcs, span.length() - 2, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); this.registerButton.setText(span); mAutoCheck.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { auto = !auto; mAutoCheck.setChecked(auto); } }); mUser = User.lastLoginUser(mContext); if (mUser == null) { mUser = new User(); mUser.setUserName(""); mUser.setPassword(""); } else { } initUI(); initData(); }
/** Inflate the layout for this fragment */ @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false); mSelectKeysButton = (BootstrapButton) view.findViewById(R.id.btn_selectEncryptKeys); mSign = (CheckBox) view.findViewById(R.id.sign); mMainUserId = (TextView) view.findViewById(R.id.mainUserId); mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); mSelectKeysButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { selectPublicKeys(); } }); mSign.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { CheckBox checkBox = (CheckBox) v; if (checkBox.isChecked()) { selectSecretKey(); } else { setSignatureKeyId(Constants.key.none); } } }); return view; }
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 init() { Log.d(TAG, "call TwitterSelectUserItemView init"); LayoutInflater factory = LayoutInflater.from(mContext); removeAllViews(); // container FrameLayout view = (FrameLayout) FrameLayout.inflate(getContext(), R.layout.sns_container_normal, null); FrameLayout.LayoutParams paras = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); view.setLayoutParams(paras); view.setVerticalScrollBarEnabled(true); addView(view); // child 1 View v = factory.inflate(R.layout.sns_user_select_item, null); v.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); view.addView(v); chekbox = (CheckBox) v.findViewById(R.id.sns_user_select_checkbox); username = (TextView) v.findViewById(R.id.sns_user_name_item); chekbox.setOnClickListener(stOnClik); setUI(); }
@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 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; }
@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 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()); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create_family_diet_chart); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); Date date = new Date(); mCurrentDate = dateFormat.format(date); mAlarm = "0"; etDate = (EditText) findViewById(R.id.editTextDP); etTime = (EditText) findViewById(R.id.etFamilyDietTime); // etName = (EditText) findViewById(R.id.etFamilyDietName); etFamilyDietName = (Spinner) findViewById(R.id.spinnerFamilyDietName); etDescription = (EditText) findViewById(R.id.editFamilyDietDetails); cbAlarm = (CheckBox) findViewById(R.id.FamilyDiet_alarm); btnSave = (Button) findViewById(R.id.btnSave); etDate.setOnClickListener(this); etTime.setOnClickListener(this); cbAlarm.setOnClickListener(this); btnSave.setOnClickListener(this); Intent mActivityIntent = getIntent(); mStrActivityID = mActivityIntent.getStringExtra(FTFLConstants.ACTIVITYID); if (mStrActivityID != null) { mActivityId = Long.parseLong(mStrActivityID); mActivityDataSource = new FamilyDietDataSource(this); mUpdateActivity = mActivityDataSource.updateActivityData(mActivityId); String mDate = mUpdateActivity.getDate(); String mTime = mUpdateActivity.getTime(); String mName = mUpdateActivity.getFamilyDietName(); String mDescription = mUpdateActivity.getFamilyDietDetails(); String mAlarm = mUpdateActivity.getAlarm(); long mActivityAlarm = Long.parseLong(mAlarm); // set the value of database to the text field. etDate.setText(mDate); etTime.setText(mTime); etName.setText(mName); etDescription.setText(mDescription); if (mActivityAlarm == 1) { cbAlarm.setChecked(!cbAlarm.isChecked()); } /* * change button name */ btnSave.setText(getString(R.string.Update)); } addItemsOnSpinner3(); addListenerOnSpinnerItemSelection3(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fr_settings_chat, container, false); res.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor()); res.findViewById(R.id.dividerTop) .setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor()); res.findViewById(R.id.dividerBot) .setBackgroundColor(ActorSDK.sharedActor().style.getDividerColor()); final CheckBox sendByEnter = (CheckBox) res.findViewById(R.id.sendByEnter); sendByEnter.setChecked(messenger().isSendByEnterEnabled()); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { messenger().changeSendByEnter(!messenger().isSendByEnterEnabled()); sendByEnter.setChecked(messenger().isSendByEnterEnabled()); } }; sendByEnter.setOnClickListener(listener); res.findViewById(R.id.sendByEnterCont).setOnClickListener(listener); ((TextView) res.findViewById(R.id.settings_send_by_enter_title)) .setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor()); ((TextView) res.findViewById(R.id.settings_set_by_enter_hint)) .setTextColor(ActorSDK.sharedActor().style.getTextSecondaryColor()); final CheckBox animationsAtoPlay = (CheckBox) res.findViewById(R.id.animationAutoPlay); animationsAtoPlay.setChecked(messenger().isAnimationAutoPlayEnabled()); View.OnClickListener animListener = new View.OnClickListener() { @Override public void onClick(View v) { messenger().changeAnimationAutoPlayEnabled(!messenger().isAnimationAutoPlayEnabled()); animationsAtoPlay.setChecked(messenger().isAnimationAutoPlayEnabled()); } }; animationsAtoPlay.setOnClickListener(animListener); res.findViewById(R.id.animationAutoPlayCont).setOnClickListener(animListener); ((TextView) res.findViewById(R.id.settings_animation_auto_play_title)) .setTextColor(ActorSDK.sharedActor().style.getTextPrimaryColor()); ((TextView) res.findViewById(R.id.settings_animation_auto_play_hint)) .setTextColor(ActorSDK.sharedActor().style.getTextSecondaryColor()); return res; }
void setOnClickListener(OnClickListener listener) { if (mUseText) { mCheckBox.setOnClickListener(listener); // mButton.setOnClickListener( listener ); } else { mButton.setOnClickListener(listener); } }
private void setListeners() { setDefaultTag(); sunBtn.setOnClickListener(this); monBtn.setOnClickListener(this); tueBtn.setOnClickListener(this); wedBtn.setOnClickListener(this); thuBtn.setOnClickListener(this); friBtn.setOnClickListener(this); satBtn.setOnClickListener(this); weekDayRB.setOnClickListener(this); weekEndRB.setOnClickListener(this); alwaysOnRB.setOnClickListener(this); enteredCB.setOnClickListener(this); exitCB.setOnClickListener(this); mBtnUpdate.setOnClickListener(this); mBtnDelete.setOnClickListener(this); }
/** * Returns the view for a specific item on the list */ @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; final WorkItem currentItem = getItem(position); if (row == null) { LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); row = inflater.inflate(mLayoutResourceId, parent, false); } row.setTag(currentItem); final CheckBox checkBox = (CheckBox) row .findViewById(R.id.checkToDoItem); final TextView txtDate = (TextView) row .findViewById(R.id.textDueDate); final Calendar c = Calendar.getInstance(); c.setTime(currentItem.getDueDate()); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); @SuppressWarnings("deprecation") String gmtTime = currentItem.getDueDate().toGMTString(); // set current date into textview txtDate.setText(gmtTime); checkBox.setText(currentItem.getTitle()); checkBox.setChecked(currentItem.isComplete()); checkBox.setEnabled(true); checkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if (checkBox.isChecked()) { checkBox.setEnabled(false); if (mContext instanceof ToDoActivity) { ToDoActivity activity = (ToDoActivity) mContext; activity.checkItem(currentItem); } } } }); Date currentDate = new Date(); row.setBackgroundResource(R.color.normal); if(currentItem.getDueDate().before(currentDate)) { row.setBackgroundResource(R.color.highlight); } return row; }
@Override public View getView(int position, View convertView, final ViewGroup parent) { final Item item = getItem(position); final View view; if (convertView != null && item.getClass().equals(convertView.getTag())) { view = convertView; } else { view = getLayoutInflater() .inflate( item instanceof SectionItem ? R.layout.catalog_manager_section_head : R.layout.catalog_manager_item, null); view.setTag(item.getClass()); } if (item instanceof SectionItem) { ((TextView) view.findViewById(R.id.catalog_manager_section_head_title)) .setText(((SectionItem) item).Title); } else /* if (item instanceof CatalogItem) */ { final CatalogItem catalogItem = (CatalogItem) item; if (myCoverManager == null) { view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int coverHeight = view.getMeasuredHeight(); myCoverManager = new CoverManager(CatalogManagerActivity.this, coverHeight * 15 / 22, coverHeight); view.requestLayout(); } final INetworkLink link = catalogItem.Tree.getLink(); ((TextView) view.findViewById(R.id.catalog_manager_item_title)).setText(link.getTitle()); ((TextView) view.findViewById(R.id.catalog_manager_item_subtitle)) .setText(link.getSummary()); final ImageView coverView = (ImageView) view.findViewById(R.id.catalog_manager_item_icon); if (!myCoverManager.trySetCoverImage(coverView, catalogItem.Tree)) { coverView.setImageResource(R.drawable.ic_list_library_books); } final CheckBox checkBox = (CheckBox) view.findViewById(R.id.catalog_manager_item_checkbox); checkBox.setChecked(catalogItem.IsChecked); checkBox.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { catalogItem.IsChecked = checkBox.isChecked(); setResultIds(catalogItem, 0); } }); } return view; }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.rpc_demo); classTxt = (EditText) findViewById(R.id.classTxt); methodTxt = (EditText) findViewById(R.id.methodTxt); parameterTxt = (EditText) findViewById(R.id.parameterTxt); resultTxt = (EditText) findViewById(R.id.resultTxt); targetTxt = (EditText) findViewById(R.id.targetTxt); targetLabel = (TextView) findViewById(R.id.targetLabel); invokeBtn = (Button) findViewById(R.id.invokeBtn); statusImage = (ImageView) findViewById(R.id.statusImage); // targetRadioGroup = (RadioGroup) findViewById(R.id.radio_group); statusImage.setImageResource(R.drawable.disconnected); final CheckBox checkbox = (CheckBox) findViewById(R.id.rrpcCheckBox); checkbox.setOnClickListener( new OnClickListener() { public void onClick(View v) { if (((CheckBox) v).isChecked()) { targetTxt.setVisibility(EditText.VISIBLE); targetLabel.setVisibility(TextView.VISIBLE); // targetRadioGroup.setVisibility(RadioGroup.VISIBLE); useRRPC = true; } else { targetTxt.setVisibility(EditText.GONE); targetLabel.setVisibility(TextView.GONE); // targetRadioGroup.setVisibility(RadioGroup.GONE); useRRPC = false; } predefinedValues(); targetLabel.invalidate(); targetTxt.invalidate(); // targetRadioGroup.invalidate(); } }); invokeBtn.setOnClickListener( new OnClickListener() { public void onClick(View arg0) { sendMethodInvokeToken(); } }); // final RadioButton radio_browser = (RadioButton) findViewById(R.id.radio_browser); // final RadioButton radio_android = (RadioButton) findViewById(R.id.radio_android); // radio_browser.setOnClickListener(radio_listener); // radio_android.setOnClickListener(radio_listener); }
/** * getChildView * * @param int group_position * @param int child_position * @param boolean is_last_child * @param View convert_view * @param ViewGroup parent * @return View */ public View getChildView( int group_position, int child_position, boolean is_last_child, View convert_view, ViewGroup parent) { // get the current setting ServiceSetting setting = (ServiceSetting) getChild(group_position, child_position); // create a text layout AbsListView.LayoutParams text_layout_params = new AbsListView.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout text_layout = new LinearLayout(activity); TextView text_view = getGenericView(); text_view.setText(setting.getDisplayName()); text_view.setTextColor(Color.BLACK); text_layout.setLayoutParams(text_layout_params); text_layout.setOrientation(LinearLayout.HORIZONTAL); text_layout.addView(text_view); // create checkbox CheckBox check_box = new CheckBox(activity); check_box.setChecked(setting.getPrefValue()); check_box.setOnClickListener(setting); // create a check box layout AbsListView.LayoutParams check_box_layout_params = new AbsListView.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout check_box_layout = new LinearLayout(activity); check_box_layout.setLayoutParams(check_box_layout_params); check_box_layout.setGravity(Gravity.RIGHT); check_box_layout.setPadding(0, 0, 5, 0); check_box_layout.addView(check_box); // create row and add text and check box layouts to it AbsListView.LayoutParams main_layout_params = new AbsListView.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); LinearLayout main_layout = new LinearLayout(activity); // add to main layout main_layout.setLayoutParams(main_layout_params); main_layout.setOrientation(LinearLayout.HORIZONTAL); main_layout.addView(text_layout); main_layout.setGravity(Gravity.CENTER); main_layout.addView(check_box_layout); return main_layout; }