// Path: app/src/main/java/com/konifar/annict/util/LocaleUtil.java
// public class LocaleUtil {
// 
//     public static boolean shouldRtl() {
//         return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
//             == ViewCompat.LAYOUT_DIRECTION_RTL;
//     }
// }


import com.konifar.annict.R;
import com.konifar.annict.databinding.ViewSearchToolbarBinding;
import com.konifar.annict.util.LocaleUtil;
import android.content.Context;
import android.content.res.TypedArray;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.widget.FrameLayout;
    public void setHint(int resId) {
        binding.editSearch.setHint(resId);
    }

    private void toggleCloseButtonVisible(boolean visible) {
        getCloseDrawable().setAlpha(visible ? 255 : 0);
    }

    private void initView() {
        binding.editSearch.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                // Do nothing
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                boolean visible = count > 0 || start > 0;
                toggleCloseButtonVisible(visible);
            }

            @Override
            public void afterTextChanged(Editable s) {
                //
            }
        });

        binding.editSearch.setOnTouchListener((v, event) -> {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                boolean shouldClear = false;
// Path: app/src/main/java/com/konifar/annict/util/LocaleUtil.java
// public class LocaleUtil {
// 
//     public static boolean shouldRtl() {
//         return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
//             == ViewCompat.LAYOUT_DIRECTION_RTL;
//     }
// }


// Path: app/src/main/java/com/konifar/annict/view/widget/SearchToolbar.java
import com.konifar.annict.R;
import com.konifar.annict.databinding.ViewSearchToolbarBinding;
import com.konifar.annict.util.LocaleUtil;
import android.content.Context;
import android.content.res.TypedArray;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.widget.FrameLayout;

    public void setHint(int resId) {
        binding.editSearch.setHint(resId);
    }

    private void toggleCloseButtonVisible(boolean visible) {
        getCloseDrawable().setAlpha(visible ? 255 : 0);
    }

    private void initView() {
        binding.editSearch.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                // Do nothing
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                boolean visible = count > 0 || start > 0;
                toggleCloseButtonVisible(visible);
            }

            @Override
            public void afterTextChanged(Editable s) {
                //
            }
        });

        binding.editSearch.setOnTouchListener((v, event) -> {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                boolean shouldClear = false;
                if (LocaleUtil.shouldRtl()) {