package com.sdk.example;

import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import android.util.Log;
import android.widget.TextView;

import com.sdk.util.Parser;
import com.wole56.sdk.APP;

/**
 * 获取应用下的所有视频，支持分页
 * 
 */
public class GetAppVideo extends Activity {

	private String TAG = "GetAppVideo";
	private TextView resultTxtV;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.app_video);
		// init ui
		resultTxtV = (TextView) findViewById(R.id.appvideo_result_txt);
		String num = "3";// 返回数据 每页的数量
		String page = "1";// 返回数据，第几页
		// 获取应用下的所有视频
		JSONObject result = APP.getVideo(getApplicationContext(), num, page);
		Log.i(TAG, "应用下所有视频:" + result.toString());

		// 数据简单解析与呈现
		String parseStr = Parser.simpleParser(result);

		// 富文本形式展现
		Spanned span = Html.fromHtml(parseStr);
		SpannableString spanStr = new SpannableString(span);
		// show result
		resultTxtV.setText(spanStr);
	}
}
