Compare commits

..
Author SHA1 Message Date
r-ca 3a979b7dab WIP 2024-01-19 17:18:34 +09:00
r-ca f1d8a3341e padding追加 2024-01-19 16:59:12 +09:00
r-ca 462495b173 radius変更 2024-01-19 16:53:36 +09:00
r-ca 74d1011412 fix 2024-01-19 16:53:15 +09:00
r-ca 52d2a244a0 WIP 2024-01-19 16:36:44 +09:00
r-ca 1b050f5d3c リソースファイル追加tuika 2024-01-19 16:19:17 +09:00
r-ca 2cec483288 MaterialToolBarへ変更 2024-01-19 16:16:49 +09:00
r-ca 10019cb86b タイトルを中央へ WIP 2024-01-19 16:12:41 +09:00
r-ca 83806e0d90 仮置きアイテム追加 2024-01-19 16:08:50 +09:00
r-ca 30661e1a2b 実装テスト 2024-01-19 16:08:41 +09:00
r-ca 26326024e0 仮置き用リソース追加 2024-01-19 16:06:44 +09:00
r-ca b0bd74af5a 全体のUIを修正 WIP 2024-01-19 16:04:10 +09:00
ろむねこ 9ad6a6291d Merge pull request #82 from lacerta-doc/improve/extract_resource_1
テキストリソースを抽出 1
2024-01-19 15:32:45 +09:00
r-ca 4235030986 外部リソースを使うように 2024-01-19 15:27:51 +09:00
r-ca c60fedeb87 WIP 2024-01-19 15:26:57 +09:00
r-ca 2f18134581 WIP 2024-01-19 15:25:28 +09:00
ろむねこ 4101f75685 Merge pull request #81 from lacerta-doc/refactor/refactor1
リファクタリング
2024-01-19 15:20:52 +09:00
r-ca 184771c92d リソースを切り出す準備 2024-01-19 15:19:15 +09:00
r-ca 3e12f1222b ナビゲーションの並び順を変更 2024-01-19 15:17:44 +09:00
r-ca 29f2749cb7 整形 2024-01-19 15:16:20 +09:00
r-ca 244b2fb123 リファクタリング 2024-01-19 15:15:46 +09:00
r-ca 725d541316 リファクタリング 2024-01-19 15:14:08 +09:00
r-ca fc712a131a Revert "utilsを依存関係に追加, LoggerをInject"
This reverts commit 42eb3d4c80.
2024-01-19 15:07:35 +09:00
r-ca cc7b0dc5d1 Revert "utilsを依存関係に追加, LoggerをInject"
This reverts commit 169a6c6e0a.
2024-01-19 15:07:34 +09:00
r-ca 169a6c6e0a utilsを依存関係に追加, LoggerをInject 2024-01-19 15:07:27 +09:00
r-ca 42eb3d4c80 utilsを依存関係に追加, LoggerをInject 2024-01-19 15:07:23 +09:00
r-ca 1c87b73a5b テスト用に設置していたトーストを削除 2024-01-19 15:05:44 +09:00
ろむねこ 46f119b531 Merge pull request #80 from lacerta-doc/improve/bottom_nav_color
システムナビゲーションの色をUIにあわせるようにした
2024-01-19 15:02:32 +09:00
r-ca def799bbe6 APIレベル27以上でシステムナビゲーションのアイコン色を適切に変更できるようにした 2024-01-19 15:01:20 +09:00
r-ca defc051436 システムナビゲーションの背景をボトムナビゲーションと同じに 2024-01-19 14:56:44 +09:00
r-ca de9b68de87 Revert "依存関係追加"
This reverts commit 802e4cc75a.
2024-01-19 14:50:20 +09:00
r-ca 802e4cc75a 依存関係追加 2024-01-19 14:48:17 +09:00
ろむねこ abc91b79ee Merge pull request #79 from lacerta-doc/feature/search/add_ui
Feature/search/add UI
2024-01-19 14:24:03 +09:00
Fuchimoto1234 b601b28f81 search UI 2024-01-19 12:49:33 +09:00
Fuchimoto1234 853ac1eca3 search UI 2024-01-19 12:42:04 +09:00
Fuchimoto1234 834bc35318 search UI 2024-01-19 12:30:17 +09:00
Fuchimoto1234 1e3a3262a4 search UI 2024-01-19 12:11:56 +09:00
r-ca 475c511d32 hotfix 2024-01-18 18:23:14 +09:00
r-ca 474d6417c9 hotfix: Adapterの初期化処理修正 2024-01-18 18:22:10 +09:00
r-ca c7e141b892 hotfix: 型の変更に追従 2024-01-18 18:21:01 +09:00
ろむねこ 3d2cc5ac05 Merge pull request #78 from lacerta-doc/feature/home/add_document_history
ドキュメント履歴をホームに追加
2024-01-18 18:19:49 +09:00
r-ca 73c310ee01 hotfix: 型の変更に追従 2024-01-18 18:16:44 +09:00
ろむねこ 5c3d811979 Merge pull request #77 from lacerta-doc/feature/lacerta_library_recent
Feature/lacerta library recent
2024-01-18 18:12:18 +09:00
ろむねこ f5bc740f58 Merge pull request #76 from lacerta-doc/feature/scan_and_save_document
Feature/scan and save document
2024-01-18 18:11:21 +09:00
r-ca 8a57331d32 メニューに検索を追加 2024-01-18 14:33:27 +09:00
r-ca abdca108d4 ナビゲーショングラフに追加 2024-01-18 14:32:57 +09:00
r-ca 8b66646e7d ナビゲーショングラフ作成 2024-01-18 14:32:36 +09:00
r-ca c9160a2df0 依存関係修正 2024-01-18 14:31:52 +09:00
r-ca c5b0a33720 Revert "ナビゲーショングラフ作成"
This reverts commit 13f31017f7.
2024-01-18 14:31:30 +09:00
r-ca 13f31017f7 ナビゲーショングラフ作成 2024-01-18 14:30:22 +09:00
r-ca e6778e6214 フラグメント作成 2024-01-18 14:29:29 +09:00
Fuchimoto1234 71f9be77cd fix 2024-01-17 12:58:25 +09:00
r-ca e0d63122bd getRecentDocument実装 2024-01-17 12:52:13 +09:00
r-ca 1c3fdf921d Dao追加 2024-01-17 12:52:05 +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 3be6185c21 getRecentDocumentの戻り値を変更 2024-01-17 12:15:47 +09:00
r-ca c82952f397 スキーマ更新, Dao更新 2024-01-17 12:11:12 +09:00
r-ca 8c9dc14f16 DBスキーマアップデート 2024-01-17 12:09:27 +09:00
r-ca d22644e37a 依存関係に追加 2024-01-17 12:08:54 +09:00
r-ca c80576d046 修正 2024-01-17 12:08:45 +09:00
r-ca b7cb4369d1 クエリ追加 2024-01-17 12:08:24 +09:00
r-ca 2cfab24c76 Injection追加 2024-01-17 12:07:28 +09:00
r-ca 55b34d964c Folderをデータベースに保存するように WIP 2024-01-17 12:07:18 +09:00
r-ca 744a2bef65 actionを追加するように WIP 2024-01-17 11:25:41 +09:00
r-ca 74becab37b デバッグ用のログポイント追加 2024-01-17 11:09:33 +09:00
r-ca 58d6ae17c6 タイミングの都合でエラーが出るのでloggerを使わないように 2024-01-17 11:07:54 +09:00
r-ca dea5f240f0 ドキュメント新規保存のロジックを実装 WIP 2024-01-17 11:05:25 +09:00
r-ca 119771a7f9 コメント追加, デバッグ用の実装を追加 2024-01-17 11:00:20 +09:00
r-ca b6a30d5cbf Document実装 2024-01-17 10:57:08 +09:00
r-ca 2ec4b96c14 Vcs変更 2024-01-17 10:55:39 +09:00
r-ca 151911d0b2 バージョンコード更新 2024-01-17 10:46:55 +09:00
r-ca d832438f8f Vcs実装 2024-01-17 10:46:31 +09:00
r-ca 0487553f3b Dao追加 2024-01-17 10:40:01 +09:00
r-ca 678c9730ef Dao追加 2024-01-17 10:39:17 +09:00
r-ca e1b43a5f22 EntityにisIncludedを追加 2024-01-17 10:37:42 +09:00
r-ca d384347e0a Merge branch 'develop' into feature/scan_and_save_document 2024-01-17 10:31:28 +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
r-ca a61c044391 新ドキュメントを生成できるように 2024-01-16 12:36:28 +09:00
r-ca bc19dd22d8 DocumentMetaにコンストラクタを追加 2024-01-16 12:35:19 +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
58 changed files with 929 additions and 347 deletions

No files matched your search

+1 -1
View File
@@ -4,6 +4,7 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" /> <option name="gradleJvm" value="jbr-17" />
<option name="modules"> <option name="modules">
@@ -25,7 +26,6 @@
<option value="$PROJECT_DIR$/model" /> <option value="$PROJECT_DIR$/model" />
<option value="$PROJECT_DIR$/processor" /> <option value="$PROJECT_DIR$/processor" />
<option value="$PROJECT_DIR$/shared" /> <option value="$PROJECT_DIR$/shared" />
<option value="$PROJECT_DIR$/shared/icon" />
<option value="$PROJECT_DIR$/shared/ui" /> <option value="$PROJECT_DIR$/shared/ui" />
<option value="$PROJECT_DIR$/source" /> <option value="$PROJECT_DIR$/source" />
<option value="$PROJECT_DIR$/utils" /> <option value="$PROJECT_DIR$/utils" />
+1 -2
View File
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <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" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
+9 -26
View File
@@ -59,32 +59,6 @@ dependencies {
androidTestImplementation libs.androidx.test.ext.junit androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core androidTestImplementation libs.androidx.test.espresso.core
// 内部モジュール
// Feature
implementation project(':feature:home')
implementation project(':feature:search')
implementation project(':feature:library')
implementation project(':feature:scan')
implementation project(':feature:debug') // デバッグメニュー
// // Component
// implementation project(':component:common')
// implementation project(':component:scanner')
// implementation project(':component:viewer')
// // Data
// implementation project(':data:repository')
//
// // Source
// implementation project(':data:source:database')
// implementation project(':data:source:preference')
//
implementation project(':data')
implementation project(':shared:ui')
implementation project(':shared:icon')
// Hilt (DI) // Hilt (DI)
implementation libs.com.google.dagger.hilt.android implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler annotationProcessor libs.com.google.dagger.hilt.compiler
@@ -94,4 +68,13 @@ dependencies {
implementation libs.navigation.ui implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment implementation libs.navigation.dynamic.features.fragment
// Feature
implementation project(':feature:home')
implementation project(':feature:search')
implementation project(':feature:library')
implementation project(':feature:scan')
implementation project(':feature:debug') // デバッグメニュー
implementation project(':data')
implementation project(':shared:ui')
} }
@@ -1,6 +1,7 @@
package one.nem.lacerta; package one.nem.lacerta;
import android.app.Application; import android.app.Application;
import android.util.Log;
import com.google.android.material.color.DynamicColors; import com.google.android.material.color.DynamicColors;
@@ -12,7 +13,13 @@ public class LacertaApplication extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
// DynamicColorを有効化 if (DynamicColors.isDynamicColorAvailable()) {
DynamicColors.applyToActivitiesIfAvailable(this); Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
DynamicColors.applyToActivitiesIfAvailable(this);
} else {
Log.d("DynamicColors", "DynamicColors is not available.");
}
} }
} }
@@ -1,17 +1,26 @@
package one.nem.lacerta; package one.nem.lacerta;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.NavigationUI; import androidx.navigation.ui.NavigationUI;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.shape.CornerFamily;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
@@ -25,16 +34,56 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
// Debug // Init navigation
FragmentManager supportFragmentManager = getSupportFragmentManager(); try {
FragmentManager supportFragmentManager = getSupportFragmentManager();
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
assert navHostFragment != null;
NavController navController = navHostFragment.getNavController();
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
NavigationUI.setupWithNavController(bottomNavigationView, navController);
}
catch (Exception e) {
Log.e("Init", "Failed to init navigation");
Log.e("Init", "Searchable Error code: " + "894b5941-3bc0-46fe-b752-0dbc88be29a8");
Toast.makeText(this, "Failed to init navigation", Toast.LENGTH_LONG).show();
finish(); // Exit app
}
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment); // Set navigation bar color
NavController navController = navHostFragment.getNavController(); getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
NavigationUI.setupWithNavController(bottomNavigationView, navController); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show(); // // Create a new TextView
// TextView toolbarTitle = new TextView(this);
// // Set the text and center it in the TextView
// toolbarTitle.setText("App Name");
// toolbarTitle.setTextColor(Color.WHITE);
// toolbarTitle.setTextSize(20);
// toolbarTitle.setLayoutParams(new Toolbar.LayoutParams(Toolbar.LayoutParams.WRAP_CONTENT,
// Toolbar.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL));
//
// // Set the TextView as the title
// toolbar.addView(toolbarTitle);
float radius = getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius);
MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable)toolbar.getBackground();
materialShapeDrawable.setShapeAppearanceModel(materialShapeDrawable.getShapeAppearanceModel()
.toBuilder()
.setAllCorners(CornerFamily.ROUNDED,radius)
.build());
// Set the MaterialShapeDrawable as the background of the Toolbar
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
drawer.addDrawerListener(toggle);
toggle.syncState();
// Set the app name in the middle of the toolbar
getSupportActionBar().setTitle("App Name");
} }
}
}
+54 -22
View File
@@ -1,32 +1,64 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta" android:theme="@style/Theme.Lacerta"
tools:context=".MainActivity"> tools:context=".MainActivity">
<androidx.fragment.app.FragmentContainerView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/nav_host_fragment" android:layout_width="match_parent"
android:name="androidx.navigation.fragment.NavHostFragment" android:layout_height="match_parent">
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/main_nav"
tools:layout="@layout/fragment_debug_menu_container" />
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.appbar.AppBarLayout
android:id="@+id/bottom_nav" android:id="@+id/app_bar_layout"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent">
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout> <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?attr/colorSecondaryContainer"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_margin="8dp"
app:titleCentered="true" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar_layout"
app:navGraph="@navigation/main_nav"
tools:layout="@layout/fragment_debug_menu_container" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- NavigationView for the navigation drawer -->
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/drawer_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
+8 -4
View File
@@ -4,17 +4,21 @@
<item <item
android:id="@id/feature_home_navigation" android:id="@id/feature_home_navigation"
android:icon="@drawable/home_24px" android:icon="@drawable/home_24px"
android:title="Home"/> android:title="@string/home_title"/>
<item
android:id="@id/feature_search_navigation"
android:icon="@drawable/search_24px"
android:title="@string/search_title"/>
<item <item
android:id="@id/feature_library_navigation" android:id="@id/feature_library_navigation"
android:icon="@drawable/folder_24px" android:icon="@drawable/folder_24px"
android:title="Library"/> android:title="@string/library_title"/>
<item <item
android:id="@id/feature_debug_navigation" android:id="@id/feature_debug_navigation"
android:icon="@drawable/developer_mode_24px" android:icon="@drawable/developer_mode_24px"
android:title="Debug menu"/> android:title="@string/debug_menu_title"/>
</menu> </menu>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:icon="@drawable/developer_mode_24px"
android:title="@string/placeholder" />
</menu>
+1
View File
@@ -9,6 +9,7 @@
<include app:graph="@navigation/feature_library_navigation" /> <include app:graph="@navigation/feature_library_navigation" />
<include app:graph="@navigation/feature_home_navigation" /> <include app:graph="@navigation/feature_home_navigation" />
<include app:graph="@navigation/feature_search_navigation" />
</navigation> </navigation>
@@ -26,8 +26,12 @@ import java.util.Objects;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.processor.factory.DocumentProcessorFactory;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.data.Document; import one.nem.lacerta.data.Document;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
@AndroidEntryPoint @AndroidEntryPoint
public class ScannerManagerActivity extends AppCompatActivity { public class ScannerManagerActivity extends AppCompatActivity {
@@ -40,6 +44,11 @@ public class ScannerManagerActivity extends AppCompatActivity {
@Inject @Inject
Document document; Document document;
@Inject
DocumentProcessorFactory documentProcessorFactory;
@Inject
LacertaVcsFactory lacertaVcsFactory;
// Variables // Variables
private ArrayList<Bitmap> croppedImages = new ArrayList<>(); private ArrayList<Bitmap> croppedImages = new ArrayList<>();
@@ -143,7 +152,21 @@ public class ScannerManagerActivity extends AppCompatActivity {
private void saveNewDocument() { private void saveNewDocument() {
logger.debug(TAG, "saveNewDocument"); logger.debug(TAG, "saveNewDocument");
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
DocumentDetail documentDetail = document.createDocument(documentMeta);
Bitmap[] bitmaps = new Bitmap[this.croppedImages.size()];
this.croppedImages.toArray(bitmaps);
try {
documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps);
Toast.makeText(this, "Saved.", Toast.LENGTH_SHORT).show();
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent("Initial commit");
lacertaVcsFactory.create(documentDetail.getMeta().getId()).printLog(); // Debug
lacertaVcsFactory.create(documentDetail.getMeta().getId()).printRev(); // Debug
finish();
} catch (Exception e) {
logger.error(TAG, "Error: " + e.getMessage());
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
}
} }
private void insertToExistDocument() { private void insertToExistDocument() {
@@ -1,5 +1,8 @@
package one.nem.lacerta.data; package one.nem.lacerta.data;
import java.util.ArrayList;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.ListItemType;
import one.nem.lacerta.model.LibraryItemPage; import one.nem.lacerta.model.LibraryItemPage;
@@ -8,8 +11,8 @@ import one.nem.lacerta.model.document.DocumentDetail;
public interface LacertaLibrary { public interface LacertaLibrary {
// Get History // Get History
LibraryItemPage getRecentDocument(int limit); ArrayList<ListItem> getRecentDocument(int limit);
LibraryItemPage getRecentDocument(int limit, int offset); ArrayList<ListItem> getRecentDocument(int limit, int offset);
// Get Library page // Get Library page
LibraryItemPage getLibraryPage(int limit); LibraryItemPage getLibraryPage(int limit);
@@ -2,33 +2,29 @@ package one.nem.lacerta.data.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.UUID; import java.util.UUID;
// Hilt
import javax.inject.Inject; import javax.inject.Inject;
// Lacerta/data
import one.nem.lacerta.data.Document; import one.nem.lacerta.data.Document;
// Lacerta/model
import one.nem.lacerta.model.PublicPath; import one.nem.lacerta.model.PublicPath;
import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath; // Lacerta/source
import one.nem.lacerta.model.document.tag.DocumentTag;
import one.nem.lacerta.source.database.LacertaDatabase; import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.DocumentEntity; 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; // Lacerta/utils
import one.nem.lacerta.vcs.ActionType;
import one.nem.lacerta.source.file.factory.FileManagerFactory;
import one.nem.lacerta.source.jgit.JGitRepository;
import one.nem.lacerta.utils.LacertaLogger; 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.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
public class DocumentImpl implements Document { public class DocumentImpl implements Document {
@@ -42,13 +38,13 @@ public class DocumentImpl implements Document {
LacertaDatabase database; LacertaDatabase database;
@Inject @Inject
LacertaVcs vcs; LacertaVcsFactory vcsFactory;
@Inject @Inject
public DocumentImpl() { public DocumentImpl() {
// Init // Init
logger.debug(TAG, "called"); // logger.debug(TAG, "called");
} }
@@ -74,6 +70,7 @@ public class DocumentImpl implements Document {
database.documentDao().insert(documentEntity); database.documentDao().insert(documentEntity);
// Vcs // Vcs
LacertaVcs vcs = vcsFactory.create(meta.getId());
vcs.createDocument(meta.getId()); vcs.createDocument(meta.getId());
return detail; return detail;
@@ -1,18 +1,48 @@
package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.LibraryItemPage; import one.nem.lacerta.model.LibraryItemPage;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.ListItemType;
import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.common.DateTypeConverter;
import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.utils.LacertaLogger;
public class LacertaLibraryImpl implements LacertaLibrary { public class LacertaLibraryImpl implements LacertaLibrary {
@Inject
LacertaLogger logger;
@Inject
LacertaDatabase database;
@Override @Override
public LibraryItemPage getRecentDocument(int limit) { public ArrayList<ListItem> getRecentDocument(int limit) {
return null; List<DocumentEntity> documentEntities = database.documentDao().getRecentDocument(limit);
ArrayList<ListItem> listItems = new ArrayList<>();
for (DocumentEntity documentEntity : documentEntities) {
ListItem listItem = new ListItem();
listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT);
listItem.setTitle(documentEntity.title);
listItem.setDescription(DateFormat.getDateInstance().format(documentEntity.updatedAt));
listItem.setItemId(documentEntity.id);
listItems.add(listItem);
}
return listItems;
} }
@Override @Override
public LibraryItemPage getRecentDocument(int limit, int offset) { public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
return null; return null; // TODO-rca: Implement
} }
@Override @Override
@@ -148,8 +148,8 @@ public class LacertaLibraryStubImpl implements LacertaLibrary {
* @return ページオブジェクト * @return ページオブジェクト
*/ */
@Override @Override
public LibraryItemPage getRecentDocument(int limit) { public ArrayList<ListItem> getRecentDocument(int limit) {
return getRecentDocumentPage(limit); return getRecentDocumentPage(limit).getListItems();
} }
/** /**
@@ -159,8 +159,8 @@ public class LacertaLibraryStubImpl implements LacertaLibrary {
* @return ページオブジェクト * @return ページオブジェクト
*/ */
@Override @Override
public LibraryItemPage getRecentDocument(int limit, int offset) { public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
return getRecentDocumentPage(limit); return getRecentDocumentPage(limit).getListItems();
} }
/** /**
@@ -1,10 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".DebugMenuContainerActivity"
android:exported="false" />
</application>
</manifest> </manifest>
@@ -57,13 +57,13 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false);
LibraryItemPage libraryItemPage = lacertaLibrary.getRecentDocument(10); ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(10);
for (ListItem listItem : libraryItemPage.getListItems()) { for (ListItem listItem : listItems) {
System.out.println(listItem.getTitle()); System.out.println(listItem.getTitle());
} }
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view); RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
recyclerView.setAdapter(new ItemAdapter(libraryItemPage.getListItems())); recyclerView.setAdapter(new ItemAdapter(listItems));
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@@ -23,4 +23,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" /> app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
+15
View File
@@ -1,4 +1,5 @@
plugins { plugins {
id 'com.google.dagger.hilt.android'
id 'com.android.library' id 'com.android.library'
} }
@@ -29,6 +30,8 @@ dependencies {
implementation libs.androidx.appcompat implementation libs.androidx.appcompat
implementation libs.com.google.android.material implementation libs.com.google.android.material
implementation project(path: ':feature:debug')
implementation project(path: ':utils')
testImplementation libs.junit testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core androidTestImplementation libs.androidx.test.espresso.core
@@ -38,6 +41,18 @@ dependencies {
implementation libs.navigation.ui implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment implementation libs.navigation.dynamic.features.fragment
// DI
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
// shared // shared
implementation project(':shared:ui') 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 of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("one.nem.lacerta.feature.home.test", appContext.getPackageName()); assertEquals("one.nem.lacerta.feature.home.test", appContext.getPackageName());
} }
} }
@@ -1,20 +1,40 @@
package one.nem.lacerta.feature.home; package one.nem.lacerta.feature.home;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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. * A simple {@link Fragment} subclass.
* Use the {@link HomeTopFragment#newInstance} factory method to * Use the {@link HomeTopFragment#newInstance} factory method to
* create an instance of this fragment. * create an instance of this fragment.
*/ */
@AndroidEntryPoint
public class HomeTopFragment extends Fragment { public class HomeTopFragment extends Fragment {
@Inject
LacertaLibrary lacertaLibrary;
// TODO: Rename parameter arguments, choose names that match // TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM1 = "param1";
@@ -46,12 +66,15 @@ public class HomeTopFragment extends Fragment {
return fragment; return fragment;
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getArguments() != null) { if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1); mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2); mParam2 = getArguments().getString(ARG_PARAM2);
} }
} }
@@ -59,6 +82,42 @@ public class HomeTopFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // 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);
ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(100);
Log.d("docs", Integer.toString(listItems.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> listItems) {
this.listItems = listItems;
}
@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,20 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".HomeTopFragment"> tools:context=".HomeTopFragment"
tools:ignore="ExtraText"
android:background="@color/colorSurface">
<!-- TODO: Update blank fragment layout --> <!-- TODO: Update blank fragment layout -->
<TextView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/item_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:text="@string/hello_blank_fragment" />
</androidx.recyclerview.widget.RecyclerView>
</FrameLayout> </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> <resources>
<!-- TODO: Remove or change this placeholder text --> <!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</string>
<string name="textview">TextView</string>
</resources> </resources>
@@ -25,6 +25,8 @@ import one.nem.lacerta.data.Document;
import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.tag.DocumentTag; import one.nem.lacerta.model.document.tag.DocumentTag;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
* Use the {@link LibraryTopFragment#newInstance} factory method to * Use the {@link LibraryTopFragment#newInstance} factory method to
+13 -5
View File
@@ -27,9 +27,17 @@ android {
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1' implementation libs.androidx.appcompat
implementation 'com.google.android.material:material:1.10.0' implementation libs.com.google.android.material
testImplementation 'junit:junit:4.13.2' testImplementation libs.junit
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation libs.androidx.test.espresso.core
// Navigation
implementation libs.navigation.fragment
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// shared
implementation project(':shared:ui')
} }
@@ -0,0 +1,142 @@
package one.nem.lacerta.feature.search;
import android.app.LauncherActivity;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SearchTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SearchTopFragment extends Fragment {
private static final String TAG = SearchTopFragment.class.getSimpleName();
private final SearchTopFragment self = this;
private SearchView searchView;
private String searchWord;
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public SearchTopFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment SearchTopFragment.
*/
// TODO: Rename and change types and number of parameters
public static SearchTopFragment newInstance(String param1, String param2) {
SearchTopFragment fragment = new SearchTopFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_search_top, container, false);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
this.searchView.setIconifiedByDefault(true);
this.searchView.setSubmitButtonEnabled(false);
if (!this.searchWord.equals("")) {
this.searchView.setQuery(this.searchWord, false);
} else {
String queryHint = self.getResources().getString(R.string.hello_blank_fragment);
this.searchView.setQueryHint(queryHint);
}
this.searchView.setOnQueryTextListener(self.onQueryTextListener);
}
private final SearchView.OnQueryTextListener onQueryTextListener = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return self.setSearchWord(searchWord);
}
@Override
public boolean onQueryTextChange(String query) {
return false;
}
};
private boolean setSearchWord(String query) {
if (searchWord != null && !searchWord.equals("")) {
this.searchWord = searchWord;
}
this.searchView.setIconified(false);
this.searchView.onActionViewCollapsed();
this.searchView.clearFocus();
return false;
}
}
interface LacertaSearch {
ArrayList<LauncherActivity.ListItem> autoSearch(String query, int limit);
ArrayList<LauncherActivity.ListItem> autoSearch(String query, int limit, int offset);
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".SearchTopFragment">
<!-- TODO: Update blank fragment layout -->
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/Search_tool_bar"
android:layout_width="match_parent"
android:layout_height="69dp"
android:background="#E4E8EA"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="" />
<SearchView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feature_search_navigation"
app:startDestination="@id/searchTopFragment">
<fragment
android:id="@+id/searchTopFragment"
android:name="one.nem.lacerta.feature.search.SearchTopFragment"
android:label="fragment_search_top"
tools:layout="@layout/fragment_search_top" />
</navigation>
@@ -0,0 +1,4 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
@@ -73,4 +73,6 @@ public class DocumentDetail {
this.pages = pages; this.pages = pages;
} }
}
}
@@ -48,6 +48,17 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
public DocumentMeta() { public DocumentMeta() {
} }
public DocumentMeta(String title) {
this.id = UUID.randomUUID().toString();
this.title = title;
this.tags = new ArrayList<>();
this.author = ""; // TODO-rca: 作者のデフォルト値を設定できるようにする
this.defaultBranch = "main"; // TODO-rca: デフォルトブランチのデフォルト値を設定できるようにする
this.path = new PublicPath().getRoot();
this.updatedAt = new Date();
this.createdAt = new Date();
}
public DocumentMeta(String title, List<DocumentTag> tags, String author, String defaultBranch) { public DocumentMeta(String title, List<DocumentTag> tags, String author, String defaultBranch) {
this.id = UUID.randomUUID().toString(); this.id = UUID.randomUUID().toString();
this.title = title; this.title = title;
@@ -3,27 +3,30 @@ package one.nem.lacerta.processor.impl;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList;
import java.util.UUID; import java.util.UUID;
// Hilt
import dagger.assisted.Assisted; import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject; 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.DocumentDetail;
import one.nem.lacerta.model.document.internal.XmlMetaModel; import one.nem.lacerta.model.document.internal.XmlMetaModel;
import one.nem.lacerta.model.document.page.Page; 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.FileManager;
import one.nem.lacerta.source.file.factory.FileManagerFactory; import one.nem.lacerta.source.file.factory.FileManagerFactory;
// Lacerta/utils
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.utils.XmlMetaParser; import one.nem.lacerta.utils.XmlMetaParser;
import one.nem.lacerta.utils.repository.DeviceInfoUtils; import one.nem.lacerta.utils.repository.DeviceInfoUtils;
// Lacerta/vcs
import one.nem.lacerta.vcs.LacertaVcs; import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory; import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
-1
View File
@@ -30,5 +30,4 @@ include ':source'
include ':model' include ':model'
include ':processor' include ':processor'
include ':shared:ui' include ':shared:ui'
include ':shared:icon'
include ':vcs' include ':vcs'
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorOnPrimary</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/colorOnSecondary</item>
<item name="colorSurface">@color/colorSurface</item>
<item name="colorOnSurface">@color/colorOnSurface</item>
<item name="colorSurfaceVariant">@color/colorSurfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/colorOnSurfaceVariant</item>
<item name="colorSurfaceInverse">@color/colorSurfaceInverse</item>
<item name="colorOnSurfaceInverse">@color/colorOnSurfaceInverse</item>
<item name="colorPrimaryInverse">@color/colorPrimaryInverse</item>
<item name="colorPrimaryContainer">@color/colorPrimaryContainer</item>
<item name="colorOnPrimaryContainer">@color/colorOnPrimaryContainer</item>
<item name="colorSecondaryContainer">@color/colorSecondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/colorOnSecondaryContainer</item>
<item name="colorTertiary">@color/colorTertiary</item>
<item name="colorOnTertiary">@color/colorOnTertiary</item>
<item name="colorTertiaryContainer">@color/colorTertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/colorOnTertiaryContainer</item>
<item name="colorError">@color/colorError</item>
<item name="colorOnError">@color/colorOnError</item>
<item name="colorErrorContainer">@color/colorErrorContainer</item>
<item name="colorOnErrorContainer">@color/colorOnErrorContainer</item>
<item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">false</item>
</style>
</resources>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorOnPrimary</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/colorOnSecondary</item>
<item name="colorSurface">@color/colorSurface</item>
<item name="colorOnSurface">@color/colorOnSurface</item>
<item name="colorSurfaceVariant">@color/colorSurfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/colorOnSurfaceVariant</item>
<item name="colorSurfaceInverse">@color/colorSurfaceInverse</item>
<item name="colorOnSurfaceInverse">@color/colorOnSurfaceInverse</item>
<item name="colorPrimaryInverse">@color/colorPrimaryInverse</item>
<item name="colorPrimaryContainer">@color/colorPrimaryContainer</item>
<item name="colorOnPrimaryContainer">@color/colorOnPrimaryContainer</item>
<item name="colorSecondaryContainer">@color/colorSecondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/colorOnSecondaryContainer</item>
<item name="colorTertiary">@color/colorTertiary</item>
<item name="colorOnTertiary">@color/colorOnTertiary</item>
<item name="colorTertiaryContainer">@color/colorTertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/colorOnTertiaryContainer</item>
<item name="colorError">@color/colorError</item>
<item name="colorOnError">@color/colorOnError</item>
<item name="colorErrorContainer">@color/colorErrorContainer</item>
<item name="colorOnErrorContainer">@color/colorOnErrorContainer</item>
<item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="toolbar_corner_radius">32dp</dimen>
</resources>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- home -->
<string name="home_title">ホーム</string>
<!-- search -->
<string name="search_title">検索</string>
<!-- library -->
<string name="library_title">ライブラリ</string>
<!-- debug -->
<string name="debug_menu_title">デバッグメニュー</string>
<!-- common -->
<!-- for placeholder -->
<string name="placeholder">Placeholder(TODO: Replace)</string>
</resources>
+1
View File
@@ -28,6 +28,7 @@
<item name="colorOutline">@color/colorOutline</item> <item name="colorOutline">@color/colorOutline</item>
<item name="colorOnBackground">@color/colorOnBackground</item> <item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">true</item>
</style> </style>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
+3
View File
@@ -47,4 +47,7 @@ dependencies {
// Utils モジュール // Utils モジュール
implementation project(':utils') implementation project(':utils')
// Model
implementation project(':model')
} }
@@ -4,6 +4,8 @@ import androidx.room.Database;
import androidx.room.RoomDatabase; import androidx.room.RoomDatabase;
// Entities // Entities
import one.nem.lacerta.source.database.dao.FolderDao;
import one.nem.lacerta.source.database.entity.FolderEntity;
import one.nem.lacerta.source.database.entity.TagEntity; import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity; import one.nem.lacerta.source.database.entity.LibraryEntity;
@@ -17,11 +19,12 @@ import one.nem.lacerta.source.database.dao.LibraryDao;
import one.nem.lacerta.source.database.dao.VcsRevDao; import one.nem.lacerta.source.database.dao.VcsRevDao;
import one.nem.lacerta.source.database.dao.VcsLogDao; import one.nem.lacerta.source.database.dao.VcsLogDao;
@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class}, version = 2) @Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class, FolderEntity.class}, version = 4)
public abstract class LacertaDatabase extends RoomDatabase { public abstract class LacertaDatabase extends RoomDatabase {
public abstract TagDao tagDao(); public abstract TagDao tagDao();
public abstract DocumentDao documentDao(); public abstract DocumentDao documentDao();
public abstract LibraryDao libraryDao(); public abstract LibraryDao libraryDao();
public abstract VcsRevDao vcsRevDao(); public abstract VcsRevDao vcsRevDao();
public abstract VcsLogDao vcsLogDao(); public abstract VcsLogDao vcsLogDao();
public abstract FolderDao folderDao();
} }
@@ -28,6 +28,12 @@ public interface DocumentDao {
@Query("SELECT * FROM Document WHERE id IN (:ids)") @Query("SELECT * FROM Document WHERE id IN (:ids)")
List<DocumentEntity> findByIds(List<String> ids); List<DocumentEntity> findByIds(List<String> ids);
@Query("SELECT * FROM Document WHERE public_path = :publicPath LIMIT :limit")
List<DocumentEntity> findByPublicPathWithLimit(String publicPath, int limit);
@Query("SELECT * FROM Document ORDER BY created_at DESC LIMIT :limit")
List<DocumentEntity> getRecentDocument(int limit);
// Insert // Insert
@Insert @Insert
void insert(DocumentEntity document); void insert(DocumentEntity document);
@@ -0,0 +1,23 @@
package one.nem.lacerta.source.database.dao;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import one.nem.lacerta.source.database.entity.FolderEntity;
@Dao
public interface FolderDao {
@Query("SELECT * FROM Folder WHERE id = :id")
FolderEntity findById(String id);
@Query("SELECT * FROM Folder WHERE public_path = :publicPath")
FolderEntity findByPublicPath(String publicPath);
@Insert
void insert(FolderEntity folderEntity);
@Insert
void insertAll(FolderEntity... folderEntities);
}
@@ -3,6 +3,7 @@ package one.nem.lacerta.source.database.dao;
import androidx.room.Dao; import androidx.room.Dao;
import androidx.room.Insert; import androidx.room.Insert;
import androidx.room.Query; import androidx.room.Query;
import androidx.room.Update;
import java.util.List; import java.util.List;
@@ -24,6 +25,14 @@ public interface VcsLogDao {
@Query("SELECT * FROM vcs_log WHERE document_id = :documentId") @Query("SELECT * FROM vcs_log WHERE document_id = :documentId")
List<VcsLogEntity> findByDocumentId(String documentId); List<VcsLogEntity> findByDocumentId(String documentId);
@Query("SELECT * FROM vcs_log WHERE document_id = :documentId AND is_included = :isIncluded ORDER BY created_at")
List<VcsLogEntity> findByDocumentIdAndIncluded(String documentId, boolean isIncluded);
@Query("SELECT * FROM vcs_log WHERE document_id = :documentId AND branch_name = :branchName")
List<VcsLogEntity> findByDocumentIdAndBranchName(String documentId, String branchName);
@Query("SELECT * FROM vcs_log WHERE document_id = :documentId AND branch_name = :branchName AND is_included = :isIncluded ORDER BY created_at")
List<VcsLogEntity> findByDocumentIdAndBranchNameAndIncluded(String documentId, String branchName, boolean isIncluded);
// Insert // Insert
@Insert @Insert
@@ -35,5 +44,12 @@ public interface VcsLogDao {
@Insert @Insert
void insert(VcsLogEntity vcsLog); void insert(VcsLogEntity vcsLog);
// TODO-rca: Update, Deleteが必要か検討 @Update
void update(VcsLogEntity vcsLog);
@Update
void updateAll(VcsLogEntity... vcsLogs);
@Update
void updateAll(List<VcsLogEntity> vcsLogs);
} }
@@ -0,0 +1,22 @@
package one.nem.lacerta.source.database.entity;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity(tableName = "folder")
public class FolderEntity {
@PrimaryKey
@ColumnInfo(name = "id")
@NonNull
public String id; // フォルダID
@ColumnInfo(name = "title")
public String name; // フォルダ名
@ColumnInfo(name = "public_path")
public String publicPath; // 公開パス
}
@@ -45,4 +45,10 @@ public class VcsLogEntity {
*/ */
@ColumnInfo(name = "action") @ColumnInfo(name = "action")
public String action; public String action;
/**
* Revに含まれてるかどうか
*/
@ColumnInfo(name = "is_included")
public boolean isIncluded;
} }
@@ -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.
@@ -11,7 +11,12 @@ public interface LacertaVcs {
public void createDocument(String documentId); public void createDocument(String documentId);
public void generateRevisionAtCurrent(String message);
// debug // debug
public void printLog(); public void printLog();
public void printRev();
} }
@@ -1,5 +1,7 @@
package one.nem.lacerta.vcs.impl; package one.nem.lacerta.vcs.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.inject.Inject; import javax.inject.Inject;
@@ -8,8 +10,12 @@ import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject; import dagger.assisted.AssistedInject;
import one.nem.lacerta.source.database.LacertaDatabase; import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.VcsLogEntity; import one.nem.lacerta.source.database.entity.VcsLogEntity;
import one.nem.lacerta.source.database.entity.VcsRevEntity;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.vcs.ActionType;
import one.nem.lacerta.vcs.LacertaVcs; import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.internal.JsonUtils;
import one.nem.lacerta.vcs.model.action.InsertPage;
public class LacertaVcsImpl implements LacertaVcs { public class LacertaVcsImpl implements LacertaVcs {
@@ -38,12 +44,17 @@ public class LacertaVcsImpl implements LacertaVcs {
@Override @Override
public void insertPage(int index, String fileName) { public void insertPage(int index, String fileName) {
logger.debug(TAG, "insertPage"); logger.debug(TAG, "insertPage");
// InsertPage
InsertPage insertPage = new InsertPage(index, fileName);
insertPage.setActionType(ActionType.INSERT_PAGE);
VcsLogEntity vcsLogEntity = new VcsLogEntity(); VcsLogEntity vcsLogEntity = new VcsLogEntity();
vcsLogEntity.id = UUID.randomUUID().toString(); vcsLogEntity.id = UUID.randomUUID().toString();
vcsLogEntity.documentId = documentId; vcsLogEntity.documentId = documentId;
vcsLogEntity.branchName = "master"; vcsLogEntity.branchName = "master";
vcsLogEntity.createdAt = new java.util.Date(); vcsLogEntity.createdAt = new java.util.Date();
vcsLogEntity.action = "placeholder"; vcsLogEntity.action = JsonUtils.toJson(insertPage);
database.vcsLogDao().insert(vcsLogEntity); database.vcsLogDao().insert(vcsLogEntity);
} }
@@ -54,7 +65,61 @@ public class LacertaVcsImpl implements LacertaVcs {
@Override @Override
public void createDocument(String documentId) { public void createDocument(String documentId) {
logger.debug(TAG, "createDocument");
VcsLogEntity vcsLogEntity = new VcsLogEntity();
vcsLogEntity.id = UUID.randomUUID().toString();
vcsLogEntity.documentId = documentId;
vcsLogEntity.branchName = "master";
vcsLogEntity.createdAt = new java.util.Date();
vcsLogEntity.action = "ph-createDocument";
database.vcsLogDao().insert(vcsLogEntity);
}
// Internal
private ArrayList<VcsLogEntity> getNonIncludedVcsLogEntities() {
return new ArrayList<>(database.vcsLogDao().findByDocumentIdAndIncluded(documentId, false));
}
private ArrayList<VcsLogEntity> getNonIncludedVcsLogEntities(String branchName) {
return new ArrayList<>(database.vcsLogDao().findByDocumentIdAndBranchNameAndIncluded(documentId, branchName, false));
}
private void setIncludedVcsLogEntities(ArrayList<VcsLogEntity> vcsLogEntities) {
vcsLogEntities.forEach(vcsLogEntity -> {
vcsLogEntity.isIncluded = true;
database.vcsLogDao().update(vcsLogEntity);
});
logger.debug(TAG, "setIncludedVcsLogEntities updated: " + vcsLogEntities.size() + " entities");
}
@Override
public void generateRevisionAtCurrent(String message) {
logger.debug(TAG, "generateRevisionAtCurrent");
// TODO-rca: ブランチを考慮する
ArrayList<VcsLogEntity> vcsLogEntities = getNonIncludedVcsLogEntities();
ArrayList<String> logIds = new ArrayList<>();
vcsLogEntities.forEach(vcsLogEntity -> {
logIds.add(vcsLogEntity.id);
});
VcsRevEntity vcsRevEntity = new VcsRevEntity();
vcsRevEntity.id = UUID.randomUUID().toString();
vcsRevEntity.documentId = documentId;
vcsRevEntity.branchName = "master";
vcsRevEntity.createdAt = new java.util.Date();
vcsRevEntity.commitMessage = message;
vcsRevEntity.logIds = logIds;
database.vcsRevDao().insert(vcsRevEntity);
setIncludedVcsLogEntities(vcsLogEntities);
logger.debug(TAG, "generateRevisionAtCurrent finished");
logger.debug(TAG, "New revision inserted: " + vcsRevEntity.id);
} }
@Override @Override
@@ -62,6 +127,19 @@ public class LacertaVcsImpl implements LacertaVcs {
logger.debug(TAG, "printLog"); logger.debug(TAG, "printLog");
database.vcsLogDao().findAll().forEach(vcsLog -> { database.vcsLogDao().findAll().forEach(vcsLog -> {
logger.debug(TAG, vcsLog.id); logger.debug(TAG, vcsLog.id);
logger.debug(TAG, vcsLog.documentId + " " + vcsLog.branchName);
logger.debug(TAG, vcsLog.action);
});
}
@Override
public void printRev() {
logger.debug(TAG, "printRev");
database.vcsRevDao().findAll().forEach(vcsRev -> {
logger.debug(TAG, vcsRev.id);
logger.debug(TAG, vcsRev.documentId + " " + vcsRev.branchName);
logger.debug(TAG, vcsRev.commitMessage);
logger.debug(TAG, vcsRev.logIds.toString());
}); });
} }
} }