Exemplo n.º 1
0
  @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);
    }
  }
Exemplo n.º 2
0
 public void expand() {
   behavior.expand(commentFrame);
 }
Exemplo n.º 3
0
 public void collapse() {
   hideKeyboard();
   behavior.collapse(commentFrame);
 }
Exemplo n.º 4
0
 public void hide() {
   hideKeyboard();
   behavior.hide(commentFrame);
 }
Exemplo n.º 5
0
 public boolean isExpanded() {
   return behavior.getState() == HideablePartBehavior.State.EXPANDED;
 }
Exemplo n.º 6
0
 public HideablePartBehavior.State getState() {
   return behavior.getState();
 }