element-hq / riot-android

A glossy Matrix collaboration client for Android
Apache License 2.0
1.4k stars 394 forks source link

Support the "Direct share" feature in Android 6+ #1103

Open vurpo opened 7 years ago

vurpo commented 7 years ago

Commonly used rooms should be put in the Direct Share menu introduced in Android 6.0. Then, one could directly share content to one's most commonly shared-to rooms instead of always going through tapping Riot -> selecting the room from the room list.

When a user shares some text from some other app, this sample app will be listed as an option. Using the Direct Share feature, this app also shows some of contacts directly in the chooser dialog.

To enable Direct Share, apps need to implement a Service extending ChooserTargetService. Override the method onGetChooserTargets and return a list of Direct Share options.

In your AndroidManifest.xml, add a meta-data tag in your Activity that receives the Intent. Specify android:name as android.service.chooser.chooser_target_service, and point the android:value to the Service.

Source: https://github.com/googlesamples/android-DirectShare

gad-o commented 7 years ago

Hi, I'm trying to write this feature. Currently, VectorSharedFilesActivity receives all SEND actions and then path is going like this (exp: Text share) User wants share text to a Riot Room -> VectorSharedFilesActivity -> VectorHomeActivity -> CommonActivityUtils.sendFilesTo -> AlertDialog.Builder creates dialog -> User Selects **Room** ->

And also, user must already have a created room with contact before this path which is a long path like this.

What do you think about convenient way for this without broke matrix's approach?