mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ドキュメント新規保存のロジックを実装 WIP
This commit is contained in:
parent
119771a7f9
commit
dea5f240f0
|
@ -26,9 +26,12 @@ import java.util.Objects;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
import one.nem.lacerta.model.document.DocumentMeta;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
|
import one.nem.lacerta.processor.factory.DocumentProcessorFactory;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
import one.nem.lacerta.data.Document;
|
import one.nem.lacerta.data.Document;
|
||||||
|
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
public class ScannerManagerActivity extends AppCompatActivity {
|
public class ScannerManagerActivity extends AppCompatActivity {
|
||||||
|
@ -41,6 +44,11 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||||
@Inject
|
@Inject
|
||||||
Document document;
|
Document document;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DocumentProcessorFactory documentProcessorFactory;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LacertaVcsFactory lacertaVcsFactory;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
private ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
||||||
|
@ -145,7 +153,18 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||||
private void saveNewDocument() {
|
private void saveNewDocument() {
|
||||||
logger.debug(TAG, "saveNewDocument");
|
logger.debug(TAG, "saveNewDocument");
|
||||||
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
|
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
|
||||||
document.createDocument(documentMeta);
|
DocumentDetail documentDetail = document.createDocument(documentMeta);
|
||||||
|
Bitmap[] bitmaps = new Bitmap[this.croppedImages.size()];
|
||||||
|
this.croppedImages.toArray(bitmaps);
|
||||||
|
try {
|
||||||
|
documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps);
|
||||||
|
Toast.makeText(this, "Saved.", Toast.LENGTH_SHORT).show();
|
||||||
|
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent("Initial commit");
|
||||||
|
finish();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(TAG, "Error: " + e.getMessage());
|
||||||
|
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertToExistDocument() {
|
private void insertToExistDocument() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user