Merge branch 'master' of https://its-gitlab.init.hs-owl.de/mo_b_l/aped_app
This commit is contained in:
commit
291269cc80
@ -25,6 +25,15 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<provider
|
||||||
|
android:authorities="${applicationId}.provider"
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/provider_paths"/>
|
||||||
|
</provider>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -25,6 +25,7 @@ import com.google.android.material.navigation.NavigationView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
@ -142,7 +143,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
case R.id.action_adjust_xml:
|
case R.id.action_adjust_xml:
|
||||||
Toast.makeText(this, "Adjust .xml",
|
Toast.makeText(this, "Adjust .xml",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
||||||
String externalPrivateStorageDir = null;
|
String externalPrivateStorageDir = null;
|
||||||
try {
|
try {
|
||||||
externalPrivateStorageDir = ExternalStorageHandler.getExternalPrivateStorageDir(this);
|
externalPrivateStorageDir = ExternalStorageHandler.getExternalPrivateStorageDir(this);
|
||||||
@ -150,10 +150,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Log.e("MainActivity","error while opening the config.xml for adjustment: " + e.getMessage());
|
Log.e("MainActivity","error while opening the config.xml for adjustment: " + e.getMessage());
|
||||||
}
|
}
|
||||||
File xmlFile = new File(externalPrivateStorageDir, "config.xml");
|
File xmlFile = new File(externalPrivateStorageDir, "config.xml");
|
||||||
|
Uri uri = FileProvider.getUriForFile(this,this.getApplicationContext().getPackageName() + ".provider", xmlFile);
|
||||||
|
|
||||||
//String shareBody = text;
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setType("text/plain");
|
intent.setDataAndType(uri,"text/xml");
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, xmlFile.toString());
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
/**
|
/**
|
||||||
* xml anstatt beispieltext muss übergeben werden
|
* xml anstatt beispieltext muss übergeben werden
|
||||||
|
6
APED/app/src/main/res/xml/provider_paths.xml
Normal file
6
APED/app/src/main/res/xml/provider_paths.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<external-path
|
||||||
|
name="external_files"
|
||||||
|
path="."/>
|
||||||
|
</paths>
|
Loading…
x
Reference in New Issue
Block a user