mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
Improve sharing
This commit is contained in:
parent
b60f8ac7b4
commit
8e2041923b
3 changed files with 7 additions and 1 deletions
|
|
@ -153,7 +153,7 @@ android {
|
|||
multiDexEnabled true
|
||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||
|
||||
versionCode 2364
|
||||
versionCode 2369
|
||||
versionName "2.5"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -578,6 +578,7 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
val sharingIntent = Intent(Intent.ACTION_SEND)
|
||||
sharingIntent.type = "*/*"
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, event.sharedMessage)
|
||||
BitmapUtils.clearDirectoryContent("$filesDir/shared_images")
|
||||
val f = BitmapUtils.saveToShareableFile("$filesDir/shared_images", "${Date().toString()}.png", event.shareImage)
|
||||
val fileUri = f?.let { FileProvider.getUriForFile(this, getString(R.string.content_provider), it) }
|
||||
if (fileUri != null) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ import java.io.File
|
|||
import java.io.FileOutputStream
|
||||
|
||||
object BitmapUtils {
|
||||
fun clearDirectoryContent(directory: String) {
|
||||
val dirFile = File(directory)
|
||||
dirFile.listFiles()?.forEach { it.delete() }
|
||||
}
|
||||
|
||||
fun saveToShareableFile(directory: String, filename: String, bmp: Bitmap): File? {
|
||||
var name = filename
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue