|
@ -18,7 +18,9 @@ import android.content.SharedPreferences; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.net.Uri; |
|
|
import android.net.Uri; |
|
|
import android.os.AsyncTask; |
|
|
import android.os.AsyncTask; |
|
|
|
|
|
import android.os.Build; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
|
|
|
import android.text.Html; |
|
|
import android.view.MenuItem; |
|
|
import android.view.MenuItem; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.widget.Button; |
|
|
import android.widget.Button; |
|
@ -695,6 +697,7 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
//True if permissions are OK
|
|
|
//True if permissions are OK
|
|
|
protected boolean checkPerms() { |
|
|
protected boolean checkPerms() { |
|
|
Timber.i("Checking storage permissions."); |
|
|
Timber.i("Checking storage permissions."); |
|
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU){ |
|
|
String[] PERMISSIONS_STORAGE = { |
|
|
String[] PERMISSIONS_STORAGE = { |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
|
Manifest.permission.WRITE_EXTERNAL_STORAGE}; |
|
|
Manifest.permission.WRITE_EXTERNAL_STORAGE}; |
|
@ -702,6 +705,8 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
return !(checkSelfPermission(PERMISSIONS_STORAGE[0]) == PackageManager.PERMISSION_DENIED || |
|
|
return !(checkSelfPermission(PERMISSIONS_STORAGE[0]) == PackageManager.PERMISSION_DENIED || |
|
|
checkSelfPermission(PERMISSIONS_STORAGE[1]) == PackageManager.PERMISSION_DENIED); |
|
|
checkSelfPermission(PERMISSIONS_STORAGE[1]) == PackageManager.PERMISSION_DENIED); |
|
|
} |
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//Display popup for user to grant permission
|
|
|
//Display popup for user to grant permission
|
|
|
protected void requestPerms(int code) { |
|
|
protected void requestPerms(int code) { |
|
@ -735,6 +740,7 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
prepareDownload(thmmyFile); |
|
|
prepareDownload(thmmyFile); |
|
|
else { |
|
|
else { |
|
|
tempThmmyFile = thmmyFile; |
|
|
tempThmmyFile = thmmyFile; |
|
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) |
|
|
requestPerms(DOWNLOAD_REQUEST_CODE); |
|
|
requestPerms(DOWNLOAD_REQUEST_CODE); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|