Skip to content

Commit

Permalink
file import
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosPaha01 committed Jul 18, 2021
1 parent 8c23dc1 commit d428c6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
10 changes: 1 addition & 9 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.rboard" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.rboard" />
<data android:scheme="content" />
<data android:scheme="file" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.ViewTreeObserver
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.google.firebase.messaging.FirebaseMessaging
Expand Down Expand Up @@ -121,7 +122,24 @@ class SplashScreen : AppCompatActivity() {

when {
initialized && scheme != "content" && data != null -> {
when (data.host?.split(".")?.first()) {
if (data.scheme == "file") {
val file = SuFile(data.path).let {
File(filesDir, "theme.pack").apply {
ProcessBuilder().apply {
su("rm $absolutePath").logs("File Import", true)
su("cp ${it.absolutePath} $absolutePath").logs("File Import", true)
su("chmod 644 $absolutePath").logs("File Import", true)
}
}
}
val uri = FileProvider.getUriForFile(this, packageName, file)
Intent(Intent.ACTION_VIEW).apply {
setDataAndType(uri, "application/pack")
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
startActivity(this)
finish()
}
} else when (data.host?.split(".")?.first()) {
"repos" -> {
data.queryParameterNames.forEach {
when (it) {
Expand Down

0 comments on commit d428c6b

Please sign in to comment.