Tabnine Logo
ExpandableTextView
Code IndexAdd Tabnine to your IDE (free)

How to use
ExpandableTextView
in
com.ms.square.android.expandabletextview

Best Java code snippets using com.ms.square.android.expandabletextview.ExpandableTextView (Showing top 12 results out of 315)

origin: Manabu-GT/ExpandableTextView

public void setText(@Nullable CharSequence text, @NonNull SparseBooleanArray collapsedStatus, int position) {
  mCollapsedStatus = collapsedStatus;
  mPosition = position;
  boolean isCollapsed = collapsedStatus.get(position, true);
  clearAnimation();
  mCollapsed = isCollapsed;
  mExpandIndicatorController.changeState(mCollapsed);
  setText(text);
}
origin: Manabu-GT/ExpandableTextView

private void findViews() {
  mTv = (TextView) findViewById(mExpandableTextId);
  if (mExpandToggleOnTextClick) {
    mTv.setOnClickListener(this);
  } else {
    mTv.setOnClickListener(null);
  }
  mToggleView = findViewById(mExpandCollapseToggleId);
  mExpandIndicatorController.setView(mToggleView);
  mExpandIndicatorController.changeState(mCollapsed);
  mToggleView.setOnClickListener(this);
}
origin: Manabu-GT/ExpandableTextView

@Override
protected void onFinishInflate() {
  super.onFinishInflate();
  findViews();
}
origin: Manabu-GT/ExpandableTextView

public void setText(@Nullable CharSequence text) {
  mRelayout = true;
  mTv.setText(text);
  setVisibility(TextUtils.isEmpty(text) ? View.GONE : View.VISIBLE);
  clearAnimation();
  getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
  requestLayout();
}
origin: Manabu-GT/ExpandableTextView

private void init(AttributeSet attrs) {
  TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
  mMaxCollapsedLines = typedArray.getInt(R.styleable.ExpandableTextView_maxCollapsedLines, MAX_COLLAPSED_LINES);
  mAnimationDuration = typedArray.getInt(R.styleable.ExpandableTextView_animDuration, DEFAULT_ANIM_DURATION);
  mAnimAlphaStart = typedArray.getFloat(R.styleable.ExpandableTextView_animAlphaStart, DEFAULT_ANIM_ALPHA_START);
  mExpandableTextId = typedArray.getResourceId(R.styleable.ExpandableTextView_expandableTextId, R.id.expandable_text);
  mExpandCollapseToggleId = typedArray.getResourceId(R.styleable.ExpandableTextView_expandCollapseToggleId, R.id.expand_collapse);
  mExpandToggleOnTextClick = typedArray.getBoolean(R.styleable.ExpandableTextView_expandToggleOnTextClick, true);
  mExpandIndicatorController = setupExpandToggleController(getContext(), typedArray);
  typedArray.recycle();
  // enforces vertical orientation
  setOrientation(LinearLayout.VERTICAL);
  // default visibility is gone
  setVisibility(GONE);
}
origin: Manabu-GT/ExpandableTextView

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
               Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_demo1, container, false);
    ((TextView) rootView.findViewById(R.id.sample1).findViewById(R.id.title)).setText("Sample 1");
    ((TextView) rootView.findViewById(R.id.sample2).findViewById(R.id.title)).setText("Sample 2");
    ExpandableTextView expTv1 = (ExpandableTextView) rootView.findViewById(R.id.sample1)
        .findViewById(R.id.expand_text_view);
    ExpandableTextView expTv2 = (ExpandableTextView) rootView.findViewById(R.id.sample2)
        .findViewById(R.id.expand_text_view);
    expTv1.setOnExpandStateChangeListener(new ExpandableTextView.OnExpandStateChangeListener() {
      @Override
      public void onExpandStateChanged(TextView textView, boolean isExpanded) {
        Toast.makeText(getActivity(), isExpanded ? "Expanded" : "Collapsed", Toast.LENGTH_SHORT).show();
      }
    });
    expTv1.setText(getString(R.string.dummy_text1));
    expTv2.setText(getString(R.string.dummy_text2));
    return rootView;
  }
}
origin: Manabu-GT/ExpandableTextView

  animation = new ExpandCollapseAnimation(this, getHeight(), mCollapsedHeight);
} else {
  animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() +
      mTextHeightWithMaxLines - mTv.getHeight());
});
clearAnimation();
startAnimation(animation);
origin: Manabu-GT/ExpandableTextView

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (!mRelayout || getVisibility() == View.GONE) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    return;
  mTextHeightWithMaxLines = getRealTextViewHeight(mTv);
    mCollapsedHeight = getMeasuredHeight();
origin: Manabu-GT/ExpandableTextView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
  final ViewHolder viewHolder;
  if (convertView == null) {
    convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false);
    viewHolder = new ViewHolder();
    viewHolder.expandableTextView = (ExpandableTextView) convertView.findViewById(R.id.expand_text_view);
    convertView.setTag(viewHolder);
  } else {
    viewHolder = (ViewHolder) convertView.getTag();
  }
  viewHolder.expandableTextView.setText(sampleStrings[position], mCollapsedStatus, position);
  return convertView;
}
origin: Manabu-GT/ExpandableTextView

  @Override
  public void run() {
    mMarginBetweenTxtAndBottom = getHeight() - mTv.getHeight();
  }
});
origin: Manabu-GT/ExpandableTextView

@Override
public void onAnimationEnd(Animation animation) {
  // clear animation here to avoid repeated applyTransformation() calls
  clearAnimation();
  // clear the animation flag
  mAnimating = false;
  // notify the listener
  if (mListener != null) {
    mListener.onExpandStateChanged(mTv, !mCollapsed);
  }
}
@Override
origin: Manabu-GT/ExpandableTextView

private static ExpandIndicatorController setupExpandToggleController(@NonNull Context context, TypedArray typedArray) {
  final int expandToggleType = typedArray.getInt(R.styleable.ExpandableTextView_expandToggleType, DEFAULT_TOGGLE_TYPE);
  final ExpandIndicatorController expandIndicatorController;
  switch (expandToggleType) {
    case EXPAND_INDICATOR_IMAGE_BUTTON:
      Drawable expandDrawable = typedArray.getDrawable(R.styleable.ExpandableTextView_expandIndicator);
      Drawable collapseDrawable = typedArray.getDrawable(R.styleable.ExpandableTextView_collapseIndicator);
      if (expandDrawable == null) {
        expandDrawable = getDrawable(context, R.drawable.ic_expand_more_black_12dp);
      }
      if (collapseDrawable == null) {
        collapseDrawable = getDrawable(context, R.drawable.ic_expand_less_black_12dp);
      }
      expandIndicatorController = new ImageButtonExpandController(expandDrawable, collapseDrawable);
      break;
    case EXPAND_INDICATOR_TEXT_VIEW:
      String expandText = typedArray.getString(R.styleable.ExpandableTextView_expandIndicator);
      String collapseText = typedArray.getString(R.styleable.ExpandableTextView_collapseIndicator);
      expandIndicatorController = new TextViewExpandController(expandText, collapseText);
      break;
    default:
      throw new IllegalStateException("Must be of enum: ExpandableTextView_expandToggleType, one of EXPAND_INDICATOR_IMAGE_BUTTON or EXPAND_INDICATOR_TEXT_VIEW.");
  }
  return expandIndicatorController;
}
com.ms.square.android.expandabletextviewExpandableTextView

Most used methods

  • setText
  • clearAnimation
  • findViewById
  • findViews
  • getContext
  • getDrawable
  • getHeight
  • getLayoutParams
  • getMeasuredHeight
  • getRealTextViewHeight
  • getVisibility
  • init
  • getVisibility,
  • init,
  • isPostHoneycomb,
  • isPostLolipop,
  • requestLayout,
  • setOnExpandStateChangeListener,
  • setOrientation,
  • setVisibility,
  • setupExpandToggleController,
  • startAnimation

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now