@Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View item = inflater.inflate(R.layout.time_settings_dropdown_item, null); item.setMinimumHeight(60); if (position >= times.size()) { ((CheckedTextView) item).setText(getText(R.string.customTime)); } else { SpannableString ss = new SpannableString( times.get(position) + " " + getString(R.string.min) + " (+" + increments.get(position) + getString(R.string.secPerMove) + ")"); ss.setSpan(new ForegroundColorSpan(0xFF000000), 0, 6, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan( new ForegroundColorSpan(0xFF666666), 6, ss.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); ((CheckedTextView) item).setText(ss); } return item; }
public View getView(int position, View convertView, ViewGroup parent) { Vector categories = model.getVector(KEY_V_ALL_CATEGORIES); if (categories == null || position >= categories.size() + 1) { return convertView; } if (convertView == null) { convertView = mInflater.inflate(R.layout.add_place_category_item, null); } CheckedTextView categoryItem = (CheckedTextView) convertView; if (position == 0) { categoryItem.setText(R.string.addplace_category_label_none); categoryItem.setCompoundDrawablesWithIntrinsicBounds( R.drawable.list_icon_folder_disabled, 0, 0, 0); } else { FavoriteCatalog category = (FavoriteCatalog) categories.elementAt(position - 1); categoryItem.setCompoundDrawablesWithIntrinsicBounds( R.drawable.list_icon_folder_unfocused, 0, 0, 0); String categoryName; if (category.isReceivedCatalog()) { categoryName = ResourceManager.getInstance() .getCurrentBundle() .getString(IStringCommon.RES_RECEIVED_CATEGORY, IStringCommon.FAMILY_COMMON); } else { categoryName = category.getName(); } categoryItem.setText(categoryName); } return convertView; }
private void rebuildComplicationsList() { ViewGroup complicationsContainer = (ViewGroup) mRootView.findViewById(R.id.complications_list); complicationsContainer.removeAllViews(); LayoutInflater inflater = LayoutInflater.from(getActivity()); for (int i = 0; i < PREF_KEYS.length; i++) { final String prefKey = PREF_KEYS[i]; ViewGroup itemContainer = (ViewGroup) inflater.inflate(R.layout.config_complications_item, complicationsContainer, false); final CheckedTextView titleView = (CheckedTextView) itemContainer.findViewById(android.R.id.text1); final View checkmarkView = itemContainer.findViewById(R.id.checkmark); titleView.setText(PREF_TITLE_IDS[i]); boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false); checkmarkView.setVisibility(isPrefOn ? View.VISIBLE : View.INVISIBLE); titleView.setChecked(isPrefOn); itemContainer.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean isPrefOn = mSharedPreferences.getBoolean(prefKey, false); mSharedPreferences.edit().putBoolean(prefKey, !isPrefOn).apply(); rebuildComplicationsList(); } }); complicationsContainer.addView(itemContainer); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { AlarmPre alarmPreference = (AlarmPre) getItem(position); LayoutInflater layoutInflater = LayoutInflater.from(getContext()); switch (alarmPreference.getType()) { case BOOLEAN: if (null == convertView || convertView.getId() != android.R.layout.simple_list_item_checked) convertView = layoutInflater.inflate(android.R.layout.simple_list_item_checked, null); CheckedTextView checkedTextView = (CheckedTextView) convertView.findViewById(android.R.id.text1); checkedTextView.setText(alarmPreference.getTitle()); checkedTextView.setChecked((Boolean) alarmPreference.getValue()); break; case INTEGER: case STRING: case LIST: case MULTIPLE_LIST: case TIME: default: if (null == convertView || convertView.getId() != android.R.layout.simple_list_item_2) convertView = layoutInflater.inflate(android.R.layout.simple_list_item_2, null); TextView text1 = (TextView) convertView.findViewById(android.R.id.text1); text1.setTextSize(18); text1.setText(alarmPreference.getTitle()); TextView text2 = (TextView) convertView.findViewById(android.R.id.text2); text2.setText(alarmPreference.getSummary()); break; } return convertView; }
@Override public View getGroupView( final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.group, null); } ImageButton btn = (ImageButton) convertView.findViewById(R.id.discardBtn); btn.setFocusable(false); btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "group with time " + titles.get(groupPosition) + " clicked!"); } }); CheckedTextView tw = (CheckedTextView) convertView.findViewById(R.id.checkedTW); Title title = titles.get(groupPosition); tw.setText(title.getDate()); tw.setChecked(isExpanded); TextView coordsView = (TextView) convertView.findViewById(R.id.coordsView); coordsView.setText( "Floor: " + title.getZ() + ". Position [" + title.getX() + ", " + title.getY() + "]"); return convertView; }
@Override public View getGroupView( int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.listrow_group, null); } amarre group = (amarre) getGroup(groupPosition); ((CheckedTextView) convertView).setText(group.string); ((CheckedTextView) convertView).setChecked(isExpanded); return convertView; }
@Override public View getGroupView( int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.layout_for_diary_group, null); } ((CheckedTextView) convertView).setText(parentItems.get(groupPosition)); ((CheckedTextView) convertView).setChecked(isExpanded); return convertView; }
@Override public View getView(final int position, final View convertView, final ViewGroup parent) { CheckedTextView tv = (CheckedTextView) convertView; if (tv == null) { tv = (CheckedTextView) LayoutInflater.from(AnimateDismissActivity.this) .inflate(R.layout.item_animateremoval_row, parent, false); } tv.setText(String.valueOf(getItem(position))); tv.setChecked(mSelectedPositions.contains(position)); return tv; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.listitem_device, parent, false); } if (convertView instanceof CheckedTextView) { final UsbDevice device = getItem(position); ((CheckedTextView) convertView) .setText( String.format("UVC Camera:(%x:%x)", device.getVendorId(), device.getProductId())); } return convertView; }
@Override public View getGroupView( int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.activity_terms_parent_expandablelist, null); } ((CheckedTextView) convertView).setText(parentItems.get(groupPosition)); ((CheckedTextView) convertView).setChecked(isExpanded); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(layoutId, parent, false); } ((CheckedTextView) convertView).setText(_listView.getItemAtPosition(position).toString()); if (position == _listView.getCheckedItemPosition()) { ((CheckedTextView) convertView).setBackgroundColor(Color.MAGENTA); } else { ((CheckedTextView) convertView).setBackgroundColor(Color.TRANSPARENT); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { // LayoutInflater inflater = getLayoutInflater(); row = inflater.inflate(R.layout.play_list_item, parent, false); } CheckedTextView checkedTextView = (CheckedTextView) row.findViewById(R.id.play_list_item); checkedTextView.setText(this.playlist.get(position)); Boolean checked = cds.myChecked.get(position); if (checked != null) { checkedTextView.setChecked(checked); } return row; }
@Override public View getView(int position, View convertView, ViewGroup parent) { CheckedTextView checkView = null; if (null == convertView) { LayoutInflater inflater = LayoutInflater.from(mCtx); convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null); checkView = (CheckedTextView) convertView.findViewById(android.R.id.text1); checkView.setTextSize(14); // ((CheckedTextView)convertView) } else { checkView = (CheckedTextView) convertView.getTag(); } String item = mHostList.get(position); if (item.contains("#")) { checkView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); } checkView.setText(item); convertView.setTag(checkView); return convertView; }
private void onClickMenuItem(int menuId) { final Settings settings = Settings.instance(); if (mOpenedMenuId == menuId) { mOpenedMenuId = -1; // close menu mSubMenuContrainer.setVisibility(View.INVISIBLE); mSubMenuContrainer.removeAllViews(); } else { mOpenedMenuId = menuId; // open menu here ArrayList<String> values = new ArrayList<String>(); int chosenIndex = 0; if (menuId == R.id.resolution_menu) { values = settings.getAvailResList(); chosenIndex = settings.getChosenResIndex(); } else if (menuId == R.id.bitrate_menu) { int[] bitrates = settings.getBitrates(); for (int bitrate : bitrates) { values.add(Formatter.formatShortFileSize(getActivity(), bitrate)); } chosenIndex = settings.getChosenBitrateIndex(); } else if (menuId == R.id.rotate_menu) { values.add(getActivity().getString(R.string.rotate_on)); values.add(getActivity().getString(R.string.rotate_off)); chosenIndex = settings.isRotate() ? 0 : 1; } if (values != null) { mSubMenuContrainer.removeAllViews(); for (int index = 0; index < values.size(); ++index) { CheckedTextView ctv = mSubMenuItems.get(index); ctv.setText(values.get(index)); ctv.setChecked(chosenIndex == index); mSubMenuContrainer.addView(ctv); } mSubMenuContrainer.setVisibility(View.VISIBLE); } } }
public void setTask(Task task) { this.task = task; checkbox.setText(task.getName()); checkbox.setChecked(task.isComplete()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.choosesensor); String expNum = "", expName = ""; Bundle extras = getIntent().getExtras(); if (extras != null) { expNum = extras.getString("expnum"); expName = extras.getString("expname"); } TextView tvtext = (TextView) findViewById(R.id.choose_sensor_text); tvtext.setText( getResources().getString(R.string.select_fields_for) + expNum + ", " + expName + "."); compatible = true; Context mContext = this; LinkedList<String> fields = Step1Setup.dfm.order; sensors = Step1Setup.sc; scrollViewLayout = (LinearLayout) findViewById(R.id.sensorscrollview); if (fields.isEmpty()) { isEmpty = true; } else { for (String field : fields) { View v = View.inflate(mContext, R.layout.sensorelement, null); CheckedTextView ctv = (CheckedTextView) v.findViewById(R.id.sensorlabel); ctv.setText(field); TextView tv = (TextView) v.findViewById(R.id.subsensorlabel); if (field.equals(getString(R.string.null_string)) || field.equals(getString(R.string.time)) || field.equals(getString(R.string.latitude)) || field.equals(getString(R.string.longitude))) { setCompatibility(tv, ctv); } else if (field.equals(getString(R.string.accel_x)) || field.equals(getString(R.string.accel_y)) || field.equals(getString(R.string.accel_z)) || field.equals(getString(R.string.accel_total))) { setCompatibility(tv, ctv, SensorTypes.ACCELEROMETER); } else if (field.equals(getString(R.string.magnetic_x)) || field.equals(getString(R.string.magnetic_y)) || field.equals(getString(R.string.magnetic_z)) || field.equals(getString(R.string.magnetic_total))) { setCompatibility(tv, ctv, SensorTypes.MAGNETIC_FIELD); } else if (field.equals(getString(R.string.heading_deg)) || field.equals(getString(R.string.heading_rad))) { setCompatibility(tv, ctv, SensorTypes.ORIENTATION); } else if (field.equals(getString(R.string.temperature_c)) || field.equals(getString(R.string.temperature_f)) || field.equals(getString(R.string.temperature_k))) { setCompatibility(tv, ctv, SensorTypes.AMBIENT_TEMPERATURE); } else if (field.equals(getString(R.string.pressure))) { setCompatibility(tv, ctv, SensorTypes.PRESSURE); } else if (field.equals(getString(R.string.luminous_flux))) { setCompatibility(tv, ctv, SensorTypes.LIGHT); } else if (field.equals(getString(R.string.altitude))) { setCompatibility(tv, ctv, SensorTypes.PRESSURE, SensorTypes.AMBIENT_TEMPERATURE); } LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(1, 1, 1, 1); scrollViewLayout.addView(v, layoutParams); v.setOnClickListener(this); if (field.equals(getString(R.string.null_string))) { nullViewCount++; v.setVisibility(View.GONE); } } } if (nullViewCount == scrollViewLayout.getChildCount()) { errorTV = new TextView(mContext); errorTV.setBackgroundColor(Color.TRANSPARENT); if (isEmpty) errorTV.setText(getString(R.string.invalidExperiment)); else { errorTV.setText(getString(R.string.noCompatibleFields)); compatible = false; } scrollViewLayout.addView(errorTV); isEmpty = false; } Button okay = (Button) findViewById(R.id.sensor_ok); okay.setOnClickListener(this); }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.xmainentry, parent, false); LinearLayout llIcon = (LinearLayout) row.findViewById(R.id.llIcon); ImageView imgIcon = (ImageView) row.findViewById(R.id.imgIcon); ImageView imgInternet = (ImageView) row.findViewById(R.id.imgInternet); ImageView imgUsed = (ImageView) row.findViewById(R.id.imgUsed); final CheckedTextView ctvApp = (CheckedTextView) row.findViewById(R.id.ctvName); // Get entry final XApplicationInfo xAppInfo = getItem(position); // Set background color if (xAppInfo.getIsSystem()) if (mThemeId == android.R.style.Theme_Holo_Light) row.setBackgroundColor(Color.parseColor("#FFFDD0")); else row.setBackgroundColor(Color.DKGRAY); // Click handler llIcon.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intentSettings = new Intent(view.getContext(), ActivityApp.class); intentSettings.putExtra(ActivityApp.cPackageName, xAppInfo.getPackageName()); intentSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); view.getContext().startActivity(intentSettings); } }); // Set icon imgIcon.setImageDrawable(xAppInfo.getDrawable()); // Set title ctvApp.setText(xAppInfo.toString()); // Check if internet access imgInternet.setVisibility(xAppInfo.hasInternet() ? View.VISIBLE : View.INVISIBLE); // Check if used boolean used = XRestriction.isUsed(row.getContext(), xAppInfo.getUid(), mRestrictionName, null); ctvApp.setTypeface(null, used ? Typeface.BOLD_ITALIC : Typeface.NORMAL); imgUsed.setVisibility(used ? View.VISIBLE : View.INVISIBLE); // Display restriction boolean restricted = XRestriction.getRestricted( null, row.getContext(), xAppInfo.getUid(), mRestrictionName, null, false, false); ctvApp.setChecked(restricted); // Listen for restriction changes ctvApp.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { boolean restricted = XRestriction.getRestricted( null, view.getContext(), xAppInfo.getUid(), mRestrictionName, null, false, false); restricted = !restricted; ctvApp.setChecked(restricted); XRestriction.setRestricted( null, view.getContext(), xAppInfo.getUid(), mRestrictionName, null, restricted); } }); row.refreshDrawableState(); return row; }
@Override public View getGroupView( int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.restrictionentry, parent, false); ImageView imgIndicator = (ImageView) row.findViewById(R.id.imgIndicator); ImageView imgUsed = (ImageView) row.findViewById(R.id.imgUsed); ImageView imgGranted = (ImageView) row.findViewById(R.id.imgGranted); ImageView imgInfo = (ImageView) row.findViewById(R.id.imgInfo); final CheckedTextView ctvRestriction = (CheckedTextView) row.findViewById(R.id.ctvName); // Indicator state imgIndicator.setImageResource( isExpanded ? R.drawable.expander_ic_maximized : R.drawable.expander_ic_minimized); // Disable indicator for empty groups if (mExpert) { if (getChildrenCount(groupPosition) == 0) imgIndicator.setVisibility(View.INVISIBLE); } else imgIndicator.setVisibility(View.GONE); // Get entry final String restrictionName = (String) getGroup(groupPosition); // Display if restriction granted if (!PrivacyManager.hasPermission( row.getContext(), mAppInfo.getPackageName(), restrictionName)) imgGranted.setVisibility(View.INVISIBLE); // Display if used if (PrivacyManager.getUsed(row.getContext(), mAppInfo.getUid(), restrictionName, null) != 0) ctvRestriction.setTypeface(null, Typeface.BOLD_ITALIC); else imgUsed.setVisibility(View.INVISIBLE); // Handle info imgInfo.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent infoIntent = new Intent(Intent.ACTION_VIEW); infoIntent.setData( Uri.parse( String.format( "http://wiki.faircode.eu/index.php?title=%s", restrictionName))); startActivity(infoIntent); } }); // Display localized name ctvRestriction.setText(PrivacyManager.getLocalizedName(row.getContext(), restrictionName)); // Display restriction boolean restricted = PrivacyManager.getRestricted( null, row.getContext(), mAppInfo.getUid(), restrictionName, null, false, false); ctvRestriction.setChecked(restricted); // Listen for restriction changes ctvRestriction.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { boolean restricted = PrivacyManager.getRestricted( null, view.getContext(), mAppInfo.getUid(), restrictionName, null, false, false); restricted = !restricted; ctvRestriction.setChecked(restricted); PrivacyManager.setRestricted( null, view.getContext(), mAppInfo.getUid(), restrictionName, null, restricted); notifyDataSetChanged(); } }); return row; }
@Override public View getChildView( int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.restrictionchild, parent, false); final CheckedTextView ctvMethodName = (CheckedTextView) row.findViewById(R.id.ctvMethodName); // Get entry final String restrictionName = (String) getGroup(groupPosition); final String methodName = (String) getChild(groupPosition, childPosition); long lastUsage = PrivacyManager.getUsed(row.getContext(), mAppInfo.getUid(), restrictionName, methodName); // Display method name if (lastUsage == 0) ctvMethodName.setText(methodName); else { Date date = new Date(lastUsage); SimpleDateFormat format = new SimpleDateFormat("dd/HH:mm", Locale.US); ctvMethodName.setText(String.format("%s %s", methodName, format.format(date))); } boolean parentRestricted = PrivacyManager.getRestricted( null, row.getContext(), mAppInfo.getUid(), restrictionName, null, false, false); ctvMethodName.setEnabled(parentRestricted); // Display if used if (lastUsage != 0) ctvMethodName.setTypeface(null, Typeface.BOLD_ITALIC); // Display restriction boolean restricted = PrivacyManager.getRestricted( null, row.getContext(), mAppInfo.getUid(), restrictionName, methodName, false, false); ctvMethodName.setChecked(restricted); // Listen for restriction changes ctvMethodName.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { boolean restricted = PrivacyManager.getRestricted( null, view.getContext(), mAppInfo.getUid(), restrictionName, methodName, false, false); restricted = !restricted; ctvMethodName.setChecked(restricted); PrivacyManager.setRestricted( null, view.getContext(), mAppInfo.getUid(), restrictionName, methodName, restricted); } }); return row; }