Merge branch 'ignore_sdcard' of Umnik/SaveTo into master

pull/49/head 1.15.3
Umnik 1 year ago committed by Gogs
commit 369f044fe7

1
.gitignore vendored

@ -16,3 +16,4 @@ local.properties
/.idea/
/.gradle/
/app/build
/app/release

@ -1,5 +1,3 @@
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
1. Definitions.

@ -1,8 +1,15 @@
Will be updated later...
If you want to support me:
## Mirrors:
- https://notabug.org/Umnik/SaveTo
- https://gitlab.com/myachin/SaveTo
- https://gitea.myachin.xyz/umnik/SaveTo
### If you want to support me:
- https://paypal.me/DMyachin
- https://liberapay.com/Umnik/
- https://www.tinkoff.ru/rm/myachin.dmitriy4/5wLpN86994
- monero:46AM2x4HaPEGUiUZCN7GxXW5g6PDGn7fWFqchGa2PBFcW7k9kuTdwpPFXTSPeibMvkW9wERfMxRQs2jY7t9aKToVRKYsYm6
- monero:
46AM2x4HaPEGUiUZCN7GxXW5g6PDGn7fWFqchGa2PBFcW7k9kuTdwpPFXTSPeibMvkW9wERfMxRQs2jY7t9aKToVRKYsYm6

3
app/.gitignore vendored

@ -1,3 +0,0 @@
/build
/src/androidTest/
/src/test/

@ -12,8 +12,8 @@ android {
applicationId "xyz.myachin.saveto"
minSdkVersion 23
targetSdkVersion 32
versionCode 17
versionName '1.15.2'
versionCode 18
versionName '1.15.3'
}
buildTypes {

@ -1,9 +1,13 @@
package xyz.myachin.saveto.ui.share.fake
import android.app.Activity
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import xyz.myachin.saveto.R
import xyz.myachin.saveto.settings.Settings
import xyz.myachin.saveto.ui.notification.ResetDefaultsNotification
import xyz.myachin.saveto.ui.share.direct.DirectShareActivity
@ -25,12 +29,47 @@ class ActionViewActivity : Activity() {
}
}.start()
startActivity(intent.apply {
action = Intent.ACTION_SEND
setClassName(packageName,
if (Settings.actionViewManual) ManualShareActivity::class.java.name else DirectShareActivity::class.java.name)
putExtra(Intent.EXTRA_STREAM, data)
})
if (isSdcard(intent.data)) {
intent.component = null
val chooser = Intent.createChooser(intent, getString(R.string.choose_target)).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
putExtra(Intent.EXTRA_EXCLUDE_COMPONENTS,
arrayOf(ComponentName.createRelative(applicationContext.packageName,
ActionViewActivity::class.java.name)))
}
}
startActivity(chooser)
} else {
startActivity(intent.apply {
action = Intent.ACTION_SEND
setClassName(packageName,
if (Settings.actionViewManual) ManualShareActivity::class.java.name else DirectShareActivity::class.java.name)
putExtra(Intent.EXTRA_STREAM, data)
})
}
}
private fun isSdcard(uri: Uri?): Boolean {
val storages = arrayOf(
"/storage/emulated/",
"/media/external/",
".externalstorage.",
"com.mobisystems.fileman.RemoteFiles",
"com.github.axet.filemanager",
"/external_files/",
"com.google.android.apps.nbu.files.provider",
"com.ghostsq.commander.FileProvider/FS/",
)
uri?.let {
storages.forEach { storage ->
if (uri.toString().replace("%2F", "/").contains(storage)) return true
}
}
return false
}
override fun onRestart() {
super.onRestart()
finish()
}
}

@ -67,4 +67,5 @@
<string name="detect_as_default_action_viewer_summary">Если приложение стало вьювером по умолчанию, показывать нотификацию</string>
<string name="clear_defaults">Сбросить дефолты</string>
<string name="need_to_reset_defaults">Приложение стало вьювером по умолчанию.\nНужно сбросить эту настройку</string>
<string name="choose_target">Выбери другое приложение</string>
</resources>

@ -94,4 +94,5 @@
<string name="detect_as_default_action_viewer_summary">Show notification if the app was set as viewer by default</string>
<string name="clear_defaults">Clear defaults</string>
<string name="need_to_reset_defaults">The app was set as default viewer.\nIt\'s need to reset this preference</string>
<string name="choose_target">Choose another app</string>
</resources>

@ -0,0 +1,2 @@
1. Dependencies update
2. If file with ACTION_VIEW intent already saved on /sdcard/, SaveTo… opens it in external app (beta)

@ -0,0 +1,2 @@
1. Обновление зависимостей
2. Для ACTION_VIEW открывается запрос действий, если файл уже лежит на /sdcard/ (beta)
Loading…
Cancel
Save