update javadocs
This commit is contained in:
parent
c0344c1eed
commit
15a024b06e
@ -1,8 +1,8 @@
|
|||||||
package org.fdroid.fdroid;
|
package org.fdroid.fdroid;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -16,6 +16,9 @@ public class AssetUtils {
|
|||||||
|
|
||||||
private static final String TAG = "Utils";
|
private static final String TAG = "Utils";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This requires {@link Context} from {@link android.app.Instrumentation#getContext()}
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static File copyAssetToDir(Context context, String assetName, File directory) {
|
public static File copyAssetToDir(Context context, String assetName, File directory) {
|
||||||
File tempFile = null;
|
File tempFile = null;
|
||||||
@ -28,6 +31,7 @@ public class AssetUtils {
|
|||||||
output = new FileOutputStream(tempFile);
|
output = new FileOutputStream(tempFile);
|
||||||
Utils.copy(input, output);
|
Utils.copy(input, output);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Check the context is from Instrumentation.getContext()");
|
||||||
fail(e.getMessage());
|
fail(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
Utils.closeQuietly(output);
|
Utils.closeQuietly(output);
|
||||||
|
@ -618,6 +618,10 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
|
|||||||
return new File(this.getMediaInstallPath(context), SanitizedFile.sanitizeFileName(this.apkName));
|
return new File(this.getMediaInstallPath(context), SanitizedFile.sanitizeFileName(this.apkName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a media file is "installed" as based on the file type's
|
||||||
|
* install path, derived in {@link #getMediaInstallPath(Context)}
|
||||||
|
*/
|
||||||
public boolean isMediaInstalled(Context context) {
|
public boolean isMediaInstalled(Context context) {
|
||||||
return getInstalledMediaFile(context).isFile();
|
return getInstalledMediaFile(context).isFile();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user