Merge branch 'main' into feat/room-sqlcipher

# Conflicts:
#	SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java
#	SWADroid/src/main/java/es/ugr/swad/swadroid/modules/downloads/DownloadsManager.java
This commit is contained in:
Amab 2023-07-08 11:21:00 +02:00
commit be6c7fceb7
8 changed files with 29 additions and 30 deletions

View File

@ -26,7 +26,3 @@ steps:
# from_secret: sonar_host
# sonar_token:
# from_secret: sonar_token
trigger:
event:
- pull_request

View File

@ -214,10 +214,10 @@ public class DirectoryNavigator {
if (firstChild != null) {
switch (tag) {
case "code":
fileCode = Long.valueOf(firstChild.getNodeValue());
fileCode = Long.parseLong(firstChild.getNodeValue());
break;
case "time":
time = Long.valueOf(firstChild.getNodeValue());
time = Long.parseLong(firstChild.getNodeValue());
break;
case "license":
license = firstChild.getNodeValue();
@ -397,4 +397,4 @@ public class DirectoryNavigator {
*/
class InvalidPathException extends IllegalArgumentException {
private static final long serialVersionUID = 1L;
}
}

View File

@ -18,11 +18,9 @@
*/
package es.ugr.swad.swadroid.modules.downloads;
import android.annotation.TargetApi;
import android.app.DownloadManager;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
@ -50,7 +48,6 @@ public class DownloadFactory {
* @param title title of the download notification
* @param description description of the download notification
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static boolean downloadFile(Context context, String url, String fileName, String title,
String description) {
@ -77,7 +74,7 @@ public class DownloadFactory {
/**
* Method to show file size in bytes in a human readable way
* http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
* @see <a href="http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java">how-to-convert-byte-size-into-human-readable-format-in-java</a>
*/
public static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024;

View File

@ -18,7 +18,6 @@
*/
package es.ugr.swad.swadroid.modules.downloads;
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
@ -27,7 +26,6 @@ import android.database.Cursor;
import android.database.CursorWrapper;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.BaseColumns;
@ -827,7 +825,6 @@ public class DownloadManager {
* method will only work when called from within the download manager's process.
* @param ids the IDs of the downloads
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public void restartDownload(long... ids) {
try (Cursor cursor = query(new Query().setFilterById(ids))) {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
@ -1019,7 +1016,7 @@ public class DownloadManager {
private long translateLong(String column) {
if (!isLongColumn(column)) {
// mimic behavior of underlying cursor -- most likely, throw NumberFormatException
return Long.valueOf(translateString(column));
return Long.parseLong(translateString(column));
}
if (column.equals(COLUMN_ID)) {
@ -1139,4 +1136,4 @@ public class DownloadManager {
}
}
}
}
}

View File

@ -1215,4 +1215,4 @@ public final class Downloads {
public static final String INSERT_KEY_PREFIX = "http_header_";
}
}
}
}

View File

@ -19,7 +19,6 @@
package es.ugr.swad.swadroid.modules.downloads;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
@ -194,9 +193,11 @@ public class DownloadsManager extends MenuActivity {
protected void onStart() {
super.onStart();
// check Android 6 permission
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
// check permissions
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
&& ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
Constants.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
@ -316,22 +317,20 @@ public class DownloadsManager extends MenuActivity {
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
public boolean onKeyDown(int keyCode, KeyEvent event) {
//If back button is pressed, go to parent directory
if ((keyCode == KeyEvent.KEYCODE_BACK))
{
if (navigator != null) {
//If current directory is not the root, go to parent directory
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
if (navigator != null) {
//If current directory is not the root, go to parent directory
if (!navigator.isRootDirectory()) {
updateView(navigator.goToParentDirectory());
//If current directory is the root, exit module
//If current directory is the root, exit module
} else {
return super.onKeyDown(keyCode, event);
}
}
return true;
return true;
}
return super.onKeyDown(keyCode, event);
@ -785,7 +784,6 @@ public class DownloadsManager extends MenuActivity {
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -803,8 +801,9 @@ public class DownloadsManager extends MenuActivity {
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case Constants.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE: {
if (grantResults.length > 0

View File

@ -23,6 +23,11 @@
<li type="disc">Añadido módulo para localización en interiores</li>
</ul>-->
<h4>1.5.10</h4>
<ul>
<li type="disc">Corregida gestión de permisos en la descarga de documentos para Android 10+</li>
</ul>
<h4>1.5.9</h4>
<ul>
<li type="disc">Añadido soporte para la descarga de notificaciones en segundo plano cuando la optimización de batería está habilitada</li>

View File

@ -23,6 +23,11 @@
<li type="disc">Added indoor location module</li>
</ul>-->
<h4>1.5.10</h4>
<ul>
<li type="disc">Fixed permissions management on document download for Android 10+</li>
</ul>
<h4>1.5.9</h4>
<ul>
<li type="disc">Added support for background notification download when power save mode is enabled</li>