(share) add share functionality

- get the text shared and put it on the Clipboard
- pass by the same way that past for Download the information
This commit is contained in:
torrentcome 2017-05-16 17:56:35 +02:00
parent b1bbcb39d5
commit 418fbd3b5c
2 changed files with 9 additions and 0 deletions

View file

@ -390,6 +390,9 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
int left = Math.min(start, end); int left = Math.min(start, end);
int right = Math.max(start, end); int right = Math.max(start, end);
textEditor.getText().replace(left, right, text, 0, text.length()); textEditor.getText().replace(left, right, text, 0, text.length());
parser.putInClipboardManager(this, text);
textEditor.onPaste();
} }
} }
} }

View file

@ -43,6 +43,12 @@ public class ParserUtils {
return null; return null;
} }
public void putInClipboardManager(Context context, String string) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", string);
clipboard.setPrimaryClip(clip);
}
// parse the HTML page // parse the HTML page
private HeaderInfo parsePageHeaderInfo(String urlStr) throws Exception { private HeaderInfo parsePageHeaderInfo(String urlStr) throws Exception {
Connection con = Jsoup.connect(urlStr); Connection con = Jsoup.connect(urlStr);