update javadocs

This commit is contained in:
Hans-Christoph Steiner 2020-10-20 16:11:58 +02:00
parent c0344c1eed
commit 15a024b06e
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -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();
} }