This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from eduardb/master
Provide share functionality
- Loading branch information
Showing
7 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...extended/src/main/java/com/novoda/simplechromecustomtabs/demo/ShareBroadcastReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.novoda.simplechromecustomtabs.demo; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
public class ShareBroadcastReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
String url = intent.getDataString(); | ||
if (url == null) { | ||
return; | ||
} | ||
Intent shareIntent = new Intent(Intent.ACTION_SEND); | ||
shareIntent.setType("text/plain"); | ||
shareIntent.putExtra(Intent.EXTRA_TEXT, url); | ||
Intent chooserIntent = Intent.createChooser(shareIntent, context.getString(R.string.share)); | ||
chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
context.startActivity(chooserIntent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../main/java/com/novoda/simplechromecustomtabs/navigation/DefaultShareMenuItemComposer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.novoda.simplechromecustomtabs.navigation; | ||
|
||
import android.support.customtabs.CustomTabsIntent; | ||
|
||
class DefaultShareMenuItemComposer implements Composer { | ||
|
||
@Override | ||
public CustomTabsIntent.Builder compose(CustomTabsIntent.Builder builder) { | ||
return builder.addDefaultShareMenuItem(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters