Compare commits

..
Author SHA1 Message Date
ろむねこ d770ac76aa Create general.md 2024-01-08 15:55:46 +09:00
ろむねこ 930b48af2f Merge pull request #15 from lacerta-doc/common/improve_logger
Loggerの機能を強化
2024-01-08 15:36:24 +09:00
r-ca dec4983bfc 移動 2024-01-08 12:43:31 +09:00
r-ca 88dfae7d37 KeyValueログモデル作成 2024-01-08 12:43:30 +09:00
r-ca 48101190a2 修正 2024-01-08 12:43:21 +09:00
r-ca 2b79c7669f Key-Valueなログを出力しやすくした 2024-01-08 12:43:21 +09:00
ろむねこ 6be44cd9b5 Merge pull request #13 from lacerta-doc/component/fix_camera_stub
カメラスタブが現行のAndroidバージョンから呼び出せない問題を修正
2023-12-24 14:58:56 +09:00
r-ca efa3134dc6 Manifestで使用するインテントを明言した 2023-12-22 11:33:11 +09:00
ろむねこ acb039ee23 Merge pull request #10 from lacerta-doc/feature/library/add_document_list
Feature/library/add document list
2023-12-21 14:06:55 +09:00
nero 7965ce90a6 LibraryArchiveFragmentにてコードが重複していたため、削除した 2023-12-21 13:58:20 +09:00
nero 142ca57f76 名前を修正
前のは適当でわかりにくい名前になっていたため
2023-12-21 13:50:08 +09:00
r-ca c7a387df3d レイアウトマージン設定 2023-12-21 12:24:46 +09:00
r-ca 732f047ff7 余白が異常に大きくなるのを修正 2023-12-21 12:24:46 +09:00
r-ca bbeba2b733 コメント追加 2023-12-21 12:24:46 +09:00
r-ca 83d2d0af02 一旦保存して読み込むように 2023-12-21 12:24:46 +09:00
r-ca 3518464716 権限修正 2023-12-21 12:24:46 +09:00
r-ca f9247e9114 プロバイダパスを追加 2023-12-21 12:24:46 +09:00
r-ca be610059cf プロバイダパスを追加 2023-12-21 12:24:46 +09:00
r-ca b12c689d4e AndroidManifest.xmlにFileProviderを追加 WIP 2023-12-21 12:24:46 +09:00
r-ca 55ae0b541a 取得される画像の解像度が低すぎるので修正 WIP 2023-12-21 12:24:46 +09:00
r-ca f74abd11fc レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca 8817c62ed3 レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca d5616d63b6 Revert "Revert "内部クラスじゃだめそうなので切り出し""
This reverts commit ba4ff5652e.
2023-12-21 12:24:46 +09:00
r-ca 9cbf6f9d56 Revert "Revert "WIP 内部クラスじゃだめそうなので切り出し""
This reverts commit aea6ea3808.
2023-12-21 12:24:46 +09:00
r-ca ad66688bf9 WIP 2023-12-21 12:24:46 +09:00
r-ca b5281443bf Revert "WIP 内部クラスじゃだめそうなので切り出し"
This reverts commit 9a71fb5c26.
2023-12-21 12:24:46 +09:00
r-ca c616edf9f7 Revert "内部クラスじゃだめそうなので切り出し"
This reverts commit c0e64ad5fd.
2023-12-21 12:24:46 +09:00
r-ca aa4f8360dc 内部クラスじゃだめそうなので切り出し 2023-12-21 12:24:46 +09:00
r-ca 99dea6d6f6 WIP 内部クラスじゃだめそうなので切り出し 2023-12-21 12:24:46 +09:00
r-ca b3dcaefede WIP 結果をプレビューするロジック実装 2023-12-21 12:24:46 +09:00
r-ca 9ec45096ba 命名修正 2023-12-21 12:24:46 +09:00
r-ca a3edcf845a レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca 48de3f9a8d fix typo 2023-12-21 12:24:46 +09:00
r-ca 979a3f8ee7 レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca 9c79e02cc8 レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca 3db91fb937 レイアウト修正 2023-12-21 12:24:46 +09:00
r-ca e9f2a6b711 レイアウト実装WIP 2023-12-21 12:24:46 +09:00
r-ca 955c0122cf レイアウトファイル作成 2023-12-21 12:24:46 +09:00
r-ca d5f3d36d23 仮置きデータモデル作成 2023-12-21 12:24:46 +09:00
r-ca 2c74fa3339 仮置きデータモデル作成 2023-12-21 12:24:46 +09:00
r-ca e3220910f5 レイアウトにRecyclerViewを追加 2023-12-21 12:24:46 +09:00
r-ca 8e97dd6972 まちがえてrequireActivityを使っていたので修正 2023-12-21 12:24:46 +09:00
r-ca 0bf6b3fa1a ログ追加 2023-12-21 12:24:46 +09:00
r-ca 6ac0599f4c パーミッションを追加してみた 2023-12-21 12:24:46 +09:00
r-ca f14b9accee デバッグメニューにリンクを追加 2023-12-21 12:24:46 +09:00
r-ca da2ff27391 暫定, debugメニューのナビゲーショングラフに追加 2023-12-21 12:24:46 +09:00
r-ca 60d13ac9a9 fix typo 2023-12-21 12:24:46 +09:00
r-ca 011cac925a fix typo 2023-12-21 12:24:46 +09:00
r-ca 4d0412e5bd debugの依存関係にスキャナコンポーネントを追加 2023-12-21 12:24:46 +09:00
r-ca be30ce2c62 ボタンアクションを実装 2023-12-21 12:24:46 +09:00
r-ca 3c6541607c カメラ起動を実装 2023-12-21 12:24:46 +09:00
r-ca be80e42dc5 ArrayListに変更 2023-12-21 12:24:46 +09:00
r-ca 031a1d2810 ロジック実装 WIP 2023-12-21 12:24:46 +09:00
r-ca ccbbb45f39 引数削除 2023-12-21 12:24:46 +09:00
r-ca 13b53c62ec スタイル変更 2023-12-21 12:24:46 +09:00
r-ca 8c83c7adcf レイアウトマージン修正 2023-12-21 12:24:46 +09:00
r-ca 5617dacfe7 テーマ設定 2023-12-21 12:24:46 +09:00
r-ca ed9e20ede3 依存関係追加 2023-12-21 12:24:46 +09:00
r-ca b7f91b593e レイアウト作成 WIP 2023-12-21 12:24:46 +09:00
r-ca 4a39c5c525 スキャナのスタブを実装 WIP 2023-12-21 12:24:46 +09:00
r-ca fc716df189 一旦過去に作成したフラグメントを削除 2023-12-21 12:24:46 +09:00
nero 9d108212dd データを取得するための機能実装 2023-12-20 12:52:24 +09:00
nero e34dd65dda コードの微修正 2023-12-20 12:22:18 +09:00
nero 3386418abd 画面変移のコード作成。
データを受け取る側と渡す側を作った
2023-12-20 12:21:37 +09:00
nero c8b99e10e8 コメントを足した。 2023-12-20 12:02:21 +09:00
nero d8f8b87c54 フォーマットを整えた 2023-12-20 12:00:33 +09:00
nero 31d3b975ea 表示されている文字をクリックすることでそのページを表示する機能の基礎部分 2023-12-20 10:52:01 +09:00
ろむねこ fb5de4f12a Merge pull request #7 from lacerta-doc/common/fix-gradle
リリース準備
2023-12-20 10:47:02 +09:00
nero 866b8270fe 仮データを出力できるように調整した。 2023-12-19 12:45:41 +09:00
nero e0af9381cb Revert "アクティビティを宣言"
This reverts commit 6d71322982.
2023-12-19 12:24:19 +09:00
nero e70f930929 コードを微修正 2023-12-19 12:00:56 +09:00
nero ac2001142f Laibraryが表示できるようにコードを書き換えた。
・nullを検出して安全性を高めた
・RecyclerView.Adapterを使用するためのコードを追加
2023-12-19 10:15:33 +09:00
nero 6d71322982 アクティビティを宣言 2023-12-18 16:26:19 +09:00
nero 3bf14799b5 改善したもののやっぱり実行するとアプリが落ちる 2023-12-18 16:19:50 +09:00
nero aaf4264f44 仮の画面はできたが、実行するとアプリが落ちる 2023-12-18 16:13:35 +09:00
nero b097e8070a ListViewからRecyclerViewに変えた 2023-12-18 16:09:40 +09:00
nero 99ad244376 基本的な画面レイアウトを作成 2023-12-18 15:57:48 +09:00
nero 99817d3e33 依存関係追加
レイアウトの設定
2023-12-18 15:45:31 +09:00
nero 5a92c210f7 依存関係追加 2023-12-18 15:15:54 +09:00
31 changed files with 727 additions and 304 deletions

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
# 概要
<!-- PRの概要 -->
# 関連Issue
- #000 <!-- 関連するIssueを指定(なければ省略可) -->
# 詳細
<!-- 詳細 -->
# 影響箇所
<!-- 予想される影響箇所 -->
# チェック
<!-- 参考用, 全てにチェックがついている必要があるわけではありません -->
- [ ] 機能として完成している
- [ ] WIP(Work in progress: 作業中)
- [ ] 正常にビルド/起動ができる
- [ ] 既存の機能を壊していない
+12 -5
View File
@@ -1,10 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
</entry>
</value>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="ZY227DCBHN" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-12-21T04:53:14.729902700Z" />
</component>
</project>
+1
View File
@@ -4,6 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
+1 -1
View File
@@ -1,6 +1,6 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
+21
View File
@@ -2,6 +2,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -22,6 +33,16 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="one.nem.lacerta.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="cache" path="." />
</paths>
+3
View File
@@ -34,4 +34,7 @@ dependencies {
androidTestImplementation libs.androidx.test.espresso.core
implementation 'com.websitebeaver:documentscanner:1.0.0'
implementation project(':shared:ui')
implementation project(':model')
}
@@ -0,0 +1,55 @@
package one.nem.lacerta.component.scanner;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class CaptureResultAdapter extends RecyclerView.Adapter<CaptureResultAdapter.ViewHolder> {
private final ArrayList<CapturedData> results;
public CaptureResultAdapter(ArrayList<CapturedData> results) {
this.results = results;
}
@Override
public CaptureResultAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_scanner_component_manager_stub, parent, false);
return new CaptureResultAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(CaptureResultAdapter.ViewHolder holder, int position) {
CapturedData result = results.get(position);
holder.textViewPath.setText(result.getPath());
holder.textViewResolutionHeight.setText(result.getResolutionHeight());
holder.textViewResolutionWidth.setText(result.getResolutionWidth());
holder.imageView.setImageBitmap(result.getBitmap());
}
@Override
public int getItemCount() {
return results.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView textViewPath;
public TextView textViewResolutionHeight;
public TextView textViewResolutionWidth;
public ImageView imageView;
public ViewHolder(View view) {
super(view);
textViewPath = view.findViewById(R.id.textViewPath);
textViewResolutionHeight = view.findViewById(R.id.textViewResHeight);
textViewResolutionWidth = view.findViewById(R.id.textViewResWidth);
imageView = view.findViewById(R.id.imageViewResult);
}
}
}
@@ -0,0 +1,44 @@
package one.nem.lacerta.component.scanner;
import android.graphics.Bitmap;
public class CapturedData {
private String path;
private String resolutionHeight;
private String resolutionWidth;
private String size;
private Bitmap bitmap;
// Constructor
public CapturedData(String path, String resolutionHeight, String resolutionWidth, String size, Bitmap bitmap) {
this.path = path;
this.resolutionHeight = resolutionHeight;
this.resolutionWidth = resolutionWidth;
this.size = size;
this.bitmap = bitmap;
}
// Getters
public String getPath() {
return path;
}
public String getResolutionHeight() {
return resolutionHeight;
}
public String getResolutionWidth() {
return resolutionWidth;
}
public String getSize() {
return size;
}
public Bitmap getBitmap() {
return bitmap;
}
}
@@ -0,0 +1,144 @@
package one.nem.lacerta.component.scanner;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.core.content.FileProvider;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ScannerDataManagerStubFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ScannerDataManagerStubFragment extends Fragment {
// TODO-rca: 時間があったらcacheを使うようにする?
// Results
private ArrayList<CapturedData> results = new ArrayList<>();
private Uri photoURI;
private final ActivityResultLauncher<Intent> cameraLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == Activity.RESULT_OK) {
try {
if (getActivity() == null) {
Log.d("ScannerDataManagerStubFragment", "getActivity() is null");
return;
}
if (photoURI == null) {
Log.d("ScannerDataManagerStubFragment", "photoURI is null");
Toast.makeText(getActivity(), "photoURI is null", Toast.LENGTH_LONG).show();
return;
}
Bitmap imageBitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), photoURI);
results.add(new CapturedData("Placeholder", Integer.toString(imageBitmap.getHeight()), Integer.toString(imageBitmap.getWidth()), "Placeholder", imageBitmap));
} catch (IOException e) {
Log.e("ScannerDataManagerStubFragment", "Error occurred while reading the file", e);
}
}
}
);
public ScannerDataManagerStubFragment() {
// Required empty public constructor
}
// TODO: Rename and change types and number of parameters
public static ScannerDataManagerStubFragment newInstance() {
ScannerDataManagerStubFragment fragment = new ScannerDataManagerStubFragment();
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_scanner_data_manager_stub, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_call_camera).setOnClickListener(v -> {
Log.d("ScannerDataManagerStubFragment", "button_call_camera clicked");
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
File photoFile = null;
try {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
photoFile = File.createTempFile(imageFileName, ".jpg", storageDir);
} catch (IOException ex) {
Log.e("ScannerDataManagerStubFragment", "Error occurred while creating the file", ex);
}
if (photoFile != null) {
photoURI = FileProvider.getUriForFile(getActivity(), "one.nem.lacerta.provider", photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
cameraLauncher.launch(takePictureIntent);
}
else {
Log.d("ScannerDataManagerStubFragment", "photoFile is null");
}
}
else {
Log.d("ScannerDataManagerStubFragment", "camera not available");
}
updateResults();
});
}
@Override
public void onResume() {
super.onResume();
Log.d("ScannerDataManagerStubFragment", "onResume");
updateResults();
}
public void updateResults() {
Log.d("ScannerDataManagerStubFragment", "updateResults");
// TODO-rca: エラーハンドリング
RecyclerView recyclerView = getView().findViewById(R.id.result_recycler_view);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
recyclerView.setAdapter(new CaptureResultAdapter(this.results));
}
}
@@ -1,75 +0,0 @@
package one.nem.lacerta.component.scanner;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import androidx.constraintlayout.utils.widget.ImageFilterView;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.websitebeaver.documentscanner.DocumentScanner;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ScannerScanFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ScannerScanFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
// private static final String MAX_SCAN_COUNT = "max_scan_count"; // 規定値
// TODO: Rename and change types of parameters
private String mParam1;
public ScannerScanFragment() {
// Required empty public constructor
}
public static ScannerScanFragment newInstance(String param1) {
ScannerScanFragment fragment = new ScannerScanFragment();
Bundle args = new Bundle();
// args.putString(MAX_SCAN_COUNT, param1);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
// mParam1 = getArguments().getString(MAX_SCAN_COUNT);
// scan(Integer.parseInt(mParam1));
}
}
public DocumentScanner getDocumentScanner() {
return new DocumentScanner(
this,
(croppedImageResults) -> {
// display the first cropped image
croppedImageView.setImageBitmap(
BitmapFactory.decodeFile(croppedImageResults.get(0))
);
return null;
},
(errorMessage) -> {
// an error happened
return null;
},
() -> {
// user canceled document scan
return null;
},
null,
null,
null
);
}
}
@@ -1,64 +0,0 @@
package one.nem.lacerta.component.scanner;
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 ScannerScanResultFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ScannerScanResultFragment extends Fragment {
// 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 ScannerScanResultFragment() {
// 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 ScannerScanResultFragment.
*/
// TODO: Rename and change types and number of parameters
public static ScannerScanResultFragment newInstance(String param1, String param2) {
ScannerScanResultFragment fragment = new ScannerScanResultFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_scanner_scan_result, container, false);
}
}
@@ -0,0 +1,40 @@
<?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="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".ScannerDataManagerStubFragment" >
<LinearLayout
android:id="@+id/action_button_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/button_call_camera"
style="@style/Widget.Material3.Button.IconButton.Filled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16px"
android:layout_weight="1"
android:text="Call camera" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/result_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/action_button_container" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -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=".ScannerScanFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -1,133 +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="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/cropped_image_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/linear_layout_buttons">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_margin="12dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:text="Saturation" />
<SeekBar
android:id="@+id/seekBar_saturation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="200"
android:progress="100"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_margin="12dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:text="Contrast" />
<SeekBar
android:id="@+id/seekBar_contrast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="200"
android:progress="100"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_margin="12dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:text="Brightness" />
<SeekBar
android:id="@+id/seekBar_brightness"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="200"
android:progress="100"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_margin="12dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0"
android:text="Warmth" />
<SeekBar
android:id="@+id/seekBar_warmth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="500"
android:progress="100"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_layout_buttons"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/button_save_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:insetLeft="12dp"
android:insetRight="12dp"
android:text="Save Image" />
<Button
android:id="@+id/button_kill_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:insetLeft="12dp"
android:insetRight="12dp"
android:text="Kill me" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,70 @@
<?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"
android:layout_margin="24px">
<ImageView
android:id="@+id/imageViewResult"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@android:drawable/presence_video_online"
android:adjustViewBounds="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageViewResult">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Resolution:"
android:textIsSelectable="false"
android:textSize="16sp" />
<TextView
android:id="@+id/textViewResHeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Height"
android:textIsSelectable="false"
android:textSize="16sp" />
<TextView
android:id="@+id/textViewResWidth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Width"
android:textIsSelectable="false"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/textViewPath"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Path"
android:textIsSelectable="false"
android:textSize="16sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+3
View File
@@ -62,4 +62,7 @@ dependencies {
// Shared
implementation project(':shared:ui')
// Scanner
implementation project(':component:scanner')
}
@@ -48,6 +48,7 @@ public class DebugMenuTopFragment extends Fragment {
debugMenuListItems.add(new DebugMenuListItem("Meta Data", "View meta data", R.id.action_debugMenuTopFragment_to_debugMenuMetaDataFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter);
@@ -16,6 +16,9 @@
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment"
app:destination="@id/debugMenuDocumentTesterTopFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_scannerDataManagerStubFragment"
app:destination="@id/scannerDataManagerStubFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuMetaDataFragment"
@@ -44,4 +47,8 @@
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterManageFragment"
android:label="fragment_debug_menu_document_tester_manage"
tools:layout="@layout/fragment_debug_menu_document_tester_manage" />
<fragment
android:id="@+id/scannerDataManagerStubFragment"
android:name="one.nem.lacerta.component.scanner.ScannerDataManagerStubFragment"
android:label="ScannerDataManagerStubFragment" />
</navigation>
+9
View File
@@ -29,6 +29,8 @@ dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
implementation 'androidx.navigation:navigation-fragment:2.7.5'
implementation 'androidx.navigation:navigation-ui:2.7.5'
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
@@ -38,4 +40,11 @@ dependencies {
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
implementation project(':shared:ui')
}
@@ -0,0 +1,46 @@
package one.nem.lacerta.feature.library;
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.util.List;
public class DocumentAdapter extends RecyclerView.Adapter<DocumentAdapter.DocumentViewHolder> {
private List<String> documentList;
public DocumentAdapter(List<String> documentList) {
this.documentList = documentList;
}
@NonNull
@Override
public DocumentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_library_menu, parent, false);
return new DocumentViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull DocumentViewHolder holder, int position) {
holder.title.setText(documentList.get(position));
}
@Override
public int getItemCount() {
return documentList.size();
}
class DocumentViewHolder extends RecyclerView.ViewHolder {
TextView title;
DocumentViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.debug_menu_item_title);
}
}
}
@@ -0,0 +1,35 @@
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
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);
}
});
}
}
@@ -0,0 +1,50 @@
package one.nem.lacerta.feature.library;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
public class LibraryDocFragment extends Fragment {
private TextView textView; // フィールドとして TextView を定義
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library_file, container, false);
textView = view.findViewById(R.id.textView);
return view;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// フラグメントに渡されたデータを取得
if (getArguments() != null) {
String receivedData = getArguments().getString("key_name");
// onCreateView メソッドで取得した TextView にデータをセットする
if (textView != null) {
textView.setText(receivedData);
}
}
}
// Factory method for creating a new instance of the fragment
public static LibraryDocFragment newInstance(String data) {
LibraryDocFragment fragment = new LibraryDocFragment();
// フラグメントにデータを渡す
Bundle args = new Bundle();
args.putString("key_name", data);
fragment.setArguments(args);
return fragment;
}
}
@@ -2,11 +2,20 @@ 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 java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
@@ -55,10 +64,28 @@ public class LibraryTopFragment extends Fragment {
}
}
@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
return inflater.inflate(R.layout.fragment_library_top, container, false);
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<String> documentList = new ArrayList<>();
documentList.add("Document A");
documentList.add("Document B");
documentList.add("Document C");
// Create and set the adapter
DocumentAdapter adapter = new DocumentAdapter(documentList);
documentRecyclerView.setAdapter(adapter);
// Use a LinearLayoutManager to specify the layout
return view;
}
}
}
@@ -0,0 +1,17 @@
<?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="match_parent"
android:padding="16dp">
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,14 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".LibraryTopFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
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" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/document_list"
android:layout_width="match_parent"
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" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/debug_menu_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/debug_menu_item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,4 +1,3 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="app_name">Library</string>
</resources>
@@ -1,5 +1,7 @@
package one.nem.lacerta.utils;
import one.nem.lacerta.utils.model.KeyValueLog;
public interface LacertaLogger {
void info(String tag, String message);
@@ -9,4 +11,7 @@ public interface LacertaLogger {
void trace(String tag, String message);
void fatal(String tag, String message);
String buildKVMessage(KeyValueLog... logs);
// With name
String buildKVMessage(String name, KeyValueLog... logs);
}
@@ -5,6 +5,8 @@ import android.util.Log;
import javax.inject.Inject;
import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.utils.model.KeyValueLog;
public class LacertaLoggerImpl implements LacertaLogger{
@Inject
@@ -40,4 +42,30 @@ public class LacertaLoggerImpl implements LacertaLogger{
public void fatal(String tag, String message) {
Log.wtf(tag, message);
}
@Override
public String buildKVMessage(KeyValueLog... logs) {
StringBuilder builder = new StringBuilder();
for (KeyValueLog log : logs) {
builder.append(log.getKey());
builder.append(": ");
builder.append(log.getValue());
builder.append("\n");
}
return builder.toString();
}
@Override
public String buildKVMessage(String name, KeyValueLog... logs) {
StringBuilder builder = new StringBuilder();
builder.append(name);
builder.append("\n");
for (KeyValueLog log : logs) {
builder.append(log.getKey());
builder.append(": ");
builder.append(log.getValue());
builder.append("\n");
}
return builder.toString();
}
}
@@ -0,0 +1,31 @@
package one.nem.lacerta.utils.model;
public class KeyValueLog {
String key;
String value;
public KeyValueLog(String key, String value) {
this.key = key;
this.value = value;
}
// Getter
public String getKey() {
return key;
}
public String getValue() {
return value;
}
// Setter
public void setKey(String key) {
this.key = key;
}
public void setValue(String value) {
this.value = value;
}
}