@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); final CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) commentFrame.getLayoutParams(); commentFrame.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); behavior = (HideablePartBehavior) layoutParams.getBehavior(); behavior.setChangeCallback(this); root.setResizeCallback( new IgnorantCoordinatorLayout.ResizeCallback() { @Override public void onSizeChanged(int w, int h, int oldw, int oldh) { commentFrame.post( new Runnable() { @Override public void run() { behavior.sync(commentFrame); } }); } }); instrumentsLayout.removeAllViews(); LayoutInflater inflater = getLayoutInflater(savedInstanceState); for (final TextChanger changer : instruments) { View button = inflater.inflate(R.layout.include_instrument_button, instrumentsLayout, false); ((ImageView) button.findViewById(R.id.icon)).setImageResource(changer.getImageResource()); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { changer.onSelect(CommentEditFragment.this, text); selectedInstrument = instruments.indexOf(changer); } }); instrumentsLayout.addView(button); } }
public void expand() { behavior.expand(commentFrame); }
public void collapse() { hideKeyboard(); behavior.collapse(commentFrame); }
public void hide() { hideKeyboard(); behavior.hide(commentFrame); }
public boolean isExpanded() { return behavior.getState() == HideablePartBehavior.State.EXPANDED; }
public HideablePartBehavior.State getState() { return behavior.getState(); }