@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))); }
@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 init(Context context, View contentview, String[] items) { /** 用数据初始化ui */ radioGroup = (RadioGroup) contentview.findViewById(R.id.filter_layout); radioGroup.clearCheck(); if (items == null) return; for (int i = 0; i < items.length; i++) { RadioButton radioButton = (RadioButton) LayoutInflater.from(context).inflate(R.layout.line_popupwindow_rbt, null); radioButton.setId(rbtIds[i]); radioButton.setText(items[i]); radioGroup.addView(radioButton, -1, radioGroup.getLayoutParams()); if (items[i].equals(outCbx.getText())) { outCbx.setTag(i); radioButton.setChecked(true); } } radioGroup.setOnCheckedChangeListener( new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { dismiss(); } }); }
@Override public View getView(int i, View view, ViewGroup viewGroup) { View v = view; if (v == null) { v = layoutInflater.inflate(R.layout.history_item, viewGroup, false); } v.setTag(i); final CheckBox cbHistory = (CheckBox) v.findViewById(R.id.cbHistory); cbHistory.setTag(i); v.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { cbHistory.setChecked(!cbHistory.isChecked()); if (cbHistory.isChecked()) { checkedModelsIDs.add(getItemId(Integer.parseInt(cbHistory.getTag().toString()))); } else { checkedModelsIDs.remove(getItemId(Integer.parseInt(cbHistory.getTag().toString()))); } } }); TripModel tripModel = tripModelList.get(i); TextView tvDate = ButterKnife.findById(v, R.id.tvDate); TextView tvMark = ButterKnife.findById(v, R.id.tvMark); TextView tvType = ButterKnife.findById(v, R.id.tvType); tvDate.setText(simpleDateFormat.format(tripModel.getFinishTime())); tvMark.setText(String.format(Double.toString(tripModel.getMark()))); tvType.setText(tripModel.getTripType().toString()); return v; }
@SuppressLint("ViewHolder") @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.select_item, parent, false); TextView appName = (TextView) rowView.findViewById(R.id.firstLine); TextView packName = (TextView) rowView.findViewById(R.id.secondLine); CheckBox checkBox = (CheckBox) rowView.findViewById(R.id.checkBox); checkBox.setTag(R.string.itemKey, (Integer) position); checkBox.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton button, boolean checked) { checkedChanged((Integer) button.getTag(R.string.itemKey), checked); } }); AppItem item = applications.get(position); appName.setText(item.getApplicationName()); packName.setText(item.getPackageName()); checkBox.setChecked(item.getExpectsGPS()); return rowView; }
// пункт списка @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 dismiss() { if (outCbx != null && outCbx.isChecked()) { int id = radioGroup.getCheckedRadioButtonId(); RadioButton rbt = (RadioButton) radioGroup.findViewById(id); Integer old_tag = (Integer) outCbx.getTag(); if (old_tag == null) { super.dismiss(); return; } if (old_tag != id) { outCbx.setTag(id); outCbx.setText(rbt.getText()); } else { outCbx.setTag(-1); } outCbx.setChecked(false); } super.dismiss(); }
private void bind(View view, final Juice juice) { TextView titleView = (TextView) view.findViewById(R.id.title); titleView.setText(juice.name); TextView kanTitleView = (TextView) view.findViewById(R.id.title_kan); kanTitleView.setText(JuiceDecorator.matchKannadaName(juice.name)); CheckBox availabilityView = (CheckBox) view.findViewById(R.id.availability); availabilityView.setChecked(juice.available); availabilityView.setOnCheckedChangeListener(adminActivity); availabilityView.setTag(juice); view.setTag(juice); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; TextView folder = null; CheckBox check = null; if (row == null) { LayoutInflater inflater = LayoutInflater.from(context); row = inflater.inflate(R.layout.folder_adapter_row, parent, false); folder = (TextView) row.findViewById(R.id.folder); folder.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View folder) { int position = (Integer) folder.getTag(); // FolderAdapter.this.clear(); directory.browseTo(position); currentChecked = -1; FolderAdapter.this.notifyDataSetChanged(); doneButton.setEnabled(false); } }); check = (CheckBox) row.findViewById(R.id.checkbox); check.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // update last checked position int position = (Integer) buttonView.getTag(); if (isChecked) currentChecked = position; else if (currentChecked == position) currentChecked = -1; FolderAdapter.this.notifyDataSetChanged(); if (isChecked) doneButton.setEnabled(true); } }); } folder = (TextView) row.findViewById(R.id.folder); folder.setText(directory.get(position)); folder.setTag(new Integer(position)); check = (CheckBox) row.findViewById(R.id.checkbox); // disable the "Up one level" checkbox; otherwise make sure its enabled if (position == 0 && !directory.isCurrentDirectoryRoot()) check.setEnabled(false); else check.setEnabled(true); check.setTag(new Integer(position)); // set check state. only one can be checked boolean status = (currentChecked == position) ? true : false; check.setChecked(status); return (row); }
private void addCheckbox(int i, int checkboxLayout, LayoutInflater li) { CheckBox view = (CheckBox) li.inflate(checkboxLayout, this, false); LayoutParams params = new TableRow.LayoutParams(0, view.getLayoutParams().height, 1f); if (i > 0) { params.setMargins(mPadding, 0, 0, 0); } view.setLayoutParams(params); view.setCompoundDrawablePadding(0); view.setTag(i); view.setText(String.valueOf(i + 1)); view.setOnCheckedChangeListener(this); addView(view); }
@Override public View getView(final int position, View convertView, ViewGroup parent) { View vi = convertView; if (convertView == null) { vi = mInflater.inflate(R.layout.row, null); } TextView tv = (TextView) vi.findViewById(R.id.textView1); TextView tv1 = (TextView) vi.findViewById(R.id.textView2); CheckBox cb = (CheckBox) vi.findViewById(R.id.checkBox1); tv.setText(mContactNames.get(position)); tv1.setText(mContactNumbers.get(position)); cb.setTag(position); cb.setChecked(mCheckStates.get(position, false)); cb.setOnCheckedChangeListener(this); return vi; }
@Override public View getChildView( int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View view = getCustomChildView(); TextView titleView = (TextView) view.findViewById(R.id.HistoryRow_Title); HistoryItem item = (HistoryItem) getChild(groupPosition, childPosition); titleView.setText(item.getTitle()); TextView urlView = (TextView) view.findViewById(R.id.HistoryRow_Url); urlView.setText(item.getUrl()); CheckBox bookmarkStar = (CheckBox) view.findViewById(R.id.HistoryRow_BookmarkStar); bookmarkStar.setTag(item.getId()); bookmarkStar.setOnCheckedChangeListener(null); bookmarkStar.setChecked(item.isBookmark()); bookmarkStar.setOnCheckedChangeListener(mBookmarkStarChangeListener); ImageView faviconView = (ImageView) view.findViewById(R.id.HistoryRow_Thumbnail); Bitmap favicon = item.getFavicon(); if (favicon != null) { BitmapDrawable icon = new BitmapDrawable(favicon); Bitmap bm = Bitmap.createBitmap(mFaviconSize, mFaviconSize, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bm); icon.setBounds(0, 0, mFaviconSize, mFaviconSize); icon.draw(canvas); faviconView.setImageBitmap(bm); } else { faviconView.setImageResource(R.drawable.fav_icn_unknown); } return view; }
public void updateView(View convertView, int pos) { if (convertView == null || pos < 0 || pos >= getCount()) { return; } ImageView icon = (ImageView) convertView.findViewById(R.id.icon); icon.setImageDrawable(getIcon(pos, new IconLoadListener(pos))); TextView title = (TextView) convertView.findViewById(R.id.entry_title); bindTitle(title, pos); TextView summary = (TextView) convertView.findViewById(R.id.entry_summary1); bindSummary(summary, pos); CheckBox checkBox = (CheckBox) convertView.findViewById(R.id.checkbox); checkBox.setVisibility(isEnabled(pos) ? View.VISIBLE : View.GONE); checkBox.setOnCheckedChangeListener(null); checkBox.setChecked(isSelected(pos)); checkBox.setTag(pos); checkBox.setOnCheckedChangeListener(mOnCheckedChangeListener); }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.row_multiphoto_item, null); } CheckBox mCheckBox = (CheckBox) convertView.findViewById(R.id.checkBox1); final ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView1); imageLoader.displayImage( "file://" + imageUrls.get(position), imageView, options, new SimpleImageLoadingListener() { // @Override // public void onLoadingComplete(Bitmap loadedImage) { // Animation anim = AnimationUtils.loadAnimation(MutipleUpload.this, // R.anim.fade_in); // imageView.setAnimation(anim); // anim.start(); // } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); Animation anim = AnimationUtils.loadAnimation(MutipleUpload.this, R.anim.fade_in); imageView.setAnimation(anim); anim.start(); } }); mCheckBox.setTag(position); mCheckBox.setChecked(mSparseBooleanArray.get(position)); mCheckBox.setOnCheckedChangeListener(mCheckedChangeListener); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.person_list_item, null); } RegistrationDTO attendant = getItem(position); if (attendant != null) { PersonDTO person = attendant.getPerson(); TextView tt = (TextView) v.findViewById(R.id.toptext); TextView bt = (TextView) v.findViewById(R.id.bottomtext); if (tt != null) { tt.setText(person.getName()); } if (bt != null) { bt.setText(person.getEmailAddress()); } CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1); cb.setTag(attendant); cb.setOnCheckedChangeListener(null); cb.setChecked(attendant.getStatus() == 1); cb.setOnCheckedChangeListener(this); ImageView imageView = (ImageView) v.findViewById(R.id.icon); if (gravatars.containsKey(attendant)) { imageView.setImageBitmap(gravatars.get(attendant)); } else { imageView.setImageResource(R.drawable.icon); new DownloadImageTask(imageView).execute(attendant); } } v.setTag(attendant.getPerson()); v.setOnLongClickListener( new OnLongClickListener() { @Override public boolean onLongClick(View v) { final PersonDTO person = (PersonDTO) v.getTag(); AlertDialog.Builder builder; Context mContext = getContext(); getContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate( R.layout.custom_dialog, (ViewGroup) v.findViewById(R.id.custom_dialog)); final EditText editText = (EditText) layout.findViewById(R.id.nameFld); editText.setText(person.getName()); builder = new AlertDialog.Builder(mContext); builder.setView(layout); final AlertDialog alertDialog = builder.create(); final Button saveBtn = (Button) layout.findViewById(R.id.savePoiNameBtn); final Button cancelBtn = (Button) layout.findViewById(R.id.cancelPoiNameBtn); saveBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { person.setName(editText.getText().toString()); // RestClient rc = new RestClient(AttendItActivity.URL // + "/attendit/rest/registration/person/" // + person.getId()); // GsonBuilder builder = new GsonBuilder(); // Gson gson = builder.create(); // // String json = gson.toJson(person, PersonDTO.class); // Log.i("PersonAdapter", "Person JSON: " + json); // rc.AddParam("person", json); // try { // rc.Execute(RestClient.RequestMethod.POST); // Toast.makeText(getContext(), // "Successfully updated person", // Toast.LENGTH_SHORT).show(); // alertDialog.dismiss(); // } catch (Exception e) { // Toast.makeText(getContext(), // "An error occured saving person: " + e.getMessage(), // Toast.LENGTH_LONG).show(); // } Toast.makeText(getContext(), "Successfully updated person", Toast.LENGTH_SHORT) .show(); alertDialog.dismiss(); } }); cancelBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); alertDialog.show(); return false; } }); return v; }
public void displayAccounts() { accounts = b2evolution.DB.getAccounts(this); HashMap<?, ?> notificationOptions = b2evolution.DB.getNotificationOptions(this); boolean sound = false, vibrate = false, light = false, taglineValue = false; String tagline = ""; if (notificationOptions != null) { if (notificationOptions.get("sound").toString().equals("1")) { sound = true; } if (notificationOptions.get("vibrate").toString().equals("1")) { vibrate = true; } if (notificationOptions.get("light").toString().equals("1")) { light = true; } if (notificationOptions.get("tagline_flag").toString().equals("1")) { taglineValue = true; } tagline = notificationOptions.get("tagline").toString(); } if (accounts.size() > 0) { ScrollView sv = new ScrollView(this); sv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); sv.setBackgroundColor(Color.parseColor("#FFFFFFFF")); LinearLayout layout = new LinearLayout(this); layout.setPadding(14, 14, 14, 14); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); layout.setGravity(Gravity.LEFT); final LinearLayout cbLayout = new LinearLayout(this); cbLayout.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); cbLayout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams section1Params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); section1Params.setMargins(0, 0, 0, 20); LinearLayout section1 = new LinearLayout(this); section1.setBackgroundDrawable(getResources().getDrawable(R.drawable.content_bg)); section1.setLayoutParams(section1Params); section1.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams headerParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); headerParams.setMargins(1, 1, 1, 0); TextView textView = new TextView(this); textView.setLayoutParams(headerParams); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setPadding(0, 4, 0, 4); textView.setShadowLayer(1, 0, 2, Color.parseColor("#FFFFFFFF")); textView.setBackgroundDrawable(getResources().getDrawable(R.drawable.content_bg_header)); textView.setText(" " + getResources().getText(R.string.comment_notifications)); section1.addView(textView); LinearLayout.LayoutParams cbParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); cbParams.setMargins(4, 0, 0, 6); for (int i = 0; i < accounts.size(); i++) { HashMap<?, ?> curHash = (HashMap<?, ?>) accounts.get(i); String curBlogName = curHash.get("blogName").toString(); String accountID = curHash.get("id").toString(); int runService = Integer.valueOf(curHash.get("runService").toString()); accountNames.add(i, curBlogName); final CheckBox checkBox = new CheckBox(this); checkBox.setTextColor(Color.parseColor("#444444")); checkBox.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); checkBox.setText(EscapeUtils.unescapeHtml(curBlogName)); checkBox.setId(Integer.valueOf(accountID)); checkBox.setLayoutParams(cbParams); if (runService == 1) { checkBox.setChecked(true); } cbLayout.addView(checkBox); } if (cbLayout.getChildCount() > 0) { section1.addView(cbLayout); } // add spinner and buttons TextView textView2 = new TextView(this); LinearLayout.LayoutParams labelParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); labelParams.setMargins(8, 0, 0, 0); textView2.setLayoutParams(labelParams); textView2.setTextColor(Color.parseColor("#444444")); textView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView2.setText(getResources().getText(R.string.notifications_interval)); section1.addView(textView2); final Spinner sInterval = new Spinner(this); LinearLayout.LayoutParams spinnerParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); spinnerParams.setMargins(4, 0, 4, 10); sInterval.setLayoutParams(spinnerParams); ArrayAdapter<Object> sIntervalArrayAdapter = new ArrayAdapter<Object>( this, R.layout.spinner_textview, new String[] { "5 Minutes", "10 Minutes", "15 Minutes", "30 Minutes", "1 Hour", "3 Hours", "6 Hours", "12 Hours", "Daily" }); sIntervalArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sInterval.setAdapter(sIntervalArrayAdapter); String interval = b2evolution.DB.getInterval(this); if (interval != "") { sInterval.setSelection(sIntervalArrayAdapter.getPosition(interval)); } section1.addView(sInterval); final LinearLayout nOptionsLayout = new LinearLayout(this); nOptionsLayout.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); nOptionsLayout.setOrientation(LinearLayout.VERTICAL); CheckBox soundCB = new CheckBox(this); soundCB.setTag("soundCB"); soundCB.setTextColor(Color.parseColor("#444444")); soundCB.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); soundCB.setText(getResources().getText(R.string.notification_sound)); soundCB.setLayoutParams(cbParams); soundCB.setChecked(sound); nOptionsLayout.addView(soundCB); CheckBox vibrateCB = new CheckBox(this); vibrateCB.setTag("vibrateCB"); vibrateCB.setTextColor(Color.parseColor("#444444")); vibrateCB.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); vibrateCB.setText(getResources().getText(R.string.notification_vibrate)); vibrateCB.setLayoutParams(cbParams); vibrateCB.setChecked(vibrate); nOptionsLayout.addView(vibrateCB); CheckBox lightCB = new CheckBox(this); lightCB.setTag("lightCB"); lightCB.setTextColor(Color.parseColor("#444444")); lightCB.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); lightCB.setText(getResources().getText(R.string.notification_blink)); lightCB.setLayoutParams(cbParams); lightCB.setChecked(light); nOptionsLayout.addView(lightCB); section1.addView(nOptionsLayout); layout.addView(section1); final LinearLayout section2 = new LinearLayout(this); section2.setBackgroundDrawable(getResources().getDrawable(R.drawable.content_bg)); section2.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams section2Params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); section2Params.setMargins(0, 0, 0, 20); section2.setLayoutParams(section2Params); section2.setPadding(0, 0, 0, 10); TextView section2lbl = new TextView(this); section2lbl.setLayoutParams(headerParams); section2lbl.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); section2lbl.setTypeface(Typeface.DEFAULT_BOLD); section2lbl.setShadowLayer(1, 0, 2, Color.parseColor("#FFFFFFFF")); section2lbl.setPadding(0, 4, 0, 4); section2lbl.setText(" " + getResources().getText(R.string.post_signature)); section2lbl.setBackgroundDrawable(getResources().getDrawable(R.drawable.content_bg_header)); section2.addView(section2lbl); CheckBox taglineCB = new CheckBox(this); taglineCB.setTag("taglineCB"); taglineCB.setTextColor(Color.parseColor("#444444")); taglineCB.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); taglineCB.setText(getResources().getText(R.string.add_tagline)); taglineCB.setLayoutParams(cbParams); taglineCB.setChecked(taglineValue); section2.addView(taglineCB); EditText taglineET = new EditText(this); LinearLayout.LayoutParams taglineParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); taglineParams.setMargins(4, 0, 4, 4); taglineET.setLayoutParams(taglineParams); if (tagline != null) { if (tagline.equals("")) { if (BlackBerryUtils.getInstance().isBlackBerry()) taglineET.setText(getResources().getText(R.string.posted_from_blackberry)); else taglineET.setText(getResources().getText(R.string.posted_from)); } else { taglineET.setText(tagline); } } taglineET.setMinLines(2); section2.addView(taglineET); layout.addView(section2); final LinearLayout section3 = new LinearLayout(this); section3.setOrientation(LinearLayout.HORIZONTAL); section3.setGravity(Gravity.RIGHT); LinearLayout.LayoutParams section3Params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); section3Params.setMargins(0, 0, 0, 20); section3.setLayoutParams(section3Params); final Button cancel = new Button(this); LinearLayout.LayoutParams cancelParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); cancelParams.setMargins(0, 0, 10, 0); cancel.setLayoutParams(cancelParams); cancel.setBackgroundDrawable(getResources().getDrawable(R.drawable.b2evo_button_small)); cancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); cancel.setText(getResources().getText(R.string.cancel)); cancel.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { finish(); } }); section3.addView(cancel); final Button save = new Button(this); save.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT)); save.setBackgroundDrawable(getResources().getDrawable(R.drawable.b2evo_button_small)); save.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); save.setText(getResources().getText(R.string.save)); save.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { boolean sound = false, vibrate = false, light = false, tagValue = false; checkCtr = 0; int listItemCount = cbLayout.getChildCount(); for (int i = 0; i < listItemCount; i++) { CheckBox cbox = (CheckBox) cbLayout.getChildAt(i); int id = cbox.getId(); if (cbox.isChecked()) { checkCtr++; b2evolution.DB.updateNotificationFlag(id, true); Log.i("CommentService", "Service enabled for " + cbox.getText()); } else { b2evolution.DB.updateNotificationFlag(id, false); } } int noOptionsItemCount = nOptionsLayout.getChildCount(); for (int i = 0; i < noOptionsItemCount; i++) { CheckBox cbox = (CheckBox) nOptionsLayout.getChildAt(i); if (cbox.getTag().equals("soundCB")) { sound = cbox.isChecked(); } else if (cbox.getTag().equals("vibrateCB")) { vibrate = cbox.isChecked(); } else if (cbox.getTag().equals("lightCB")) { light = cbox.isChecked(); } } CheckBox tagFlag = (CheckBox) section2.getChildAt(1); tagValue = tagFlag.isChecked(); EditText taglineET = (EditText) section2.getChildAt(2); String taglineText = taglineET.getText().toString(); b2evolution.DB.updateNotificationSettings( sInterval.getSelectedItem().toString(), sound, vibrate, light, tagValue, taglineText); if (checkCtr > 0) { String updateInterval = sInterval.getSelectedItem().toString(); int UPDATE_INTERVAL = 3600000; // configure time interval if (updateInterval.equals("5 Minutes")) { UPDATE_INTERVAL = 300000; } else if (updateInterval.equals("10 Minutes")) { UPDATE_INTERVAL = 600000; } else if (updateInterval.equals("15 Minutes")) { UPDATE_INTERVAL = 900000; } else if (updateInterval.equals("30 Minutes")) { UPDATE_INTERVAL = 1800000; } else if (updateInterval.equals("1 Hour")) { UPDATE_INTERVAL = 3600000; } else if (updateInterval.equals("3 Hours")) { UPDATE_INTERVAL = 10800000; } else if (updateInterval.equals("6 Hours")) { UPDATE_INTERVAL = 21600000; } else if (updateInterval.equals("12 Hours")) { UPDATE_INTERVAL = 43200000; } else if (updateInterval.equals("Daily")) { UPDATE_INTERVAL = 86400000; } Intent intent = new Intent(Preferences.this, CommentBroadcastReceiver.class); PendingIntent pIntent = PendingIntent.getBroadcast(Preferences.this, 0, intent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.setRepeating( AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5 * 1000), UPDATE_INTERVAL, pIntent); } else { Intent stopIntent = new Intent(Preferences.this, CommentBroadcastReceiver.class); PendingIntent stopPIntent = PendingIntent.getBroadcast(Preferences.this, 0, stopIntent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.cancel(stopPIntent); Intent service = new Intent(Preferences.this, CommentService.class); stopService(service); } finish(); } }); section3.addView(save); layout.addView(section3); sv.addView(layout); setContentView(sv); } }
@SuppressWarnings("unchecked") public SelectMultiWidget(Context context, FormEntryPrompt prompt) { super(context, prompt); mPrompt = prompt; mCheckboxes = new ArrayList<CheckBox>(); // SurveyCTO-added support for dynamic select content (from .csv files) XPathFuncExpr xPathFuncExpr = ExternalDataUtil.getSearchXPathExpression(prompt.getAppearanceHint()); if (xPathFuncExpr != null) { mItems = ExternalDataUtil.populateExternalChoices(prompt, xPathFuncExpr); } else { mItems = prompt.getSelectChoices(); } setOrientation(LinearLayout.VERTICAL); Vector<Selection> ve = new Vector<Selection>(); if (prompt.getAnswerValue() != null) { ve = (Vector<Selection>) prompt.getAnswerValue().getValue(); } if (mItems != null) { for (int i = 0; i < mItems.size(); i++) { // no checkbox group so id by answer + offset CheckBox c = new CheckBox(getContext()); c.setTag(Integer.valueOf(i)); c.setId(QuestionWidget.newUniqueId()); c.setText(prompt.getSelectChoiceText(mItems.get(i))); c.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); c.setFocusable(!prompt.isReadOnly()); c.setEnabled(!prompt.isReadOnly()); for (int vi = 0; vi < ve.size(); vi++) { // match based on value, not key if (mItems.get(i).getValue().equals(ve.elementAt(vi).getValue())) { c.setChecked(true); break; } } mCheckboxes.add(c); // when clicked, check for readonly before toggling c.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!mCheckboxInit && mPrompt.isReadOnly()) { if (buttonView.isChecked()) { buttonView.setChecked(false); Collect.getInstance() .getActivityLogger() .logInstanceAction( this, "onItemClick.deselect", mItems.get((Integer) buttonView.getTag()).getValue(), mPrompt.getIndex()); } else { buttonView.setChecked(true); Collect.getInstance() .getActivityLogger() .logInstanceAction( this, "onItemClick.select", mItems.get((Integer) buttonView.getTag()).getValue(), mPrompt.getIndex()); } } } }); String audioURI = null; audioURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), FormEntryCaption.TEXT_FORM_AUDIO); String imageURI; if (mItems.get(i) instanceof ExternalSelectChoice) { imageURI = ((ExternalSelectChoice) mItems.get(i)).getImage(); } else { imageURI = prompt.getSpecialFormSelectChoiceText( mItems.get(i), FormEntryCaption.TEXT_FORM_IMAGE); } String videoURI = null; videoURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "video"); String bigImageURI = null; bigImageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "big-image"); MediaLayout mediaLayout = new MediaLayout(getContext()); mediaLayout.setAVT( prompt.getIndex(), "." + Integer.toString(i), c, audioURI, imageURI, videoURI, bigImageURI); addView(mediaLayout); // Last, add the dividing line between elements (except for the last element) ImageView divider = new ImageView(getContext()); divider.setBackgroundResource(android.R.drawable.divider_horizontal_bright); if (i != mItems.size() - 1) { addView(divider); } } } mCheckboxInit = false; }
@Override public View updateView(final View view, final TreeNodeInfo<Item> treeNodeInfo) { final Item item = treeNodeInfo.getId(); LinearLayout viewLayout = (LinearLayout) view; TextView itemContent = (TextView) viewLayout.findViewById(R.id.item_list_item_content); TextView itemLabels = (TextView) viewLayout.findViewById(R.id.item_list_item_labels); ImageView itemNotes = (ImageView) viewLayout.findViewById(R.id.item_list_item_notes); TextView itemNoteCount = (TextView) viewLayout.findViewById(R.id.item_list_item_note_count); ImageView itemRepeat = (ImageView) viewLayout.findViewById(R.id.item_list_item_repeat); TextView itemDueDate = (TextView) viewLayout.findViewById(R.id.item_list_item_due_date); LinearLayout itemDateLayout = (LinearLayout) viewLayout.findViewById(R.id.item_list_item_date_layout); final CheckBox itemCheckbox = (CheckBox) viewLayout.findViewById(R.id.item_list_item_checkbox); mTextSize = mStorage.getTextSize(); mItemViewInQueryMode = mItemListView.getItemViewInQueryMode(); // Display the formatted text (highlighting, etc) itemContent.setText(TodoistTextFormatter.formatText(item.getContent())); itemContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTextSize); // Linkify any emails, web addresses and phone numbers in the item's content Linkify.addLinks(itemContent, Linkify.ALL); itemLabels.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTextSize - 4); if ((mItemViewMode == ItemViewMode.FILTER_BY_LABELS) || ((mItemViewMode == ItemViewMode.FILTER_BY_QUERIES) && (mItemViewInQueryMode == ItemViewInQueryMode.PROJECTS))) { // Show item's projects Project project = mClient.getProjectById(item.projectId); if (project != null) { itemLabels.setText(project.getName()); itemLabels.setBackgroundColor((0xFF << 24) | project.getColor()); } else { // Rare case that shouldn't happen - item is pointing to an old project that no longer // exists itemLabels.setText(""); itemLabels.setBackgroundColor((0xFF << 24) | Color.WHITE); } } else { itemLabels.setText(""); itemLabels.setBackgroundColor((0x00 << 24)); // Transparent background color // Show item's labels if (item.labelIds != null) { // Fill out the labels for (int i = 0; i < item.labelIds.size(); i++) { int labelId = item.labelIds.get(i); Label currentLabel = mIdToLabels.get(labelId); if (currentLabel == null) { // Weird case when we have an ID but no matching label for it // TODO: What should we do other than this? continue; } itemLabels.append( Html.fromHtml( String.format( "<font color='#%X'><i>%s</i></font>", currentLabel.getColor(), currentLabel.name))); if (i < item.labelIds.size() - 1) { itemLabels.append(", "); } } // Since Italic text gets cut off on "wrap_contents" TextView width itemLabels.append(" "); } } if (mClient.isPremium()) { itemNoteCount.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTextSize - 7); if (item.noteCount > 0) { itemNotes.setVisibility(View.VISIBLE); itemNoteCount.setText(String.valueOf(item.noteCount)); itemNoteCount.setVisibility(View.VISIBLE); } else { // No notes (don't show an icon) itemNotes.setVisibility(View.GONE); itemNoteCount.setVisibility(View.GONE); } itemNotes.setTag(item); itemNotes.setOnClickListener(this); } else { // Only premium users have task notes itemNotes.setVisibility(View.GONE); itemNoteCount.setVisibility(View.GONE); } // Show a "recurring" image for item if necessary if (item.isRecurring()) { itemRepeat.setVisibility(View.VISIBLE); } else { itemRepeat.setVisibility(View.GONE); } itemDueDate.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTextSize - 4); if ((item.dueDate == null) || (item.dueDate.getTime() == 0)) { itemDateLayout.setVisibility(View.GONE); } else { itemDateLayout.setVisibility(View.VISIBLE); itemDueDate.setText( item.getDueDateDescription( mClient.getUser().timeFormat, mClient.getUser().timezoneOffsetMinutes)); itemDateLayout.setBackgroundColor((0xFF << 24) | item.getDueDateColor()); } itemCheckbox.setTag(item); itemCheckbox.setOnCheckedChangeListener(null); itemCheckbox.setChecked(item.completed); // Determine which checkbox to display according to text size int checkBoxDrawable; int checkBoxHeight; if (mTextSize <= 10) { checkBoxDrawable = R.drawable.checkbox_selector_small; checkBoxHeight = 16; // DP - height and width are the same } else if (mTextSize <= 13) { checkBoxDrawable = R.drawable.checkbox_selector_medium; checkBoxHeight = 24; // DP - height and width are the same } else { checkBoxDrawable = R.drawable.checkbox_selector_large; checkBoxHeight = 32; // DP - height and width are the same } // Convert from Device-Independent pixels to actual screen pixels int dpHeight = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, checkBoxHeight, mItemListView.getResources().getDisplayMetrics()); // Set the checkbox image + dimensions to use itemCheckbox.setLayoutParams(new LinearLayout.LayoutParams(dpHeight, dpHeight)); itemCheckbox.setButtonDrawable(checkBoxDrawable); if (item.completed) itemContent.setTextColor(Color.GRAY); else itemContent.setTextColor((0xFF << 24) | item.getItemPriorityColor()); itemCheckbox.setOnCheckedChangeListener(onCheckedChange); if (!item.canBeCompleted()) { // Some items can be marked as non-completeable itemCheckbox.setVisibility(View.INVISIBLE); } else { itemCheckbox.setVisibility(View.VISIBLE); } viewLayout.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { if (item.canBeCompleted()) { itemCheckbox.setChecked(!itemCheckbox.isChecked()); } } }); viewLayout.setLongClickable(true); viewLayout.setTag(item); return viewLayout; }
@SuppressWarnings("unchecked") public ListMultiWidget(Context context, FormEntryPrompt prompt, boolean displayLabel) { super(context, prompt); mItems = prompt.getSelectChoices(); mCheckboxes = new ArrayList<CheckBox>(); mPrompt = prompt; // Layout holds the horizontal list of buttons LinearLayout buttonLayout = new LinearLayout(context); Vector<Selection> ve = new Vector<Selection>(); if (prompt.getAnswerValue() != null) { ve = (Vector<Selection>) prompt.getAnswerValue().getValue(); } if (mItems != null) { for (int i = 0; i < mItems.size(); i++) { CheckBox c = new CheckBox(getContext()); c.setTag(Integer.valueOf(i)); c.setId(QuestionWidget.newUniqueId()); c.setFocusable(!prompt.isReadOnly()); c.setEnabled(!prompt.isReadOnly()); for (int vi = 0; vi < ve.size(); vi++) { // match based on value, not key if (mItems.get(i).getValue().equals(ve.elementAt(vi).getValue())) { c.setChecked(true); break; } } mCheckboxes.add(c); // when clicked, check for readonly before toggling c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!mCheckboxInit && mPrompt.isReadOnly()) { if (buttonView.isChecked()) { buttonView.setChecked(false); Collect.getInstance().getActivityLogger().logInstanceAction(this, "onItemClick.deselect", mItems.get((Integer)buttonView.getTag()).getValue(), mPrompt.getIndex()); } else { buttonView.setChecked(true); Collect.getInstance().getActivityLogger().logInstanceAction(this, "onItemClick.select", mItems.get((Integer)buttonView.getTag()).getValue(), mPrompt.getIndex()); } } } }); String imageURI = null; imageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), FormEntryCaption.TEXT_FORM_IMAGE); // build image view (if an image is provided) ImageView mImageView = null; TextView mMissingImage = null; final int labelId = QuestionWidget.newUniqueId(); // Now set up the image view String errorMsg = null; if (imageURI != null) { try { String imageFilename = ReferenceManager._().DeriveReference(imageURI).getLocalURI(); final File imageFile = new File(imageFilename); if (imageFile.exists()) { Bitmap b = null; try { Display display = ((WindowManager) getContext().getSystemService( Context.WINDOW_SERVICE)).getDefaultDisplay(); int screenWidth = display.getWidth(); int screenHeight = display.getHeight(); b = FileUtils.getBitmapScaledToDisplay(imageFile, screenHeight, screenWidth); } catch (OutOfMemoryError e) { errorMsg = "ERROR: " + e.getMessage(); } if (b != null) { mImageView = new ImageView(getContext()); mImageView.setPadding(2, 2, 2, 2); mImageView.setAdjustViewBounds(true); mImageView.setImageBitmap(b); mImageView.setId(labelId); } else if (errorMsg == null) { // An error hasn't been logged and loading the image failed, so it's // likely // a bad file. errorMsg = getContext().getString(R.string.file_invalid, imageFile); } } else if (errorMsg == null) { // An error hasn't been logged. We should have an image, but the file // doesn't // exist. errorMsg = getContext().getString(R.string.file_missing, imageFile); } if (errorMsg != null) { // errorMsg is only set when an error has occured Log.e(t, errorMsg); mMissingImage = new TextView(getContext()); mMissingImage.setText(errorMsg); mMissingImage.setPadding(2, 2, 2, 2); mMissingImage.setId(labelId); } } catch (InvalidReferenceException e) { Log.e(t, "image invalid reference exception"); e.printStackTrace(); } } else { // There's no imageURI listed, so just ignore it. } // build text label. Don't assign the text to the built in label to he // button because it aligns horizontally, and we want the label on top TextView label = new TextView(getContext()); label.setText(prompt.getSelectChoiceText(mItems.get(i))); label.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); label.setGravity(Gravity.CENTER_HORIZONTAL); if (!displayLabel) { label.setVisibility(View.GONE); } // answer layout holds the label text/image on top and the radio button on bottom RelativeLayout answer = new RelativeLayout(getContext()); RelativeLayout.LayoutParams headerParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); headerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); headerParams.addRule(RelativeLayout.CENTER_HORIZONTAL); RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); buttonParams.addRule(RelativeLayout.CENTER_HORIZONTAL); if (mImageView != null) { mImageView.setScaleType(ScaleType.CENTER); if (!displayLabel) { mImageView.setVisibility(View.GONE); } answer.addView(mImageView, headerParams); } else if (mMissingImage != null) { answer.addView(mMissingImage, headerParams); } else { if (displayLabel) { label.setId(labelId); answer.addView(label, headerParams); } } if (displayLabel) { buttonParams.addRule(RelativeLayout.BELOW, labelId); } answer.addView(c, buttonParams); answer.setPadding(4, 0, 4, 0); // /Each button gets equal weight LinearLayout.LayoutParams answerParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); answerParams.weight = 1; buttonLayout.addView(answer, answerParams); } } // Align the buttons so that they appear horizonally and are right justified // buttonLayout.setGravity(Gravity.RIGHT); buttonLayout.setOrientation(LinearLayout.HORIZONTAL); // LinearLayout.LayoutParams params = new // LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // buttonLayout.setLayoutParams(params); // The buttons take up the right half of the screen LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); buttonParams.weight = 1; questionLayout.addView(buttonLayout, buttonParams); addView(questionLayout); }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mLockObect = new Object(); mPreference = getPreferences(MODE_PRIVATE); mOppacity = mPreference.getInt(PREFERENCE_OPPACITY_KEY, 0); mVerticalLogLinesWeight = mPreference.getInt(PREFERENCE_VERTICAL_WEIGHT_KEY, 0); mVerticalLogLinesOffset = mPreference.getInt(PREFERENCE_VERTICAL_OFFSET_KEY, 0); mHorizontalLogLinesWeight = mPreference.getInt(PREFERENCE_HORIZONTAL_WEIGHT_KEY, 0); mHorizontalLogLinesOffset = mPreference.getInt(PREFERENCE_HOZITONTAL_OFFSET_KEY, 0); mSelectedFontSizePosition = mPreference.getInt(PREFERENCE_SELECTED_FONT_SIZE_POSITION_KEY, 0); mSelectedFontColorPosition = mPreference.getInt(PREFERENCE_SELECTED_FONT_COLOR_POSITION_KEY, 0); mDisplayContentsCheckBoxState = mPreference.getInt(PREFERENCE_DISPLAY_CONTENTS_CHECKBOX_STATE_KEY, 0); mGrepEnable = mPreference.getBoolean(PREFERENCE_GREP_ENABLE_KEY, false); mGrepText = mPreference.getString(PREFERENCE_GREP_TEXT_KEY, ""); ToggleButton tb = (ToggleButton) findViewById(R.id.enableButton); tb.setChecked(LoggerService.isRunning(this)); tb.setOnCheckedChangeListener(mEnableButtonListener); Spinner fontSizeSpinner = (Spinner) findViewById(R.id.fontSizeSpinner); fontSizeSpinner.setSelection(mSelectedFontSizePosition); fontSizeSpinner.setOnItemSelectedListener(mFontsizeSpinnerListener); mFontSize = getResources().obtainTypedArray(R.array.fontsize).getInt(mSelectedFontSizePosition, 8); Spinner fontColorSpinner = (Spinner) findViewById(R.id.fontColorSpinner); fontColorSpinner.setOnItemSelectedListener(mFontColorSpinnerListener); fontColorSpinner.setSelection(mSelectedFontColorPosition); mFontColor = getResources() .obtainTypedArray(R.array.fontcolor_value) .getIndex(mSelectedFontColorPosition); TableLayout tblLayout = (TableLayout) findViewById(R.id.logContentCheckBox); int checkBoxCount = 0; for (int i = 0; i < tblLayout.getChildCount(); i++) { TableRow row = (TableRow) tblLayout.getChildAt(i); final int rowChildCound = row.getChildCount(); for (int j = 0; j < rowChildCound; j++) { CheckBox checkBox = (CheckBox) row.getChildAt(j); checkBox.setOnCheckedChangeListener(mContentsCheckBoxListener); checkBox.setTag(checkBoxCount); if ((mDisplayContentsCheckBoxState & (1 << checkBoxCount)) != 0) { mDisplayContents |= (1 << LOGCAT_COLUMN_POS[checkBoxCount]); checkBox.setChecked(true); } checkBoxCount++; } } ToggleButton grepEnableButton = (ToggleButton) findViewById(R.id.grepEnableButton); grepEnableButton.setOnCheckedChangeListener(mGrepEnableButtonListener); grepEnableButton.setChecked(mGrepEnable); EditText grepEditText = (EditText) findViewById(R.id.grepEditText); grepEditText.addTextChangedListener(mGrepTextWatcher); grepEditText.setText(mGrepText); SeekBar horizontalLogLinesWeightSB = (SeekBar) findViewById(R.id.horizontalSizeSlider); horizontalLogLinesWeightSB.setOnSeekBarChangeListener(mHorizontalLogLinesWeightSliderListener); horizontalLogLinesWeightSB.setProgress(mHorizontalLogLinesWeight); SeekBar verticalLogLinesWeightSB = (SeekBar) findViewById(R.id.logLinesSlider); verticalLogLinesWeightSB.setOnSeekBarChangeListener(mVerticalLogLinesWeightSliderListener); verticalLogLinesWeightSB.setProgress(mVerticalLogLinesWeight); SeekBar horizontalLogLinesOffsetSB = (SeekBar) findViewById(R.id.horizontalOffsetSlider); horizontalLogLinesOffsetSB.setOnSeekBarChangeListener(mHorizontalLogLinesOffsetSliderListener); horizontalLogLinesOffsetSB.setProgress(mHorizontalLogLinesOffset); SeekBar verticalLogLinesOffsetSB = (SeekBar) findViewById(R.id.verticalOffsetSlider); verticalLogLinesOffsetSB.setOnSeekBarChangeListener(mVerticalLogLinesOffsetSliderListener); verticalLogLinesOffsetSB.setProgress(mVerticalLogLinesOffset); SeekBar sb = (SeekBar) findViewById(R.id.opacitySlider); sb.setOnSeekBarChangeListener(mOpacitySliderListener); sb.setProgress(mOppacity); }