This file contains hidden or 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
| #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME} | |
| import android.support.v7.widget.RecyclerView | |
| import android.view.View | |
| import android.view.ViewGroup | |
| #end | |
| #parse("File Header.java") | |
| class ${NAME}(private var items: MutableList<${ITEM_TYPE}>): RecyclerView.Adapter<${VIEWHOLDER}>() { | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${VIEWHOLDER} { |
This file contains hidden or 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
| if (type.equals("image/png")){ | |
| Uri fileStream = intentReader.getStream(); | |
| Bitmap bitmap = null; | |
| try { | |
| InputStream inputStream = getContentResolver() | |
| .openInputStream(fileStream); | |
| bitmap = BitmapFactory.decodeStream(inputStream); | |
| } catch (FileNotFoundException e) { | |
| e.printStackTrace(); | |
| } |
This file contains hidden or 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
| String type = intentReader.getType(); | |
| if (type.equals("text/plain")){ | |
| CharSequence text = intentReader.getText(); | |
| textView.setText(text); | |
| } |
This file contains hidden or 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
| ShareCompat.IntentReader intentReader = ShareCompat.IntentReader.from(this); | |
| if (intentReader.isShareIntent()) { | |
| // ... | |
| } |
This file contains hidden or 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
| <intent-filter> | |
| <action android:name="android.intent.action.SEND" /> | |
| <category android:name="android.intent.category.DEFAULT" /> | |
| <category android:name="android.intent.category.BROWSABLE" /> | |
| <data android:mimeType="text/plain" /> | |
| <data android:mimeType="text/html" /> | |
| <data android:mimeType="image/png" /> | |
| </intent-filter> |
This file contains hidden or 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
| Intent intent = ShareCompat.IntentBuilder.from(this) | |
| .setType("image/png") | |
| .setStream(imageUri) | |
| .setChooserTitle("Choose image client") | |
| .getIntent(); | |
| if (intent.resolveActivity(getPackageManager()) != null) { | |
| startActivity(intent); | |
| } |
This file contains hidden or 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
| ShareCompat.IntentBuilder intentBuilder = ShareCompat.IntentBuilder.from(this); | |
| Intent intent = intentBuilder | |
| .setType("text/html") | |
| .setText(text) | |
| .setChooserTitle("Choose email client") | |
| .createChooserIntent(); | |
| if (intent.resolveActivity(getPackageManager()) != null) { | |
| startActivity(intent); | |
| } |