mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
fix crash when exposing URI on Android 7+
This commit is contained in:
parent
af859dfbda
commit
c3eb12caef
1 changed files with 12 additions and 3 deletions
|
@ -23,10 +23,12 @@ import android.content.ActivityNotFoundException;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -148,11 +150,18 @@ public class LogHistoryActivity extends ToolbarActivity {
|
|||
ArrayList<Uri> uris = new ArrayList<Uri>();
|
||||
|
||||
// Convert from paths to Android friendly Parcelable Uri's
|
||||
for (String file : Log_OC.getLogFileNames())
|
||||
{
|
||||
for (String file : Log_OC.getLogFileNames()) {
|
||||
File logFile = new File(mLogPath, file);
|
||||
if (logFile.exists()) {
|
||||
uris.add(Uri.fromFile(logFile));
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
uris.add(Uri.fromFile(logFile));
|
||||
} else {
|
||||
uris.add(FileProvider.getUriForFile(
|
||||
this,
|
||||
getString(R.string.file_provider_authority),
|
||||
logFile
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue