" + getString(R.string.attachments) + " ";
for (Attachment a : m_article.attachments) {
if (a.content_type != null && a.content_url != null && a.content_type.indexOf("image") != -1) {
try {
URL url = new URL(a.content_url.trim());
String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName();
content += "
";
attachments += "
" + atitle + ", ";
} catch (MalformedURLException e) {
//
} catch (Exception e) {
e.printStackTrace();
}
}
}
content += attachments.replaceAll(", $", "");
content += "
";
}
content += "";
try {
web.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
} catch (RuntimeException e) {
e.printStackTrace();
}
if (m_onlineServices.isSmallScreen())
web.setOnTouchListener(m_gestureListener);
}
TextView dv = (TextView)view.findViewById(R.id.date);
if (dv != null) {
Date d = new Date(m_article.updated * 1000L);
SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy, HH:mm");
dv.setText(df.format(d));
}
TextView tagv = (TextView)view.findViewById(R.id.tags);
if (tagv != null) {
if (m_article.tags != null) {
String tagsStr = "";
for (String tag : m_article.tags)
tagsStr += tag + ", ";
tagsStr = tagsStr.replaceAll(", $", "");
tagv.setText(tagsStr);
} else {
tagv.setVisibility(View.GONE);
}
}
}
return view;
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onSaveInstanceState (Bundle out) {
super.onSaveInstanceState(out);
out.putParcelable("article", m_article);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
m_onlineServices = (OnlineServices)activity;
//m_article = m_onlineServices.getSelectedArticle();
}
}