moved XML submodule to resources

This commit is contained in:
paul-loedige 2020-12-27 13:57:30 +01:00
parent af91253e42
commit 33e5d3106e
4 changed files with 56 additions and 3 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "APED/app/src/main/java/com/example/aped/xml"]
path = APED/app/src/main/java/com/example/aped/xml
[submodule "APED/app/src/main/res/raw/XML"]
path = APED/app/src/main/res/raw/XML
url = https://its-gitlab.init.hs-owl.de/mo_b_l/aped_xml_configs.git

View File

@ -0,0 +1,53 @@
package com.example.aped.utils;
import android.content.Context;
import android.os.Environment;
import java.io.File;
import java.io.FileNotFoundException;
/**
* Utility for getting information related to the external storage.
*/
public final class ExternalStorageHandler {
private ExternalStorageHandler() { }
/**
* Checks whether the external storage is mounted.
* @return boolean value
*/
public static boolean isExternalStorageMounted() {
return Environment.MEDIA_MOUNTED.equals(
Environment.getExternalStorageState()
);
}
/**
* Checks whether the external storage is read only.
* @return boolean value
*/
public static boolean isExternalStorageReadOnly() {
return Environment.MEDIA_MOUNTED_READ_ONLY.equals(
Environment.getExternalStorageState()
);
}
/**
* Returns the external private storage base directory path for an activity.
* @param context the relevant activity
* @return the path to the base of the external private storage
* @throws FileNotFoundException checks if the directory is mounted
*/
public static String getExternalPrivateStorageDir(final Context context)
throws FileNotFoundException {
if (isExternalStorageMounted()) {
File file = context.getExternalCacheDir();
return file.getAbsolutePath();
} else {
throw new FileNotFoundException(
"The relevant storage is not available."
);
}
}
}

@ -1 +0,0 @@
Subproject commit 3600828925b4f02fcf472797c5cf526d24f53f63

@ -0,0 +1 @@
Subproject commit ce8ce41609a1a7ef9282cbcdda3358f9c2ec6939