// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/PixelButton.java
// public class PixelButton extends Button {
// 
//     private static final String FONT_PATH = "fonts/pixel.ttf";
// 
//     public PixelButton(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         initFonts();
//     }
// 
//     public PixelButton(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//         initFonts();
//     }
// 
//     private void initFonts() {
//         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), FONT_PATH);
//         setTypeface(typeface);
//     }
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/editor/EditorMenuView.java
// public class EditorMenuView extends RelativeLayout {
//     private ClearView clearView;
//     private PixelButton clearButton;
// 
//     public EditorMenuView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public EditorMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//     }
// 
//     @Override
//     protected void onFinishInflate() {
//         super.onFinishInflate();
//         clearView = Views.findById(this, R.id.clear_view);
//         clearButton = Views.findById(this, R.id.edit_fab_clear);
//     }
// 
//     public void animateClear(final ClearAnimationListener clearAnimationListener) {
//         clearView.animateClearFrom(ViewMeasurer.getViewCenterOnScreen(clearButton), clearAnimationListener);
//     }
// 
//     public interface ClearAnimationListener {
//         void onClearDone();
//     }
// 
//     public interface OnActionSelectedListener {
//         void onActionPerformed(EditorAction action);
//     }
// }


import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.juankysoriano.materiallife.R;
import com.juankysoriano.materiallife.ui.sketch.PixelButton;
import com.juankysoriano.materiallife.ui.sketch.editor.EditorMenuView;
import com.novoda.notils.caster.Views;
    private PixelButton clearButton;
    private PixelButton cancelButton;
    private PixelButton doneButton;
    private EditorMenuView.OnActionSelectedListener onActionSelectedListener;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View fragmentView = inflater.inflate(R.layout.include_edit_view, container, false);
        editorMenuView = Views.findById(fragmentView, R.id.edit_layout);
        clearButton = Views.findById(fragmentView, R.id.edit_fab_clear);
        cancelButton = Views.findById(fragmentView, R.id.edit_fab_cancel);
        doneButton = Views.findById(fragmentView, R.id.edit_fab_accept);
        worldEditor = WorldEditor.newInstance();
        return fragmentView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        attachListeners();
        worldEditor.startEdition();
    }

    private void attachListeners() {
        clearButton.setOnClickListener(onClearClickListener);
        cancelButton.setOnClickListener(onCancelClickListener);
        doneButton.setOnClickListener(onDoneClickListener);
    }

// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/PixelButton.java
// public class PixelButton extends Button {
// 
//     private static final String FONT_PATH = "fonts/pixel.ttf";
// 
//     public PixelButton(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         initFonts();
//     }
// 
//     public PixelButton(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//         initFonts();
//     }
// 
//     private void initFonts() {
//         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), FONT_PATH);
//         setTypeface(typeface);
//     }
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/editor/EditorMenuView.java
// public class EditorMenuView extends RelativeLayout {
//     private ClearView clearView;
//     private PixelButton clearButton;
// 
//     public EditorMenuView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public EditorMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//     }
// 
//     @Override
//     protected void onFinishInflate() {
//         super.onFinishInflate();
//         clearView = Views.findById(this, R.id.clear_view);
//         clearButton = Views.findById(this, R.id.edit_fab_clear);
//     }
// 
//     public void animateClear(final ClearAnimationListener clearAnimationListener) {
//         clearView.animateClearFrom(ViewMeasurer.getViewCenterOnScreen(clearButton), clearAnimationListener);
//     }
// 
//     public interface ClearAnimationListener {
//         void onClearDone();
//     }
// 
//     public interface OnActionSelectedListener {
//         void onActionPerformed(EditorAction action);
//     }
// }


// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/editor/WorldEditorMenuFragment.java
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.juankysoriano.materiallife.R;
import com.juankysoriano.materiallife.ui.sketch.PixelButton;
import com.juankysoriano.materiallife.ui.sketch.editor.EditorMenuView;
import com.novoda.notils.caster.Views;

    private PixelButton clearButton;
    private PixelButton cancelButton;
    private PixelButton doneButton;
    private EditorMenuView.OnActionSelectedListener onActionSelectedListener;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View fragmentView = inflater.inflate(R.layout.include_edit_view, container, false);
        editorMenuView = Views.findById(fragmentView, R.id.edit_layout);
        clearButton = Views.findById(fragmentView, R.id.edit_fab_clear);
        cancelButton = Views.findById(fragmentView, R.id.edit_fab_cancel);
        doneButton = Views.findById(fragmentView, R.id.edit_fab_accept);
        worldEditor = WorldEditor.newInstance();
        return fragmentView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        attachListeners();
        worldEditor.startEdition();
    }

    private void attachListeners() {
        clearButton.setOnClickListener(onClearClickListener);
        cancelButton.setOnClickListener(onCancelClickListener);
        doneButton.setOnClickListener(onDoneClickListener);
    }

    private final PixelButton.OnClickListener onClearClickListener = new View.OnClickListener() {