mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
InternalUtilsなモジュールに移植WIP
This commit is contained in:
parent
6bc741d0b0
commit
119140a6bc
|
@ -8,5 +8,4 @@ public interface UtilsRepo {
|
|||
|
||||
Path getExternalFilesDirPath();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
package one.nem.lacerta.source.jgit;
|
||||
|
||||
import org.eclipse.jgit.internal.storage.file.FileRepository;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
|
||||
public class RepoUtils {
|
||||
// Internal Utils
|
||||
public static String getRepoName(Repository repo) {
|
||||
|
||||
public Repository createRepo(String id, ) {
|
||||
Repository repository = FileRepositoryBuilder.create(
|
||||
|
||||
)
|
||||
}
|
||||
public Repository getRepo(String id) {
|
||||
// WIP
|
||||
}
|
||||
public String getRepoName(Repository repo) {
|
||||
return repo.getDirectory().getParentFile().getName();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package oen.nem.lacerta.utils.impl;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||
import one.nem.lacerta.data.utils.UtilsRepo;
|
||||
|
||||
public class UtilsImpl implements UtilsRepo{
|
||||
|
||||
private final Context applicationContext;
|
||||
|
||||
@Inject
|
||||
public UtilsImpl(@ApplicationContext Context applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public Path getExternalFilesDirPath(String type) {
|
||||
return Objects.requireNonNull(applicationContext.getExternalFilesDir(type)).toPath();
|
||||
}
|
||||
|
||||
public Path getExternalFilesDirPath() {
|
||||
return Objects.requireNonNull(applicationContext.getExternalFilesDir(null)).toPath();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package oen.nem.lacerta.utils.module;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.hilt.InstallIn;
|
||||
import dagger.hilt.components.SingletonComponent;
|
||||
import one.nem.lacerta.data.utils.UtilsImpl;
|
||||
import one.nem.lacerta.data.utils.UtilsRepo;
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent.class)
|
||||
abstract public class UtilsModule {
|
||||
|
||||
@Binds
|
||||
public abstract UtilsRepo bindUtils(UtilsImpl utilsImpl);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package oen.nem.lacerta.utils.repository;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface UtilsRepo {
|
||||
|
||||
Path getExternalFilesDirPath(String type);
|
||||
|
||||
Path getExternalFilesDirPath();
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user