Skip to content

Commit

Permalink
implemented sharing via android share provider
Browse files Browse the repository at this point in the history
  • Loading branch information
konradrenner committed Jul 17, 2015
1 parent 72109d1 commit d6f4c82
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
Expand All @@ -22,6 +23,9 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioButton;
Expand All @@ -48,6 +52,7 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -188,11 +193,16 @@ public void onClick(View v) {
String action = startIntent.getAction();

if (Intent.ACTION_SEND.equals(action)) {
String description = startIntent.getStringExtra(Intent.EXTRA_TEXT);
CharSequence description = startIntent.getCharSequenceExtra(Intent.EXTRA_TEXT);
CharSequence hdescription = startIntent.getCharSequenceExtra(Intent.EXTRA_HTML_TEXT);
String summary = startIntent.getStringExtra(Intent.EXTRA_SUBJECT);

if(!TextUtils.isEmpty(description)) {
String updatedDesc = initImageMap(description);
if(!TextUtils.isEmpty(hdescription)) {
String updatedDesc = initImageMap(hdescription.toString());
editor.setHtml(updatedDesc);
}else if(!TextUtils.isEmpty(description)) {

String updatedDesc = initImageMap(description.toString());
editor.setHtml(updatedDesc);
}

Expand Down Expand Up @@ -583,7 +593,8 @@ String setShareIntentDescription(Intent shareIntent){
descriptionValue = HTMLSTART + repairImages(getDescriptionFromView()) + HTMLEND;
}

shareIntent.putExtra(Intent.EXTRA_TEXT, descriptionValue);
shareIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(descriptionValue));
shareIntent.putExtra(Intent.EXTRA_HTML_TEXT, descriptionValue);
return descriptionValue;
}
return null;
Expand Down

0 comments on commit d6f4c82

Please sign in to comment.