diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/pages/ImageOcclusion.kt b/AnkiDroid/src/main/java/com/ichi2/anki/pages/ImageOcclusion.kt index 0cd25597e781..327f67732f68 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/pages/ImageOcclusion.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/pages/ImageOcclusion.kt @@ -18,18 +18,34 @@ package com.ichi2.anki.pages import android.content.Context import android.content.Intent import android.os.Bundle +import android.view.View import android.webkit.WebView import androidx.core.os.bundleOf +import com.google.android.material.appbar.MaterialToolbar import com.ichi2.anki.CollectionManager.TR import com.ichi2.anki.ImageOcclusionActivity +import com.ichi2.anki.R import org.json.JSONObject +import timber.log.Timber -class ImageOcclusion : PageFragment() { +class ImageOcclusion : PageFragment(R.layout.image_occlusion) { override val title: String get() = TR.notetypesImageOcclusionName() override val pageName = "image-occlusion" + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById(R.id.toolbar).setOnMenuItemClickListener { + if (it.itemId == R.id.action_save) { + Timber.i("save item selected") + webView.evaluateJavascript("anki.imageOcclusion.addNote()", null) + } + return@setOnMenuItemClickListener true + } + } + override fun onCreateWebViewClient(savedInstanceState: Bundle?): PageWebViewClient { val kind = arguments?.getString(ARG_KEY_KIND) ?: throw Exception("missing kind") val id = arguments?.getLong(ARG_KEY_ID) ?: throw Exception("missing ID") diff --git a/AnkiDroid/src/main/res/drawable/ic_done.xml b/AnkiDroid/src/main/res/drawable/ic_done.xml new file mode 100644 index 000000000000..29caa791bf19 --- /dev/null +++ b/AnkiDroid/src/main/res/drawable/ic_done.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/AnkiDroid/src/main/res/layout/image_occlusion.xml b/AnkiDroid/src/main/res/layout/image_occlusion.xml new file mode 100644 index 000000000000..d318de04874d --- /dev/null +++ b/AnkiDroid/src/main/res/layout/image_occlusion.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnkiDroid/src/main/res/menu/image_occlusion.xml b/AnkiDroid/src/main/res/menu/image_occlusion.xml new file mode 100644 index 000000000000..c231cae16af9 --- /dev/null +++ b/AnkiDroid/src/main/res/menu/image_occlusion.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file