mirror of
https://github.com/fr3ts0n/AndrOBD.git
synced 2025-12-23 22:28:06 -05:00
Use FileProvider for load measurements
- Implements changes of PR#244
This commit is contained in:
@@ -61,6 +61,15 @@
|
||||
android:name=".PidCustomization"
|
||||
android:label="@string/customize_display"
|
||||
android:configChanges="touchscreen|orientation|screenSize" />
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths"/>
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -54,6 +54,8 @@ import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.fr3ts0n.androbd.plugin.Plugin;
|
||||
import com.fr3ts0n.androbd.plugin.mgr.PluginManager;
|
||||
import com.fr3ts0n.ecu.EcuCodeItem;
|
||||
@@ -1913,9 +1915,10 @@ public class MainActivity extends PluginManager
|
||||
File file = new File(FileHelper.getPath(this));
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
Uri data = Uri.fromFile(file);
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
Uri uri = FileProvider.getUriForFile(MainActivity.this, getPackageName()+".provider", file);
|
||||
String type = "*/*";
|
||||
intent.setDataAndType(data, type);
|
||||
intent.setDataAndType(uri, type);
|
||||
startActivityForResult(intent, REQUEST_SELECT_FILE);
|
||||
}
|
||||
|
||||
|
||||
4
androbd/src/main/res/xml/provider_paths.xml
Normal file
4
androbd/src/main/res/xml/provider_paths.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path path="." name="external_storage_root" />
|
||||
</paths>
|
||||
@@ -6,7 +6,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.3.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
android.nonFinalResIds=false
|
||||
android.nonTransitiveRClass=true
|
||||
android.useAndroidX=true
|
||||
org.gradle.unsafe.configuration-cache=true
|
||||
Reference in New Issue
Block a user