Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8449c8ea87 | ||
|
|
ab5a8bfa87 | ||
|
|
af53ba6c86 | ||
|
|
64d7a53616 | ||
|
|
696c58921d | ||
|
|
bda8496259 | ||
|
|
60f279d365 | ||
|
|
6e4904967b | ||
|
|
fda8adae80 | ||
|
|
1ce3af59e6 | ||
|
|
1692399b9a | ||
|
|
5288855075 | ||
|
|
7ece8c7b69 | ||
|
|
56a49d4c7e | ||
|
|
e69d489a96 | ||
|
|
4611c46eca | ||
|
|
6f94b3408f |
No files matched your search
@@ -1,8 +1,10 @@
|
|||||||
# Lacerta
|
# Lacerta
|
||||||
WIP
|
学習に便利な機能とGit-like VCSを持ったドキュメントスキャナ (Work In Progress)
|
||||||
|
(グループワーク)
|
||||||
|
|
||||||
## モジュール設計
|
## モジュール設計
|
||||||
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## メモ
|
## メモ
|
||||||
- アイコン: 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)
|
||||||
@@ -11,45 +13,28 @@ WIP
|
|||||||
### モジュール一覧
|
### モジュール一覧
|
||||||
- `component` : コンポーネント
|
- `component` : コンポーネント
|
||||||
- `common` : 共通コンポーネント
|
- `common` : 共通コンポーネント
|
||||||
- UIの中で共通で使う要素(メニューアイテムとか)
|
|
||||||
- `scanner` : スキャナー
|
- `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` : データモデルをまとめたモジュール
|
||||||
- データモデルをまとめたモジュール (WIP)
|
- `processor` : プロセッサ(例: `DocumentProcessor` : ドキュメント処理(ドキュメントにページを追加したり更新したり))
|
||||||
- `document` : ドキュメント
|
- `shared`: 共有リソース
|
||||||
- `meta` : メタデータ
|
- `ui`: UI要素(Theme, Drawable, Colorなど)
|
||||||
- `processor` : プロセッサ
|
- `source` : ソース(DB/FileManagerなど)
|
||||||
- いくつかの処理をまとめたモジュール
|
- `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)
|
||||||
|
-
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher_temp_round"
|
||||||
android:name=".LacertaApplication"
|
android:name=".LacertaApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 6.2 KiB |
@@ -6,6 +6,7 @@ import android.util.Log;
|
|||||||
import com.google.android.material.color.DynamicColors;
|
import com.google.android.material.color.DynamicColors;
|
||||||
|
|
||||||
import dagger.hilt.android.HiltAndroidApp;
|
import dagger.hilt.android.HiltAndroidApp;
|
||||||
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
|
|
||||||
@HiltAndroidApp
|
@HiltAndroidApp
|
||||||
public class LacertaApplication extends Application {
|
public class LacertaApplication extends Application {
|
||||||
@@ -15,7 +16,11 @@ public class LacertaApplication extends Application {
|
|||||||
|
|
||||||
if (DynamicColors.isDynamicColorAvailable()) {
|
if (DynamicColors.isDynamicColorAvailable()) {
|
||||||
Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
|
Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
|
||||||
|
if (FeatureSwitch.Meta.disableDynamicColor) {
|
||||||
|
Log.d("DynamicColors", "DynamicColors is disabled by FeatureSwitch.");
|
||||||
|
} else {
|
||||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("DynamicColors", "DynamicColors is not available.");
|
Log.d("DynamicColors", "DynamicColors is not available.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package one.nem.lacerta;
|
package one.nem.lacerta;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
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;
|
||||||
@@ -11,6 +12,7 @@ import androidx.navigation.fragment.NavHostFragment;
|
|||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -85,6 +87,21 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == 1) {
|
||||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Toast.makeText(this, "Permission granted", Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show();
|
||||||
|
Toast.makeText(this, "カメラの権限は必須です.", Toast.LENGTH_LONG).show();
|
||||||
|
finish(); // Exit app
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeApp() {
|
private void initializeApp() {
|
||||||
Log.d("Init", "Initializing app");
|
Log.d("Init", "Initializing app");
|
||||||
// Set feature switch override to default value
|
// Set feature switch override to default value
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="#5F4769">
|
||||||
|
<group android:scaleX="0.377"
|
||||||
|
android:scaleY="0.377"
|
||||||
|
android:translateX="7.476"
|
||||||
|
android:translateY="7.476">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M7,3H4v3H2V1h5V3zM22,6V1h-5v2h3v3H22zM7,21H4v-3H2v5h5V21zM20,18v3h-3v2h5v-5H20zM19,18c0,1.1 -0.9,2 -2,2H7c-1.1,0 -2,-0.9 -2,-2V6c0,-1.1 0.9,-2 2,-2h10c1.1,0 2,0.9 2,2V18zM15,8H9v2h6V8zM15,11H9v2h6V11zM15,14H9v2h6V14z"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_temp_background"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_temp_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_temp_background"/>
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_temp_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 630 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1004 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_temp_background">#A386EB</color>
|
||||||
|
</resources>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package one.nem.lacerta.component.scanner;
|
package one.nem.lacerta.component.scanner;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -11,6 +13,8 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
@@ -92,6 +96,14 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1); // TODO-rca: リクエストコードを定数にする
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
|
MaterialToolbar toolbar = findViewById(R.id.top_toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||||
@@ -116,11 +128,12 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
|||||||
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "保存処理", Toast.LENGTH_SHORT).show();
|
||||||
saveNewDocument();
|
saveNewDocument();
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.action_insert_exist) {
|
// }
|
||||||
// 既存ドキュメントに挿入
|
// else if (item.getItemId() == R.id.action_insert_exist) {
|
||||||
Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
|
// // 既存ドキュメントに挿入
|
||||||
insertToExistDocument();
|
// Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
// insertToExistDocument();
|
||||||
|
// return true;
|
||||||
} else if (item.getItemId() == android.R.id.home) {
|
} else if (item.getItemId() == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
android:icon="@drawable/save_24px"
|
android:icon="@drawable/save_24px"
|
||||||
android:title="Save"
|
android:title="Save"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
<item
|
<!-- <item-->
|
||||||
android:id="@+id/action_insert_exist"
|
<!-- android:id="@+id/action_insert_exist"-->
|
||||||
android:icon="@drawable/ic_baseline_add_24"
|
<!-- android:icon="@drawable/description_24px"-->
|
||||||
android:title="Save"
|
<!-- android:title="Insert"-->
|
||||||
app:showAsAction="ifRoom"/>
|
<!-- app:showAsAction="ifRoom"/>-->
|
||||||
</menu>
|
</menu>
|
||||||
@@ -8,6 +8,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -40,13 +41,14 @@ public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) {
|
||||||
VcsRevModel revModel = revModels.get(position);
|
VcsRevModel revModel = revModels.get(position);
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
holder.title.setText(revModel.getCommitMessage());
|
holder.title.setText(revModel.getCommitMessage());
|
||||||
if (FeatureSwitch.Vcs.disableBranchDisplay) {
|
if (FeatureSwitch.Vcs.disableBranchDisplay) {
|
||||||
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()));
|
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()));
|
||||||
holder.detail.setText("DateTimePlaceholder");
|
holder.detail.setText(simpleDateFormat.format(revModel.getCreatedAt()));
|
||||||
} else {
|
} else {
|
||||||
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()) + " " + revModel.getBranchName());
|
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()) + " " + revModel.getBranchName());
|
||||||
holder.detail.setText("DateTimePlaceholder" + " " + revModel.getBranchName());
|
holder.detail.setText(simpleDateFormat.format(revModel.getCreatedAt())+ " " + revModel.getBranchName());
|
||||||
}
|
}
|
||||||
holder.revId.setText("RevID: " + revModel.getId());
|
holder.revId.setText("RevID: " + revModel.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
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 javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
@@ -56,6 +59,17 @@ public class HomeTopFragment extends Fragment {
|
|||||||
// 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);
|
||||||
|
|
||||||
|
// Set status bar color
|
||||||
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
|
if (Math.abs(verticalOffset) == appBarLayout1.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));
|
||||||
|
}
|
||||||
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,15 +82,12 @@ public class HomeTopFragment extends Fragment {
|
|||||||
Toolbar toolbar = view.findViewById(R.id.home_toolbar);
|
Toolbar toolbar = view.findViewById(R.id.home_toolbar);
|
||||||
toolbarSetup(toolbar, false, "ホーム");
|
toolbarSetup(toolbar, false, "ホーム");
|
||||||
|
|
||||||
this.listItemAdapter = new ListItemAdapter(new DocumentSelectListener() {
|
this.listItemAdapter = new ListItemAdapter((documentId, documentName) -> {
|
||||||
@Override
|
|
||||||
public void onDocumentSelect(String documentId, String documentName) {
|
|
||||||
Intent intent = new Intent(getContext(), ViewerMainActivity.class);
|
Intent intent = new Intent(getContext(), ViewerMainActivity.class);
|
||||||
Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
|
Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
|
||||||
intent.putExtra("documentId", documentId);
|
intent.putExtra("documentId", documentId);
|
||||||
intent.putExtra("documentName", documentName);
|
intent.putExtra("documentName", documentName);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
recyclerView.setAdapter(listItemAdapter);
|
recyclerView.setAdapter(listItemAdapter);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
@@ -121,8 +132,6 @@ public class HomeTopFragment extends Fragment {
|
|||||||
if (showBackButton) {
|
if (showBackButton) {
|
||||||
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
||||||
toolbar.setNavigationOnClickListener(v -> {
|
toolbar.setNavigationOnClickListener(v -> {
|
||||||
//this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join();
|
|
||||||
// Back
|
|
||||||
Navigation.findNavController(requireView()).popBackStack();
|
Navigation.findNavController(requireView()).popBackStack();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -53,5 +53,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation project(':utils')
|
implementation project(':utils')
|
||||||
|
|
||||||
|
implementation project(':component:viewer')
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package one.nem.lacerta.feature.library;
|
package one.nem.lacerta.feature.library;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -35,6 +36,7 @@ import java.util.Objects;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import one.nem.lacerta.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.FragmentNavigation;
|
import one.nem.lacerta.model.FragmentNavigation;
|
||||||
@@ -117,19 +119,13 @@ public class LibraryPageFragment extends Fragment {
|
|||||||
|
|
||||||
// Set status bar color
|
// Set status bar color
|
||||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
@Override
|
if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) {
|
||||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
||||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
|
||||||
// Collapsed
|
// Collapsed
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||||
} else if (verticalOffset == 0) {
|
} else if (verticalOffset == 0) {
|
||||||
// Expanded
|
// Expanded
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
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;
|
return view;
|
||||||
@@ -179,7 +175,11 @@ public class LibraryPageFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDocumentSelected(String documentId, String documentName) {
|
public void onDocumentSelected(String documentId, String documentName) {
|
||||||
Toast.makeText(getContext(), "Document selected! documentId: " + documentId + ", documentName: " + documentName, Toast.LENGTH_SHORT).show();
|
Intent intent = new Intent(getContext(), ViewerMainActivity.class);
|
||||||
|
logger.debug("LibraryTopFragment", "Document selected! documentId: " + documentId + ", documentName: " + documentName);
|
||||||
|
intent.putExtra("documentId", documentId);
|
||||||
|
intent.putExtra("documentName", documentName);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ 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 java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import one.nem.lacerta.setting.model.SettingListItem;
|
import one.nem.lacerta.setting.model.SettingListItem;
|
||||||
@@ -86,6 +88,17 @@ public class SettingTopFragment extends Fragment {
|
|||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
recyclerView.setAdapter(new ListItemAdapter(settingListItems));
|
recyclerView.setAdapter(new ListItemAdapter(settingListItems));
|
||||||
|
|
||||||
|
// Set status bar color
|
||||||
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
|
if (Math.abs(verticalOffset) == appBarLayout1.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));
|
||||||
|
}
|
||||||
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ public class FeatureSwitch {
|
|||||||
|
|
||||||
public static class Meta {
|
public static class Meta {
|
||||||
public static boolean canOverrideSwitch = false;
|
public static boolean canOverrideSwitch = false;
|
||||||
|
|
||||||
|
public static boolean disableDynamicColor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RecyclerView {
|
public static class RecyclerView {
|
||||||
@@ -11,6 +13,7 @@ public class FeatureSwitch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Viewer {
|
public static class Viewer {
|
||||||
|
// TODO-rca: 実装
|
||||||
public static boolean showOriginalImage = false;
|
public static boolean showOriginalImage = false;
|
||||||
public static int maxImageSize = 1024;
|
public static int maxImageSize = 1024;
|
||||||
public static boolean showProgressBarWhenLoading = true;
|
public static boolean showProgressBarWhenLoading = true;
|
||||||
@@ -18,7 +21,7 @@ public class FeatureSwitch {
|
|||||||
|
|
||||||
public static class FeatureMaster {
|
public static class FeatureMaster {
|
||||||
public static boolean enableSearch = false;
|
public static boolean enableSearch = false;
|
||||||
public static boolean enableDebugMenu = true;
|
public static boolean enableDebugMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Vcs {
|
public static class Vcs {
|
||||||
@@ -26,6 +29,7 @@ public class FeatureSwitch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Setting {
|
public static class Setting {
|
||||||
|
// TODO-rca: 実装
|
||||||
public static boolean showDisplayMenu = false;
|
public static boolean showDisplayMenu = false;
|
||||||
public static boolean showDataMenu = false;
|
public static boolean showDataMenu = false;
|
||||||
public static boolean showScanMenu = false;
|
public static boolean showScanMenu = false;
|
||||||
|
|||||||