package com.itant.shiwushu.ui.menu.message;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.itant.shiwushu.R;
import com.itant.shiwushu.base.BaseSkinActivity;
import com.itant.shiwushu.constant.ServerHost;

/**
 * Created by Jason on 2018/10/7.
 */

public class MessageActivity extends BaseSkinActivity implements View.OnClickListener {
    private WebView wv_message;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message);
        findViewById(R.id.aciv_back).setOnClickListener(this);

        wv_message = findViewById(R.id.wv_message);
        WebSettings settings = wv_message.getSettings();
        // 显示完整网页
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setJavaScriptEnabled(true);
        //settings.setDisplayZoomControls(false);
        //settings.setBuiltInZoomControls(true);
        settings.setBuiltInZoomControls(false); // 显示放大缩小 controler
        settings.setSupportZoom(false); // 可以缩放
        settings.setDefaultZoom(WebSettings.ZoomDensity.CLOSE);// 默认缩放模式
        wv_message.setWebChromeClient(new WebChromeClient());
        wv_message.setWebViewClient(new WebViewClient());
        settings.setDomStorageEnabled(true);
        // 解决三星note4显示不全
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);

        wv_message.loadUrl(ServerHost.URL_SYSTEM_MESSAGE);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        wv_message.destroy();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.aciv_back:
                finish();
                break;
        }
    }
}
