Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: copy image charts android (#109)
* temp * fix: totals view initialization * fix: missing file Co-authored-by: Vittorio Cellucci <vel@qlik.com>
- Loading branch information
Showing
10 changed files
with
127 additions
and
10 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
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
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
31 changes: 31 additions & 0 deletions
31
android/src/main/java/com/qliktrialreactnativestraighttable/ImageShare.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,31 @@ | ||
package com.qliktrialreactnativestraighttable; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.graphics.Bitmap; | ||
import android.net.Uri; | ||
import android.provider.MediaStore; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
|
||
public class ImageShare { | ||
|
||
public void share(Bitmap bitmap, Context context) { | ||
Uri uri = getImageUri(bitmap, context); | ||
Intent intent = new Intent(Intent.ACTION_SEND); | ||
intent.setType("image/png"); | ||
intent.putExtra(Intent.EXTRA_STREAM, uri); | ||
try { | ||
context.startActivity(Intent.createChooser(intent, null)); | ||
} catch (Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
|
||
private Uri getImageUri(Bitmap bitmap, Context context) { | ||
ByteArrayOutputStream bytes = new ByteArrayOutputStream(); | ||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bytes); | ||
String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, null, null); | ||
return Uri.parse(path); | ||
} | ||
} |
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
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