Created
June 29, 2014 05:29
-
-
Save veb/655f11a74f6ad8675f0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void doPost() { | |
// get hashtags and return into tokens | |
Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b"); | |
Matcher m = tagMatcher.matcher(statusText.getText().toString()); | |
List<String> tokens = new ArrayList<String>(); | |
while(m.find()) { | |
String token = m.group(); | |
tokens.add(token); | |
} | |
JournalEntry journalEntry = new JournalEntry(); | |
journalEntry.setMood(statusPager.getCurrentItem()); | |
journalEntry.setContent(statusText.getText().toString()); | |
journalEntry.setIntensity(statusSeekBar.getProgress()); | |
journalEntry.setArchived(false); | |
journalEntry.save(); | |
for (int i = 0; i < tokens.size(); i++) { | |
HashTagEntry hashtagEntry = new HashTagEntry(journalEntry, tokens.get(i)); | |
} | |
finish(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment