diff options
author | zkwip | 2015-05-19 16:24:30 +0200 |
---|---|---|
committer | zkwip | 2015-05-19 16:24:30 +0200 |
commit | 6fca177dfc3339877945d1815fb52305da82f880 (patch) | |
tree | b02b7afc0731ea60b6f8f2dc4d1f1142f8c9758b /app/src/main/java/org | |
parent | basic Filter & Keyword classes (diff) |
wip summary
Diffstat (limited to 'app/src/main/java/org')
3 files changed, 78 insertions, 0 deletions
diff --git a/app/src/main/java/org/rssin/summaries/Summary.java b/app/src/main/java/org/rssin/summaries/Summary.java new file mode 100644 index 0000000..90ceb04 --- /dev/null +++ b/app/src/main/java/org/rssin/summaries/Summary.java @@ -0,0 +1,16 @@ +package org.rssin.summaries; + +public class Summary { + + private String content; + + public Summary(String s) + { + content = s; + } + + public String getText() + { + return content; + } +}
\ No newline at end of file diff --git a/app/src/main/java/org/rssin/summaries/SummaryAPI.java b/app/src/main/java/org/rssin/summaries/SummaryAPI.java new file mode 100644 index 0000000..aebf249 --- /dev/null +++ b/app/src/main/java/org/rssin/summaries/SummaryAPI.java @@ -0,0 +1,53 @@ +package org.rssin.summaries; + +import java.net.URL; + +public class SummaryAPI implements SummaryAPIInterface { + + private final String APIURL = "http://api.smmry.com/"; + private final String APIKEY = "D5DDCDBD6F"; + private final int LINES = 3; + + public SummaryAPI() + { + + } + + @Override; + public Summary getSummary(FeedItem f) + { + String desc = f.description; + + } + + private String sendRequest(String desc) + { + String q = APIURL + "?SM_API_KEY=" + APIKEY + "&SM_LENGTH=" + LINES; + + // Create a new HttpClient and Post Header + HttpClient httpclient = new DefaultHttpClient(); + HttpPost httppost = new HttpPost(q); + + try { + + List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); + nameValuePairs.add(new BasicNameValuePair("id", "12345")); + nameValuePairs.add(new BasicNameValuePair("stringdata", "Hi")); + httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); + + // Execute HTTP Post Request + HttpResponse response = httpclient.execute(httppost); + + HttpEntity con = response.getEntity(); + InputStream in = con.getInputStream(); + String encoding = con.getContentEncoding(); + encoding = encoding == null ? "UTF-8" : encoding; + String body = IOUtils.toString(in, encoding); + + } catch (ClientProtocolException e) { + // TODO Auto-generated catch block + } catch (IOException e) { + // TODO Auto-generated catch block + } + } +}
\ No newline at end of file diff --git a/app/src/main/java/org/rssin/summaries/SummaryAPIInterface.java b/app/src/main/java/org/rssin/summaries/SummaryAPIInterface.java new file mode 100644 index 0000000..1caf922 --- /dev/null +++ b/app/src/main/java/org/rssin/summaries/SummaryAPIInterface.java @@ -0,0 +1,9 @@ +package org.rssin.summaries; + +import rss.FeedItem; + +public interface SummaryAPIInterface { + + public Summary getSummary(FeedItem f); + +}
\ No newline at end of file |