package com.lovejjfg.blogdemo.activity;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

import com.lovejjfg.blogdemo.R;

public class ScrollingActivity extends AppCompatActivity implements View.OnClickListener {

    private Toast toast;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scrolling);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        findViewById(R.id.tv1).setOnClickListener(this);
        findViewById(R.id.tv2).setOnClickListener(this);
        findViewById(R.id.tv3).setOnClickListener(this);
        setSupportActionBar(toolbar);
        toast = Toast.makeText(this, "", Toast.LENGTH_SHORT);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override
    public void onClick(View v) {
        toast.setText(v.getId() + "");
        toast.show();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_scrolling, menu);
        return super.onCreateOptionsMenu(menu);
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        toast.setText(item.getItemId() + "");
        toast.show();
        return true;
    }

}

@@ -60,16 +60,67 @@
 Bundle;%0A
+import android.support.design.widget.AppBarLayout;%0A
 import a
@@ -213,24 +213,75 @@
 t.Snackbar;%0A
+import android.support.v4.widget.NestedScrollView;%0A
 import andro
@@ -355,24 +355,49 @@
 et.Toolbar;%0A
+import android.util.Log;%0A
 import andro
@@ -563,16 +563,124 @@
 emo.R;%0A%0A
+import butterknife.Bind;%0Aimport butterknife.ButterKnife;%0Aimport butterknife.internal.ButterKnifeProcessor;%0A%0A
 public c
@@ -788,16 +788,75 @@
  toast;%0A
+    @Bind(R.id.scrollView)%0A    NestedScrollView scrollView;
 %0A    @Ov
@@ -1015,16 +1015,499 @@
 olling);
+%0A        ButterKnife.bind(this);%0A        AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.app_bar);%0A        if (appBarLayout != null) %7B%0A            appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() %7B%0A                @Override%0A                public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) %7B%0A                    Log.e(%22onOffsetChanged:%22, verticalOffset + %22%22);%0A                %7D%0A            %7D);%0A        %7D%0A%0A      
 %0A%0A      

add AppBarLayout #OnOffsetChangedListener