package ch.pizzalemon.android.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import ch.pizzalemon.android.R;

/**
 * Created by cimenmus on 23.10.2017.
 */

public class AppDropdown extends LinearLayout{

    private View rootView;
    private TextView hintTextView;
    private TextView textview;
    private Typeface typeFace;
    private String hint;

    public AppDropdown(Context context) {
        super(context);
        init(context);
    }

    public AppDropdown(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AppDropdown, 0, 0);
        try {
            hint = a.getString(R.styleable.AppDropdown_dropdownHint);
        } finally {
            a.recycle();
        }
        init(context);
    }

    private void init(Context context) {
        rootView = (View) inflate(context, R.layout.layout_pizzalink_dropdown, this);
        hintTextView = (TextView) rootView.findViewById(R.id.hintTextView);
        textview = (TextView) rootView.findViewById(R.id.textview);
        rootView.setClickable(true);
        hintTextView.setText(hint);
    }

    public boolean isEmpty(){
        return hintTextView.getText().toString().isEmpty();
    }

    public String getText(){
        return hintTextView.getText().toString();
    }

    public void setText(String text){
        textview.setText(text);
    }

    private void onZoneDropdownClicked(View view){
        Log.i("vdknvkd", "vıjıwf");
    }

    private void onCountryDropdownClicked(View view){
        Log.i("vdknvkd", "vıjıwf");
    }
}