package com.onefishtwo.bbqtimer;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;

import com.google.android.material.textfield.TextInputEditText;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Workaround: A subclass of Material Design TextInputEditText with a working OnFocusChangeListener,
 * "listener2".
 *
 * See {@link #setOnFocusChangeListener2}.
 */
public class EditText2 extends TextInputEditText {
    private OnFocusChangeListener focusChangeListener2 = null;

    public EditText2(@NonNull Context context) {
        super(context);
    }

    public EditText2(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public EditText2(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    /**
     * Sets a working OnFocusChangeListener without disturbing the inherited mechanism (that doesn't
     * call its OnFocusChangeListener).
     */
    public void setOnFocusChangeListener2(OnFocusChangeListener listener2) {
        focusChangeListener2 = listener2;
    }

    @Override
    protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);

        if (focusChangeListener2 != null) {
            focusChangeListener2.onFocusChange(this, focused);
        }
    }
}

@@ -1,8 +1,1140 @@
+// The MIT License (MIT)%0A//%0A// Copyright (c) 2022 Jerry Morrison%0A//%0A// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and%0A// associated documentation files (the %22Software%22), to deal in the Software without restriction,%0A// including without limitation the rights to use, copy, modify, merge, publish, distribute,%0A// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is%0A// furnished to do so, subject to the following conditions:%0A//%0A// The above copyright notice and this permission notice shall be included in all copies or%0A// substantial portions of the Software.%0A//%0A// THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT%0A// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND%0A// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,%0A// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A%0A
 package 

add a copyright to EditText2.java