Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -27,6 +27,7 @@ import de.sebse.fuplanner.R;
|
||||
import de.sebse.fuplanner.services.KVV.KVV;
|
||||
import de.sebse.fuplanner.services.KVV.types.Modules;
|
||||
import de.sebse.fuplanner.services.KVV.types.Resource;
|
||||
import de.sebse.fuplanner.tools.Regex;
|
||||
import de.sebse.fuplanner.tools.UtilsDate;
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
import de.sebse.fuplanner.tools.ui.treeview.DirectoryNodeBinder;
|
||||
@@ -181,7 +182,14 @@ public class ModDetailResourceFragment extends Fragment {
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.show();
|
||||
}else {
|
||||
fileOpen(new File(success1));
|
||||
if (Regex.has("^http", success1)){
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(success1));
|
||||
startActivity(intent);
|
||||
}
|
||||
else {
|
||||
fileOpen(new File(success1));
|
||||
}
|
||||
|
||||
}
|
||||
}, error -> {
|
||||
|
||||
|
||||
@@ -544,10 +544,18 @@ class KVVModuleList extends HTTPService {
|
||||
errorCallback.onError(new NetworkError(101701, 500, "Currently running in offline mode!"));
|
||||
return;
|
||||
}
|
||||
|
||||
get(url, token.getCookies(), response ->{
|
||||
|
||||
final String[] pfad = {""};
|
||||
|
||||
if (response.getBytes()==null){
|
||||
if (Regex.has("\\.[Uu][Rr][Ll]$", url)){//für Links
|
||||
if (response.getHeaders().get("Location") != null){
|
||||
pfad[0] = response.getHeaders().get("Location");
|
||||
}
|
||||
callback.onResponse(pfad[0]);
|
||||
}
|
||||
else if (response.getBytes()==null){
|
||||
log.d("ResourceFile neu einlogen");
|
||||
testLogin(token, token -> {
|
||||
if (isExternalStorageWritable()) {
|
||||
|
||||
@@ -8,10 +8,12 @@ import java.util.regex.MatchResult;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
|
||||
public class Regex {
|
||||
public static boolean has(@Language("Regexp") String regex, String match) {
|
||||
try {
|
||||
regex(regex, match, 1);
|
||||
regex(regex, match, 0);
|
||||
return true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user