Java Code Examples for android.support.v4.widget.TextViewCompat#setCompoundDrawablesRelativeWithIntrinsicBounds()

The following examples show how to use android.support.v4.widget.TextViewCompat#setCompoundDrawablesRelativeWithIntrinsicBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppDetailsRecyclerViewAdapter.java    From fdroidclient with GNU General Public License v3.0 6 votes vote down vote up
private void addLinkItemView(ViewGroup parent, int resIdText, int resIdDrawable, final String url, String formatArg) {
    TextView view = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.app_details2_link_item, parent, false);
    if (formatArg == null) {
        view.setText(resIdText);
    } else {
        String text = parent.getContext().getString(resIdText, formatArg);
        view.setText(text);
    }
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(view, resIdDrawable, 0, 0, 0);
    parent.addView(view);
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onLinkClicked(url);
        }
    });
}
 
Example 2
Source File: PasswordEditText.java    From materialandroid with Apache License 2.0 5 votes vote down vote up
private void setDrawables() {
  Drawable[] drawables = getDrawables();
  if (passwordVisible) {
    drawables[2] = shownIcon;
  } else {
    drawables[2] = hiddenIcon;
  }
  TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this,
      drawables[0], drawables[1], tintDrawable(drawables[2]), drawables[3]);
}
 
Example 3
Source File: AppDetailsRecyclerViewAdapter.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
NoVersionsViewHolder(View view) {
    super(view);
    headerView = (TextView) view.findViewById(R.id.information);
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(headerView, R.drawable.ic_access_time_24dp_grey600, 0, 0, 0);

    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            explainIncompatibleVersions();
        }
    });
}
 
Example 4
Source File: AppDetailsRecyclerViewAdapter.java    From fdroidclient with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Depending on whether we are expanded or not, update the icon which indicates whether the
 * user can expand/collapse this item.
 */
protected void updateExpandableItem(boolean isExpanded) {
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(headerView, getIcon(), 0, isExpanded ? R.drawable.ic_expand_less_grey600 : R.drawable.ic_expand_more_grey600, 0);
}