/*
 *  Copyright (c) 2015 RoboSwag (Gavriil Sitnikov, Vsevolod Ivanov)
 *
 *  This file is part of RoboSwag library.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package ru.touchin.roboswag.components.views;

import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.EditText;

/**
 * Created by Gavriil Sitnikov on 18/07/2014.
 * TextView that supports fonts from Typefaces class
 */
public class TypefacedEditText extends EditText implements TypefacedView {

    public TypefacedEditText(final Context context) {
        super(context);
        TypefacedViewHelper.initialize(this, context, null);
    }

    public TypefacedEditText(final Context context, final AttributeSet attrs) {
        super(context, attrs);
        TypefacedViewHelper.initialize(this, context, attrs);
    }

    public TypefacedEditText(final Context context, final AttributeSet attrs, final int defStyle) {
        super(context, attrs, defStyle);
        TypefacedViewHelper.initialize(this, context, attrs);
    }

    @Override
    public void setTypeface(@NonNull final String name) {
        TypefacedViewHelper.setTypeface(this, getContext(), name);
    }

    @Override
    public void setTypeface(@NonNull final String name, final int style) {
        TypefacedViewHelper.setTypeface(this, getContext(), name, style);
    }

}

@@ -803,16 +803,123 @@
 onNull;%0A
+import android.support.annotation.Nullable;%0Aimport android.text.Editable;%0Aimport android.text.TextWatcher;%0A
 import a
@@ -944,16 +944,16 @@
 uteSet;%0A
-
 import a
@@ -1160,16 +1160,88 @@
 View %7B%0A%0A
+    @Nullable%0A    private OnTextChangedListener onTextChangedListener;%0A%0A
     publ
@@ -1371,16 +1371,38 @@
  null);%0A
+        initialize();%0A
     %7D%0A%0A 
@@ -1565,32 +1565,54 @@
 ontext, attrs);%0A
+        initialize();%0A
     %7D%0A%0A    publi
@@ -1801,24 +1801,941 @@
 xt, attrs);%0A
+        initialize();%0A    %7D%0A%0A    private void initialize() %7B%0A        addTextChangedListener(new TextWatcher() %7B%0A%0A            @Override%0A            public void beforeTextChanged(final CharSequence oldText, final int start, final int count, final int after) %7B%0A                //do nothing%0A            %7D%0A%0A            @Override%0A            public void onTextChanged(final CharSequence inputText, final int start, final int before, final int count) %7B%0A                if (onTextChangedListener != null) %7B%0A                    onTextChangedListener.onTextChanged(inputText);%0A                %7D%0A            %7D%0A%0A            @Override%0A            public void afterTextChanged(final Editable editable) %7B%0A                //do nothing%0A            %7D%0A%0A        %7D);%0A    %7D%0A%0A    public void setOnTextChangedListener(@Nullable final OnTextChangedListener onTextChangedListener) %7B%0A        this.onTextChangedListener = onTextChangedListener;%0A
     %7D%0A%0A    @
@@ -2956,32 +2956,32 @@
 al int style) %7B%0A
-
         Typeface
@@ -3045,10 +3045,120 @@
 %0A    %7D%0A%0A
+    public interface OnTextChangedListener %7B%0A%0A        void onTextChanged(@NonNull CharSequence text);%0A%0A    %7D%0A%0A
 %7D%0A

edit text changedlistener added