Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

信ぴょう性対応 #32

Merged
merged 8 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
信ぴょう性対応
  • Loading branch information
JangSungChul committed Sep 26, 2023
commit 6d8b2fdc661333674b685273764563ad11a9c117
12 changes: 7 additions & 5 deletions src/android/BlackboardCamera.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,26 @@ class BlackboardCamera : CordovaPlugin() {
var applicationContext = cordova.activity.applicationContext
val intent = Intent(applicationContext, CameraActivity::class.java)
val base64: String = data[0] as String
Log.d("TAG", "data[1]=" + data[1])
val isNeedBlackBoard: Boolean = try {
(data[1] as Boolean)
} catch (e: ClassCastException) {
(data[1] as Int) == 1
}
val blackboardViewPriority: String = data[2] as String
var jcomsiaPhoto: String = data[3] as String
val photoInfoJson = JSONObject(jcomsiaPhoto)
val photoInfo = PhotoInfo(photoInfoJson)
var jcomsiaPhoto: String? = data[3] as? String

var version: String = data[4] as String
val filePath = "${cordova.activity.applicationContext.filesDir}/board.png"
decoder(base64, filePath)
if (File(filePath).exists()) {
intent.putExtra("boardPath", filePath)
intent.putExtra("isNeedBlackBoard", isNeedBlackBoard)
intent.putExtra("blackboardViewPriority", blackboardViewPriority)
intent.putExtra("photoInfo", photoInfo)
if (jcomsiaPhoto != null) {
val photoInfoJson = JSONObject(jcomsiaPhoto)
val photoInfo = PhotoInfo(photoInfoJson)
intent.putExtra("photoInfo", photoInfo)
}
intent.putExtra("version", version)
}
cordova.startActivityForResult(this, intent, 1)
Expand Down
9 changes: 7 additions & 2 deletions src/android/Camera2Fragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1250,15 +1250,17 @@ class Camera2Fragment : Fragment(), View.OnClickListener, View.OnTouchListener {
if (photoInfo != null) {
ElectronicBlackBoardManager.createImageEmbeddedMetaData(file.absolutePath, photoInfo, "DCP PHOTO", "Android", version ?: "TPR2 3.1.1")
}
val checkedFilePath = "$file.parent/_$file.name"
writeHash(file.absolutePath, checkedFilePath)

Log.i(TAG, "exifOrientation=$exifOrientation, rotation=$rotation")
// activity.runOnUiThread {
// Toast.makeText(activity, "exifOrientation=$exifOrientation, rotation=$rotation", Toast.LENGTH_LONG).show()
// }

addImageToGallery(file.absolutePath)
addImageToGallery(checkedFilePath)
val intent = Intent()
intent.putExtra("filePath", file.absolutePath)
intent.putExtra("filePath", checkedFilePath)
intent.putExtra("mode", activity.blackboardViewPriority)
activity.setResult(1, intent)
activity.finish()
Expand Down Expand Up @@ -1348,11 +1350,14 @@ class Camera2Fragment : Fragment(), View.OnClickListener, View.OnTouchListener {
private val ORIENTATIONS = SparseIntArray()

init {
System.loadLibrary("native-lib")
ORIENTATIONS.append(Surface.ROTATION_0, 90)
ORIENTATIONS.append(Surface.ROTATION_90, 0)
ORIENTATIONS.append(Surface.ROTATION_180, 270)
ORIENTATIONS.append(Surface.ROTATION_270, 180)
}
// 改ざん検知情報埋め込みメソッド
external fun writeHash(srcFilePath: String, outputFilePath: String): Int

/**
* Tag for the [Log].
Expand Down