/* (non-Javadoc) * @see javax.microedition.lcdui.ItemCommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Item) */ public void commandAction(Command command, Item item) { // System.out.println("DefaultRssItemCommandListner: command ="+ command.getLabel() ); if (command == RssTagHandler.CMD_RSS_ITEM_SELECT) { RssItem rssItem = (RssItem) UiAccess.getAttribute(item, RssItem.ATTRIBUTE_KEY); String rssUrl = rssItem.getLink(); if (rssUrl != null && this.rssBrowser != null) { this.rssBrowser.getRssTagHandler().onViewUrl(rssUrl, item); } if (rssItem != null && StyleSheet.display != null) { // #style rssDescriptionAlert Alert alert = new Alert( rssItem.getTitle(), rssItem.getDescription(), null, AlertType.INFO, de.enough.polish.ui.StyleSheet.rssdescriptionalertStyle); alert.setTimeout(Alert.FOREVER); alert.addCommand(RssTagHandler.CMD_GO_TO_ARTICLE); alert.addCommand(HtmlTagHandler.CMD_BACK); alert.setCommandListener(this); StyleSheet.display.setCurrent(alert); this.url = rssItem.getLink(); } } else { this.rssBrowser.handleCommand(command); } }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { RssItem item = rssList.get(position); Intent intent = new Intent(RssReaderActivity.this, RssDetailActivity.class); intent.putExtra("rss_title", item.getTitle()); intent.putExtra("rss_link", item.getLink()); RssReaderActivity.this.startActivity(intent); }
/** rss item 문자열 생성 */ private static String rssItemStr(RssItem item) { StringBuilder buffer = new StringBuilder(); buffer.append(" "); // 들여쓰기용 buffer.append("<item>"); if (item.getTitle() != null && !"".equals(item.getTitle())) buffer.append("<title>" + "<![CDATA[" + item.getTitle() + "]]>" + "</title>"); if (item.getLink() != null && !"".equals(item.getLink())) buffer.append("<link>" + item.getLink() + "</link>"); if (item.getDescription() != null && !"".equals(item.getDescription())) buffer.append( "<description>" + "<![CDATA[" + item.getDescription().replaceAll(BR, "") + "]]>" + "</description>"); if (item.getAuthor() != null && !"".equals(item.getAuthor())) buffer.append("<author>" + item.getAuthor() + "</author>"); if (item.getCategory() != null && !"".equals(item.getCategory())) buffer.append("<category>" + "<![CDATA[" + item.getCategory() + "]]>" + "</category>"); if (item.getLink() != null && !"".equals(item.getLink())) buffer.append("<guid>" + item.getLink() + "</guid>"); if (item.getPubDate() != null) buffer.append("<pubDate>" + toRfc822DateFormat(item.getPubDate()) + "</pubDate>"); buffer.append("</item>"); return buffer.toString(); }