package com.tofly.ghrq_route.common.ui.activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import androidx.appcompat.app.AlertDialog;

import com.tofly.ghrq_route.R;
import com.tofly.ghrq_route.base.ui.BaseUi;
import com.tofly.ghrq_route.common.ui.view.CustomView;

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

/**
 * Created by zombiexq on 2016/6/15.
 */
public class UiDataUpdate extends BaseUi {


    @BindView(R.id.updatemap_parent)
    RelativeLayout updatemapParent;
    @BindView(R.id.updatecfg_parent)
    RelativeLayout updatecfgParent;

    private String tpkname;
    private String geoname;
    private String dataurl;
    int han_config = 1;
    int han_data = 2;

    private int pageindex = 1;
    private int pagesize = 10;
    private int pagecount = 0;
    CustomView ui = new CustomView(UiDataUpdate.this);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        setContentView(R.layout.ui_dataupdate);
        ButterKnife.bind(this);


        initView();
        initData();
        initListener();

    }

    private void initView() {

    }

    private void initData() {

    }

    private void initListener(){
        
    }


    private void showDownOfflineMapDialog(){
        String title = "下载离线地图";
        String content = "是否下载离线地图?";
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(title);
        builder.setMessage(content);
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                //thread_config();
            }
        });
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.show();
    }

    private void gotoDownloadMap(){
        Intent intent = new Intent();
        intent.setClass(this, DownloadMapActivity.class);
        startActivity(intent);
    }

    /*private void showDownConfigDialog(){
        String title = "下载系统数据";
        String content = "是否下载系统数据?";
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(title);
        builder.setMessage(content);
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                thread_downData();
            }
        });
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.show();
    }*/

    @OnClick({R.id.updatemap_parent, R.id.updatecfg_parent})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.updatemap_parent:
                /*showDownOfflineMapDialog();*/
                gotoDownloadMap();
                break;
            case R.id.updatecfg_parent:{
                //showDownConfigDialog();
                Intent intent = new Intent();
                intent.setClass(this, UiSystemConfig.class);
                startActivity(intent);
            }
            break;
        }
    }
}
