Compare commits

...
Author SHA1 Message Date
Fuchimoto1234 71f9be77cd fix 2024-01-17 12:58:25 +09:00
Fuchimoto1234 d07e63f534 Merge branch 'develop' into feature/home/add_document_history
# Conflicts:
#	data/src/main/java/one/nem/lacerta/data/Document.java
#	data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java
2024-01-17 12:42:55 +09:00
Fuchimoto1234 5160411c76 fix 2024-01-17 12:41:31 +09:00
Fuchimoto1234 20d30e338e wip 2024-01-17 12:35:30 +09:00
r-ca 8faaf1e84a hotfix: 起動できないので暫定で修正 2024-01-16 13:01:35 +09:00
ろむねこ a81d79a972 Merge pull request #75 from lacerta-doc/refactor/refactoring2
リファクタリング
2024-01-16 12:59:08 +09:00
r-ca 1e2f48e0ae shared:iconを削除 2024-01-16 12:58:04 +09:00
r-ca be7bd6b6fc 依存関係から削除 2024-01-16 12:55:04 +09:00
r-ca 16eb6d083e :shared:iconを廃止1 2024-01-16 12:54:07 +09:00
r-ca 4de33b9550 JGit関連のモジュールを削除 2024-01-16 12:53:04 +09:00
r-ca b4d94954b9 消し忘れていた記述を削除 2024-01-16 12:51:54 +09:00
r-ca 526ab97706 整理, コメント追加 2024-01-16 12:50:06 +09:00
r-ca 6f0af7c4eb 整理 2024-01-16 12:49:37 +09:00
r-ca c6d85471c6 整理, コメント追加 2024-01-16 12:48:54 +09:00
r-ca c5d7224b40 不用意なインポートを整理 2024-01-16 12:46:20 +09:00
ろむねこ cc62529224 Merge pull request #74 from lacerta-doc/r-ca-patch-2
Create PULL_REQUEST_TEMPLATE.md
2024-01-16 12:42:06 +09:00
Fuchimoto1234 a5efab5838 アイテムのレイアウトを作成 2023-12-20 10:00:16 +09:00
Fuchimoto1234 f186064f6e 途中 2023-12-19 12:56:31 +09:00
Fuchimoto1234 59a35cbb4a 依存関係追加 2023-12-19 10:36:27 +09:00
Fuchimoto1234 a78e60416d 依存関係追加 2023-12-19 10:34:31 +09:00
Fuchimoto1234 ac5a950ce3 依存関係追加 2023-12-18 15:16:57 +09:00
28 changed files with 241 additions and 263 deletions

No files matched your search

+1 -1
View File
@@ -4,6 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
@@ -25,7 +26,6 @@
<option value="$PROJECT_DIR$/model" />
<option value="$PROJECT_DIR$/processor" />
<option value="$PROJECT_DIR$/shared" />
<option value="$PROJECT_DIR$/shared/icon" />
<option value="$PROJECT_DIR$/shared/ui" />
<option value="$PROJECT_DIR$/source" />
<option value="$PROJECT_DIR$/utils" />
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
-2
View File
@@ -83,8 +83,6 @@ dependencies {
implementation project(':shared:ui')
implementation project(':shared:icon')
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
@@ -14,5 +14,7 @@ public class LacertaApplication extends Application {
// DynamicColorを有効化
DynamicColors.applyToActivitiesIfAvailable(this);
}
}
@@ -35,6 +35,8 @@ public class MainActivity extends AppCompatActivity {
NavigationUI.setupWithNavController(bottomNavigationView, navController);
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
}
}
}
@@ -2,32 +2,27 @@ package one.nem.lacerta.data.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
// Hilt
import javax.inject.Inject;
// Lacerta/data
import one.nem.lacerta.data.Document;
// Lacerta/model
import one.nem.lacerta.model.PublicPath;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
// Lacerta/source
import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity;
import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.database.entity.VcsLogEntity;
import one.nem.lacerta.vcs.ActionType;
import one.nem.lacerta.source.file.factory.FileManagerFactory;
import one.nem.lacerta.source.jgit.JGitRepository;
// Lacerta/utils
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.utils.XmlMetaParser;
import one.nem.lacerta.utils.repository.DeviceInfoUtils;
// Lacerta/vcs
import one.nem.lacerta.vcs.LacertaVcs;
@@ -41,8 +36,8 @@ public class DocumentImpl implements Document {
@Inject
LacertaDatabase database;
@Inject
LacertaVcs vcs;
// @Inject
// LacertaVcs vcs;
@Inject
@@ -74,7 +69,7 @@ public class DocumentImpl implements Document {
database.documentDao().insert(documentEntity);
// Vcs
vcs.createDocument(meta.getId());
// vcs.createDocument(meta.getId());
return detail;
}
@@ -1,10 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".DebugMenuContainerActivity"
android:exported="false" />
</application>
</manifest>
@@ -23,4 +23,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
+15
View File
@@ -1,4 +1,5 @@
plugins {
id 'com.google.dagger.hilt.android'
id 'com.android.library'
}
@@ -29,6 +30,8 @@ dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
implementation project(path: ':feature:debug')
implementation project(path: ':utils')
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
@@ -38,6 +41,18 @@ dependencies {
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// DI
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
// shared
implementation project(':shared:ui')
// DI
implementation project(':data')
//model
implementation project(':model')
implementation "androidx.recyclerview:recyclerview:1.3.2"
}
@@ -22,5 +22,7 @@ public class ExampleInstrumentedTest {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("one.nem.lacerta.feature.home.test", appContext.getPackageName());
}
}
@@ -1,20 +1,40 @@
package one.nem.lacerta.feature.home;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.document.DocumentMeta;
/**
* A simple {@link Fragment} subclass.
* Use the {@link HomeTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class HomeTopFragment extends Fragment {
@Inject
LacertaLibrary lacertaLibrary;
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
@@ -46,12 +66,15 @@ public class HomeTopFragment extends Fragment {
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@@ -59,6 +82,42 @@ public class HomeTopFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home_top, container, false);
}
}
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
List<ListItem> listItem = lacertaLibrary.getRecentDocument(100).getListItems();
Log.d("docs", Integer.toString(listItem.size()));
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
MyAdapter myAdapter = new MyAdapter(listItems);
recyclerView.setAdapter(myAdapter);
return view;
}
String pageTitle;
String pageId;
ArrayList listItems;
String title;
String description;
String itemId;
}
@@ -0,0 +1,70 @@
package one.nem.lacerta.feature.home;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.document.DocumentMeta;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
ArrayList<ListItem> listItems;
public MyAdapter(ArrayList<ListItem> ListItem) {
// this.listItem = listItem;
}
@NonNull
@Override
public MyAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_home_document, parent, false);
return new MyAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) {
holder.title.setText(listItems.get(position).getTitle());
holder.description.setText(listItems.get(position).getDescription());
}
@Override
public int getItemCount() {
return listItems.size();
}
public class MyAdapterViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
public MyAdapterViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.debug_menu_item_title);
description = itemView.findViewById(R.id.debug_menu_item_description);
}
}
}
@@ -3,12 +3,19 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeTopFragment">
tools:context=".HomeTopFragment"
tools:ignore="ExtraText">
<!-- TODO: Update blank fragment layout -->
<TextView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/item_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</FrameLayout>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/debug_menu_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/debug_menu_item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
<TextView
android:id="@+id/debug_menu_item_updated_at_home"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="Updated at: aaaaaaaaaa"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="my_recycler_view" type="id" />
<item name="TITLE" type="id" />
<item name="textView" type="id" />
</resources>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
@@ -1,4 +1,5 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="textview">TextView</string>
</resources>
@@ -25,6 +25,8 @@ import one.nem.lacerta.data.Document;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.tag.DocumentTag;
/**
* A simple {@link Fragment} subclass.
* Use the {@link LibraryTopFragment#newInstance} factory method to
@@ -73,4 +73,6 @@ public class DocumentDetail {
this.pages = pages;
}
}
}
@@ -3,27 +3,30 @@ package one.nem.lacerta.processor.impl;
import android.graphics.Bitmap;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.UUID;
// Hilt
import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject;
import one.nem.lacerta.model.document.internal.XmlMetaPageModel;
import one.nem.lacerta.processor.DocumentProcessor;
// Lacerta/model
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.internal.XmlMetaModel;
import one.nem.lacerta.model.document.page.Page;
// Lacerta/processor
import one.nem.lacerta.processor.DocumentProcessor;
// Lacerta/source
import one.nem.lacerta.source.file.FileManager;
import one.nem.lacerta.source.file.factory.FileManagerFactory;
// Lacerta/utils
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.utils.XmlMetaParser;
import one.nem.lacerta.utils.repository.DeviceInfoUtils;
// Lacerta/vcs
import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
-1
View File
@@ -30,5 +30,4 @@ include ':source'
include ':model'
include ':processor'
include ':shared:ui'
include ':shared:icon'
include ':vcs'
@@ -1,31 +0,0 @@
package one.nem.lacerta.source.jgit;
import org.eclipse.jgit.lib.Repository;
public interface ActionRepo {
// リポジトリをインスタンス変数に格納
void setRepository(Repository repository);
// リポジトリ取得
Repository getRepository();
// リポジトリ名取得
String getRepositoryName();
// ステージングされていないファイルの一覧を取得
String[] getUnstagedFiles();
// ステージングされているファイルの一覧を取得
String[] getStagedFiles();
// ファイルをステージング
void stageFile(String path);
// ファイルをアンステージング
void unstageFile(String path);
// ステージングされているファイルをコミット
void commit(String message);
}
@@ -1,17 +0,0 @@
package one.nem.lacerta.source.jgit;
import org.eclipse.jgit.lib.Repository;
public interface JGitRepository {
// リポジトリ取得
Repository getRepository(String id);
// リポジトリ作成
Repository createRepository(String id);
// リポジトリ削除
void deleteRepository(String id);
// リポジトリ存在確認
boolean repositoryExists(String id);
}
@@ -1,101 +0,0 @@
package one.nem.lacerta.source.jgit.impl;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
import javax.inject.Inject;
import one.nem.lacerta.source.jgit.ActionRepo;
import one.nem.lacerta.utils.LacertaLogger;
public class ActionRepoImpl implements ActionRepo{
@Inject // Inject logger
LacertaLogger logger;
private final String TAG = "ActionRepoImpl";
Repository repository;
Git git;
// Internal method
private Git getGit() {
if (this.git == null) {
logger.debug(TAG, "getGit: git is null. Creating new Git instance");
this.git = new Git(repository);
}
return this.git;
}
@Override
public void setRepository(Repository repository) {
this.repository = repository;
}
@Override
public Repository getRepository() {
if (repository == null) {
logger.warn(TAG, "getRepository: repository is null. Throwing RuntimeException");
throw new RuntimeException("リポジトリが設定されていません");
}
return repository;
}
@Override
public String getRepositoryName() {
return repository.getDirectory().getParentFile().getName();
}
@Override
public String[] getUnstagedFiles() {
Git git = getGit();
try {
return git.status().call().getUntracked().toArray(new String[0]);
} catch (Exception e) { // TODO-rca: エラーハンドリング
logger.error(TAG, "getUnstagedFiles: " + e.getMessage());
return new String[0];
}
}
@Override
public String[] getStagedFiles() {
Git git = getGit();
try {
return git.status().call().getAdded().toArray(new String[0]);
} catch (Exception e) { // TODO-rca: エラーハンドリング
logger.error(TAG, "getStagedFiles: " + e.getMessage());
return new String[0];
}
}
@Override
public void stageFile(String path) {
Git git = getGit();
try {
git.add().addFilepattern(path).call();
} catch (Exception e) { // TODO-rca: エラーハンドリング
logger.error(TAG, "stageFile: " + e.getMessage());
}
}
@Override
public void unstageFile(String path) {
Git git = getGit();
try {
git.reset().addPath(path).call();
} catch (Exception e) { // TODO-rca: エラーハンドリング
logger.error(TAG, "unstageFile: " + e.getMessage());
}
}
@Override
public void commit(String message) {
Git git = getGit();
try {
git.commit().setMessage(message).call();
} catch (Exception e) { // TODO-rca: エラーハンドリング
logger.error(TAG, "commit: " + e.getMessage());
}
}
}
@@ -1,55 +0,0 @@
package one.nem.lacerta.source.jgit.impl;
import one.nem.lacerta.source.jgit.JGitRepository;
import javax.inject.Inject;
import one.nem.lacerta.utils.repository.DeviceInfoUtils;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryBuilder;
public class JGitRepositoryImpl implements JGitRepository {
private final DeviceInfoUtils deviceInfoUtils;
@Inject
public JGitRepositoryImpl(DeviceInfoUtils deviceInfoUtils) {
this.deviceInfoUtils = deviceInfoUtils;
}
@Override
public Repository getRepository(String id) {
RepositoryBuilder repositoryBuilder = new RepositoryBuilder();
repositoryBuilder.setGitDir(deviceInfoUtils.getExternalStorageDirectory().resolve(id).resolve(".git").toFile());
repositoryBuilder.setMustExist(true);
try {
return repositoryBuilder.build();
} catch (Exception e) {
return null;
}
}
@Override
public Repository createRepository(String id) {
RepositoryBuilder repositoryBuilder = new RepositoryBuilder();
repositoryBuilder.setGitDir(deviceInfoUtils.getExternalStorageDirectory().resolve(id).resolve(".git").toFile());
repositoryBuilder.setMustExist(false);
try {
return repositoryBuilder.build();
} catch (Exception e) {
return null;
}
}
@Override
public void deleteRepository(String id) {
// TODO-rca: 未実装
}
@Override
public boolean repositoryExists(String id) {
return false; // TODO-rca: 未実装
}
}
Whitespace-only changes.
@@ -1,15 +0,0 @@
package one.nem.lacerta.source.jgit.module;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.source.jgit.JGitRepository;
@Module
@InstallIn(SingletonComponent.class)
abstract public class JGitRepositoryModule {
@Binds
public abstract JGitRepository bindManageRepo(one.nem.lacerta.source.jgit.impl.JGitRepositoryImpl manageRepoImpl);
}
Whitespace-only changes.