tvbarthel / intentshare Goto Github PK
View Code? Open in Web Editor NEWThis project is a light open-source library that improves the sharing experience on Android.
Home Page: http://tvbarthel.fr/IntentShare/
This project is a light open-source library that improves the sharing experience on Android.
Home Page: http://tvbarthel.fr/IntentShare/
Hey there,
first thanks for creating this libary! Sharing is by far not that easy on Android as it should, so IntentShare comes in very handy.
Now to my issue: Selecting an app to share to from the TargetChooserActivity
works as expected. But going back to my app using Android's back button or application switcher causes a crash of my app with the following stacktrace:
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:2).state:2 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5427) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5363) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5359) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2141) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1525) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1488) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:585) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3457) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3252) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3767) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.widget.ScrollView.onLayout(ScrollView.java:1528) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16646) at android.view.ViewGroup.layout(ViewGroup.java:5440) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2183) at android.view.ViewRootImpl.performTraver
For me it seems that the RecyclerView
in TargetChooserActivity
is causing the issue as I don't have one in my layout of my activity.
Looking forward to a fix - keep up the good work!
I tried to implement in my project, but when share, some applications are not showing (empty icon), and if I try to share on this "empty icon" applications, I get a toast error from the application or it just do nothing...
The sample application on google play has the same problem...
Eg: I cannot share to Whatsapp -> https://imgur.com/HhLJIGr
Hello, I am a Chinese developer, I found that can only share text, pictures can not be shared when I share to Sina weibo(com.sina.weibo)/Tencent QQ(com.tencent.mobileqq)/WeChat(com.tencent.mm) with IntentShare,please help me!
Hello,
I have noticed a weird bug when scrolling fast: the background becomes transparent.
Example: https://imgur.com/a/tKpeVXU
The problem is - at least - reproducible on an Android 8.1 device.
Hello,
Actually there is a limit exception in IntentShare
class.
According to Twitter : https://blog.twitter.com/2016/doing-more-with-140-characters (section "Tweet object changes")
"...Developers must avoid hard-coding length assumptions into their applications."
I think it's better that we remove the following Exception in IntentShare
:
if (tweet.length() > 140) {
throw new IllegalArgumentException("Invalid tweet content : "
+ "exceed the 140-Character limit : " + tweet);
}
We could not know if Twitter API will be changed in other ways so let Twitter application manages the sharing text.
What do you think?
Thanks.
The target app com.android.mms crashes when an image is send as stream in the shared extras due to orientation check.
As the Uri has a content provider scheme, the com.android.mms skips the Exif check (which seems to be slow) and tries to query the MediaStore.Images.ImageColumns.ORIENTATION :
http://androidxref.com/5.1.1_r6/xref/packages/apps/Mms/src/com/android/mms/ui/UriImage.java#546
Unfortunately, the default implementation of FileProvider from support-v4 won't return any data for such a query since only OpenableColumns.DISPLAY_NAME and OpenableColumns.SIZE are taken into account :
http://androidxref.com/5.1.1_r6/xref/frameworks/support/v4/java/android/support/v4/content/FileProvider.java#421
As a result, http://androidxref.com/5.1.1_r6/xref/packages/apps/Mms/src/com/android/mms/ui/UriImage.java#546 will throw an exception.
FileProvider myst be extend in order to handle MediaStore.Images.ImageColumns.ORIENTATION query on our side.
You should not set attribute application@allowbackup value=(false).
Please add support android 14+
Picasso.with(getActivity()).load(cardata.getImage()).into(new Target() {
@Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
// Intent i = new Intent(Intent.ACTION_SEND);
// i.setType("image/*");
// i.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap));
// startActivity(Intent.createChooser(i, "Share Image"));
IntentShare.with(getActivity())
.chooserTitle("Share ")
.text("test")
.image(getLocalBitmapUri(bitmap))
.mailSubject("Test")
.mailBody("Test")
.deliver();
}
@Override public void onBitmapFailed(Drawable errorDrawable) { }
@Override public void onPrepareLoad(Drawable placeHolderDrawable) { }
});
public Uri getLocalBitmapUri(Bitmap bmp) {
Uri bmpUri = null;
try {
File file = new File(getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png");
FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
bmpUri = Uri.fromFile(file);
} catch (IOException e) {
e.printStackTrace();
}
return bmpUri;
}
Use a custom prefix (like "icl_") for all the resources of the Intent Share Library to avoid conflict with resources of client projects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.