mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
ビルドエラー回避コメントアウト
This commit is contained in:
parent
e026da96fa
commit
78ff41b3e3
|
@ -123,109 +123,110 @@ public class ScannerDataManagerStubFragment extends Fragment {
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
view.findViewById(R.id.button_call_camera).setOnClickListener(v -> {
|
// view.findViewById(R.id.button_call_camera).setOnClickListener(v -> {
|
||||||
Log.d("ScannerDataManagerStubFragment", "button_call_camera clicked");
|
// Log.d("ScannerDataManagerStubFragment", "button_call_camera clicked");
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
// Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
|
// if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
|
||||||
File photoFile = null;
|
// File photoFile = null;
|
||||||
try {
|
// try {
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
|
// String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
|
||||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
// String imageFileName = "JPEG_" + timeStamp + "_";
|
||||||
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
// File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
photoFile = File.createTempFile(imageFileName, ".jpg", storageDir);
|
// photoFile = File.createTempFile(imageFileName, ".jpg", storageDir);
|
||||||
} catch (IOException ex) {
|
// } catch (IOException ex) {
|
||||||
Log.e("ScannerDataManagerStubFragment", "Error occurred while creating the file", ex);
|
// Log.e("ScannerDataManagerStubFragment", "Error occurred while creating the file", ex);
|
||||||
}
|
// }
|
||||||
if (photoFile != null) {
|
// if (photoFile != null) {
|
||||||
photoURI = FileProvider.getUriForFile(getActivity(), "one.nem.lacerta.provider", photoFile);
|
// photoURI = FileProvider.getUriForFile(getActivity(), "one.nem.lacerta.provider", photoFile);
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
// takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||||
cameraLauncher.launch(takePictureIntent);
|
// cameraLauncher.launch(takePictureIntent);
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
Log.d("ScannerDataManagerStubFragment", "photoFile is null");
|
// Log.d("ScannerDataManagerStubFragment", "photoFile is null");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
Log.d("ScannerDataManagerStubFragment", "camera not available");
|
// Log.d("ScannerDataManagerStubFragment", "camera not available");
|
||||||
}
|
// }
|
||||||
updateResults();
|
// updateResults();
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
view.findViewById(R.id.button_create_documnent).setOnClickListener(v -> {
|
// view.findViewById(R.id.button_create_documnent).setOnClickListener(v -> {
|
||||||
Log.d("ScannerDataManagerStubFragment", "button_create_documnent clicked");
|
// Log.d("ScannerDataManagerStubFragment", "button_create_documnent clicked");
|
||||||
Toast.makeText(getActivity(), "button_create_documnent clicked", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "button_create_documnent clicked", Toast.LENGTH_LONG).show();
|
||||||
|
//
|
||||||
this.documentDetail = createSampleDocumentDetail();
|
// this.documentDetail = createSampleDocumentDetail();
|
||||||
|
//
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
view.findViewById(R.id.button_init_document_processor).setOnClickListener(v -> {
|
// view.findViewById(R.id.button_init_document_processor).setOnClickListener(v -> {
|
||||||
Log.d("ScannerDataManagerStubFragment", "button_init_document_processor clicked");
|
// Log.d("ScannerDataManagerStubFragment", "button_init_document_processor clicked");
|
||||||
Toast.makeText(getActivity(), "button_init_document_processor clicked", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "button_init_document_processor clicked", Toast.LENGTH_LONG).show();
|
||||||
// TODO-rca: ここでDocumentProcessorを初期化する
|
// // TODO-rca: ここでDocumentProcessorを初期化する
|
||||||
if (this.documentDetail == null) {
|
// if (this.documentDetail == null) {
|
||||||
Toast.makeText(getActivity(), "documentDetail is null", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "documentDetail is null", Toast.LENGTH_LONG).show();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
this.documentProcessor = documentProcessorFactory.create(this.documentDetail);
|
// this.documentProcessor = documentProcessorFactory.create(this.documentDetail);
|
||||||
Toast.makeText(getActivity(), "documentProcessor created", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "documentProcessor created", Toast.LENGTH_LONG).show();
|
||||||
try {
|
// try {
|
||||||
this.documentProcessor.init();
|
// this.documentProcessor.init();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Toast.makeText(getActivity(), "Error occurred while initializing documentProcessor", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "Error occurred while initializing documentProcessor", Toast.LENGTH_LONG).show();
|
||||||
Log.e("ScannerDataManagerStubFragment", "Error occurred while initializing documentProcessor", e);
|
// Log.e("ScannerDataManagerStubFragment", "Error occurred while initializing documentProcessor", e);
|
||||||
}
|
// }
|
||||||
Toast.makeText(getActivity(), "documentProcessor initialized", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "documentProcessor initialized", Toast.LENGTH_LONG).show();
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
view.findViewById(R.id.button_add_page).setOnClickListener(v -> {
|
// view.findViewById(R.id.button_add_page).setOnClickListener(v -> {
|
||||||
Log.d("ScannerDataManagerStubFragment", "button_add_page clicked");
|
// Log.d("ScannerDataManagerStubFragment", "button_add_page clicked");
|
||||||
Toast.makeText(getActivity(), "button_add_page clicked", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "button_add_page clicked", Toast.LENGTH_LONG).show();
|
||||||
if (this.documentProcessor == null) {
|
// if (this.documentProcessor == null) {
|
||||||
Toast.makeText(getActivity(), "documentProcessor is null", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "documentProcessor is null", Toast.LENGTH_LONG).show();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
Bitmap[] bitmaps = new Bitmap[results.size()];
|
// Bitmap[] bitmaps = new Bitmap[results.size()];
|
||||||
for (int i = 0; i < results.size(); i++) {
|
// for (int i = 0; i < results.size(); i++) {
|
||||||
bitmaps[i] = results.get(i).getBitmap();
|
// bitmaps[i] = results.get(i).getBitmap();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
this.documentProcessor.addNewPagesToLast(bitmaps);
|
// this.documentProcessor.addNewPagesToLast(bitmaps);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Toast.makeText(getActivity(), "Error occurred while adding pages", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "Error occurred while adding pages", Toast.LENGTH_LONG).show();
|
||||||
Log.e("ScannerDataManagerStubFragment", "Error occurred while adding pages", e);
|
// Log.e("ScannerDataManagerStubFragment", "Error occurred while adding pages", e);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Toast.makeText(getActivity(), "pages added", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "pages added", Toast.LENGTH_LONG).show();
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
this.documentProcessor.close();
|
// this.documentProcessor.close();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Toast.makeText(getActivity(), "Error occurred while closing documentProcessor", Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "Error occurred while closing documentProcessor", Toast.LENGTH_LONG).show();
|
||||||
Log.e("ScannerDataManagerStubFragment", "Error occurred while closing documentProcessor", e);
|
// Log.e("ScannerDataManagerStubFragment", "Error occurred while closing documentProcessor", e);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocumentDetail createSampleDocumentDetail() {
|
public DocumentDetail createSampleDocumentDetail() {
|
||||||
|
//
|
||||||
String id = UUID.randomUUID().toString();
|
// String id = UUID.randomUUID().toString();
|
||||||
|
//
|
||||||
Toast.makeText(getActivity(), "Generated id: " + id, Toast.LENGTH_LONG).show();
|
// Toast.makeText(getActivity(), "Generated id: " + id, Toast.LENGTH_LONG).show();
|
||||||
//logger.debug("CreateSample", "Generated id: " + id);
|
// //logger.debug("CreateSample", "Generated id: " + id);
|
||||||
|
//
|
||||||
DocumentMeta meta = new DocumentMeta(
|
// DocumentMeta meta = new DocumentMeta(
|
||||||
id,
|
// id,
|
||||||
"Sample" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now()),
|
// "Sample" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now()),
|
||||||
new Date(),
|
// new Date(),
|
||||||
new Date());
|
// new Date());
|
||||||
|
//
|
||||||
DocumentPath path = new DocumentPath(
|
// DocumentPath path = new DocumentPath(
|
||||||
deviceInfoUtils.getExternalStorageDirectoryString(),
|
// deviceInfoUtils.getExternalStorageDirectoryString(),
|
||||||
"Sample" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now()));
|
// "Sample" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now()));
|
||||||
|
//
|
||||||
return new DocumentDetail(meta, path, "SampleAuthor", "SampleDefaultBranch");
|
// return new DocumentDetail(meta, path, "SampleAuthor", "SampleDefaultBranch");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -90,13 +90,13 @@ public class LibraryTopFragment extends Fragment {
|
||||||
|
|
||||||
//データを取得
|
//データを取得
|
||||||
|
|
||||||
List<DocumentMeta> metas = document.getAllDocumentMetas(100);
|
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
|
||||||
|
|
||||||
Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();
|
// Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
// Create and set the adapter
|
// Create and set the adapter
|
||||||
DocumentAdapter adapter = new DocumentAdapter(metas);
|
// DocumentAdapter adapter = new DocumentAdapter(metas);
|
||||||
documentRecyclerView.setAdapter(adapter);
|
// documentRecyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
// Use a LinearLayoutManager to specify the layout
|
// Use a LinearLayoutManager to specify the layout
|
||||||
return view;
|
return view;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user