/*
  * The initial state when there is no active conversation.
  */
 private void intializeUI() {
   connectActionFab.setImageDrawable(
       ContextCompat.getDrawable(this, R.drawable.ic_call_white_24px));
   connectActionFab.show();
   connectActionFab.setOnClickListener(connectActionClickListener());
   switchCameraActionFab.show();
   switchCameraActionFab.setOnClickListener(switchCameraClickListener());
   localVideoActionFab.show();
   localVideoActionFab.setOnClickListener(localVideoClickListener());
   muteActionFab.show();
   muteActionFab.setOnClickListener(muteClickListener());
 }
  private void attachFragment(String fragment, boolean isNew) {
    Fragment fragmentToAttach = null;
    boolean fabVisible = false;
    switch (fragment) {
      case Constants.FRAGMENT_LIST:
        textToFind = "";
        fragmentToAttach = NoteListFragment.newInstance(folderId);

        if (folderId != trashNavId) // Folder list
        fabVisible = true;
        if (folderId != trashNavId && folderId != myNotesNavId) setOnTitleClickListener(true);
        else setOnTitleClickListener(false);
        break;
      case Constants.FRAGMENT_NOTE:
        Log.e(TAG, "NOTE FRAGMENT");
        setOnTitleClickListener(true);
        fragmentToAttach = NoteFragment.newInstance(isNew, noteId, folderId);
        break;
      case Constants.FRAGMENT_TRASH_NOTE:
        setOnTitleClickListener(false);
        fragmentToAttach = TrashNoteFragment.newInstance(noteId);
        break;
      case Constants.FRAGMENT_SEARCH:
        setOnTitleClickListener(false);
        fragmentToAttach = SearchFragment.newInstance(textToFind);
        getSupportActionBar().setTitle(R.string.search);
        break;
    }
    fragmentManager
        .beginTransaction()
        .replace(R.id.container, fragmentToAttach, fragment)
        .commitAllowingStateLoss();
    if (fabVisible) fab.show();
    else fab.hide();
  }
 private void showFab() {
   final CoordinatorLayout.LayoutParams layoutParams =
       (CoordinatorLayout.LayoutParams) fabPhoto.getLayoutParams();
   layoutParams.setAnchorId(R.id.layout_app_bar);
   layoutParams.anchorGravity = Gravity.RIGHT | Gravity.END | Gravity.BOTTOM;
   fabPhoto.requestLayout();
   fabPhoto.show();
 }
 @Override
 protected void onResume() {
   super.onResume();
   if (fabIsHidden) {
     floatingActionButton.show();
     fabIsHidden = false;
   }
 }
Exemple #5
0
 private void start() {
   running = true;
   mReset.show();
   final Runnable runnable =
       new Runnable() {
         public void run() {
           mElapsedTime += 1000;
           setTime();
           handler.postDelayed(this, 1000);
         }
       };
   handler.postDelayed(runnable, 1000);
   mFab.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_pause));
 }
  private boolean updateFab(FloatingActionButton child, View dependency) {
    float toolbarPosition = dependency.getY();

    // toolbar is gone
    if (toolbarPosition + mActionBarSize == 0) {
      child.hide();
    }

    // toolbar is visible
    else {
      child.show();
    }

    return toolbarPosition != 0;
  }
 @Override
 public void onNestedScroll(
     CoordinatorLayout coordinatorLayout,
     FloatingActionButton child,
     View target,
     int dxConsumed,
     int dyConsumed,
     int dxUnconsumed,
     int dyUnconsumed) {
   super.onNestedScroll(
       coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
   if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
     child.hide();
   } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
     child.show();
   }
 }
 @Override
 public void onNestedScroll(
     final CoordinatorLayout coordinatorLayout,
     final FloatingActionButton child,
     final View target,
     final int dxConsumed,
     final int dyConsumed,
     final int dxUnconsumed,
     final int dyUnconsumed) {
   super.onNestedScroll(
       coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
   if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
     // User scrolled down and the FAB is currently visible -> hide the FAB
     child.hide();
   } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
     // User scrolled up and the FAB is currently not visible -> show the FAB
     child.show();
   }
 }
 /*
  * The actions performed during disconnect.
  */
 private void setDisconnectAction() {
   connectActionFab.setImageDrawable(
       ContextCompat.getDrawable(this, R.drawable.ic_call_end_white_24px));
   connectActionFab.show();
   connectActionFab.setOnClickListener(disconnectClickListener());
 }