package com.bdyjy.fragment;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import com.bdyjy.R;
import com.bdyjy.activity.MainActivity;
import com.bdyjy.constants.HandlerOrder;
import com.bdyjy.entity.lecture.Lecture;
import com.bdyjy.fragment.base.CollectionTypeConst;
import com.bdyjy.fragment.base.FragmentWithCollection;
import com.loopj.android.image.SmartImageView;
public class LectureContentFragment extends FragmentWithCollection
{
private TextView tv_lecture_back;
private MainActivity ctx;
public LectureContentFragment(final MainActivity ctx)
{
super(ctx, CollectionTypeConst.LECTURE);
this.ctx = ctx;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.lecture_content, null);
view.findViewById(R.id.ll_back).setOnClickListener(
new OnClickListener()
{
@Override
public void onClick(View v)
{
if ("myCollectionList".equals(MainActivity.orderFrom))
{
ctx.jumpToMyCollectionListFragment();
MainActivity.orderFrom = "";
} else if ("firstPage".equals(MainActivity.orderFrom))
{
ctx.jumpToFirstPageFregment();
MainActivity.orderFrom = "";
} else
ctx.jumpToLectureListFragment();
}
});
SmartImageView poster = (SmartImageView) view
.findViewById(R.id.lecture_content_image);
TextView title = (TextView) view
.findViewById(R.id.lecture_content_title);
TextView speaker = (TextView) view
.findViewById(R.id.lecture_content_name);
TextView lecTime = (TextView) view
.findViewById(R.id.lecture_content_time);
TextView lecPlace = (TextView) view
.findViewById(R.id.lecture_content_location);
WebView content = (WebView) view
.findViewById(R.id.lecture_content_webview);
content.getSettings().setDefaultTextEncodingName("UTF-8");
final Lecture n = MainActivity.lecture;
String http = "";
String http2 = "";
String http1 = "";
try
{
http1 = n.getPoster().toString().trim();
http2 = n.getAttachmentPrefix();
} catch (Exception e)
{
e.printStackTrace();
}
// ͼƬ��ַ
http = http2 + http1;
if (http != null)
{
String path = http;
SmartImageView image2 = (SmartImageView) view
.findViewById(R.id.image2);
poster.setImageUrl(path);
}
title.setText(n.getTitle());
speaker.setText(n.getSpeaker());
lecTime.setText(n.getLecTime());
lecPlace.setText(n.getLecPlace());
content.loadDataWithBaseURL(null, n.getContent(), "text/html", "UTF-8",
null);
// ���µ���β���ղ���صĴ���
super.setMainView(view);
dealCollect(n.getId(), n.getIsCollect(), n.getTitle());
return view;
}
}