projects/syncslides/app/src/main/java/io/v/android/apps/syncslides/NavigateFragment.java
/**
     * Handoff control of the presentation to a questioner. A snackbar displays the status while
     * the audience member is in control, and control ends when the presenter presses the action
     * text.
     */
Handoff control of the presentation to a questioner. A snackbar displays the status while
the audience member is in control, and control ends when the presenter presses the action
text.
Handoff control of the presentation to a questioner . A snackbar displays the status while the audience member is in control and control ends when the presenter presses the action text .
private void handoffControl() {
        Question handoff = null;
        for (Question question : mQuestionList) {
            if (question.getId().equals(mQuestionId)) {
                handoff = question;
                break;
            }
        }
        if (handoff == null) {
            toast("No such question");
            return;
        }
        sync();
        mDB.handoffQuestion(mDeckId, mPresentationId, handoff.getId());
        View.OnClickListener snackbarClickListener = new NavigateClickListener() {
            @Override
            public void onClick(View v) {
                super.onClick(v);
                mDB.resumeControl(mDeckId, mPresentationId);
            }
        };
        ((PresentationActivity) getActivity()).setUiImmersive(true);
        Snackbar snack = Snackbar.make(
                getView(),
                getResources().getString(R.string.handoff_message) + " " + handoff.getName(),
                Snackbar.LENGTH_INDEFINITE)
                .setAction(getResources().getString(R.string.end_handoff),
                        snackbarClickListener)
                .setActionTextColor(ContextCompat.getColor(getContext(), R.color.action_orange));
        View view = snack.getView();
        FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams();
        params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
        view.setLayoutParams(params);
        snack.show();
    }
private void handoffControl ( ) { Question handoff = null ; for ( Question question : mQuestionList ) { if ( question . getId ( ) . equals ( mQuestionId ) ) { handoff = question ; break ; } } if ( handoff == null ) { toast ( "No such question" ) ; return ; } sync ( ) ; mDB . handoffQuestion ( mDeckId , mPresentationId , handoff . getId ( ) ) ; View . OnClickListener snackbarClickListener = new NavigateClickListener ( ) { @ Override public void onClick ( View v ) { super . onClick ( v ) ; mDB . resumeControl ( mDeckId , mPresentationId ) ; } } ; ( ( PresentationActivity ) getActivity ( ) ) . setUiImmersive ( true ) ; Snackbar snack = Snackbar . make ( getView ( ) , getResources ( ) . getString ( R . string . handoff_message ) + " " + handoff . getName ( ) , Snackbar . LENGTH_INDEFINITE ) . setAction ( getResources ( ) . getString ( R . string . end_handoff ) , snackbarClickListener ) . setActionTextColor ( ContextCompat . getColor ( getContext ( ) , R . color . action_orange ) ) ; View view = snack . getView ( ) ; FrameLayout . LayoutParams params = ( FrameLayout . LayoutParams ) view . getLayoutParams ( ) ; params . gravity = Gravity . RIGHT | Gravity . BOTTOM ; view . setLayoutParams ( params ) ; snack . show ( ) ; }
Handoff control of the presentation to a questioner.
Handoff control of the presentation to a questioner .
// Needed to set the location of the snackbar (default is bottom center, which hides buttons // in landscape mode).