package io.geeteshk.hyper.widget;

import android.content.Context;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;

import io.geeteshk.hyper.R;

public class KeyboardDetectorLayout extends RelativeLayout {

    Context mContext;
    FloatingActionButton mButton;

    public KeyboardDetectorLayout(Context context) {
        this(context, null);
    }

    public KeyboardDetectorLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public KeyboardDetectorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        mContext = context;
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.activity_project, this);
    }

    public void setButton(FloatingActionButton button) {
        mButton = button;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int proposedheight = MeasureSpec.getSize(heightMeasureSpec);
        final int actualHeight = getHeight();

        if (((AppCompatActivity) mContext).getSupportActionBar() != null && mButton != null) {
            if (actualHeight > proposedheight) {
                ((AppCompatActivity) mContext).getSupportActionBar().hide();
                mButton.hide();
            } else if (actualHeight < proposedheight) {
                ((AppCompatActivity) mContext).getSupportActionBar().show();
                mButton.show();
            }
        }

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }
}

@@ -64,67 +64,8 @@
 xt;%0A
-import android.support.design.widget.FloatingActionButton;%0A
 impo
@@ -109,16 +109,16 @@
 tivity;%0A
+
 import a
@@ -334,42 +334,8 @@
 ext;
-%0A    FloatingActionButton mButton;
 %0A%0A  
@@ -879,98 +879,8 @@
  %7D%0A%0A
-    public void setButton(FloatingActionButton button) %7B%0A        mButton = button;%0A    %7D%0A%0A
     
@@ -1158,27 +1158,8 @@
 ) !=
- null && mButton !=
  nul
@@ -1293,40 +1293,8 @@
 ();%0A
-                mButton.hide();%0A
     
@@ -1337,32 +1337,32 @@
 oposedheight) %7B%0A
+
                 
@@ -1426,40 +1426,8 @@
 ();%0A
-                mButton.show();%0A
     

Remove extra code in KeyboardDetectorLayout