From efb248456907cf2dec2364c41b5707de77987f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Tue, 12 Dec 2023 10:18:50 +0900 Subject: [PATCH] =?UTF-8?q?Commons:=20=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=81=AB=E5=BC=95=E6=95=B0=E3=81=AA=E3=81=97=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=81=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/data/impl/CommonsImpl.java | 28 ++++++++++++++++++- .../nem/lacerta/data/repository/Commons.java | 4 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java index bef046fd..26a6c71b 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java @@ -1,4 +1,30 @@ 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(); + } + } diff --git a/data/src/main/java/one/nem/lacerta/data/repository/Commons.java b/data/src/main/java/one/nem/lacerta/data/repository/Commons.java index d1bc7db9..54d46f07 100644 --- a/data/src/main/java/one/nem/lacerta/data/repository/Commons.java +++ b/data/src/main/java/one/nem/lacerta/data/repository/Commons.java @@ -4,6 +4,8 @@ import java.nio.file.Path; public interface Commons { - Path getExternalFilesDir(String type); + Path getExternalFilesDirPath(String type); + + Path getExternalFilesDirPath(); }