Java 类android.widget.CheckedTextView 实例源码

项目:SearchLayout    文件:FlowSearchLayout.java   
private void initNetTags(List<String> allNames) {
    TagFlowLayout flowLayoutRecommend = mBinding.flowLayoutRecommend;
    TagAdapter adapter = new TagAdapter<String>(allNames) {
        @Override
        public View getView(FlowLayout parent, int position, String s) {
            View view = inflater.inflate(R.layout.item_search_tag, null);
            CheckedTextView tag = (CheckedTextView) view.findViewById(R.id.tv_tag);
            if (position == 2) tag.setChecked(true);
            tag.setText(s);
            return tag;
        }
    };
    flowLayoutRecommend.setAdapter(adapter);
    flowLayoutRecommend.setOnTagClickListener((view, position, parent) -> {
        String item = (String) adapter.getItem(position);
        return false;
    });
}
项目:GitHub    文件:Tool.java   
private static void setListItemsStyle(ConfigBean bean) {
    if(bean.type == DefaultConfig.TYPE_MD_SINGLE_CHOOSE || bean.type == DefaultConfig.TYPE_MD_MULTI_CHOOSE){
        ListView listView =  bean.alertDialog.getListView();
       // listView.getAdapter().
        if(listView!=null && listView.getAdapter() !=null){
            int count = listView.getChildCount();
            for(int i=0;i<count;i++){
                View childAt = listView.getChildAt(i);
                if(childAt ==null){
                    continue;
                }
                CheckedTextView itemView = (CheckedTextView) childAt.findViewById(android.R.id.text1);
                Log.e("dd",itemView+"-----"+ i);
                if(itemView !=null) {
                    itemView.setCheckMarkDrawable(R.drawable.bg_toast);
                    //itemView.setCheckMarkTintList();

                   // itemView.setCheckMarkTintList();
                    //itemView.setCheckMarkTintList();

                }

            }

        }

    }
}
项目:Delightful-SQLBrite    文件:ItemsAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice,
                parent, false);
    }

    TodoItem item = getItem(position);
    CheckedTextView textView = (CheckedTextView) convertView;
    textView.setChecked(item.complete());

    CharSequence description = item.description();
    if (item.complete()) {
        SpannableString spannable = new SpannableString(description);
        spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
        description = spannable;
    }

    textView.setText(description);

    return convertView;
}
项目:Quran    文件:DataListPreference.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
  ViewHolder holder;
  if (convertView == null) {
    LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
    convertView = inflater.inflate(R.layout.data_storage_location_item, parent, false);

    holder = new ViewHolder();
    holder.titleTextView = (TextView) convertView.findViewById(R.id.storage_label);
    holder.summaryTextView = (TextView) convertView.findViewById(R.id.available_free_space);
    holder.checkedTextView = (CheckedTextView) convertView.findViewById(R.id.checked_text_view);
    convertView.setTag(holder);
  }

  holder = (ViewHolder) convertView.getTag();
  holder.titleTextView.setText(getItem(position));
  holder.summaryTextView.setText(mFreeSpaces[position]);
  holder.checkedTextView.setText(null); // we have a 'custom' label
  if (position == mSelectedIndex) {
    holder.checkedTextView.setChecked(true);
  }

  return convertView;
}
项目:Hotspot-master-devp    文件:MyTabWidget.java   
/**
 * 设置底部导航中图片显示状态和字体颜色
 */
public void setTabsDisplay(int index) {
    if (mAttrTa != null) {
        int isSpecial = mAttrTa.getInt(index, 0);
        if (isSpecial != 0) {
            return;
        }
    }
    int size = mCheckedList.size();
    for (int i = 0; i < size; i++) {
        CheckedTextView checkedTextView = mCheckedList.get(i);
        if ((Integer) (checkedTextView.getTag()) == index) {
            LogUtils.i(mLabels[index] + " is selected...");
            checkedTextView.setChecked(true);
        } else {
            checkedTextView.setChecked(false);
        }
    }
}
项目:tuxguitar    文件:TGToolbarTrackListAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    TGToolbarTrackListItem item = (TGToolbarTrackListItem) this.getItem(position);

    View view = (convertView != null ? convertView : getLayoutInflater().inflate(R.layout.view_main_drawer_check_item, parent, false));

    CheckedTextView checkedTextView = (CheckedTextView) view.findViewById(R.id.main_drawer_check_item);
    checkedTextView.setText(item.getLabel());
    checkedTextView.setChecked(Boolean.TRUE.equals(item.getSelected()));
    checkedTextView.setOnClickListener(this.createGoToTrackAction(item.getTrack()));

    CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox_mute_track);
    checkBox.setChecked(Boolean.TRUE.equals(item.getTrack().isMute()));
    checkBox.setOnClickListener(this.createMuteTrackAction(item.getTrack()));
    return view;
}
项目:Pocket-Plays-for-Twitch    文件:SettingsStreamPlayerActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings_stream_player);

    settings = new Settings(getBaseContext());
    mShowNavigationBarView = (CheckedTextView) findViewById(R.id.player_show_navigation_title);
    mShowViewCountView = (CheckedTextView) findViewById(R.id.player_show_viewercount_title);
    mAutoPlaybackView = (CheckedTextView) findViewById(R.id.player_auto_continue_playback_title);

    mShowViewCountSummary = (TextView) findViewById(R.id.player_show_viewercount_title_summary);
    mShowNavigationBarSummary = (TextView) findViewById(R.id.player_show_navigation_summary);
    mAutoPlaybackSummary = (TextView) findViewById(R.id.player_auto_continue_playback_summary);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle(getString(R.string.settings_stream_player_name));
    }

    updateSummaries();
}
项目:Pocket-Plays-for-Twitch    文件:SettingsTwitchChatActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings_twitch_chat);
    settings = new Settings(getBaseContext());

    final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    emoteSizeSummary = (TextView) findViewById(R.id.chat_emote_size_summary);
    messageSizeSummary = (TextView) findViewById(R.id.message_size_summary);
    emoteStorageSummary = (TextView) findViewById(R.id.emote_storage_summary);
    chatLandscapeWidthSummary = (TextView) findViewById(R.id.chat_landscape_summary);
    chatLandscapeToggleSummary = (TextView) findViewById(R.id.chat_landscape_enable_summary);
    chatLandscapeSwipeToShowSummary = (TextView) findViewById(R.id.chat_landscape_swipe_summary);

    chatLandscapeToggle = (CheckedTextView) findViewById(R.id.chat_landscape_enable_title);
    chatSwipeToShowToggle = (CheckedTextView) findViewById(R.id.chat_landscape_swipe_title);
    updateSummaries();
}
项目:custode    文件:ContactsAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null)
        convertView = LayoutInflater.from(getContext()).inflate(resource, null);

    ContactItem contact = getItem(position);
    if (contact != null) {
        String html = "<b>" + contact.name + "</b> " + contact.number;
        Spanned newText;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
            newText = Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY);
        else
            newText = Html.fromHtml(html);

        CheckedTextView textView = (CheckedTextView) convertView;
        textView.setText(newText);
        textView.setChecked(contact.checked);
        textView.jumpDrawablesToCurrentState(); // (!!!) Ferma l'animazione dovuta a setChecked, terribile quando vengono riciclate le view
    }

    return convertView;
}
项目:sqlbrite-sqlcipher    文件:ItemsAdapter.java   
@Override public View getView(int position, View convertView, ViewGroup parent) {
  if (convertView == null) {
    convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, parent, false);
  }

  TodoItem item = getItem(position);
  CheckedTextView textView = (CheckedTextView) convertView;
  textView.setChecked(item.complete());

  CharSequence description = item.description();
  if (item.complete()) {
    SpannableString spannable = new SpannableString(description);
    spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
    description = spannable;
  }

  textView.setText(description);

  return convertView;
}
项目:ssj    文件:ListAdapter.java   
/**
 * @param groupPosition int
 * @param childPosition int
 * @param isLastChild   boolean
 * @param convertView   View
 * @param parent        ViewGroup
 * @return View
 */
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null)
    {
        LayoutInflater inflater = (LayoutInflater) this.context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
    }
    CheckedTextView txtListChild = (CheckedTextView) convertView;
    txtListChild.setPadding(PADDING, PADDING, PADDING, PADDING);
    txtListChild.setText(childText);
    return convertView;
}
项目:Coding-Android    文件:UserTagAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.activity_user_tags_list_item, parent, false);
        holder = new ViewHolder();
        holder.tag = (CheckedTextView) convertView.findViewById(R.id.name);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    TagObject data = new TagObject((JSONObject) getItem(position));
    holder.tag.setText(data.getmTagName());
    if (mHashSet.contains(data.getmTagId())) {
        holder.tag.setChecked(true);
    } else {
        holder.tag.setChecked(false);
    }
    return convertView;
}
项目:empeg-remote    文件:ImageArrayAdapter.java   
/**
 * {@inheritDoc}
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater();
    View row = inflater.inflate(R.layout.listitem, parent, false);

    ImageView imageView = (ImageView)row.findViewById(R.id.image);
    imageView.setImageResource(resourceIds[position]);

    CheckedTextView checkedTextView = (CheckedTextView)row.findViewById(
        R.id.check);

    checkedTextView.setText(getItem(position));

        if (position == index) {
            checkedTextView.setChecked(true);
        }

    return row;
}
项目:NewsMe    文件:MDTintHelper.java   
public static void setTint(@NonNull CheckedTextView textView, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            ThemeHelper.resolveColor(textView.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textView.setCheckMarkTintList(sl);
    } else {
        Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(textView.getContext(), R.drawable.abc_btn_radio_material));
        DrawableCompat.setTintList(d, sl);
        textView.setCheckMarkDrawable(d);
    }
}
项目:Delightful-SQLBrite    文件:ItemsAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice,
                parent, false);
    }

    TodoItem item = getItem(position);
    CheckedTextView textView = (CheckedTextView) convertView;
    textView.setChecked(item.complete());

    CharSequence description = item.description();
    if (item.complete()) {
        SpannableString spannable = new SpannableString(description);
        spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
        description = spannable;
    }

    textView.setText(description);

    return convertView;
}
项目:aptoide-client    文件:TimeLineFriendsCheckableListAdapter.java   
@Override
public View getView(final int position, View convertView, ViewGroup parent){
    final View v;
    ViewHolder holder;

    if(convertView == null){
        v = LayoutInflater.from(ctx).inflate(R.layout.row_facebook_invite_friends, parent, false);
        holder = new ViewHolder();
        holder.name = (CheckedTextView) v.findViewById(R.id.username);
        holder.avatarImage = (ImageView) v.findViewById(R.id.user_avatar);

        v.setTag(holder);
    } else {
        holder = (ViewHolder)convertView.getTag();
        v = convertView;
    }


    Friend friend = getItem(position);

    holder.name.setChecked(((ListView)parent).isItemChecked(position));
    holder.name.setText(friend.getUsername());
    Log.d("AptoideDebug", friend.getUsername());
    Glide.with(ctx).load(friend.getAvatar()).transform(new CircleTransform(ctx)).into(holder.avatarImage);
    return v;
}
项目:AndroidTint    文件:EmTintUtils.java   
public static void setTint(@NonNull CheckedTextView textView, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            ThemeHelper.resolveColor(textView.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textView.setCheckMarkTintList(sl);
    } else {
        Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(textView.getContext(), R.drawable.abc_btn_check_material));
        DrawableCompat.setTintList(d, sl);
        textView.setCheckMarkDrawable(d);
    }
}
项目:optc-mobile-db    文件:ImageArrayAdapter.java   
/**
 * {@inheritDoc}
 */
public View getView(int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
    View row = inflater.inflate(R.layout.preference_language, parent, false);
    ImageView imageView = (ImageView)row.findViewById(R.id.lanpref_image);
    imageView.setImageResource(resourceIds[position]);

    CheckedTextView checkedTextView = (CheckedTextView)row.findViewById(
            R.id.lanpref_check);

    checkedTextView.setText(getItem(position));

    if (position == index) {
        checkedTextView.setChecked(true);
    }

    return row;
}
项目:test_agent_android    文件:Solo.java   
/**
 * Checks if the specified text is checked.
 *
 * @param text the text that the {@link CheckedTextView} or {@link CompoundButton} objects display, specified as a regular expression
 * @return {@code true} if the specified text is checked and {@code false} if it is not checked
 */

@SuppressWarnings("unchecked")
public boolean isTextChecked(String text){
    if(config.commandLogging){
        Log.d(config.commandLoggingTag, "isTextChecked(\""+text+"\")");
    }

    waiter.waitForViews(false, CheckedTextView.class, CompoundButton.class);

    if(viewFetcher.getCurrentViews(CheckedTextView.class, true).size() > 0 && checker.isCheckedTextChecked(text))
        return true;

    if(viewFetcher.getCurrentViews(CompoundButton.class, true).size() > 0 && checker.isButtonChecked(CompoundButton.class, text))
        return true;

    return false;
}
项目:youkes_vr    文件:SettingItem.java   
/**
 * @param context
 * @param attrs
 */
public SettingItem(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater.from(context).inflate(R.layout.detaillist_item, this, true);

    mContent = (LinearLayout) findViewById(R.id.content);
    mTitle = (TextView) findViewById(android.R.id.title);
    mSummary = (TextView) findViewById(android.R.id.summary);
    mNewUpdate = (TextView) findViewById(R.id.text_tv_one);
    mCheckedTextView = (CheckedTextView) findViewById(R.id.accessory_checked);
    mDividerView = findViewById(R.id.item_bottom_divider);

    TypedArray localTypedArray = context.obtainStyledAttributes(attrs, R.styleable.setting_info);
    setTitleText(localTypedArray.getString(R.styleable.setting_info_item_titleText));
    setDetailText(localTypedArray.getString(R.styleable.setting_info_item_detailText));
    setAccessoryType(localTypedArray.getInt(R.styleable.setting_info_item_accessoryType , 0));
    setShowDivider(localTypedArray.getBoolean(R.styleable.setting_info_item_showDivider , true));
    localTypedArray.recycle();

    mNewUpdate.setVisibility(View.GONE);
}
项目:CampusAlma    文件:CommentaireCursorAdapter.java   
/**
 * Construit une vue sur base du layout joueur_list_view_item et
 * de l'élément courant du curseur
 * @param context
 * @param convertView
 * @param cursor
 * @return
 */
public View configureView(Context context, View convertView, Cursor cursor) {
    final Commentaire commentaire = DAO.getCommentaireFromCursor(cursor);

    final CheckedTextView texteC = (CheckedTextView)convertView.findViewById(R.id.item_commentaire_etablissement);
    texteC.setText(commentaire.getTexte());

    texteC.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (texteC.isChecked()) {
                texteC.setChecked(false);
                listeCommDel.remove(new Integer(commentaire.getId()));
                Log.i("TAILLE arraylist :", "apres un remove :" + listeCommDel.size());

            } else {
                texteC.setChecked(true);
                listeCommDel.add(commentaire.getId());
                Log.i("TAILLE arraylist :", "apres un add :" + listeCommDel.size());
            }
        }
    });
    return convertView;
}
项目:FMTech    文件:cat.java   
public final View a(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
  View localView = paramLayoutInflater.inflate(efj.sD, paramViewGroup, false);
  this.ag = localView.findViewById(aaw.jR);
  this.ag.setOnClickListener(this);
  this.ah = ((TextView)localView.findViewById(aaw.jS));
  this.ab = ((CheckedTextView)localView.findViewById(aaw.cA));
  this.ab.setOnClickListener(this);
  this.ac = ((CheckedTextView)localView.findViewById(aaw.jX));
  this.ac.setOnClickListener(this);
  this.ai = ((TextView)localView.findViewById(aaw.bY));
  this.ai.setOnClickListener(this);
  this.aj = ((Button)localView.findViewById(aaw.gD));
  this.aj.setOnClickListener(this);
  this.ak = ((Button)localView.findViewById(aaw.aU));
  this.ak.setOnClickListener(this);
  k().a(0, null, this.an);
  if (paramBundle != null)
  {
    this.ab.setChecked(paramBundle.getBoolean("disable_reshares", false));
    this.ac.setChecked(paramBundle.getBoolean("show_location_data", false));
  }
  return localView;
}
项目:World-Weather    文件:AppThemeArrayAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    PreferenceViewHolder holder;
    View rowView = convertView;

    if (rowView == null) {
        rowView = LayoutInflater.from(context).inflate(R.layout.row_app_theme_preference_list,
                parent, false);
        holder = new PreferenceViewHolder();

        holder.colorView = rowView.findViewById(R.id.app_theme_color);
        holder.nameTextView = (CheckedTextView) rowView.findViewById(R.id.app_theme_name);
        rowView.setTag(holder);
    }

    holder = (PreferenceViewHolder) rowView.getTag();

    GradientDrawable gradientDrawable = (GradientDrawable) holder.colorView.getBackground();
    gradientDrawable.setColor(resourceIds[position]);

    holder.nameTextView.setText(getItem(position));
    holder.nameTextView.setChecked(position == index);
    return rowView;
}
项目:wordpress_app_android    文件:StatsAbstractListFragment.java   
protected void setupTopModulePager(LayoutInflater inflater, ViewGroup container, View view, String[] buttonTitles) {
    int dp4 = DisplayUtils.dpToPx(view.getContext(), 4);
    int dp80 = DisplayUtils.dpToPx(view.getContext(), 80);

    for (int i = 0; i < buttonTitles.length; i++) {
        CheckedTextView rb = (CheckedTextView) inflater.inflate(R.layout.stats_top_module_pager_button, container, false);
        RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT,
                RadioGroup.LayoutParams.WRAP_CONTENT);
        params.weight = 1;
        rb.setTypeface((TypefaceCache.getTypeface(view.getContext())));
        if (i == 0) {
            params.setMargins(0, 0, dp4, 0);
        } else {
            params.setMargins(dp4, 0, 0, 0);
        }
        rb.setMinimumWidth(dp80);
        rb.setGravity(Gravity.CENTER);
        rb.setLayoutParams(params);
        rb.setText(buttonTitles[i]);
        rb.setChecked(i == mTopPagerSelectedButtonIndex);
        rb.setOnClickListener(TopModulePagerOnClickListener);
        mTopPagerContainer.addView(rb);
    }
    mTopPagerContainer.setVisibility(View.VISIBLE);
}
项目:DeviceOwner    文件:MainActivity.java   
public ViewHolder(final View itemView) {
    super(itemView);

    mAppTitleTextView = (CheckedTextView) itemView.findViewById(android.R.id.text1);
    mAppTitleTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            if (mAdministrationModeManager.isAdministrator() &&
                    mAdministrationModeManager.isDeviceOwner()) {
                if (mAppTitleTextView.isChecked()) {
                    mAppsManager.hideApp(mAppsList.get(getAdapterPosition()));
                } else {
                    mAppsManager.showApp(mAppsList.get(getAdapterPosition()));
                }
                notifyDataSetChanged();
            }
        }
    });
}
项目:triethocduongpho    文件:MonthYearAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    VH vh;
    if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(android.R.layout.select_dialog_singlechoice, null);
        vh = new VH();
        vh.textView = (CheckedTextView) convertView.findViewById(android.R.id.text1);
        convertView.setTag(vh);
    } else {
        vh = (VH) convertView.getTag();
    }

    Calendar item = listMonth.get(position);
    String value = context.getResources().getString(R.string.month_format, item.get(Calendar.MONTH)+1, item.get(Calendar.YEAR));
    vh.textView.setText(value);
    return convertView;
}
项目:mc_backup    文件:BasicColorPicker.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = super.getView(position, convertView, parent);

    Drawable d = v.getBackground();
    d.setColorFilter(getItem(position), PorterDuff.Mode.MULTIPLY);
    v.setBackgroundDrawable(d);

    Drawable check = null;
    CheckedTextView checked = ((CheckedTextView) v);
    if (mSelected == position) {
        check = getCheckDrawable();
    }

    checked.setCompoundDrawables(check, null, null, null);
    checked.setText("");

    return v;
}
项目:android-CheckTextList    文件:CheckedTextListView.java   
private void singleToggle(View view, String tag){
    if(view instanceof CheckedTextView) {

        CheckedTextView check = ((CheckedTextView)view);
        if(check.getText().equals(tag)){
            check.setChecked(false);
        }
    }

    //If a layout container, iterate over children and seed recursion.
    if (view instanceof ViewGroup) {

        for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {

            View innerView = ((ViewGroup) view).getChildAt(i);

            singleToggle(innerView, tag);
        }
    }
}
项目:ViewInspector    文件:ViewFilterAdapter.java   
@Override public View getView(final int position, View convertView, ViewGroup parent) {
  ViewHolder viewHolder;
  if (convertView == null) {
    convertView =
        mLayoutInflater.inflate(R.layout.view_inspector_set_view_filter_listitem, parent, false);
    viewHolder = new ViewHolder();
    viewHolder.text1 = (CheckedTextView) convertView.findViewById(R.id.text1);
    convertView.setTag(viewHolder);
  } else {
    viewHolder = (ViewHolder) convertView.getTag();
  }

  String viewClass = mViewClassList.get(position);
  viewHolder.text1.setText(viewClass);
  if (mViewFilter.contains(viewClass)) {
    mListView.setItemChecked(position, true);
    viewHolder.text1.setPaintFlags(
        viewHolder.text1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
  } else {
    mListView.setItemChecked(position, false);
    viewHolder.text1.setPaintFlags(
        viewHolder.text1.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
  }
  return convertView;
}
项目:attendee-checkin    文件:EventSelectionFragment.java   
@Override
public void bindView(View view, Context context, Cursor cursor) {
    CheckedTextView textView = (CheckedTextView) view;
    textView.setText(cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.NAME)));
    String eventId = cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.ID));
    view.setTag(eventId);
    if (textView.getPaddingLeft() > 0) { // on Dropdown
        long endTime = cursor.getLong(cursor.getColumnIndexOrThrow(Table.Event.END_TIME));
        if (TextUtils.equals(mCurrentEventId, eventId)) {
            textView.setTextColor(mTextColorCurrent);
        } else if (endTime * 1000 < System.currentTimeMillis()) { // Past
            textView.setTextColor(mTextColorPast);
        } else {
            textView.setTextColor(mTextColorDefault);
        }
    } else { // on Toolbar
        textView.setTextColor(mTextColorInverse);
    }
}
项目:PodEmu    文件:SettingsActivity.java   
private void setDebugInfo()
{
    PodEmuLog.checkPermissions();
    String enableDebug = sharedPref.getString("enableDebug", "false");

    TextView enableDebugValue = (TextView) findViewById(R.id.enableDebugValue);
    CheckedTextView enableDebugHint = (CheckedTextView) findViewById(R.id.enableDebugHint);

    if( enableDebug.equals("true") )
    {
        enableDebugValue.setText("Debug Enabled");
        enableDebugHint.setChecked(true);
    }
    else
    {
        enableDebugValue.setText("Debug Disabled");
        enableDebugHint.setChecked(false);
    }

    enableDebugHint.setText(getResources().getString(R.string.enable_debug_hint) +
            " Logs will be saved to the following file: " + PodEmuLog.getLogFileName());
}
项目:PodEmu    文件:SettingsActivity.java   
private void setToggleForceSimpleMode()
{
    int forceSimpleMode = sharedPref.getInt("ForceSimpleMode", 0);

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.playlistCountLayout);

    CheckedTextView toggleForceSimpleModeView = (CheckedTextView) findViewById(R.id.forceSimpleModeHint);

    if( forceSimpleMode == 1 )
    {
        toggleForceSimpleModeView.setChecked(true);
        if ( enableListCountSelection ) layout.setVisibility(View.INVISIBLE);
    }
    else
    {
        toggleForceSimpleModeView.setChecked(false);
        if ( enableListCountSelection ) layout.setVisibility(View.VISIBLE);
    }
}
项目:swan-sense-studio    文件:SwanLakePlusActivity.java   
@SuppressWarnings("deprecation")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(SwanLakePlusActivity.this)
                .inflate(android.R.layout.simple_list_item_multiple_choice, null);
    }

    TypedArray ta = SwanLakePlusActivity.this.obtainStyledAttributes(new int[]{android.R.attr.activatedBackgroundIndicator});
    convertView.setBackgroundDrawable(ta.getDrawable(0));
    ta.recycle();

    ((CheckedTextView) (convertView.findViewById(android.R.id.text1)))
            .setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mNearbyPeersFragment.getListView().setItemChecked(position, !((CheckedTextView) v).isChecked());
                }
            });
    ((TextView) (convertView.findViewById(android.R.id.text1)))
            .setText(getItem(position).toString());
    ((TextView) (convertView.findViewById(android.R.id.text1)))
            .setPadding(20, 20, 20, 20);
    return convertView;
}
项目:Phlux    文件:MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    findViewById(R.id.thread_demo).setOnClickListener(v -> startActivity(new Intent(this, DemoActivity.class)));

    check1 = (CheckedTextView) findViewById(R.id.check1);
    check2 = (CheckedTextView) findViewById(R.id.check2);

    check1.setText(MainState.NAME_1);
    check2.setText(MainState.NAME_2);

    check1.setOnClickListener(v -> switchTo(MainState.NAME_1));
    check2.setOnClickListener(v -> switchTo(MainState.NAME_2));

    ListView listView = (ListView) findViewById(R.id.listView);
    listView.setAdapter(adapter = new ArrayAdapter<>(this, R.layout.item));
}
项目:ServeStream    文件:BluetoothOptionsListAdapter.java   
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;

    LayoutInflater inflater = (LayoutInflater)
        mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
        holder = new ViewHolder();
        holder.txtTitle = (CheckedTextView) convertView.findViewById(android.R.id.text1);
        convertView.setTag(holder);
    }
    else {
        holder = (ViewHolder) convertView.getTag();
    }

    BluetoothDevice device = (BluetoothDevice) getItem(position);

    holder.txtTitle.setText(device.getName() + "\n" + device.getAddress());

    return convertView;
}
项目:sqlbrite    文件:ItemsAdapter.java   
@Override public View getView(int position, View convertView, ViewGroup parent) {
  if (convertView == null) {
    convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, parent, false);
  }

  TodoItem item = getItem(position);
  CheckedTextView textView = (CheckedTextView) convertView;
  textView.setChecked(item.complete());

  CharSequence description = item.description();
  if (item.complete()) {
    SpannableString spannable = new SpannableString(description);
    spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
    description = spannable;
  }

  textView.setText(description);

  return convertView;
}
项目:robotium-tech    文件:Solo.java   
/**
 * Checks if the specified text is checked.
 *
 * @param text the text that the {@link CheckedTextView} or {@link CompoundButton} objects display, specified as a regular expression
 * @return {@code true} if the specified text is checked and {@code false} if it is not checked
 */

@SuppressWarnings("unchecked")
public boolean isTextChecked(String text){
    if(config.commandLogging){
        Log.d(config.commandLoggingTag, "isTextChecked(\""+text+"\")");
    }

    waiter.waitForViews(false, CheckedTextView.class, CompoundButton.class);

    if(viewFetcher.getCurrentViews(CheckedTextView.class, true).size() > 0 && checker.isCheckedTextChecked(text))
        return true;

    if(viewFetcher.getCurrentViews(CompoundButton.class, true).size() > 0 && checker.isButtonChecked(CompoundButton.class, text))
        return true;

    return false;
}
项目:AndroPTPB    文件:ServerChooserAdapter.java   
@Override
public void bindView(View view, Context context, Cursor cursor) {
    CheckableLinearLayout checkme = (CheckableLinearLayout)view;
    CheckedTextView base_url_view = (CheckedTextView) view.findViewById(R.id.ServerItem_Url);

    if (URL_IDX == -1) {
        URL_IDX = cursor.getColumnIndex(DBHelper.BASE_URL);
    }
    if (DEF_IDX == -1) {
        DEF_IDX = cursor.getColumnIndex(DBHelper.SERVER_DEFAULT);
    }

    boolean isChecked = (cursor.getInt(DEF_IDX) == 1);
    String base_url = cursor.getString(URL_IDX);

    Log.d(LOG_TAG, "def flag: "+cursor.getInt(DEF_IDX));

    checkme.setChecked(isChecked);
    base_url_view.setText(base_url);

    if (isChecked) {
        Log.d(LOG_TAG, base_url + " is the default");
        curId = cursor.getLong(cursor.getColumnIndex(DBHelper.COLUMN_ID));
    }
}
项目:wordwise    文件:ProficientLanguagesStep.java   
public void toggle(CheckedTextView v) {
    String langName = v.getText().toString();
    DTOLanguage l = LanguageUtils.getByName(langName);

    if (configuration.getProficientLanguages().contains(l)) {
        configuration.removeLanguage(l);
    } else {
        configuration.addLanguage(l);
    }

    // check the state of the next button
    if (configuration.getProficientLanguages().size() > 0) {
        finish.setEnabled(true);
    } else
        finish.setEnabled(false);
    setSelectedLanguageCountText(configuration.getProficientLanguages()
            .size());
}
项目:SendLog    文件:CreateShortcutActivity.java   
public ArrayAdapter<String> getInstance(final Context pContext) {
    return new ArrayAdapter<String>(pContext, android.R.layout.simple_spinner_item, names) {

        @Override
        public View getDropDownView(final int pPosition, final View pConvertView, final ViewGroup pParent) {
            final View view;
            if (pConvertView == null) {
                // TODO http://www.doubleencore.com/2013/05/layout-inflation-as-intended/
                view = View.inflate(getApplicationContext(), R.layout.sender_list_item, null);
            } else {
                view = pConvertView;
            }

            final ImageView iconView = (ImageView) view.findViewById(R.id.sender_icon);
            iconView.setImageDrawable(icons.get(pPosition));

            final CheckedTextView tv = (CheckedTextView) view.findViewById(android.R.id.text1);
            tv.setText(names.get(pPosition));
            tv.setChecked(pPosition == mSenderSpinner.getSelectedItemPosition());

            return view;
        }
    };
}