## What changes were proposed in this pull request? * Fix permissions management on document download for Android 10+. Fixes #419 ## How was this patch tested? Manually. Reviewed-on: #421 Co-authored-by: Amab <juanmi1982@gmail.com> Co-committed-by: Amab <juanmi1982@gmail.com>
This commit is contained in:
parent
8fd41782ad
commit
f45c57b456
|
@ -26,7 +26,3 @@ steps:
|
|||
# from_secret: sonar_host
|
||||
# sonar_token:
|
||||
# from_secret: sonar_token
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- pull_request
|
||||
|
|
|
@ -309,7 +309,7 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
SyncUtils.removePeriodicSync(Constants.AUTHORITY, Bundle.EMPTY, this);
|
||||
if(!Preferences.getSyncTime().equals("0") && Preferences.isSyncEnabled()) {
|
||||
SyncUtils.addPeriodicSync(Constants.AUTHORITY, Bundle.EMPTY,
|
||||
Long.valueOf(Preferences.getSyncTime()), this);
|
||||
Long.parseLong(Preferences.getSyncTime()), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,96 +680,91 @@ public class SWADMain extends MenuExpandableListActivity {
|
|||
mProgressScreen = new ProgressScreen(mProgressScreenView, mCoursesListView,
|
||||
getString(R.string.coursesProgressDescription), this);
|
||||
|
||||
OnChildClickListener mExpandableClickListener = new OnChildClickListener() {
|
||||
OnChildClickListener mExpandableClickListener = (parent, v, groupPosition, childPosition, id) -> {
|
||||
// Get the item that was clicked
|
||||
Object o = parent.getExpandableListAdapter().getChild(groupPosition, childPosition);
|
||||
@SuppressWarnings("unchecked")
|
||||
String keyword = (String) ((Map<String, Object>) o).get(NAME);
|
||||
Intent activity;
|
||||
Context ctx = getApplicationContext();
|
||||
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
// Get the item that was clicked
|
||||
Object o = parent.getExpandableListAdapter().getChild(groupPosition, childPosition);
|
||||
@SuppressWarnings("unchecked")
|
||||
String keyword = (String) ((Map<String, Object>) o).get(NAME);
|
||||
Intent activity;
|
||||
Context ctx = getApplicationContext();
|
||||
|
||||
if (keyword.equals(getString(R.string.notificationsModuleLabel))) {
|
||||
activity = new Intent(ctx, Notifications.class);
|
||||
startActivityForResult(activity, Constants.NOTIFICATIONS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.testsModuleLabel))) {
|
||||
activity = new Intent(ctx, Tests.class);
|
||||
startActivityForResult(activity, Constants.TESTS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.messagesModuleLabel))) {
|
||||
activity = new Intent(ctx, Messages.class);
|
||||
activity.putExtra("eventCode", Long.valueOf(0));
|
||||
startActivityForResult(activity, Constants.MESSAGES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.noticesModuleLabel))) {
|
||||
activity = new Intent(ctx, Notices.class);
|
||||
startActivityForResult(activity, Constants.NOTICES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.rollcallModuleLabel))) {
|
||||
if (Utils.connectionAvailable(ctx)) {
|
||||
activity = new Intent(ctx, Rollcall.class);
|
||||
startActivityForResult(activity, Constants.ROLLCALL_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(ctx, R.string.noConnectionMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else if (keyword.equals(getString(R.string.generateQRModuleLabel))) {
|
||||
activity = new Intent(ctx, GenerateQR.class);
|
||||
startActivityForResult(activity, Constants.GENERATE_QR_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.manageLocation))) {
|
||||
activity = new Intent(ctx, IndoorLocation.class);
|
||||
startActivityForResult(activity, Constants.MANAGE_LOCATION);
|
||||
} else if (keyword.equals(getString(R.string.documentsDownloadModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.DOCUMENTS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.sharedsDownloadModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.SHARE_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.marksModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.MARKS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.myGroupsModuleLabel))) {
|
||||
activity = new Intent(ctx, MyGroupsManager.class);
|
||||
activity.putExtra("courseCode", Courses.getSelectedCourseCode());
|
||||
startActivityForResult(activity, Constants.MYGROUPSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.introductionModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.INTRODUCTION_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.INTRODUCTION_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.faqsModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.FAQS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.FAQS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.bibliographyModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.BIBLIOGRAPHY_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.BIBLIOGRAPHY_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.syllabusPracticalsModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.SYLLABUSPRACTICALS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.SYLLABUSPRACTICALS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.syllabusLecturesModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.SYLLABUSLECTURES_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.SYLLABUSLECTURES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.linksModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.LINKS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.LINKS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.teachingguideModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.TEACHINGGUIDE_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.TEACHINGGUIDE_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.assessmentModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.ASSESSMENT_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.ASSESSMENT_REQUEST_CODE);
|
||||
if (keyword.equals(getString(R.string.notificationsModuleLabel))) {
|
||||
activity = new Intent(ctx, Notifications.class);
|
||||
startActivityForResult(activity, Constants.NOTIFICATIONS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.testsModuleLabel))) {
|
||||
activity = new Intent(ctx, Tests.class);
|
||||
startActivityForResult(activity, Constants.TESTS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.messagesModuleLabel))) {
|
||||
activity = new Intent(ctx, Messages.class);
|
||||
activity.putExtra("eventCode", Long.valueOf(0));
|
||||
startActivityForResult(activity, Constants.MESSAGES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.noticesModuleLabel))) {
|
||||
activity = new Intent(ctx, Notices.class);
|
||||
startActivityForResult(activity, Constants.NOTICES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.rollcallModuleLabel))) {
|
||||
if (Utils.connectionAvailable(ctx)) {
|
||||
activity = new Intent(ctx, Rollcall.class);
|
||||
startActivityForResult(activity, Constants.ROLLCALL_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(ctx, R.string.noConnectionMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (keyword.equals(getString(R.string.generateQRModuleLabel))) {
|
||||
activity = new Intent(ctx, GenerateQR.class);
|
||||
startActivityForResult(activity, Constants.GENERATE_QR_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.manageLocation))) {
|
||||
activity = new Intent(ctx, IndoorLocation.class);
|
||||
startActivityForResult(activity, Constants.MANAGE_LOCATION);
|
||||
} else if (keyword.equals(getString(R.string.documentsDownloadModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.DOCUMENTS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.sharedsDownloadModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.SHARE_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.marksModuleLabel))) {
|
||||
activity = new Intent(ctx, DownloadsManager.class);
|
||||
activity.putExtra("downloadsAreaCode", Constants.MARKS_AREA_CODE);
|
||||
startActivityForResult(activity, Constants.DOWNLOADSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.myGroupsModuleLabel))) {
|
||||
activity = new Intent(ctx, MyGroupsManager.class);
|
||||
activity.putExtra("courseCode", Courses.getSelectedCourseCode());
|
||||
startActivityForResult(activity, Constants.MYGROUPSMANAGER_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.introductionModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.INTRODUCTION_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.INTRODUCTION_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.faqsModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.FAQS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.FAQS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.bibliographyModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.BIBLIOGRAPHY_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.BIBLIOGRAPHY_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.syllabusPracticalsModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.SYLLABUSPRACTICALS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.SYLLABUSPRACTICALS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.syllabusLecturesModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.SYLLABUSLECTURES_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.SYLLABUSLECTURES_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.linksModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.LINKS_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.LINKS_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.teachingguideModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.TEACHINGGUIDE_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.TEACHINGGUIDE_REQUEST_CODE);
|
||||
} else if (keyword.equals(getString(R.string.assessmentModuleLabel))) {
|
||||
activity = new Intent(ctx, Information.class);
|
||||
activity.putExtra("requestCode", Constants.ASSESSMENT_REQUEST_CODE);
|
||||
startActivityForResult(activity, Constants.ASSESSMENT_REQUEST_CODE);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
mExpandableListView.setOnChildClickListener(mExpandableClickListener);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1215,4 +1215,4 @@ public final class Downloads {
|
|||
public static final String INSERT_KEY_PREFIX = "http_header_";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -31,10 +30,6 @@ import android.graphics.Typeface;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
@ -48,6 +43,11 @@ import android.widget.Spinner;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
@ -190,9 +190,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);
|
||||
|
@ -238,28 +240,18 @@ public class DownloadsManager extends MenuActivity {
|
|||
|
||||
TextView homeButton = (TextView) this
|
||||
.findViewById(R.id.home_button);
|
||||
homeButton.setOnClickListener((new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (navigator != null) {
|
||||
updateView(navigator.goToRoot());
|
||||
}
|
||||
homeButton.setOnClickListener((v -> {
|
||||
if (navigator != null) {
|
||||
updateView(navigator.goToRoot());
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
TextView parentButton = (TextView) this
|
||||
.findViewById(R.id.parent_button);
|
||||
parentButton.setOnClickListener((new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (navigator != null) {
|
||||
updateView(navigator.goToParentDirectory());
|
||||
}
|
||||
parentButton.setOnClickListener((v -> {
|
||||
if (navigator != null) {
|
||||
updateView(navigator.goToParentDirectory());
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
//Set Font Awesome typeface
|
||||
|
@ -272,30 +264,27 @@ public class DownloadsManager extends MenuActivity {
|
|||
messageText = (TextView) this.findViewById(R.id.messageText);
|
||||
|
||||
grid = (GridView) this.findViewById(R.id.gridview);
|
||||
grid.setOnItemClickListener((new OnItemClickListener() {
|
||||
public void onItemClick(AdapterView<?> parent, View v,
|
||||
int position, long id) {
|
||||
grid.setOnItemClickListener(((parent, v, position, id) -> {
|
||||
|
||||
DirectoryItem node = navigator.getDirectoryItem(position);
|
||||
if (node.getFileCode() == -1) //it is a directory therefore navigates into it
|
||||
updateView(navigator.goToSubDirectory(position));
|
||||
else { //it is a files therefore gets its information through web service GETFILE
|
||||
chosenNodeName = node.getName();
|
||||
fileSize = node.getSize();
|
||||
File f = new File(Constants.DOWNLOADS_PATH + File.separator + chosenNodeName);
|
||||
DirectoryItem node = navigator.getDirectoryItem(position);
|
||||
if (node.getFileCode() == -1) //it is a directory therefore navigates into it
|
||||
updateView(navigator.goToSubDirectory(position));
|
||||
else { //it is a files therefore gets its information through web service GETFILE
|
||||
chosenNodeName = node.getName();
|
||||
fileSize = node.getSize();
|
||||
File f = new File(Constants.DOWNLOADS_PATH + File.separator + chosenNodeName);
|
||||
|
||||
//If a student is requesting the marks, gets the marks and call the Marks module
|
||||
if((downloadsAreaCode == Constants.MARKS_AREA_CODE)
|
||||
&& (Login.getLoggedUser().getUserRole() == Constants.STUDENT_TYPE_CODE)) {
|
||||
//If a student is requesting the marks, gets the marks and call the Marks module
|
||||
if((downloadsAreaCode == Constants.MARKS_AREA_CODE)
|
||||
&& (Login.getLoggedUser().getUserRole() == Constants.STUDENT_TYPE_CODE)) {
|
||||
|
||||
requestGetMarks(node.getFileCode());
|
||||
} else { //Otherwise treat as a regular file
|
||||
if (isDownloaded(f)) {
|
||||
viewFile(f);
|
||||
} else {
|
||||
AlertDialog fileInfoDialog = createFileInfoDialog(node.getName(), node.getSize(), node.getTime(), node.getPublisher(), node.getFileCode(), node.getLicense());
|
||||
fileInfoDialog.show();
|
||||
}
|
||||
requestGetMarks(node.getFileCode());
|
||||
} else { //Otherwise treat as a regular file
|
||||
if (isDownloaded(f)) {
|
||||
viewFile(f);
|
||||
} else {
|
||||
AlertDialog fileInfoDialog = createFileInfoDialog(node.getName(), node.getSize(), node.getTime(), node.getPublisher(), node.getFileCode(), node.getLicense());
|
||||
fileInfoDialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,22 +311,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);
|
||||
|
@ -802,7 +789,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);
|
||||
|
||||
|
@ -820,8 +806,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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user