package com.ics.aop.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.ics.aop.R;

/**
 * “关于我们”界面
 * @author 詹子聪
 *
 */
public class UseGuideActivity extends Activity implements OnClickListener, OnCheckedChangeListener {

	private RelativeLayout btn_back;
	private RadioGroup rg_help;
	private WebView wv_help;
	
	@Override
	protected void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		setContentView(R.layout.activity_use_guide);

		btn_back = (RelativeLayout) findViewById(R.id.btn_back);
		btn_back.setOnClickListener(this);
		
		rg_help = (RadioGroup) findViewById(R.id.rg_help);
		rg_help.setOnCheckedChangeListener(this);
		
		initWebView();
	}
	
	/**
	 * 初始化webview
	 */
	private void initWebView() {
		wv_help = (WebView) findViewById(R.id.wv_help);
		
		// 设置WebView属性，能够执行Javascript脚本
        WebSettings settings = wv_help.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setBuiltInZoomControls(true);

        // 设置显示完整网页
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); 
        
        wv_help.loadUrl("file:///android_asset/help_cn.html");
	}



	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
			onBackPressed();
			break;

		default:
			break;
		}
	}

	@Override
	public void onCheckedChanged(RadioGroup group, int checkedId) {
		switch (checkedId) {
		case R.id.rb_help_offline:
			Toast.makeText(this, "查看离线", Toast.LENGTH_SHORT).show();
			break;
		case R.id.rb_help_online:
			
			break;

		default:
			break;
		}
	}
}
