Commons: リポジトリに引数なしを追加、ロジック実装

This commit is contained in:
ろむねこ 2023-12-12 10:18:50 +09:00
parent 4c958bb333
commit efb2484569
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 30 additions and 2 deletions

View File

@ -1,4 +1,30 @@
package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
public class CommonsImpl { import android.content.Context;
import java.nio.file.Path;
import javax.inject.Inject;
import dagger.hilt.android.qualifiers.ApplicationContext;
import one.nem.lacerta.data.repository.Commons;
public class CommonsImpl implements Commons{
private Context applicationContext;
@Inject
public CommonsImpl(@ApplicationContext Context applicationContext) {
this.applicationContext = applicationContext;
}
public Path getExternalFilesDirPath(String type) {
return applicationContext.getExternalFilesDir(type).toPath();
}
public Path getExternalFilesDirPath() {
return applicationContext.getExternalFilesDir(null).toPath();
}
} }

View File

@ -4,6 +4,8 @@ import java.nio.file.Path;
public interface Commons { public interface Commons {
Path getExternalFilesDir(String type); Path getExternalFilesDirPath(String type);
Path getExternalFilesDirPath();
} }