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
123 changed files with 740 additions and 3269 deletions

No files matched your search

+2 -2
View File
@@ -4,10 +4,10 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-01-20T07:15:21.179573376Z"> <DropdownSelection timestamp="2023-12-18T03:36:14.973846Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/rca/.android/avd/Pixel_3a_API_34_extension_level_7_x86_64.avd" /> <DeviceId pluginId="PhysicalDevice" identifier="serial=ZY22H7V3G7" />
</handle> </handle>
</Target> </Target>
</DropdownSelection> </DropdownSelection>
+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">
@@ -22,7 +23,6 @@
<option value="$PROJECT_DIR$/feature/library" /> <option value="$PROJECT_DIR$/feature/library" />
<option value="$PROJECT_DIR$/feature/scan" /> <option value="$PROJECT_DIR$/feature/scan" />
<option value="$PROJECT_DIR$/feature/search" /> <option value="$PROJECT_DIR$/feature/search" />
<option value="$PROJECT_DIR$/feature/setting" />
<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" />
+1 -1
View File
@@ -1,6 +1,6 @@
<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">
+32 -16
View File
@@ -1,9 +1,8 @@
# Lacerta # Lacerta
学習に便利な機能とGit-like VCSを持ったドキュメントスキャナ (Work In Progress) WIP
## モジュール設計 ## モジュール設計
![Untitled Diagram(2)(1) drawio(1)](https://github.com/lacerta-doc/Lacerta/assets/66072112/f9b9c40f-bed0-4ade-95c1-50e28df68f35)
![Untitled Diagram(2)](https://github.com/lacerta-doc/Lacerta/assets/66072112/9daabaca-5cdc-49f8-ac66-196c588a47c9)
## メモ ## メモ
- アイコン: Google Material Icons https://fonts.google.com/icons (Weight:300, Grade:0, Optical size: 24px) - アイコン: Google Material Icons https://fonts.google.com/icons (Weight:300, Grade:0, Optical size: 24px)
@@ -12,28 +11,45 @@
### モジュール一覧 ### モジュール一覧
- `component` : コンポーネント - `component` : コンポーネント
- `common` : 共通コンポーネント - `common` : 共通コンポーネント
- `scanner` : スキャナー - UIの中で共通で使う要素(メニューアイテムとか)
- `scanner` : スキャナー
- スキャナーの実装
- `viewer` : ビューワー - `viewer` : ビューワー
- `data` : UIからデータを取得/保存するためのラッパーモジュール - ドキュメントビューワーの実装
- `data` : データ
- UIからデータを取得/保存するためのラッパーモジュール
- `Document` : ドキュメント関係
- WIP(JavaDocを参照してください, 余裕があったら追記します)
- `feature` : 機能モジュール(ナビゲーションからみた機能で分割) - `feature` : 機能モジュール(ナビゲーションからみた機能で分割)
- `common`: 共通機能 - `common`: 共通機能
- 設定画面とか、どこからでも呼ばれうる画面
- `debug`: デバッグメニュー - `debug`: デバッグメニュー
- `home`: ホーム画面 - `home`: ホーム画面
- `library`: ライブラリ画面 - `library`: ライブラリ画面
- `scan`: スキャン画面 (廃止予定) - `scan`: スキャン画面
- `search`: 検索画面 - `search`: 検索画面
- `model` : データモデルをまとめたモジュール - `model` : モデル
- `processor` : プロセッサ(例: `DocumentProcessor` : ドキュメント処理(ドキュメントにページを追加したり更新したり)) - データモデルをまとめたモジュール (WIP)
- `shared`: 共有リソース - `document` : ドキュメント
- `ui`: UI要素(Theme, Drawable, Colorなど) - `meta` : メタデータ
- `source` : ソース(DB/FileManagerなど) - `processor` : プロセッサ
- `utils` : ユーティリティ(ちょっとしたユーティリティをまとめたモジュール) - いくつかの処理をまとめたモジュール
- `DocumentProcessor` : ドキュメント処理(ドキュメントにページを追加したり更新したり)
- `shared` :
- 共有リソース
- `source` : ソース
- (バックエンドが使うのでとりあえず後回し、フロントから直接操作することは絶対にありません)
- `utils` : ユーティリティ
- ちょっとしたユーティリティをまとめたモジュール
- `LacertaLogger` : ロガー
- `XmlMetaParser` : XMLメタデータパーサー(フロントから直接操作することは絶対にありません)
## コーディング規則/推奨(WIP) ## コーディング規則/推奨(WIP)
### 規則
- `// TODO`コメントには任意のsuffixを付ける - `// TODO`コメントには任意のsuffixを付ける
- 全員が同じ`// TODO:`を使っていると検索がむずかしくなるため - 全員が同じ`// TODO:`を使っていると検索がむずかしくなるため
- (例: `// TODO-rca:`) - (例: `// TODO-rca:`)
### 推奨
## Thanks for - マジックナンバーは控える(必要な場合もあるので)
- [SDA-SE/document-scanner-android](https://github.com/SDA-SE/document-scanner-android)
-
-5
View File
@@ -74,12 +74,7 @@ dependencies {
implementation project(':feature:library') implementation project(':feature:library')
implementation project(':feature:scan') implementation project(':feature:scan')
implementation project(':feature:debug') // デバッグメニュー implementation project(':feature:debug') // デバッグメニュー
implementation project(':feature:setting') // 設定画面
implementation project(':data') implementation project(':data')
implementation project(':shared:ui') implementation project(':shared:ui')
implementation project(':model')
implementation project(':utils')
} }
@@ -1,11 +1,11 @@
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.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
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;
@@ -13,47 +13,34 @@ import androidx.navigation.ui.NavigationUI;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Gravity;
import android.view.MenuItem; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import one.nem.lacerta.model.FragmentNavigation;
import one.nem.lacerta.model.pref.FeatureSwitchOverride;
import one.nem.lacerta.utils.FeatureSwitch;
import com.google.android.material.appbar.AppBarLayout;
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 java.io.NotActiveException;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.utils.repository.SharedPrefUtils;
import javax.inject.Inject; import javax.inject.Inject;
@AndroidEntryPoint @AndroidEntryPoint
public class MainActivity extends AppCompatActivity implements FragmentNavigation { public class MainActivity extends AppCompatActivity {
@Inject
SharedPrefUtils sharedPrefUtils;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
// Initialize app
if (sharedPrefUtils.getIsFirstLaunch()) initializeApp();
// Init navigation // Init navigation
try { try {
FragmentManager supportFragmentManager = getSupportFragmentManager(); FragmentManager supportFragmentManager = getSupportFragmentManager();
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment); NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
assert navHostFragment != null; assert navHostFragment != null;
NavController navController = navHostFragment.getNavController(); NavController navController = navHostFragment.getNavController();
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
NavigationUI.setupWithNavController(bottomNavigationView, navController); NavigationUI.setupWithNavController(bottomNavigationView, navController);
} }
catch (Exception e) { catch (Exception e) {
@@ -63,95 +50,40 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
finish(); // Exit app finish(); // Exit app
} }
// Apply feature switch
applyFeatureSwitch(bottomNavigationView, FeatureSwitchOverride.ENABLE_SEARCH, FeatureSwitch.FeatureMaster.enableSearch, one.nem.lacerta.feature.search.R.id.feature_search_navigation);
applyFeatureSwitch(bottomNavigationView, FeatureSwitchOverride.ENABLE_DEBUG_MENU, FeatureSwitch.FeatureMaster.enableDebugMenu, one.nem.lacerta.feature.debug.R.id.feature_debug_navigation);
// Set navigation bar color // Set navigation bar color
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
// Set status bar color Toolbar toolbar = findViewById(R.id.toolbar);
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface)); setSupportActionBar(toolbar);
} // // Create a new TextView
private void initializeApp() { // TextView toolbarTitle = new TextView(this);
Log.d("Init", "Initializing app"); // // Set the text and center it in the TextView
// Set feature switch override to default value // toolbarTitle.setText("App Name");
sharedPrefUtils.setFeatureSwitchOverride(FeatureSwitchOverride.ENABLE_SEARCH, FeatureSwitch.FeatureMaster.enableSearch); // toolbarTitle.setTextColor(Color.WHITE);
sharedPrefUtils.setFeatureSwitchOverride(FeatureSwitchOverride.ENABLE_DEBUG_MENU, FeatureSwitch.FeatureMaster.enableDebugMenu); // 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);
// Set isFirstLaunch to false float radius = getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius);
sharedPrefUtils.setIsFirstLaunch(false);
}
private void applyFeatureSwitch(BottomNavigationView bottomNavigationView, FeatureSwitchOverride featureSwitchOverride, boolean defaultValue, int menuId) { MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable)toolbar.getBackground();
boolean isEnabled = FeatureSwitch.Meta.canOverrideSwitch ? sharedPrefUtils.getFeatureSwitchOverride(featureSwitchOverride) : defaultValue; materialShapeDrawable.setShapeAppearanceModel(materialShapeDrawable.getShapeAppearanceModel()
if (!isEnabled) bottomNavigationView.getMenu().removeItem(menuId); .toBuilder()
} .setAllCorners(CornerFamily.ROUNDED,radius)
.build());
// Set the MaterialShapeDrawable as the background of the Toolbar
@Override DrawerLayout drawer = findViewById(R.id.drawer_layout);
public void navigateToFragment(Fragment fragment) { ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
getSupportFragmentManager().beginTransaction() this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
.replace(R.id.nav_host_fragment, fragment) drawer.addDrawerListener(toggle);
.addToBackStack(null) toggle.syncState();
.commit();
}
@Override // Set the app name in the middle of the toolbar
public void navigateToFragment(Fragment fragment, boolean addToBackStack) { getSupportActionBar().setTitle("App Name");
if (addToBackStack) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, fragment)
.addToBackStack(null)
.commit();
} else {
getSupportFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, fragment)
.commit();
}
}
@Override
public void navigateToFragment(Fragment fragment, boolean addToBackStack, boolean clearBackStack) {
if (clearBackStack) {
getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
if (addToBackStack) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, fragment)
.addToBackStack(null)
.commit();
} else {
getSupportFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, fragment)
.commit();
}
}
public void navigateToFragmentAlternate(Fragment fragment, boolean addToBackStack) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// get the current fragment
Fragment currentFragment = getSupportFragmentManager().getPrimaryNavigationFragment();
// hide the current fragment
if (currentFragment != null) {
transaction.hide(currentFragment);
}
// Add the new fragment
transaction.add(R.id.nav_host_fragment, fragment);
// Add the transaction to the back stack if needed
if (addToBackStack) {
transaction.addToBackStack(null);
}
// Commit the transaction
transaction.commit();
// Update the primary navigation fragment
getSupportFragmentManager().beginTransaction().setPrimaryNavigationFragment(fragment).commit();
} }
} }
+54 -27
View File
@@ -1,37 +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_home_top" />
<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"
android:background="@color/colorSecondaryContainer" app:layout_constraintTop_toTopOf="parent">
app:itemIconTint="@color/colorOnSecondaryContainer"
app:itemTextColor="@color/colorOnSecondaryContainer"
app:itemActiveIndicatorStyle="@style/Lacerta.Custom.Indicator"
app:labelVisibilityMode="selected"
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> <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>
+1 -6
View File
@@ -19,11 +19,6 @@
<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="@string/debug_menu_title" /> android:title="@string/debug_menu_title"/>
<item
android:id="@id/feature_setting_navigation"
android:icon="@drawable/settings_24px"
android:title="@string/setting_title"/>
</menu> </menu>
@@ -2,7 +2,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@+id/item_placeholder" android:id="@+id/nav_home"
android:icon="@drawable/developer_mode_24px" android:icon="@drawable/developer_mode_24px"
android:title="@string/placeholder" /> android:title="@string/placeholder" />
</menu> </menu>
+1 -4
View File
@@ -2,17 +2,14 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android" <navigation 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"
android:id="@+id/app_main_nav" android:id="@+id/app_main_nav"
app:startDestination="@id/feature_home_navigation"> app:startDestination="@id/feature_debug_navigation">
<include app:graph="@navigation/feature_debug_navigation" /> <include app:graph="@navigation/feature_debug_navigation" />
<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" /> <include app:graph="@navigation/feature_search_navigation" />
<include app:graph="@navigation/feature_setting_navigation" />
</navigation> </navigation>
+1 -3
View File
@@ -4,7 +4,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.component.common' namespace 'one.nem.lacerta.component.common'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -32,6 +32,4 @@ dependencies {
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
implementation project(':shared:ui')
} }
+1 -1
View File
@@ -5,7 +5,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.component.scanner' namespace 'one.nem.lacerta.component.scanner'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -1,6 +1,5 @@
package one.nem.lacerta.component.scanner; package one.nem.lacerta.component.scanner;
import android.app.ProgressDialog;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
@@ -23,7 +22,6 @@ import com.websitebeaver.documentscanner.DocumentScanner;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject; import javax.inject.Inject;
@@ -154,35 +152,21 @@ public class ScannerManagerActivity extends AppCompatActivity {
private void saveNewDocument() { private void saveNewDocument() {
logger.debug(TAG, "saveNewDocument"); logger.debug(TAG, "saveNewDocument");
// Deprecatedだが、中断機能が存在しないので操作をブロックする目的で(意図的に)使用
ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage("保存中..."); // TODO-rca: テキストをリソースに移動
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setCancelable(false);
dialog.show();
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
document.createDocument(documentMeta).thenAccept((documentDetail) -> { DocumentDetail documentDetail = document.createDocument(documentMeta);
Bitmap[] bitmaps = new Bitmap[croppedImages.size()]; Bitmap[] bitmaps = new Bitmap[this.croppedImages.size()];
croppedImages.toArray(bitmaps); this.croppedImages.toArray(bitmaps);
logger.debug(TAG, "bitmaps.length: " + bitmaps.length); try {
addPagesToDocumentDetail(documentDetail, bitmaps).join(); documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps);
document.updateDocument(documentDetail).join(); Toast.makeText(this, "Saved.", Toast.LENGTH_SHORT).show();
dialog.dismiss(); lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent("Initial commit");
lacertaVcsFactory.create(documentDetail.getMeta().getId()).printLog(); // Debug
lacertaVcsFactory.create(documentDetail.getMeta().getId()).printRev(); // Debug
finish(); finish();
}); } catch (Exception e) {
logger.error(TAG, "Error: " + e.getMessage());
} logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
}
private CompletableFuture<Void> addPagesToDocumentDetail(DocumentDetail documentDetail, Bitmap[] bitmaps) {
return CompletableFuture.runAsync(() -> {
try {
document.updateDocument(documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps).getDocumentDetail()).join();
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent("Initial commit");
} catch (Exception e) {
logger.error(TAG, "Error: " + e.getMessage());
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
}
});
} }
private void insertToExistDocument() { private void insertToExistDocument() {
+1 -25
View File
@@ -1,11 +1,10 @@
plugins { plugins {
alias(libs.plugins.com.android.library) alias(libs.plugins.com.android.library)
id 'com.google.dagger.hilt.android'
} }
android { android {
namespace 'one.nem.lacerta.component.viewer' namespace 'one.nem.lacerta.component.viewer'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -30,30 +29,7 @@ dependencies {
implementation libs.androidx.appcompat implementation libs.androidx.appcompat
implementation libs.com.google.android.material implementation libs.com.google.android.material
implementation libs.androidx.activity
implementation libs.androidx.constraintlayout
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
// Navigation
implementation libs.navigation.fragment
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')
implementation project(':utils')
implementation project(':data')
implementation project(':model')
implementation project(':vcs')
} }
@@ -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=".ViewerMainActivity"
android:exported="false" />
</application>
</manifest> </manifest>
@@ -1,129 +0,0 @@
package one.nem.lacerta.component.viewer;
import android.graphics.Bitmap;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.page.Page;
import one.nem.lacerta.utils.LacertaLogger;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ComponentViewerTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class ComponentViewerTopFragment extends Fragment {
@Inject
Document document;
@Inject
LacertaLogger logger;
private static final String TAG = "ComponentViewerTopFragment";
private String documentId;
public ComponentViewerTopFragment() {
// Required empty public constructor
}
public static ComponentViewerTopFragment newInstance(String documentId) {
ComponentViewerTopFragment fragment = new ComponentViewerTopFragment();
Bundle args = new Bundle();
args.putString("documentId", documentId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
documentId = getArguments().getString("documentId");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_component_viewer_top, container, false);
// Toolbar
Toolbar toolbar = view.findViewById(R.id.toolbar);
toolbarSetup(toolbar, true, "Revision List");
RecyclerView recyclerView = view.findViewById(R.id.body_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
ViewerBodyAdapter viewerBodyAdapter = new ViewerBodyAdapter(fileName -> {
Toast.makeText(getContext(), fileName, Toast.LENGTH_SHORT).show();
});
recyclerView.setAdapter(viewerBodyAdapter);
document.getDocument(documentId).thenAccept(documentDetail -> {
ArrayList<Page> pages = documentDetail.getPages();
logger.debug(TAG, "pages.size(): " + pages.size());
viewerBodyAdapter.setPages(pages);
getActivity().runOnUiThread(() -> {
viewerBodyAdapter.notifyItemRangeChanged(0, pages.size());
});
});
return view;
}
/**
* ToolbarをInitする
*
* @param toolbar Toolbar
* @param showBackButton 戻るボタンを表示するか
* @param title タイトル
*/
private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title) {
getActivity().runOnUiThread(() -> {
if (showBackButton) {
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
toolbar.setNavigationOnClickListener(v -> {
//this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join();
// Back
Navigation.findNavController(requireView()).popBackStack();
});
} else {
toolbar.setNavigationIcon(null);
}
toolbar.setTitle(title);
toolbar.inflateMenu(R.menu.viewer_menu);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.action_open_vcs_rev_list) {
// Open vcs rev list
getParentFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, ViewerVcsRevListFragment.newInstance(documentId))
.commit();
return true;
} else {
return false;
}
});
});
}
}
@@ -1,5 +0,0 @@
package one.nem.lacerta.component.viewer;
public interface ItemClickListener {
void onItemClick(String fileName); // DEBUG
}
@@ -1,80 +0,0 @@
package one.nem.lacerta.component.viewer;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import one.nem.lacerta.model.VcsRevModel;
import one.nem.lacerta.utils.FeatureSwitch;
public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
private ArrayList<VcsRevModel> revModels;
public RevAdapter(ArrayList<VcsRevModel> revModels) {
this.revModels = revModels;
}
public RevAdapter() {
}
public void setRevModels(ArrayList<VcsRevModel> revModels) {
this.revModels = revModels;
}
@NonNull
@Override
public RevAdapter.RevViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.viewer_rev_list_item, parent, false);
return new RevAdapter.RevViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) {
VcsRevModel revModel = revModels.get(position);
holder.title.setText(revModel.getCommitMessage());
if (FeatureSwitch.Vcs.disableBranchDisplay) {
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()));
holder.detail.setText("DateTimePlaceholder");
} else {
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()) + " " + revModel.getBranchName());
holder.detail.setText("DateTimePlaceholder" + " " + revModel.getBranchName());
}
holder.revId.setText("RevID: " + revModel.getId());
}
@Override
public int getItemCount() {
if (revModels == null) {
return 0;
} else {
return revModels.size();
}
}
class RevViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView detail;
TextView revId;
public RevViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.rev_item_title);
detail = itemView.findViewById(R.id.rev_item_detail);
revId = itemView.findViewById(R.id.rev_item_id);
}
}
}
@@ -1,66 +0,0 @@
package one.nem.lacerta.component.viewer;
import android.graphics.Bitmap;
import android.media.Image;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import one.nem.lacerta.model.document.page.Page;
public class ViewerBodyAdapter extends RecyclerView.Adapter<ViewerBodyAdapter.ViewHolder>{
ArrayList<Page> pages;
ItemClickListener listener;
public ViewerBodyAdapter(ArrayList<Page> pages, ItemClickListener listener){
this.pages = pages;
this.listener = listener;
}
public ViewerBodyAdapter(ItemClickListener listener){
this.pages = new ArrayList<>();
this.listener = listener;
}
public void setPages(ArrayList<Page> pages){
this.pages = pages;
}
@NonNull
@Override
public ViewerBodyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = View.inflate(parent.getContext(), R.layout.viewer_body_list_item, null);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewerBodyAdapter.ViewHolder holder, int position) {
Bitmap bitmap = pages.get(position).getBitmap();
holder.image.setImageBitmap(bitmap);
holder.itemView.setOnClickListener(v -> {
});
}
@Override
public int getItemCount() {
return pages.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
ImageView image;
public ViewHolder(@NonNull View itemView) {
super(itemView);
image = itemView.findViewById(R.id.imageView);
}
}
}
@@ -1,66 +0,0 @@
package one.nem.lacerta.component.viewer;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.NavController;
import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.NavigationUI;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.utils.LacertaLogger;
@AndroidEntryPoint
public class ViewerMainActivity extends AppCompatActivity {
@Inject
LacertaLogger logger;
@Inject
public ViewerMainActivity() {
}
// Variables
private static final String TAG = "ViewerMainActivity";
String documentId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_viewer_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
Intent intent = getIntent();
try {
documentId = intent.getStringExtra("documentId");
}
catch (Exception e) {
logger.error(TAG, "Failed to get documentId from intent");
logger.error(TAG, "Searchable Error code: " + "f64c21a2-391f-4c40-92f6-183da459de21");
Toast.makeText(this, "Failed to get documentId from intent", Toast.LENGTH_LONG).show();
finish();
}
// Navigation
getSupportFragmentManager().beginTransaction()
.replace(R.id.nav_host_fragment, ComponentViewerTopFragment.newInstance(documentId))
.commit();
}
}
@@ -1,95 +0,0 @@
package one.nem.lacerta.component.viewer;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ViewerVcsRevListFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class ViewerVcsRevListFragment extends Fragment {
@Inject
LacertaVcsFactory lacertaVcsFactory;
@Inject
LacertaLogger logger;
LacertaVcs lacertaVcs;
private String documentId;
public ViewerVcsRevListFragment() {
// Required empty public constructor
}
public static ViewerVcsRevListFragment newInstance(String documentId) {
ViewerVcsRevListFragment fragment = new ViewerVcsRevListFragment();
Bundle args = new Bundle();
args.putString("documentId", documentId);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_viewer_vcs_rev_list, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// Init arg
if (getArguments() != null) {
this.documentId = getArguments().getString("documentId");
logger.debug("ViewerVcsRevListFragment", "documentId: " + documentId);
}
// Init vcs
lacertaVcs = lacertaVcsFactory.create(documentId);
// Init view
RecyclerView recyclerView = view.findViewById(R.id.rev_list);
// Init adapter
RevAdapter revAdapter = new RevAdapter();
// Set adapter
recyclerView.setAdapter(revAdapter);
// Set layout manager
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
lacertaVcs.getRevisionHistory().thenAccept(revModels -> {
logger.debug("ViewerVcsRevListFragment", "revModels.size(): " + revModels.size());
getActivity().runOnUiThread(() -> {
revAdapter.setRevModels(revModels);
revAdapter.notifyDataSetChanged();
});
});
}
}
@@ -1,20 +0,0 @@
package one.nem.lacerta.component.viewer.model;
import android.graphics.Bitmap;
public class ViewerBodyListItem {
Bitmap image;
public ViewerBodyListItem(Bitmap image) {
this.image = image;
}
public Bitmap getImage() {
return image;
}
public void setImage(Bitmap image) {
this.image = image;
}
}
@@ -1,21 +0,0 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ViewerMainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="one.nem.lacerta.component.viewer.ComponentViewerTopFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,51 +0,0 @@
<FrameLayout 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="match_parent"
android:background="@color/colorSurface">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
app:contentScrim="@color/colorSecondaryContainer"
android:background="@color/colorSurface"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp"
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="Title" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/body_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout>
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ViewerVcsRevListFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rev_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
@@ -1,20 +0,0 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="8dp"
android:adjustViewBounds="true"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,55 +0,0 @@
<?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:paddingHorizontal="24dp"
android:paddingVertical="16dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/item_text_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/rev_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
android:text="Placeholder Title"
android:textColor="@color/colorOnSurface"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/rev_item_detail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="2023/01/01 00:00:00 - hogehoge"
android:textColor="@color/colorOnSurfaceSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rev_item_title" />
<TextView
android:id="@+id/rev_item_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="dd76a029-51f1-40f7-b316-a0c74bbfebb1(Example)"
android:textColor="@color/colorOnSurfaceSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rev_item_detail" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_open_vcs_rev_list"
android:title="Open VCS Rev List" />
</menu>
@@ -1,21 +0,0 @@
<?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/component_viewer_navigation"
app:startDestination="@id/componentViewerTopFragment">
<fragment
android:id="@+id/componentViewerTopFragment"
android:name="one.nem.lacerta.component.viewer.ComponentViewerTopFragment"
android:label="ComponentViewerTopFragment" >
<action
android:id="@+id/action_componentViewerTopFragment_to_viewerVcsRevListFragment"
app:destination="@id/viewerVcsRevListFragment" />
</fragment>
<fragment
android:id="@+id/viewerVcsRevListFragment"
android:name="one.nem.lacerta.component.viewer.ViewerVcsRevListFragment"
android:label="fragment_viewer_vcs_rev_list"
tools:layout="@layout/fragment_viewer_vcs_rev_list" />
</navigation>
@@ -1,4 +0,0 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
@@ -2,7 +2,6 @@ package one.nem.lacerta.data;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
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;
@@ -14,13 +13,13 @@ import one.nem.lacerta.model.document.tag.DocumentTag;
*/ */
public interface Document { public interface Document {
CompletableFuture<DocumentDetail> createDocument(DocumentMeta meta); DocumentDetail createDocument(DocumentMeta meta);
CompletableFuture<DocumentDetail> createDocument(); DocumentDetail createDocument();
CompletableFuture<Void> deleteDocument(String documentId); void deleteDocument(String documentId);
CompletableFuture<Void> updateDocument(DocumentDetail detail); void updateDocument(DocumentMeta meta, DocumentDetail detail);
CompletableFuture<DocumentDetail> getDocument(String documentId); DocumentDetail getDocument(String documentId);
} }
@@ -1,29 +1,25 @@
package one.nem.lacerta.data; package one.nem.lacerta.data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import one.nem.lacerta.model.ListItem; 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;
import one.nem.lacerta.model.PublicPath;
import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
public interface LacertaLibrary { public interface LacertaLibrary {
// Get History // Get History
CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit); ArrayList<ListItem> getRecentDocument(int limit);
CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit, int offset); ArrayList<ListItem> getRecentDocument(int limit, int offset);
// Get Library Page // Get Library page
CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit); LibraryItemPage getLibraryPage(int limit);
CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit, int offset); LibraryItemPage getLibraryPage(int limit, int offset);
LibraryItemPage getLibraryPage(String pageId, int limit);
// Create Folder LibraryItemPage getLibraryPage(String pageId, int limit, int offset);
CompletableFuture<String> createFolder(String parentId, String name);
// Get Public Path
CompletableFuture<PublicPath> getPublicPath(String itemId, ListItemType itemType);
// GetDocument
DocumentDetail getDocumentDetailById(String id); // TODO-rca: Documentに統合する
} }
@@ -1,10 +1,8 @@
package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture;
// Hilt // Hilt
import javax.inject.Inject; import javax.inject.Inject;
@@ -18,20 +16,13 @@ import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
// Lacerta/source // Lacerta/source
import one.nem.lacerta.model.document.internal.XmlMetaModel;
import one.nem.lacerta.model.document.internal.XmlMetaPageModel;
import one.nem.lacerta.model.document.page.Page;
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;
// Lacerta/utils // Lacerta/utils
import one.nem.lacerta.source.file.FileManager;
import one.nem.lacerta.source.file.factory.FileManagerFactory;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
// Lacerta/vcs // Lacerta/vcs
import one.nem.lacerta.utils.XmlMetaParser;
import one.nem.lacerta.utils.repository.DeviceInfoUtils;
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;
@@ -49,14 +40,6 @@ public class DocumentImpl implements Document {
@Inject @Inject
LacertaVcsFactory vcsFactory; LacertaVcsFactory vcsFactory;
@Inject
FileManagerFactory fileManagerFactory;
@Inject
DeviceInfoUtils deviceInfoUtils;
@Inject
XmlMetaParser xmlMetaParser;
@Inject @Inject
public DocumentImpl() { public DocumentImpl() {
@@ -66,37 +49,35 @@ public class DocumentImpl implements Document {
@Override @Override
public CompletableFuture<DocumentDetail> createDocument(DocumentMeta meta) { public DocumentDetail createDocument(DocumentMeta meta) {
return CompletableFuture.supplyAsync(() -> { DocumentDetail detail = new DocumentDetail();
DocumentDetail detail = new DocumentDetail(); detail.setMeta(meta);
detail.setMeta(meta); detail.setPages(new ArrayList<>());
detail.setPages(new ArrayList<>());
// Create DocumentEntity
DocumentEntity documentEntity = new DocumentEntity();
documentEntity.id = meta.getId();
documentEntity.title = meta.getTitle();
documentEntity.author = meta.getAuthor();
documentEntity.defaultBranch = meta.getDefaultBranch();
documentEntity.updatedAt = meta.getUpdatedAt();
documentEntity.createdAt = meta.getCreatedAt();
documentEntity.parentId = meta.getParentId();
documentEntity.tagIds = meta.getTagIds();
database.documentDao().insert(documentEntity); // TODO-rca: UIスレッドから追い出す
// Vcs // Create DocumentEntity
LacertaVcs vcs = vcsFactory.create(meta.getId()); DocumentEntity documentEntity = new DocumentEntity();
vcs.createDocument(meta.getId()); documentEntity.id = meta.getId();
documentEntity.title = meta.getTitle();
documentEntity.author = meta.getAuthor();
documentEntity.defaultBranch = meta.getDefaultBranch();
documentEntity.updatedAt = meta.getUpdatedAt();
documentEntity.createdAt = meta.getCreatedAt();
documentEntity.publicPath = meta.getPath().getStringPath();
documentEntity.tagIds = meta.getTagIds();
// XmlMeta database.documentDao().insert(documentEntity);
updateXmlMeta(detail).join();
return detail; // Vcs
}); LacertaVcs vcs = vcsFactory.create(meta.getId());
vcs.createDocument(meta.getId());
return detail;
} }
@Override @Override
public CompletableFuture<DocumentDetail> createDocument() { public DocumentDetail createDocument() {
DocumentMeta meta = new DocumentMeta(); DocumentMeta meta = new DocumentMeta();
meta.setId(UUID.randomUUID().toString()); meta.setId(UUID.randomUUID().toString());
meta.setTitle("New Document"); meta.setTitle("New Document");
@@ -104,118 +85,23 @@ public class DocumentImpl implements Document {
meta.setDefaultBranch("master"); meta.setDefaultBranch("master");
meta.setUpdatedAt(new Date()); meta.setUpdatedAt(new Date());
meta.setCreatedAt(new Date()); meta.setCreatedAt(new Date());
meta.setParentId(null); meta.setPath(new PublicPath().getRoot()); // TODO-rca: 2回インスタンスを生成していて無駄なのでなんとかする
meta.setTags(new ArrayList<>()); meta.setTags(new ArrayList<>());
return createDocument(meta); return createDocument(meta);
} }
@Override @Override
public CompletableFuture<Void> deleteDocument(String documentId) { public void deleteDocument(String documentId) {
return CompletableFuture.supplyAsync(() -> {
return null;
});
} }
@Override @Override
public CompletableFuture<Void> updateDocument(DocumentDetail detail) { public void updateDocument(DocumentMeta meta, DocumentDetail detail) {
return CompletableFuture.supplyAsync(() -> {
updateXmlMeta(detail).join();
return null;
});
} }
@Override @Override
public CompletableFuture<DocumentDetail> getDocument(String documentId) { public DocumentDetail getDocument(String documentId) {
return CompletableFuture.supplyAsync(() -> { return null;
DocumentEntity documentEntity = database.documentDao().findById(documentId);
if (documentEntity == null) {
throw new IllegalArgumentException("documentId is not found");
}
DocumentMeta meta = new DocumentMeta();
meta.setId(documentEntity.id);
meta.setTitle(documentEntity.title);
meta.setAuthor(documentEntity.author);
meta.setDefaultBranch(documentEntity.defaultBranch);
meta.setUpdatedAt(documentEntity.updatedAt);
meta.setCreatedAt(documentEntity.createdAt);
meta.setParentId(documentEntity.parentId);
meta.setTags(new ArrayList<>()); // TODO-rca: タグを取得する
DocumentDetail detail = new DocumentDetail();
getPagesByXmlMeta(documentId).thenCompose(xmlMetaPageModels -> getPagesByXmlMetaPageModel(documentId, xmlMetaPageModels)).thenAccept(pages -> {
logger.debug(TAG, "pages: " + pages.size());
detail.setMeta(meta);
detail.setPages(pages);
}).join();
return detail;
});
}
private CompletableFuture<ArrayList<XmlMetaPageModel>> getPagesByXmlMeta(String documentId) {
return CompletableFuture.supplyAsync(() -> {
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
try {
ArrayList<XmlMetaPageModel> xmlMetaPageModels = xmlMetaParser.deserialize(fileManager.resolve(documentId).loadXml("meta.xml")).getPages();
// Debug
logger.debug(TAG, "xmlMetaPageModels: " + xmlMetaPageModels.size());
for (XmlMetaPageModel xmlMetaPageModel : xmlMetaPageModels) {
logger.debug(TAG, "\txmlMetaPageModel: " + xmlMetaPageModel.getFilename());
}
return xmlMetaPageModels;
} catch (IOException e) {
logger.error(TAG, "DocumentMeta parse error");
logger.trace(TAG, e.getMessage());
logger.e_code("db18c04a-1625-4871-9e4e-918d805568ac");
}
return null;
});
}
private CompletableFuture<ArrayList<Page>> getPagesByXmlMetaPageModel(String documentId, ArrayList<XmlMetaPageModel> xmlMetaPageModels) {
return CompletableFuture.supplyAsync(() -> {
ArrayList<Page> pages = new ArrayList<>();
FileManager fileManager;
try {
fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory()).resolve(documentId);
} catch (IOException e) {
logger.error(TAG, "FileManager resolve error");
logger.trace(TAG, e.getMessage());
logger.e_code("2235e8ee-4177-46f8-af6b-084381b202e6");
return null;
}
for (XmlMetaPageModel xmlMetaPageModel : xmlMetaPageModels) {
try {
pages.add(new Page(xmlMetaPageModel.getFilename(), fileManager.resolve("raw").loadBitmap(xmlMetaPageModel.getFilename())));
} catch (IOException e) {
logger.error(TAG, "Bitmap decode error");
logger.trace(TAG, e.getMessage());
logger.e_code("3bba8c8f-90fb-4a24-a726-7ea201929f8b");
return null;
}
}
return pages;
});
}
private CompletableFuture<Void> updateXmlMeta(DocumentDetail documentDetail) {
return CompletableFuture.supplyAsync(() -> {
// TODO-rca: リビジョンIDを検証する, 挿入する
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
ArrayList<XmlMetaPageModel> xmlMetaPageModels = new ArrayList<>();
for (Page page : documentDetail.getPages()) {
xmlMetaPageModels.add(new XmlMetaPageModel(page.getFileName()));
}
try {
fileManager.createDirectoryIfNotExist(documentDetail.getMeta().getId()).resolve(documentDetail.getMeta().getId())
.createFileIfNotExist("meta.xml").resolve("meta.xml").saveXml(xmlMetaParser.serialize(new XmlMetaModel("revisionId_PLACEHOLDER", xmlMetaPageModels)));
} catch (IOException e) {
logger.error(TAG, "DocumentMeta serialize error");
logger.trace(TAG, e.getMessage());
logger.e_code("e3b4d0c9-5b7e-4b7e-9e9a-5b8b8b8b8b8b");
}
return null;
});
} }
} }
@@ -1,13 +1,8 @@
package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
import java.text.DateFormat; import java.text.DateFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject; import javax.inject.Inject;
@@ -15,186 +10,63 @@ 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.ListItem;
import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.ListItemType;
import one.nem.lacerta.model.PublicPath;
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.LacertaDatabase;
import one.nem.lacerta.source.database.common.DateTypeConverter; import one.nem.lacerta.source.database.common.DateTypeConverter;
import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.FolderEntity;
import one.nem.lacerta.utils.FeatureSwitch;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
public class LacertaLibraryImpl implements LacertaLibrary { public class LacertaLibraryImpl implements LacertaLibrary {
@Inject
LacertaLogger logger; LacertaLogger logger;
LacertaDatabase database;
@Inject @Inject
public LacertaLibraryImpl(LacertaLogger logger, LacertaDatabase database) { LacertaDatabase database;
this.logger = logger;
this.database = database; @Override
public ArrayList<ListItem> getRecentDocument(int limit) {
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 CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit) { public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
return CompletableFuture.supplyAsync(() -> {
// 5秒フリーズさせる
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
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
public CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit, int offset) {
return null; // TODO-rca: Implement return null; // TODO-rca: Implement
} }
@Override @Override
public CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit) { public LibraryItemPage getLibraryPage(int limit) {
return CompletableFuture.supplyAsync(() -> { return null;
LibraryItemPage libraryItemPage = new LibraryItemPage();
List<FolderEntity> folderEntities;
List<DocumentEntity> documentEntities;
if (pageId == null) { // When root folder
libraryItemPage.setPageTitle("ライブラリ");
libraryItemPage.setPageId(null);
libraryItemPage.setParentId(null);
folderEntities = database.folderDao().findRootFolders();
documentEntities = database.documentDao().findRootDocuments();
} else {
FolderEntity folderEntity = database.folderDao().findById(pageId);
if (folderEntity == null) {
logger.warn("LacertaLibraryImpl", pageId + " is not found.");
return null;
}
libraryItemPage.setPageTitle(folderEntity.name);
libraryItemPage.setPageId(folderEntity.id);
libraryItemPage.setParentId(folderEntity.parentId);
folderEntities = database.folderDao().findByParentId(pageId);
documentEntities = database.documentDao().findByParentId(pageId);
}
ArrayList<ListItem> listItems = new ArrayList<>();
for (FolderEntity childFolderEntity : folderEntities) {
logger.debug("LacertaLibraryImpl", "childFolderEntity.name: " + childFolderEntity.name);
ListItem listItem = new ListItem();
listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER);
listItem.setTitle(childFolderEntity.name);
listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる
listItem.setItemId(childFolderEntity.id);
listItems.add(listItem);
}
for (DocumentEntity documentEntity : documentEntities) {
logger.debug("LacertaLibraryImpl", "documentEntity.title: " + documentEntity.title);
ListItem listItem = new ListItem();
listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT);
listItem.setTitle(documentEntity.title);
// listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant()));
listItem.setItemId(documentEntity.id);
listItems.add(listItem);
}
libraryItemPage.setListItems(listItems);
logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
return libraryItemPage;
});
} }
@Override @Override
public CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit, int offset) { public LibraryItemPage getLibraryPage(int limit, int offset) {
return CompletableFuture.supplyAsync(() -> { return null;
return null;
});
} }
@Override @Override
public CompletableFuture<String> createFolder(String parentId, String name) { public LibraryItemPage getLibraryPage(String pageId, int limit) {
return CompletableFuture.supplyAsync(() -> { return null;
FolderEntity folderEntity = new FolderEntity();
folderEntity.id = UUID.randomUUID().toString();
folderEntity.name = name;
folderEntity.parentId = parentId;
database.folderDao().insert(folderEntity);
return folderEntity.id;
});
} }
@Override @Override
public CompletableFuture<PublicPath> getPublicPath(String itemId, ListItemType itemType) { public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) {
return CompletableFuture.supplyAsync(() -> { return null;
if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) {
DocumentEntity documentEntity = database.documentDao().findById(itemId);
if (documentEntity == null) {
logger.warn("LacertaLibraryImpl", itemId + " is not found.");
return null;
}
PublicPath publicPath = recursiveResolve(documentEntity.parentId);
publicPath.resolve(documentEntity.title);
return publicPath;
} else if (itemType == ListItemType.ITEM_TYPE_FOLDER) {
FolderEntity folderEntity = database.folderDao().findById(itemId);
if (folderEntity == null) {
return null;
}
return recursiveResolve(folderEntity.id);
} else {
logger.warn("LacertaLibraryImpl", "Unknown ListItemType: " + itemType);
return null;
}
});
} }
/** @Override
* 再帰的にパスを解決する public DocumentDetail getDocumentDetailById(String id) {
* return null;
* @param folderId
* @return
*/
private PublicPath recursiveResolve(String folderId) {
String current = folderId;
boolean continueFlag = true;
ArrayList<String> folderNames = new ArrayList<>();
while (continueFlag) {
FolderEntity folderEntity = database.folderDao().findById(current);
if (folderEntity == null) { // 存在しないフォルダIDが指定された場合
continueFlag = false;
} else {
folderNames.add(folderEntity.name);
current = folderEntity.parentId;
if (current == null) { // ルートフォルダに到達した場合
continueFlag = false;
}
}
}
// フォルダ名を逆順にしてListに変換
Collections.reverse(folderNames);
List<String> folderNamesReversed = new ArrayList<>(folderNames);
return new PublicPath(folderNamesReversed);
} }
} }
@@ -1,219 +1,219 @@
//package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
//
//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.ListItem;
//import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.ListItemType;
//import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
//
//import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentMeta;
//import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.model.document.path.DocumentPath;
//import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
//
//import com.github.javafaker.DateAndTime; import com.github.javafaker.DateAndTime;
//import com.github.javafaker.Faker; import com.github.javafaker.Faker;
//
//import java.text.DateFormat; import java.text.DateFormat;
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.Objects; import java.util.Objects;
//import java.util.UUID; import java.util.UUID;
//
//import javax.inject.Inject; import javax.inject.Inject;
//
///** /**
// * LacertaLibraryのスタブ実装 * LacertaLibraryのスタブ実装
// */ */
//public class LacertaLibraryStubImpl implements LacertaLibrary { public class LacertaLibraryStubImpl implements LacertaLibrary {
//
// LacertaLogger logger; LacertaLogger logger;
//
// Faker faker; Faker faker;
//
// @Inject @Inject
// public LacertaLibraryStubImpl(LacertaLogger logger) { public LacertaLibraryStubImpl(LacertaLogger logger) {
// faker = new Faker(); // Init Faker faker = new Faker(); // Init Faker
// this.logger = logger; this.logger = logger;
// logger.debug("LibraryStub", "Initialized"); logger.debug("LibraryStub", "Initialized");
// } }
//
// // Internal Methods // Internal Methods
//
// // Generate Stub Data // Generate Stub Data
// private LibraryItemPage generateStubLibraryItemPage(int limit, String pageId) { private LibraryItemPage generateStubLibraryItemPage(int limit, String pageId) {
// logger.debug("LibraryStub", "generateStubLibraryItemPage"); logger.debug("LibraryStub", "generateStubLibraryItemPage");
// ArrayList<ListItem> listItems = new ArrayList<>(); ArrayList<ListItem> listItems = new ArrayList<>();
// int itemTotal = faker.number().numberBetween(1, limit); // 実際に返却するアイテム数を決定 int itemTotal = faker.number().numberBetween(1, limit); // 実際に返却するアイテム数を決定
// int folderTotal; int folderTotal;
// // フォルダ数の抽選 // フォルダ数の抽選
// if (itemTotal > 4) { if (itemTotal > 4) {
// folderTotal = faker.number().numberBetween(1, itemTotal - 2); folderTotal = faker.number().numberBetween(1, itemTotal - 2);
// } }
// else { else {
// if (itemTotal > 2) { if (itemTotal > 2) {
// folderTotal = 1; folderTotal = 1;
// } }
// else { // ドキュメント数がゼロにならないように else { // ドキュメント数がゼロにならないように
// folderTotal = 0; folderTotal = 0;
// } }
// } }
// int documentTotal = itemTotal - folderTotal; // ドキュメント数を決定 int documentTotal = itemTotal - folderTotal; // ドキュメント数を決定
// logger.debug("LibraryStub", "itemTotal: " + itemTotal); logger.debug("LibraryStub", "itemTotal: " + itemTotal);
// logger.debug("LibraryStub", "folderTotal: " + folderTotal); logger.debug("LibraryStub", "folderTotal: " + folderTotal);
// logger.debug("LibraryStub", "documentTotal: " + documentTotal); logger.debug("LibraryStub", "documentTotal: " + documentTotal);
//
// // フォルダを生成 // フォルダを生成
// for (int i = 0; i < folderTotal; i++) { for (int i = 0; i < folderTotal; i++) {
// listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_FOLDER)); listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_FOLDER));
// } }
// // ドキュメントを生成 // ドキュメントを生成
// for (int i = 0; i < documentTotal; i++) { for (int i = 0; i < documentTotal; i++) {
// listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT)); listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT));
// } }
//
// LibraryItemPage libraryItemPage = new LibraryItemPage(); LibraryItemPage libraryItemPage = new LibraryItemPage();
// libraryItemPage.setListItems(listItems); libraryItemPage.setListItems(listItems);
// if (pageId == null) { if (pageId == null) {
// libraryItemPage.setPageId(UUID.randomUUID().toString()); libraryItemPage.setPageId(UUID.randomUUID().toString());
// } else { } else {
// libraryItemPage.setPageId(pageId); libraryItemPage.setPageId(pageId);
// } }
// libraryItemPage.setPageTitle("FakePage" + faker.number().digits(3)); libraryItemPage.setPageTitle("FakePage" + faker.number().digits(3));
//
// return libraryItemPage; return libraryItemPage;
// } }
//
// private ListItem generateStubListItem(ListItemType itemType) { private ListItem generateStubListItem(ListItemType itemType) {
// if (itemType == ListItemType.ITEM_TYPE_FOLDER) { if (itemType == ListItemType.ITEM_TYPE_FOLDER) {
// ListItem listItem = new ListItem(); ListItem listItem = new ListItem();
// listItem.setTitle("FakeFolder" + faker.number().digits(3)); listItem.setTitle("FakeFolder" + faker.number().digits(3));
// listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday())); listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday()));
// listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER);
// listItem.setItemId(UUID.randomUUID().toString()); listItem.setItemId(UUID.randomUUID().toString());
// return listItem; return listItem;
// } else if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) { } else if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) {
// ListItem listItem = new ListItem(); ListItem listItem = new ListItem();
// listItem.setTitle("FakeDocument" + faker.book().title()); listItem.setTitle("FakeDocument" + faker.book().title());
// listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday())); listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday()));
// listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT);
// listItem.setItemId(UUID.randomUUID().toString()); listItem.setItemId(UUID.randomUUID().toString());
// return listItem; return listItem;
// } else { } else {
// return null; return null;
// } }
// } }
//
// private LibraryItemPage getRecentDocumentPage(int limit) { private LibraryItemPage getRecentDocumentPage(int limit) {
// int itemTotal = faker.number().numberBetween(1, limit); int itemTotal = faker.number().numberBetween(1, limit);
// ArrayList<ListItem> listItems = new ArrayList<>(); ArrayList<ListItem> listItems = new ArrayList<>();
// for (int i = 0; i < itemTotal; i++) { for (int i = 0; i < itemTotal; i++) {
// listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT)); listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT));
// } }
// // DescriptionからDateを抽出して新しい順にソート // DescriptionからDateを抽出して新しい順にソート
// listItems.sort((a, b) -> { listItems.sort((a, b) -> {
// String aDate = a.getDescription().substring(11); String aDate = a.getDescription().substring(11);
// String bDate = b.getDescription().substring(11); String bDate = b.getDescription().substring(11);
// return bDate.compareTo(aDate); return bDate.compareTo(aDate);
// }); });
// LibraryItemPage libraryItemPage = new LibraryItemPage(); LibraryItemPage libraryItemPage = new LibraryItemPage();
// libraryItemPage.setListItems(listItems); libraryItemPage.setListItems(listItems);
// libraryItemPage.setPageId(UUID.randomUUID().toString()); libraryItemPage.setPageId(UUID.randomUUID().toString());
// libraryItemPage.setPageTitle("RecentDocument"); libraryItemPage.setPageTitle("RecentDocument");
// return libraryItemPage; return libraryItemPage;
// } }
//
// private DocumentDetail generateStubDocumentDetail(String id) throws IllegalArgumentException { private DocumentDetail generateStubDocumentDetail(String id) throws IllegalArgumentException {
//
// if (Objects.isNull(id)) { if (Objects.isNull(id)) {
// throw new IllegalArgumentException("id is null"); throw new IllegalArgumentException("id is null");
// } }
//
// DocumentMeta documentMeta = new DocumentMeta(); DocumentMeta documentMeta = new DocumentMeta();
// documentMeta.setId(id); documentMeta.setId(id);
// documentMeta.setTitle("FakeDocument" + faker.book().title()); documentMeta.setTitle("FakeDocument" + faker.book().title());
// documentMeta.setCreatedAt(faker.date().birthday()); documentMeta.setCreatedAt(faker.date().birthday());
// documentMeta.setUpdatedAt(faker.date().birthday()); // TODO-rca: 更新日のほうが古くなることがあるのでなんとかする? documentMeta.setUpdatedAt(faker.date().birthday()); // TODO-rca: 更新日のほうが古くなることがあるのでなんとかする?
// ArrayList<String> tagIds = new ArrayList<>(); ArrayList<String> tagIds = new ArrayList<>();
//
// DocumentDetail documentDetail = new DocumentDetail(); DocumentDetail documentDetail = new DocumentDetail();
// documentDetail.setMeta(documentMeta); documentDetail.setMeta(documentMeta);
//// documentDetail.setPath(null); // TODO-rca: なんとかする // documentDetail.setPath(null); // TODO-rca: なんとかする
//// documentDetail.setAuthor(faker.name().fullName()); // documentDetail.setAuthor(faker.name().fullName());
//// documentDetail.setRepository(null); // TODO-rca: なんとかする // documentDetail.setRepository(null); // TODO-rca: なんとかする
// return documentDetail; return documentDetail;
// } }
//
// /** /**
// * 履歴ページを取得する * 履歴ページを取得する
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public ArrayList<ListItem> getRecentDocument(int limit) { public ArrayList<ListItem> getRecentDocument(int limit) {
// return getRecentDocumentPage(limit).getListItems(); return getRecentDocumentPage(limit).getListItems();
// } }
//
// /** /**
// * 履歴ページを取得する * 履歴ページを取得する
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @param offset 取得するアイテムのオフセット * @param offset 取得するアイテムのオフセット
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public ArrayList<ListItem> getRecentDocument(int limit, int offset) { public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
// return getRecentDocumentPage(limit).getListItems(); return getRecentDocumentPage(limit).getListItems();
// } }
//
// /** /**
// * ライブラリページを取得する * ライブラリページを取得する
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public LibraryItemPage getLibraryPage(int limit) { public LibraryItemPage getLibraryPage(int limit) {
// return generateStubLibraryItemPage(limit, null); return generateStubLibraryItemPage(limit, null);
// } }
//
// /** /**
// * ライブラリページを取得する * ライブラリページを取得する
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @param offset 取得するアイテムのオフセット * @param offset 取得するアイテムのオフセット
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public LibraryItemPage getLibraryPage(int limit, int offset) { public LibraryItemPage getLibraryPage(int limit, int offset) {
// return generateStubLibraryItemPage(limit, null); return generateStubLibraryItemPage(limit, null);
// } }
//
// /** /**
// * ライブラリページを取得する * ライブラリページを取得する
// * @param pageId ページID * @param pageId ページID
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public LibraryItemPage getLibraryPage(String pageId, int limit) { public LibraryItemPage getLibraryPage(String pageId, int limit) {
// return generateStubLibraryItemPage(limit, pageId); return generateStubLibraryItemPage(limit, pageId);
// } }
//
// /** /**
// * ライブラリページを取得する * ライブラリページを取得する
// * @param pageId ページID * @param pageId ページID
// * @param limit 取得するアイテム数 * @param limit 取得するアイテム数
// * @param offset 取得するアイテムのオフセット * @param offset 取得するアイテムのオフセット
// * @return ページオブジェクト * @return ページオブジェクト
// */ */
// @Override @Override
// public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) { public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) {
// return generateStubLibraryItemPage(limit, pageId); return generateStubLibraryItemPage(limit, pageId);
// } }
//
// /** /**
// * ドキュメント詳細を取得する * ドキュメント詳細を取得する
// * @param id ドキュメントID * @param id ドキュメントID
// * @return ドキュメント詳細オブジェクト * @return ドキュメント詳細オブジェクト
// */ */
// @Override @Override
// public DocumentDetail getDocumentDetailById(String id) throws IllegalArgumentException { public DocumentDetail getDocumentDetailById(String id) throws IllegalArgumentException {
// return generateStubDocumentDetail(id); return generateStubDocumentDetail(id);
// } }
//} }
@@ -30,10 +30,9 @@ public class LacertaSearchStubImpl implements LacertaSearch {
*/ */
@Override @Override
public ArrayList<ListItem> autoSearch(String query, int limit) { public ArrayList<ListItem> autoSearch(String query, int limit) {
// logger.debug("SearchStub", "autoSearch"); logger.debug("SearchStub", "autoSearch");
// logger.debug("SearchStub", "query: " + query); logger.debug("SearchStub", "query: " + query);
// return library.getLibraryPage(limit).getListItems(); return library.getLibraryPage(limit).getListItems();
return null;
} }
/** /**
@@ -45,9 +44,8 @@ public class LacertaSearchStubImpl implements LacertaSearch {
*/ */
@Override @Override
public ArrayList<ListItem> autoSearch(String query, int limit, int offset) { public ArrayList<ListItem> autoSearch(String query, int limit, int offset) {
// logger.debug("SearchStub", "autoSearch"); logger.debug("SearchStub", "autoSearch");
// logger.debug("SearchStub", "query: " + query); logger.debug("SearchStub", "query: " + query);
// return library.getLibraryPage(limit, offset).getListItems(); return library.getLibraryPage(limit, offset).getListItems();
return null;
} }
} }
@@ -7,7 +7,7 @@ import dagger.hilt.android.components.FragmentComponent;
import dagger.hilt.migration.DisableInstallInCheck; import dagger.hilt.migration.DisableInstallInCheck;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.data.impl.LacertaLibraryImpl; import one.nem.lacerta.data.impl.LacertaLibraryStubImpl;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
@Module @Module
@@ -16,6 +16,6 @@ import one.nem.lacerta.utils.LacertaLogger;
abstract public class LacertaLibraryModule { abstract public class LacertaLibraryModule {
@Binds @Binds
public abstract LacertaLibrary bindLacertaLibrary(LacertaLibraryImpl impl); public abstract LacertaLibrary bindLacertaLibrary(LacertaLibraryStubImpl impl);
} }
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.feature.common' namespace 'one.nem.lacerta.feature.common'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -57,8 +57,7 @@ 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);
// ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(10); ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(10);
ArrayList<ListItem> listItems = new ArrayList<>();
for (ListItem listItem : listItems) { for (ListItem listItem : listItems) {
System.out.println(listItem.getTitle()); System.out.println(listItem.getTitle());
} }
@@ -11,7 +11,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp" android:textSize="16sp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:text="Placeholder Title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@@ -20,7 +19,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="14sp" android:textSize="14sp"
android:text="Placeholder Description"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
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" />
+1 -5
View File
@@ -5,7 +5,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.feature.home' namespace 'one.nem.lacerta.feature.home'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -55,8 +55,4 @@ dependencies {
implementation project(':model') implementation project(':model')
implementation "androidx.recyclerview:recyclerview:1.3.2" implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation project(':component:common')
implementation project(':component:viewer')
} }
@@ -1,5 +0,0 @@
package one.nem.lacerta.feature.home;
public interface DocumentSelectListener {
void onDocumentSelect(String documentId);
}
@@ -1,36 +1,21 @@
package one.nem.lacerta.feature.home; package one.nem.lacerta.feature.home;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.component.viewer.ViewerMainActivity;
import one.nem.lacerta.data.Document; import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.ListItem;
@@ -49,13 +34,34 @@ public class HomeTopFragment extends Fragment {
@Inject @Inject
LacertaLibrary lacertaLibrary; 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";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public HomeTopFragment() { public HomeTopFragment() {
// Required empty public constructor // Required empty public constructor
} }
public static HomeTopFragment newInstance() { /**
* 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 HomeTopFragment.
*/
// TODO: Rename and change types and number of parameters
public static HomeTopFragment newInstance(String param1, String param2) {
HomeTopFragment fragment = new HomeTopFragment(); HomeTopFragment fragment = new HomeTopFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
@@ -64,46 +70,49 @@ public class HomeTopFragment extends Fragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home_top, container, false); View view = inflater.inflate(R.layout.fragment_home_top, container, false);
setHasOptionsMenu(true); // List<DocumentMeta> metas = document.getAllDocumentMetas(100);
return view;
}
@Override ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(100);
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view); Log.d("docs", Integer.toString(listItems.size()));
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> {
Log.d("HomeTopFragment", "onViewCreated: " + documentId);
Intent intent = new Intent(getContext(), ViewerMainActivity.class);
intent.putExtra("documentId", documentId);
startActivity(intent);
});
recyclerView.setAdapter(listItemAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> { MyAdapter myAdapter = new MyAdapter(listItems);
listItemAdapter.setListItems(listItems);
getActivity().runOnUiThread(() -> { recyclerView.setAdapter(myAdapter);
listItemAdapter.notifyItemRangeInserted(0, listItems.size());
}); return view;
});
}
}
String pageTitle;
String pageId;
ArrayList listItems;
String title;
String description;
String itemId;
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.drawer_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
} }
@@ -1,73 +0,0 @@
package one.nem.lacerta.feature.home;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import one.nem.lacerta.component.viewer.ViewerMainActivity;
import one.nem.lacerta.model.ListItem;
public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListItemViewHolder>{
ArrayList<ListItem> listItems;
DocumentSelectListener listener;
public ListItemAdapter(DocumentSelectListener listener){
this.listItems = new ArrayList<>();
this.listener = listener;
}
public void setListItems(ArrayList<ListItem> listItems) {
this.listItems = listItems;
}
@NonNull
@Override
public ListItemAdapter.ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item, parent, false);
return new ListItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ListItemAdapter.ListItemViewHolder holder, int position) {
ListItem listItem = listItems.get(position);
holder.icon.setImageResource(listItem.getItemType().getIconId());
holder.icon.setColorFilter(one.nem.lacerta.shared.ui.R.color.colorOnSurface);
holder.title.setText(listItem.getTitle());
holder.description.setText(listItem.getDescription());
holder.itemView.setOnClickListener( v -> {
Intent intent = new Intent(v.getContext(), ViewerMainActivity.class);
intent.putExtra("documentId", listItem.getItemId());
v.getContext().startActivity(intent);
});
}
@Override
public int getItemCount() {
return listItems.size();
}
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
ImageView icon;
TextView title;
TextView description;
public ListItemViewHolder(@NonNull View itemView) {
super(itemView);
icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon);
title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title);
description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description);
}
}
}
@@ -1,50 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".HomeTopFragment"
tools:ignore="ExtraText"
android:background="@color/colorSurface"> android:background="@color/colorSurface">
<androidx.coordinatorlayout.widget.CoordinatorLayout
<!-- TODO: Update blank fragment layout -->
<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">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout </androidx.recyclerview.widget.RecyclerView>
android:id="@+id/collapsing_toolbar"
app:contentScrim="@color/colorSecondaryContainer"
android:background="@color/colorSurface"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp"
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="HOGE" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/home_item_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout> </FrameLayout>
+1 -3
View File
@@ -5,7 +5,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.feature.library' namespace 'one.nem.lacerta.feature.library'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
@@ -51,7 +51,5 @@ dependencies {
implementation project(':data') implementation project(':data')
implementation project(':utils')
} }
@@ -1,6 +0,0 @@
package one.nem.lacerta.feature.library;
public interface DocumentSelectListener {
void onFolderSelected(String folderId, String folderName);
void onDocumentSelected(String documentId, String documentName);
}
@@ -0,0 +1,38 @@
package one.nem.lacerta.feature.library;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
// LibraryArchiveFragment.java
//画面変移用のコード
//Fragmentへのデータの受け渡し機能
public class LibraryArchiveFragment extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_library_top);
// ここに入力された内容を表示する機能
TextView textView = findViewById(R.id.document_list);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 文字をタップしたときの処理
// 移動先のアクティビティを指定
Intent intent = new Intent(LibraryArchiveFragment.this, LibraryDocFragment.class);
// データを付加する
intent.putExtra("key_name", "value_data");
startActivity(intent);
}
});
}
}
@@ -1,283 +0,0 @@
package one.nem.lacerta.feature.library;
import android.app.AlertDialog;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
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.FragmentNavigation;
import one.nem.lacerta.model.LibraryItemPage;
import one.nem.lacerta.model.PublicPath;
import one.nem.lacerta.utils.LacertaLogger;
/**
* A simple {@link Fragment} subclass.
* Use the {@link LibraryPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class LibraryPageFragment extends Fragment {
// Variables
// このインスタンスで表示されているページ
LibraryItemPage libraryItemPage;
// Arguments
String folderId;
String title;
String parentId;
@Inject
LacertaLibrary lacertaLibrary;
@Inject
LacertaLogger logger;
ListItemAdapter listItemAdapter;
public LibraryPageFragment() {
// Required empty public constructor
}
public static LibraryPageFragment newInstance(String folderId, String title, String parentId) {
LibraryPageFragment fragment = new LibraryPageFragment();
Bundle args = new Bundle();
args.putString("folderId", folderId);
args.putString("title", title);
args.putString("publicPath", parentId);
fragment.setArguments(args);
return fragment;
}
public static LibraryPageFragment newInstance(String folderId) { // Back action
LibraryPageFragment fragment = new LibraryPageFragment();
Bundle args = new Bundle();
args.putString("folderId", folderId);
args.putString("title", null);
args.putString("publicPath", null);
fragment.setArguments(args);
return fragment;
}
public static LibraryPageFragment newInstance() {
LibraryPageFragment fragment = new LibraryPageFragment();
Bundle args = new Bundle();
args.putString("folderId", null);
args.putString("title", null);
args.putString("publicPath", null);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_library_top, container, false);
// Set status bar color
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
// Collapsed
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
} else if (verticalOffset == 0) {
// Expanded
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
} else {
// Somewhere in between
// Here you can add a color transition if you want
}
}
});
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getArguments() != null) {
this.folderId = getArguments().getString("folderId"); // Required
if (getArguments().getString("title") == null && getArguments().getString("publicPath") == null) {
this.libraryItemPage = new LibraryItemPage();
} else {
this.title = getArguments().getString("title");
this.parentId = getArguments().getString("publicPath");
}
} else {
logger.debug("LibraryTopFragment", "getArguments() is null(maybe root)");
this.libraryItemPage = new LibraryItemPage();
}
// Toolbar Setup
toolbarSetup(view.findViewById(R.id.library_toolbar), this.folderId != null, this.title != null ? this.title : "ライブラリ");
// RecyclerView Setup
RecyclerView recyclerView = view.findViewById(R.id.library_item_recycler_view);
this.listItemAdapter = new ListItemAdapter(new DocumentSelectListener() {
@Override
public void onFolderSelected(String folderId, String folderName) {
logger.debug("LibraryTopFragment", "Folder selected! folderId: " + folderId + ", folderName: " + folderName);
// // 画面遷移
// FragmentNavigation fragmentNavigation = (FragmentNavigation) getActivity();
// // folderId: 推移先で表示するフォルダのID, folderName: 推移先で表示するフォルダの名前, parentId: このフラグメントで表示しているフォルダのID(推移先の親)
// fragmentNavigation.navigateToFragment(LibraryPageFragment.newInstance(folderId, folderName, libraryItemPage != null ? libraryItemPage.getParentId() : null), false);
Bundle bundle = new Bundle();
bundle.putString("folderId", folderId);
bundle.putString("title", folderName);
bundle.putString("publicPath", libraryItemPage != null ? libraryItemPage.getParentId() : null);
try {
Navigation.findNavController(requireView()).navigate(R.id.action_feature_library_top_fragment_self, bundle);
} catch (IllegalStateException e) {
logger.error("LibraryTopFragment", "IllegalStateException: " + e.getMessage());
}
}
@Override
public void onDocumentSelected(String documentId, String documentName) {
Toast.makeText(getContext(), "Document selected! documentId: " + documentId + ", documentName: " + documentName, Toast.LENGTH_SHORT).show();
}
});
recyclerView.setAdapter(listItemAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// Get library page and update RecyclerView items
lacertaLibrary.getLibraryPage(this.folderId, 10).thenAccept(libraryItemPage -> {
this.libraryItemPage = libraryItemPage;
if (this.parentId == null) {
this.parentId = libraryItemPage.getParentId();
}
if (this.title == null) {
this.title = libraryItemPage.getPageTitle();
// Toolbar init again
toolbarSetup(view.findViewById(R.id.library_toolbar), this.folderId != null, this.title != null ? this.title : "ライブラリ");
}
logger.debug("LibraryTopFragment", "Item selected! Total item page: " + this.libraryItemPage.getListItems().size());
getActivity().runOnUiThread(() -> { // TODO-rca: 実行条件を考える?
listItemAdapter.notifyItemRangeRemoved(0, this.libraryItemPage.getListItems().size() - 1);
});
listItemAdapter.setLibraryItemPage(this.libraryItemPage);
getActivity().runOnUiThread(() -> {
listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size() - 1);
});
});
}
/**
* Currentにフォルダを作成する
*/
private void createFolder(String pageId) {
// TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("フォルダの作成");
builder.setMessage("フォルダ名を入力してください");
final android.widget.EditText input = new android.widget.EditText(getContext());
input.setText("フォルダ名");
builder.setView(input);
builder.setPositiveButton("作成", (dialog, which) -> {
lacertaLibrary.createFolder(pageId, input.getText().toString()).thenAccept(folderId -> {
// Refresh
updateItem(pageId);
});
});
builder.setNegativeButton("キャンセル", (dialog, which) -> {
dialog.cancel();
});
builder.show();
}
/**
* RecyclerViewのアイテムを更新する
*/
private void updateItem(String pageId) {
lacertaLibrary.getLibraryPage(pageId, 10).thenAccept(libraryItemPage -> {
this.libraryItemPage = libraryItemPage;
logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());
getActivity().runOnUiThread(() -> {
listItemAdapter.notifyItemRangeRemoved(0, libraryItemPage.getListItems().size() - 1);
});
listItemAdapter.setLibraryItemPage(libraryItemPage);
getActivity().runOnUiThread(() -> {
listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1);
});
});
}
/**
* ToolbarをInitする
*
* @param toolbar Toolbar
* @param showBackButton 戻るボタンを表示するか
* @param title タイトル
*/
private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title) {
getActivity().runOnUiThread(() -> {
if (showBackButton) {
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
toolbar.setNavigationOnClickListener(v -> {
//this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join();
// Back
Navigation.findNavController(requireView()).popBackStack();
});
} else {
toolbar.setNavigationIcon(null);
}
toolbar.setTitle(title);
toolbar.inflateMenu(R.menu.dir_menu);
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.menu_item_create_new_folder) {
createFolder(this.folderId);
return true;
} else {
return false;
}
});
});
}
}
@@ -0,0 +1,106 @@
package one.nem.lacerta.feature.library;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
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.model.document.DocumentMeta;
import one.nem.lacerta.model.document.tag.DocumentTag;
/**
* A simple {@link Fragment} subclass.
* Use the {@link LibraryTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class LibraryTopFragment extends Fragment {
// @Inject
// Document document;
// 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 LibraryTopFragment() {
// 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 LibraryTopFragment.
*/
// TODO: Rename and change types and number of parameters
public static LibraryTopFragment newInstance(String param1, String param2) {
LibraryTopFragment fragment = new LibraryTopFragment();
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
View view = inflater.inflate(R.layout.fragment_library_top, container, false);
// Use view.findViewById instead of findViewById
RecyclerView documentRecyclerView = view.findViewById(R.id.document_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
documentRecyclerView.setLayoutManager(layoutManager);
//データを取得
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
// Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();
// Create and set the adapter
// DocumentAdapter adapter = new DocumentAdapter(metas);
// documentRecyclerView.setAdapter(adapter);
// Use a LinearLayoutManager to specify the layout
return view;
}
}
@@ -1,78 +0,0 @@
package one.nem.lacerta.feature.library;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import one.nem.lacerta.model.LibraryItemPage;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.ListItemType;
public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListItemViewHolder>{
LibraryItemPage libraryItemPage;
DocumentSelectListener listener;
public ListItemAdapter(DocumentSelectListener listener) {
this.listener = listener;
}
public void setLibraryItemPage(LibraryItemPage libraryItemPage) {
this.libraryItemPage = libraryItemPage;
}
@NonNull
@Override
public ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item, parent, false);
return new ListItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ListItemViewHolder holder, int position) {
ListItem listItem = libraryItemPage.getListItems().get(position);
holder.icon.setImageResource(listItem.getItemType().getIconId());
holder.icon.setColorFilter(one.nem.lacerta.shared.ui.R.color.colorOnSurface);
holder.title.setText(listItem.getTitle());
holder.description.setText(listItem.getDescription());
holder.itemView.setOnClickListener( v -> {
if (listItem.getItemType() == ListItemType.ITEM_TYPE_DOCUMENT) {
listener.onDocumentSelected(listItem.getItemId(), listItem.getTitle());
}
else if (listItem.getItemType() == ListItemType.ITEM_TYPE_FOLDER) {
listener.onFolderSelected(listItem.getItemId(), listItem.getTitle());
}
});
}
@Override
public int getItemCount() {
return this.libraryItemPage == null ? 0
: this.libraryItemPage.getListItems() == null ? 0 : this.libraryItemPage.getListItems().size();
}
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
ImageView icon;
TextView title;
TextView description;
public ListItemViewHolder(@NonNull View itemView) {
super(itemView);
icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon);
title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title);
description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description);
}
}
}
@@ -1,50 +1,32 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <?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" xmlns:app="http://schemas.android.com/apk/res-auto"
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"
android:background="@color/colorSurface"> android:theme="@style/Theme.Lacerta"
tools:context=".LibraryTopFragment">
<androidx.coordinatorlayout.widget.CoordinatorLayout <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content"
android:background="@color/colorPrimaryContainer"
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="Library"
app:titleTextColor="@color/colorOnPrimaryContainer" />
<com.google.android.material.appbar.AppBarLayout <androidx.recyclerview.widget.RecyclerView
android:id="@+id/app_bar_layout" android:id="@+id/document_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tool_bar" />
<com.google.android.material.appbar.CollapsingToolbarLayout </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/collapsing_toolbar"
app:contentScrim="@color/colorSecondaryContainer"
android:background="@color/colorSurface"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp"
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/library_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="HOGE" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/library_item_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_item_create_new_folder"
android:icon="@drawable/developer_mode_24px"
android:title="@string/app_name"
app:showAsAction="ifRoom"/> <!-- TODO-rca: change this -->
</menu>
@@ -6,17 +6,7 @@
app:startDestination="@id/feature_library_top_fragment"> app:startDestination="@id/feature_library_top_fragment">
<fragment <fragment
android:id="@+id/feature_library_top_fragment" android:id="@+id/feature_library_top_fragment"
android:name="one.nem.lacerta.feature.library.LibraryPageFragment" android:name="one.nem.lacerta.feature.library.LibraryTopFragment"
android:label="fragment_library_top" android:label="fragment_library_top"
tools:layout="@layout/fragment_library_top" > tools:layout="@layout/fragment_library_top" />
<action
android:id="@+id/action_feature_library_top_fragment_self"
app:destination="@id/feature_library_top_fragment"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim"
app:popUpTo="@id/feature_library_top_fragment"
app:popUpToInclusive="false"/>
</fragment>
</navigation> </navigation>
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.feature.scan' namespace 'one.nem.lacerta.feature.scan'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
android { android {
namespace 'one.nem.lacerta.feature.search' namespace 'one.nem.lacerta.feature.search'
compileSdk 34 compileSdk 33
defaultConfig { defaultConfig {
minSdk 26 minSdk 26
-1
View File
@@ -1 +0,0 @@
/build
-52
View File
@@ -1,52 +0,0 @@
plugins {
alias(libs.plugins.com.android.library)
}
android {
namespace 'one.nem.lacerta.setting'
compileSdk 34
defaultConfig {
minSdk 26
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
// Navigation
implementation libs.navigation.fragment
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')
// https://mvnrepository.com/artifact/androidx.preference/preference
implementation 'androidx.preference:preference:1.2.1'
}
View File
Whitespace-only changes.
-21
View File
@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -1,26 +0,0 @@
package one.nem.lacerta.setting;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("one.nem.lacerta.setting.test", appContext.getPackageName());
}
}
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
@@ -1,63 +0,0 @@
package one.nem.lacerta.setting;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import one.nem.lacerta.setting.model.SettingListItem;
public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListItemViewHolder>{
ArrayList<SettingListItem> listItems;
public ListItemAdapter(ArrayList<SettingListItem> listItems){
this.listItems = listItems;
}
@NonNull
@Override
public ListItemAdapter.ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item, parent, false);
return new ListItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ListItemAdapter.ListItemViewHolder holder, int position) {
SettingListItem listItem = listItems.get(position);
holder.icon.setImageDrawable(listItem.getIcon());
holder.icon.setColorFilter(one.nem.lacerta.shared.ui.R.color.colorOnSurface);
holder.title.setText(listItem.getTitle());
holder.description.setText(listItem.getDescription());
holder.itemView.setOnClickListener( v -> {
Navigation.findNavController(v).navigate(listItem.getDestination());
});
}
@Override
public int getItemCount() {
return listItems.size();
}
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
ImageView icon;
TextView title;
TextView description;
public ListItemViewHolder(@NonNull View itemView) {
super(itemView);
icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon);
title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title);
description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description);
}
}
}
@@ -1,43 +0,0 @@
package one.nem.lacerta.setting;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SettingAboutPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SettingAboutPageFragment extends Fragment {
public SettingAboutPageFragment() {
// Required empty public constructor
}
public static SettingAboutPageFragment newInstance() {
SettingAboutPageFragment fragment = new SettingAboutPageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_setting_about_page, container, false);
return view;
}
}
@@ -1,40 +0,0 @@
package one.nem.lacerta.setting;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SettingDataPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SettingDataPageFragment extends Fragment {
public SettingDataPageFragment() {
// Required empty public constructor
}
public static SettingDataPageFragment newInstance() {
SettingDataPageFragment fragment = new SettingDataPageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_setting_data_page, container, false);
}
}
@@ -1,40 +0,0 @@
package one.nem.lacerta.setting;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SettingDisplayPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SettingDisplayPageFragment extends Fragment {
public SettingDisplayPageFragment() {
// Required empty public constructor
}
public static SettingDisplayPageFragment newInstance() {
SettingDisplayPageFragment fragment = new SettingDisplayPageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_setting_display_page, container, false);
}
}
@@ -1,38 +0,0 @@
package one.nem.lacerta.setting;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.preference.PreferenceFragmentCompat;
import android.preference.PreferenceFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SettingScanPageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SettingScanPageFragment extends PreferenceFragmentCompat {
public SettingScanPageFragment() {
// Required empty public constructor
}
@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
addPreferencesFromResource(R.xml.scan_preferences);
}
public static SettingScanPageFragment newInstance() {
SettingScanPageFragment fragment = new SettingScanPageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
}
@@ -1,92 +0,0 @@
package one.nem.lacerta.setting;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import one.nem.lacerta.setting.model.SettingListItem;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SettingTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SettingTopFragment extends Fragment {
public SettingTopFragment() {
// Required empty public constructor
}
public static SettingTopFragment newInstance() {
SettingTopFragment fragment = new SettingTopFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_setting_top, container, false);
// Setting items
ArrayList<SettingListItem> settingListItems = new ArrayList<>();
settingListItems.add(
new SettingListItem(
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_display_title),
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_display_description),
ContextCompat.getDrawable(getContext(), one.nem.lacerta.shared.ui.R.drawable.palette_24px),
R.id.action_settingTopFragment_to_settingDisplayPageFragment
)
);
settingListItems.add(
new SettingListItem(
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_data_title),
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_data_description),
ContextCompat.getDrawable(getContext(), one.nem.lacerta.shared.ui.R.drawable.settings_backup_restore_24px),
R.id.action_settingTopFragment_to_settingDataPageFragment
)
);
settingListItems.add(
new SettingListItem(
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_scan_title),
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_scan_description),
ContextCompat.getDrawable(getContext(), one.nem.lacerta.shared.ui.R.drawable.document_scanner_24px),
R.id.action_settingTopFragment_to_settingScanPageFragment
)
);
settingListItems.add(
new SettingListItem(
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_about_title),
getResources().getString(one.nem.lacerta.shared.ui.R.string.setting_top_about_description),
ContextCompat.getDrawable(getContext(), one.nem.lacerta.shared.ui.R.drawable.info_24px),
R.id.action_settingTopFragment_to_settingAboutPageFragment
)
);
// Init RecyclerView
RecyclerView recyclerView = view.findViewById(R.id.setting_item_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(new ListItemAdapter(settingListItems));
return view;
}
}
@@ -1,34 +0,0 @@
package one.nem.lacerta.setting.model;
import android.graphics.drawable.Drawable;
public class SettingListItem {
String title;
String description;
Drawable icon;
int destination;
public SettingListItem(String title, String description, Drawable icon, int destination) {
this.title = title;
this.description = description;
this.icon = icon;
this.destination = destination;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public Drawable getIcon() {
return icon;
}
public int getDestination() {
return destination;
}
}
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingAboutPageFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingDataPageFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SettingDisplayPageFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -1,50 +0,0 @@
<FrameLayout 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="match_parent"
android:background="@color/colorSurface">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
app:contentScrim="@color/colorSecondaryContainer"
android:background="@color/colorSurface"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp"
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="@string/setting_top_scan_title" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/setting_scan_page_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout>
@@ -1,50 +0,0 @@
<FrameLayout 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="match_parent"
android:background="@color/colorSurface">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
app:contentScrim="@color/colorSecondaryContainer"
android:background="@color/colorSurface"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp"
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:title="@string/setting_title" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/setting_item_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout>
@@ -1,61 +0,0 @@
<?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_setting_navigation"
app:startDestination="@id/settingTopFragment">
<fragment
android:id="@+id/settingTopFragment"
android:name="one.nem.lacerta.setting.SettingTopFragment"
android:label="SettingTopFragment" >
<action
android:id="@+id/action_settingTopFragment_to_settingAboutPageFragment"
app:destination="@id/settingAboutPageFragment"
app:enterAnim="@anim/slide_from_right"
app:exitAnim="@anim/slide_to_left"
app:popEnterAnim="@anim/slide_from_left"
app:popExitAnim="@anim/slide_to_right" />
<action
android:id="@+id/action_settingTopFragment_to_settingDisplayPageFragment"
app:destination="@id/settingDisplayPageFragment"
app:enterAnim="@anim/slide_from_right"
app:exitAnim="@anim/slide_to_left"
app:popEnterAnim="@anim/slide_from_left"
app:popExitAnim="@anim/slide_to_right" />
<action
android:id="@+id/action_settingTopFragment_to_settingDataPageFragment"
app:destination="@id/settingDataPageFragment"
app:enterAnim="@anim/slide_from_right"
app:exitAnim="@anim/slide_to_left"
app:popEnterAnim="@anim/slide_from_left"
app:popExitAnim="@anim/slide_to_right" />
<action
android:id="@+id/action_settingTopFragment_to_settingScanPageFragment"
app:destination="@id/settingScanPageFragment"
app:enterAnim="@anim/slide_from_right"
app:exitAnim="@anim/slide_to_left"
app:popEnterAnim="@anim/slide_from_left"
app:popExitAnim="@anim/slide_to_right" />
</fragment>
<fragment
android:id="@+id/settingAboutPageFragment"
android:name="one.nem.lacerta.setting.SettingAboutPageFragment"
android:label="fragment_setting_about_page"
tools:layout="@layout/fragment_setting_about_page" />
<fragment
android:id="@+id/settingDataPageFragment"
android:name="one.nem.lacerta.setting.SettingDataPageFragment"
android:label="fragment_setting_data_page"
tools:layout="@layout/fragment_setting_data_page" />
<fragment
android:id="@+id/settingDisplayPageFragment"
android:name="one.nem.lacerta.setting.SettingDisplayPageFragment"
android:label="fragment_setting_display_page"
tools:layout="@layout/fragment_setting_display_page" />
<fragment
android:id="@+id/settingScanPageFragment"
android:name="one.nem.lacerta.setting.SettingScanPageFragment"
android:label="fragment_setting_scan_page"
tools:layout="@layout/fragment_setting_scan_page" />
</navigation>
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="png_quality_array">
<item name="5">5</item>
<item name="6">6</item>
<item name="7">7</item>
<item name="8">8</item>
<item name="9">9</item>
</array>
</resources>
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="png_quality_default">70</integer>
<integer name="png_quality_min">5</integer>
<integer name="png_quality_max">100</integer>
</resources>
@@ -1,4 +0,0 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory android:title="@string/setting_scan_quality_title">
<SeekBarPreference
android:defaultValue="@integer/png_quality_default"
android:key="png_quality"
android:max="@integer/png_quality_max"
android:min="@integer/png_quality_min"
android:summary="@string/setting_scan_quality_png_quality_description"
android:title="@string/setting_scan_quality_png_quality_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/setting_scan_default_title">
<EditTextPreference
android:defaultValue="Untitled"
android:key="new_doc_default_title"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/setting_scan_default_document_name" />
<EditTextPreference
android:defaultValue="NewFolder"
android:key="new_dir_default_title"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/setting_scan_default_folder_name" />
</PreferenceCategory>
</PreferenceScreen>
@@ -1,17 +0,0 @@
package one.nem.lacerta.setting;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
@@ -1,13 +0,0 @@
package one.nem.lacerta.model;
import androidx.fragment.app.Fragment;
public interface FragmentNavigation {
void navigateToFragment(Fragment fragment);
void navigateToFragment(Fragment fragment, boolean addToBackStack);
void navigateToFragment(Fragment fragment, boolean addToBackStack, boolean clearBackStack);
void navigateToFragmentAlternate(Fragment fragment, boolean addToBackStack);
}
@@ -6,18 +6,10 @@ public class LibraryItemPage {
String pageTitle; String pageTitle;
String pageId; String pageId;
String parentId;
ArrayList<ListItem> listItems; ArrayList<ListItem> listItems;
// Constructor // Constructor
public LibraryItemPage(String pageTitle, String pageId, ArrayList<ListItem> listItems, String parentId) {
this.pageTitle = pageTitle;
this.pageId = pageId;
this.listItems = listItems;
this.parentId = parentId;
}
public LibraryItemPage(String pageTitle, String pageId, ArrayList<ListItem> listItems) { public LibraryItemPage(String pageTitle, String pageId, ArrayList<ListItem> listItems) {
this.pageTitle = pageTitle; this.pageTitle = pageTitle;
this.pageId = pageId; this.pageId = pageId;
@@ -38,10 +30,6 @@ public class LibraryItemPage {
return pageId; return pageId;
} }
public String getParentId() {
return parentId;
}
public ArrayList<ListItem> getListItems() { public ArrayList<ListItem> getListItems() {
return listItems; return listItems;
} }
@@ -56,10 +44,6 @@ public class LibraryItemPage {
this.pageId = pageId; this.pageId = pageId;
} }
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setListItems(ArrayList<ListItem> listItems) { public void setListItems(ArrayList<ListItem> listItems) {
this.listItems = listItems; this.listItems = listItems;
} }
@@ -1,7 +1,5 @@
package one.nem.lacerta.model; package one.nem.lacerta.model;
import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -31,31 +29,11 @@ public class PublicPath {
private void resolveInternal(String path) { private void resolveInternal(String path) {
if (path.equals("..")) { if (path.equals("..")) {
this.path.remove(this.path.size() - 1); this.path.remove(this.path.size() - 1);
} else if (path.equals(".")) {
// do nothing
} else { } else {
this.path.add(path); add(path);
} }
} }
public PublicPath parse(String path) {
if (path == null) {
this.path.clear();
this.path.add("/");
} else {
if (path.startsWith("/")) {
this.path.clear();
path = path.substring(1);
}
String[] pathArray = path.split("/");
for (String p : pathArray) {
Log.d("PublicPath", "parse: " + p);
resolveInternal(p);
}
}
return this;
}
public PublicPath resolve(String path) { public PublicPath resolve(String path) {
resolveInternal(path); resolveInternal(path);
return this; return this;
@@ -1,80 +0,0 @@
package one.nem.lacerta.model;
import java.util.ArrayList;
import java.util.Date;
public class VcsRevModel {
String id;
String documentId;
String branchName;
String commitMessage;
Date createdAt;
ArrayList<String> logIds;
public VcsRevModel(String id, String documentId, String branchName, String commitMessage, Date createdAt, ArrayList<String> logIds) {
this.id = id;
this.documentId = documentId;
this.branchName = branchName;
this.commitMessage = commitMessage;
this.createdAt = createdAt;
this.logIds = logIds;
}
// Empty constructor
public VcsRevModel() {
}
public String getId() {
return id;
}
public String getDocumentId() {
return documentId;
}
public String getBranchName() {
return branchName;
}
public String getCommitMessage() {
return commitMessage;
}
public Date getCreatedAt() {
return createdAt;
}
public ArrayList<String> getLogIds() {
return logIds;
}
public void setId(String id) {
this.id = id;
}
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
public void setBranchName(String branchName) {
this.branchName = branchName;
}
public void setCommitMessage(String commitMessage) {
this.commitMessage = commitMessage;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public void setLogIds(ArrayList<String> logIds) {
this.logIds = logIds;
}
}
@@ -37,7 +37,7 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
*/ */
List<DocumentTag> tags; List<DocumentTag> tags;
String parentId; PublicPath path;
String author; String author;
@@ -54,7 +54,7 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
this.tags = new ArrayList<>(); this.tags = new ArrayList<>();
this.author = ""; // TODO-rca: 作者のデフォルト値を設定できるようにする this.author = ""; // TODO-rca: 作者のデフォルト値を設定できるようにする
this.defaultBranch = "main"; // TODO-rca: デフォルトブランチのデフォルト値を設定できるようにする this.defaultBranch = "main"; // TODO-rca: デフォルトブランチのデフォルト値を設定できるようにする
this.parentId = null; this.path = new PublicPath().getRoot();
this.updatedAt = new Date(); this.updatedAt = new Date();
this.createdAt = new Date(); this.createdAt = new Date();
} }
@@ -85,13 +85,13 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
this.defaultBranch = defaultBranch; this.defaultBranch = defaultBranch;
} }
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags, String parentId, String author, String defaultBranch) { public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags, PublicPath path, String author, String defaultBranch) {
this.id = id; this.id = id;
this.title = title; this.title = title;
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
this.createdAt = createdAt; this.createdAt = createdAt;
this.tags = tags; this.tags = tags;
this.parentId = parentId; this.path = path;
this.author = author; this.author = author;
this.defaultBranch = defaultBranch; this.defaultBranch = defaultBranch;
} }
@@ -145,10 +145,10 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
} }
/** /**
* ドキュメントの親フォルダのID(String)を取得する * PublicPathを取得する
*/ */
public String getParentId() { public PublicPath getPath() {
return parentId; return path;
} }
/** /**
@@ -208,11 +208,11 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応
} }
/** /**
* ドキュメントの親フォルダのID(String)を設定する * PublicPathを設定する
* @param parentId ドキュメントの親フォルダのID * @param path PublicPath
*/ */
public void setParentId(String parentId) { public void setPath(PublicPath path) {
this.parentId = parentId; this.path = path;
} }
/** /**
@@ -1,30 +0,0 @@
package one.nem.lacerta.model.pref;
public enum FeatureSwitchOverride {
ENABLE_DEBUG_MENU("enableDebugMenu"),
ENABLE_SEARCH("enableSearch"),
SHOW_DISPLAY_MENU("showDisplayMenu"),
SHOW_DATA_MENU("showDataMenu"),
SHOW_SCAN_MENU("showScanMenu");
private final String key;
FeatureSwitchOverride(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public static FeatureSwitchOverride fromKey(String key) {
for (FeatureSwitchOverride value : values()) {
if (value.getKey().equals(key)) {
return value;
}
}
return null;
}
}
@@ -7,13 +7,13 @@ import one.nem.lacerta.model.document.DocumentDetail;
public interface DocumentProcessor { public interface DocumentProcessor {
// ページ操作 // ページ操作
DocumentProcessor addNewPageToLast(Bitmap bitmap) throws Exception; void addNewPageToLast(Bitmap bitmap) throws Exception;
DocumentProcessor addNewPagesToLast(Bitmap[] bitmaps) throws Exception; void addNewPagesToLast(Bitmap[] bitmaps) throws Exception;
DocumentProcessor insertPageAtIndex(Bitmap bitmap, int index) throws Exception; void insertPageAtIndex(Bitmap bitmap, int index) throws Exception;
DocumentProcessor removePageAtIndex(int index) throws Exception; void removePageAtIndex(int index) throws Exception;
// 更新 // 更新
DocumentProcessor updatePageAtIndex(Bitmap bitmap, int index); void updatePageAtIndex(Bitmap bitmap, int index);
// ページ取得 // ページ取得
Bitmap getPageAtIndex(int index); Bitmap getPageAtIndex(int index);
@@ -70,7 +70,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{
@Override @Override
public DocumentProcessor addNewPageToLast(Bitmap bitmap) throws Exception{ public void addNewPageToLast(Bitmap bitmap) throws Exception{
logger.debug("addNewPageToLast", "called"); logger.debug("addNewPageToLast", "called");
String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする
@@ -85,23 +85,19 @@ public class DocumentProcessorImpl implements DocumentProcessor{
logger.info("addNewPageToLast", "finished"); logger.info("addNewPageToLast", "finished");
logger.info("addNewPageToLast", "filename: " + filename); logger.info("addNewPageToLast", "filename: " + filename);
return this;
} }
@Override @Override
public DocumentProcessor addNewPagesToLast(Bitmap[] bitmaps) throws Exception{ public void addNewPagesToLast(Bitmap[] bitmaps) throws Exception{
logger.debug("addNewPagesToLast", "called"); logger.debug("addNewPagesToLast", "called");
for (Bitmap bitmap : bitmaps) { for (Bitmap bitmap : bitmaps) {
addNewPageToLast(bitmap); addNewPageToLast(bitmap);
} // TODO-rca: 効率悪いので改善する } // TODO-rca: 効率悪いので改善する
return this;
} }
@Override @Override
public DocumentProcessor insertPageAtIndex(Bitmap bitmap, int index) throws Exception { public void insertPageAtIndex(Bitmap bitmap, int index) throws Exception {
logger.debug("addNewPageAfterIndex", "called"); logger.debug("addNewPageAfterIndex", "called");
String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする
@@ -113,18 +109,16 @@ public class DocumentProcessorImpl implements DocumentProcessor{
this.documentDetail.getPages().add(index, page); this.documentDetail.getPages().add(index, page);
lacertaVcs.insertPage(index, filename); lacertaVcs.insertPage(index, filename);
return this;
} }
@Override @Override
public DocumentProcessor removePageAtIndex(int index) { public void removePageAtIndex(int index) {
return null;
} }
@Override @Override
public DocumentProcessor updatePageAtIndex(Bitmap bitmap, int index) { public void updatePageAtIndex(Bitmap bitmap, int index) {
return null;
} }
@Override @Override
-1
View File
@@ -31,4 +31,3 @@ include ':model'
include ':processor' include ':processor'
include ':shared:ui' include ':shared:ui'
include ':vcs' include ':vcs'
include ':feature:setting'
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="-100%p" android:toXDelta="0" <translate android:fromXDelta="-100%p" android:toXDelta="0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
</set> </set>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="100%p" android:toXDelta="0" <translate android:fromXDelta="100%p" android:toXDelta="0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
</set> </set>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-100%p" <translate android:fromXDelta="0" android:toXDelta="-100%p"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
</set> </set>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="100%p" <translate android:fromXDelta="0" android:toXDelta="100%p"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="120" /> android:duration="@android:integer/config_mediumAnimTime" />
</set> </set>
@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@color/colorOnBackground"
android:pathData="M90,230L90,50L270,50L270,110L150,110L150,230L90,230ZM810,230L810,110L690,110L690,50L870,50L870,230L810,230ZM90,910L90,730L150,730L150,850L270,850L270,910L90,910ZM690,910L690,850L810,850L810,730L870,730L870,910L690,910ZM270,717.69Q270,722.31 273.85,726.15Q277.69,730 282.31,730L677.69,730Q682.31,730 686.15,726.15Q690,722.31 690,717.69L690,242.31Q690,237.69 686.15,233.85Q682.31,230 677.69,230L282.31,230Q277.69,230 273.85,233.85Q270,237.69 270,242.31L270,717.69ZM282.31,790Q252,790 231,769Q210,748 210,717.69L210,242.31Q210,212 231,191Q252,170 282.31,170L677.69,170Q708,170 729,191Q750,212 750,242.31L750,717.69Q750,748 729,769Q708,790 677.69,790L282.31,790ZM370,390L590,390L590,330L370,330L370,390ZM370,510L590,510L590,450L370,450L370,510ZM370,630L590,630L590,570L370,570L370,630ZM270,717.69L270,242.31Q270,237.69 270,233.85Q270,230 270,230L270,230Q270,230 270,233.85Q270,237.69 270,242.31L270,717.69Q270,722.31 270,726.15Q270,730 270,730L270,730Q270,730 270,726.15Q270,722.31 270,717.69Z"/>
</vector>
@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@color/colorOnBackground"
android:pathData="M450,670L510,670L510,440L450,440L450,670ZM480,371.54Q493.73,371.54 503.02,362.25Q512.31,352.96 512.31,339.23Q512.31,325.5 503.02,316.21Q493.73,306.92 480,306.92Q466.27,306.92 456.98,316.21Q447.69,325.5 447.69,339.23Q447.69,352.96 456.98,362.25Q466.27,371.54 480,371.54ZM480.07,860Q401.23,860 331.86,830.08Q262.49,800.16 211.18,748.87Q159.87,697.58 129.93,628.24Q100,558.9 100,480.07Q100,401.23 129.92,331.86Q159.84,262.49 211.13,211.18Q262.42,159.87 331.76,129.93Q401.1,100 479.93,100Q558.77,100 628.14,129.92Q697.51,159.84 748.82,211.13Q800.13,262.42 830.07,331.76Q860,401.1 860,479.93Q860,558.77 830.08,628.14Q800.16,697.51 748.87,748.82Q697.58,800.13 628.24,830.07Q558.9,860 480.07,860ZM480,800Q614,800 707,707Q800,614 800,480Q800,346 707,253Q614,160 480,160Q346,160 253,253Q160,346 160,480Q160,614 253,707Q346,800 480,800ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/>
</vector>
@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@color/colorOnBackground"
android:pathData="M479.23,860Q401.46,860 332.31,830.04Q263.15,800.08 211.54,748.46Q159.92,696.84 129.96,627.5Q100,558.15 100,480Q100,400.85 130.77,331.5Q161.54,262.16 214.35,210.85Q267.15,159.54 337.89,129.77Q408.62,100 488.77,100Q563.77,100 630.92,125.58Q698.08,151.16 748.88,196.39Q799.69,241.62 829.84,303.89Q860,366.15 860,438.92Q860,542.77 798.27,601.38Q736.54,660 640,660L567.54,660Q550.46,660 540.23,671.15Q530,682.31 530,697.54Q530,716.08 545,736.08Q560,756.08 560,782Q560,821.61 538.08,840.81Q516.15,860 479.23,860ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480ZM260,510Q281.38,510 295.69,495.69Q310,481.38 310,460Q310,438.62 295.69,424.31Q281.38,410 260,410Q238.62,410 224.31,424.31Q210,438.62 210,460Q210,481.38 224.31,495.69Q238.62,510 260,510ZM380,350Q401.38,350 415.69,335.69Q430,321.38 430,300Q430,278.62 415.69,264.31Q401.38,250 380,250Q358.62,250 344.31,264.31Q330,278.62 330,300Q330,321.38 344.31,335.69Q358.62,350 380,350ZM580,350Q601.38,350 615.69,335.69Q630,321.38 630,300Q630,278.62 615.69,264.31Q601.38,250 580,250Q558.62,250 544.31,264.31Q530,278.62 530,300Q530,321.38 544.31,335.69Q558.62,350 580,350ZM700,510Q721.38,510 735.69,495.69Q750,481.38 750,460Q750,438.62 735.69,424.31Q721.38,410 700,410Q678.62,410 664.31,424.31Q650,438.62 650,460Q650,481.38 664.31,495.69Q678.62,510 700,510ZM479.23,800Q489,800 494.5,795.19Q500,790.39 500,782Q500,768 485,750.54Q470,733.08 470,695.85Q470,653.08 499,626.54Q528,600 570,600L640,600Q710.62,600 755.31,558.61Q800,517.23 800,438.92Q800,317.54 706.92,238.77Q613.85,160 488.77,160Q351.61,160 255.81,253Q160,346 160,480Q160,613 253.5,706.5Q347,800 479.23,800Z"/>
</vector>
@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@color/colorOnBackground"
android:pathData="M479.23,540Q454.69,540 436.96,522.27Q419.23,504.54 419.23,480Q419.23,455.46 436.96,437.73Q454.69,420 479.23,420Q503.77,420 521.5,437.73Q539.23,455.46 539.23,480Q539.23,504.54 521.5,522.27Q503.77,540 479.23,540ZM479.23,820Q348.69,820 252.46,734.27Q156.23,648.54 141.62,520L202.85,520Q218,623.61 296.27,691.81Q374.54,760 479.23,760Q596.23,760 677.73,678.5Q759.23,597 759.23,480Q759.23,363 677.73,281.5Q596.23,200 479.23,200Q413.69,200 356.39,229.11Q299.08,258.23 257.69,309.23L362.31,309.23L362.31,369.23L159.23,369.23L159.23,166.15L219.23,166.15L219.23,260.92Q267.92,203.46 335.85,171.73Q403.77,140 479.23,140Q550.03,140 611.86,166.77Q673.69,193.54 719.69,239.54Q765.69,285.54 792.46,347.36Q819.23,409.19 819.23,479.98Q819.23,550.77 792.46,612.61Q765.69,674.46 719.69,720.46Q673.69,766.46 611.86,793.23Q550.03,820 479.23,820Z"/>
</vector>
@@ -1,56 +0,0 @@
<?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:paddingHorizontal="24dp"
android:paddingVertical="16dp">
<ImageView
android:id="@+id/item_icon"
android:layout_width="32dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/item_text_container"
app:srcCompat="@drawable/description_24px"
android:contentDescription="icon" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/item_text_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/item_icon"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
android:text="Placeholder Title"
android:textColor="@color/colorOnSurface"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="Placeholder Description"
android:textColor="@color/colorOnSurfaceSecondary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -30,7 +30,6 @@
<item name="colorOnBackground">@color/colorOnBackground</item> <item name="colorOnBackground">@color/colorOnBackground</item>
<item name="android:windowLightNavigationBar">false</item> <item name="android:windowLightNavigationBar">false</item>
<item name="android:windowLightStatusBar">false</item>
</style> </style>
</resources> </resources>
@@ -25,8 +25,4 @@
<color name="colorSurfaceVariant">@color/material_dynamic_neutral_variant90</color> <color name="colorSurfaceVariant">@color/material_dynamic_neutral_variant90</color>
<color name="colorOnSurfaceVariant">@color/material_dynamic_neutral_variant30</color> <color name="colorOnSurfaceVariant">@color/material_dynamic_neutral_variant30</color>
<color name="colorSurfaceInverse">@color/material_dynamic_neutral20</color> <color name="colorSurfaceInverse">@color/material_dynamic_neutral20</color>
<!-- indicator icon background -->
<color name="colorIndicator">@color/material_dynamic_secondary70</color>
<color name="colorOnSurfaceSecondary">@color/material_dynamic_neutral_variant30</color>
</resources> </resources>
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more