package com.danding.yang800;

import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.danding.yang800.Adapter.AbstractWheelTextAdapter;
import com.danding.yang800.Adapter.ArrayWheelAdapter;
import com.danding.yang800.General.Yang800App;
import com.danding.yang800.Presenter.WriteLogisticsActivityPresenter;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.Util.ToastUtil;
import com.danding.yang800.View.WheelView;
import com.danding.yang800.listener.OnWheelChangedListener;
import com.yanzhenjie.sofia.Sofia;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class WriteLogisticsActivity extends BaseActivity {
    @BindView(R.id.writeLogistics_backTv)
    TextView writeLogistics_backTv;
    @BindView(R.id.writeLogistics_NameTv)
    TextView writeLogistics_NameTv;
    @BindView(R.id.writeLogistics_PhoneTv)
    TextView writeLogistics_PhoneTv;
    @BindView(R.id.writeLogistics_AddressTv)
    TextView writeLogistics_AddressTv;
    @BindView(R.id.putlogistics_postTv)
    TextView putlogistics_postTv;
    @BindView(R.id.writeLogistics_companyEdit)
    EditText writeLogistics_companyEdit;
    @BindView(R.id.writeLogistics_numberEdit)
    EditText writeLogistics_numberEdit;
    String cancelId;
    WriteLogisticsActivityPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        int type = StatusColorUtil.StatusBarLightMode(this);
//        if (type > 0) {
//            StatusColorUtil.setStatusBarColor(this, R.color.white);
//            StatusColorUtil.StatusBarLightMode(this, type);
//        }
        setContentView(R.layout.activity_write_logistics);
        Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
        ButterKnife.bind(this);
        Intent intent = getIntent();
        String addressName = intent.getStringExtra("addressName");
        String addressPhone = intent.getStringExtra("addressPhone");
        String addressDesc = intent.getStringExtra("addressDesc");
        cancelId = intent.getStringExtra("cancelId");
        writeLogistics_NameTv.setText(addressName);
        writeLogistics_PhoneTv.setText(addressPhone);
        writeLogistics_AddressTv.setText(addressDesc);
        presenter = new WriteLogisticsActivityPresenter(this);
    }

    @OnClick({R.id.writeLogistics_backTv, R.id.putlogistics_postTv
    })
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.writeLogistics_backTv:
                finish();
                break;
            case R.id.putlogistics_postTv:
                presenter.submit(cancelId, writeLogistics_companyEdit.getText().toString().trim(), writeLogistics_numberEdit.getText().toString().trim());
                break;
        }
    }


}
