package com.usai.redant.raimage;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

import com.usai.redant.redantmobile.R;

import org.apache.http.util.EncodingUtils;

import java.io.InputStream;

public class LicenseActivity extends Activity
{

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_license);
		WebView wv = (WebView) findViewById(R.id.webView1);
		String content = "";
		try
		{
			InputStream in = getResources().openRawResource(R.raw.license);
			// 获取文件的字节数
			int lenght = in.available();
			// 创建byte数组
			byte[] buffer = new byte[lenght];
			// 将文件中的数据读到byte数组中
			in.read(buffer);
			content = EncodingUtils.getString(buffer, "UTF-8");
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		wv.getSettings().setDefaultTextEncodingName("UTF-8");
		wv.loadData(content, "text/html", null);		
	}

//	@Override
//	public boolean onCreateOptionsMenu(Menu menu)
//	{
//		// Inflate the menu; this adds items to the action bar if it is present.
//		getMenuInflater().inflate(R.menu.license, menu);
//		return true;
//	}
//
//	@Override
//	public boolean onOptionsItemSelected(MenuItem item)
//	{
//		// Handle action bar item clicks here. The action bar will
//		// automatically handle clicks on the Home/Up button, so long
//		// as you specify a parent activity in AndroidManifest.xml.
//		int id = item.getItemId();
//		if (id == R.id.action_settings)
//		{
//			return true;
//		}
//		return super.onOptionsItemSelected(item);
//	}
}
