package com.danding.yang800;

import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.danding.yang800.Adapter.NewsAdapter;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.Util.StatusColorUtil;
import com.danding.yang800.View.XListView;
import com.yanzhenjie.sofia.Sofia;

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

public class NewsActivity extends BaseActivity implements View.OnClickListener, XListView.IXListViewListener {
    NewsAdapter adapter;
    @BindView(R.id.news_list)
    XListView news_list;
    RelativeLayout news_aideLayout;
    @BindView(R.id.news_backTv)
    TextView news_backTv;

    @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_news);
        Sofia.with(this).statusBarDarkFont().statusBarBackground(ContextCompat.getColor(this, R.color.white));
        ButterKnife.bind(this);
        findView();
    }

    private void findView() {
        news_list.setPullRefreshEnable(true);
        news_list.setPullLoadEnable(false);
        news_list.setAutoLoadEnable(true);
        news_list.setXListViewListener(this);
        news_aideLayout = (RelativeLayout) findViewById(R.id.news_aideLayout);
        news_aideLayout.setOnClickListener(this);
        adapter = new NewsAdapter(this);
//        for (int i = 0; i < 10; i++) {
//            adapter.addData(new SortListInfo("", "", "", true, "", "", "", "", false, "", "", "","",""));
//        }
//        news_list.setAdapter(adapter);
    }

    @OnClick({R.id.news_backTv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.news_backTv:
                finish();
                break;
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.news_aideLayout:
                startActivity(LogisticsAideActivity.class);
                break;
            default:

                break;
        }
    }

    @Override
    public void onRefresh() {

    }

    @Override
    public void onLoadMore() {

    }
}
