/*
 * tv.java
 * classes : cn.com.wasu.main.jsobject.tv
 * @author Administrator
 * V 1.0.0
 * Create at 2014年10月16日 下午5:19:35
 */
package com.wasu.cs.jsobject;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.webkit.JavascriptInterface;

/**
 * cn.com.wasu.main.jsobject.tv
 * 
 * @author zhangrm@wasu.com <br/>
 *         create at 2014年10月16日 下午5:19:35
 */
public class tv {
	private static final String TAG = "tv";

	private Context mContext;
	private long preTimeMills;

	public tv(Context context) {
		this.mContext = context;
	}

	@JavascriptInterface
	public void openDetail(String playUri) {
		try {
			long currTimeMills = System.currentTimeMillis();
			if (preTimeMills == 0 || currTimeMills - preTimeMills > 1000) {
				preTimeMills = currTimeMills;
				Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.setData(Uri.parse(playUri));
				intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
				mContext.startActivity(intent);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
