When sharing data in an Android application I have seen multiple applications use a bottom sheet (Google I/O 2015 for ex.) to indicate apps to perform an action rather than the standard dialog which includes apps to handle your intent.
For example:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TITLE, "Some title..");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Some text");
startActivity(Intent.createChooser(shareIntent, "Share via.."));
does not do the trick since the OS version picks the display of the chooser.
Any way to change this code to get the Share Bottom sheet per the material design https://www.google.com/design/spec/components/bottom-sheets.html#bottom-sheets-content
Does anyone know of third party libraries to do just this on older API versions?
I have found https://github.com/soarcn/BottomSheet
but this only lets me create a menu from the bottom sheet. I guess in reality, i can lookup all the apps that can perform the action I am trying to do and manually add Menu Items on top of this library, but i was hoping for something a little simpler since it is not a deal breaking feature.
Here is that same exact bottom sheet on a Nexus 5 running Android 6.0.
This may be different on older or modified versions of Android. (i.e. Samsung Devices etc)
Code
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Check out this dope website! - https://mikemiller.design/"); // Simple text and URL to share
sendIntent.setType("text/plain");
this.startActivity(sendIntent);
Result
Our BottomSheet implementation has a commons component you can use that lets you specify an intent/filter/etc for the sheet and it will behave fairly similarly to the system version on Lollipop
https://github.com/flipboard/bottomsheet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With