Kaynağa Gözat

phase2 fix 4-5
`

faterhenry 5 yıl önce
ebeveyn
işleme
0c7d482ca5

+ 32 - 0
src/main/java/com/bomostory/sceneeditmodule/ImageOperation.kt

@@ -0,0 +1,32 @@
+package com.bomostory.sceneeditmodule
+
+import android.graphics.*
+import android.graphics.Paint.ANTI_ALIAS_FLAG
+
+object ImageOperation {
+    fun imageoperation(mbitmap: Bitmap, hue: Float, saturation: Float, lum: Float): Bitmap {
+        val mbitmap_fu = Bitmap.createBitmap(mbitmap.getWidth(), mbitmap.getHeight(), Bitmap.Config.ARGB_8888)
+        val canvas = Canvas(mbitmap_fu)
+        val mpaint = Paint(ANTI_ALIAS_FLAG)
+        val huematrix = ColorMatrix()
+        val saturationmatrix = ColorMatrix()
+        val lummatrix = ColorMatrix()
+        val imagematrix = ColorMatrix()
+
+        huematrix.setRotate(0, hue)
+        huematrix.setRotate(1, hue)
+        huematrix.setRotate(2, hue)
+
+        saturationmatrix.setSaturation(saturation)
+
+        lummatrix.setScale(lum, lum, lum, 1f)
+
+        imagematrix.postConcat(huematrix)
+        imagematrix.postConcat(saturationmatrix)
+        imagematrix.postConcat(lummatrix)
+        mpaint.setColorFilter(ColorMatrixColorFilter(imagematrix))
+        canvas.drawBitmap(mbitmap, 0f, 0f, mpaint)
+        return mbitmap_fu
+    }
+}
+

+ 43 - 13
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -1,6 +1,7 @@
 package com.example.tfat.myapplication
 
 import android.app.Activity
+import android.app.AlertDialog
 import android.app.ProgressDialog
 import android.content.Context
 import android.content.DialogInterface
@@ -153,6 +154,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
 
     override fun onResume() {
         super.onResume()
+        hideStatusBar()
+    }
+
+    private fun hideStatusBar(){
         window.decorView.apply {
             systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                     or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
@@ -163,7 +168,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                     or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
         }
     }
-
     private fun initResource(){
         resourceThemeBitmap = when(intent.getStringExtra("resource_actor")) {
             null -> {
@@ -295,21 +299,47 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                         newSceneRecyclerView.adapter = addSceneAdapter
                     })
                     editSceneView.setOnClickDeleteListener(View.OnClickListener {
-                        project.story?.let {
-                            it.scenes?.let{
-                                if (it.size <= 1) { return@let }
-                                it.removeAt(currentSceneIndex)
-                                when(currentSceneIndex >= it.size){
-                                    true -> {
-                                        currentSceneIndex = 0
-                                        sceneEditView.scene = it[0]
+                        var builder = AlertDialog.Builder(this@SceneEditActivity).apply {
+                            setTitle(resources.getString(R.string.delete_check))
+                            setPositiveButton(R.string.uikit_others_yes) { dialog, whichButton ->
+                                project.story?.let {
+                                    it.scenes?.let{
+                                        if (it.size <= 1) { return@let }
+                                        it.removeAt(currentSceneIndex)
+                                        when(currentSceneIndex >= it.size){
+                                            true -> {
+                                                currentSceneIndex = 0
+                                                sceneEditView.scene = it[0]
+                                            }
+                                            false -> sceneEditView.scene = it[currentSceneIndex]
+                                        }
+                                        initNavigationBarView(currentSceneIndex)
+                                        setControlSceneView()
                                     }
-                                    false -> sceneEditView.scene = it[currentSceneIndex]
                                 }
-                                initNavigationBarView(currentSceneIndex)
-                                setControlSceneView()
+                                window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                                        WindowManager.LayoutParams.FLAG_FULLSCREEN)
+                                actionBar?.hide()
+                                supportActionBar?.hide()
+                                hideStatusBar()
+                            }
+                            setNegativeButton(R.string.uikit_others_not) { dialog, whichButton ->
+                                window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                                        WindowManager.LayoutParams.FLAG_FULLSCREEN)
+                                actionBar?.hide()
+                                supportActionBar?.hide()
+                                hideStatusBar()
+                            }
+                            setOnDismissListener {
+                                window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                                        WindowManager.LayoutParams.FLAG_FULLSCREEN)
+                                actionBar?.hide()
+                                supportActionBar?.hide()
+                                hideStatusBar()
                             }
                         }
+                        val dialog: AlertDialog = builder.create()
+                        dialog.show()
                     })
                 }
             }
@@ -823,7 +853,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         project.story?.let {
             it.scenes?.let{
                 scene.sceneWidth = monitorSize.widthPixels
-                it.add(scene)
+                it.add(currentSceneIndex + 1,scene)
             }
         }
     }

+ 3 - 0
src/main/java/com/bomostory/sceneeditmodule/screen/view/ActorView.kt

@@ -7,7 +7,9 @@ import android.graphics.drawable.Drawable
 import android.util.AttributeSet
 import android.widget.ImageView
 import com.bomostory.sceneeditmodule.DialogueDrawer
+import com.bomostory.sceneeditmodule.ImageOperation
 import com.bomostory.sceneeditmodule.basicdata.Actor
+import kotlinx.android.synthetic.main.control_actor_dialog.view.*
 import pl.droidsonroids.gif.GifDrawable
 import kotlin.math.max
 
@@ -25,6 +27,7 @@ class ActorView : ImageView {
                         setImageDrawable(gifDrawable)
                         gifDrawable?.start()
                     } else {
+                        //TODO() setImageBitmap(ImageOperation.imageoperation(BitmapFactory.decodeFile(it.resourcePath),1f,it.opacity,1f))
                         setImageDrawable(Drawable.createFromPath(it.resourcePath))
                     }
                 }

+ 2 - 0
src/main/res/values/strings.xml

@@ -52,4 +52,6 @@
     <string name="theme_name">Theme Name</string>
     <string name="ok">OK</string>
     <string name="project_name">Project Name</string>
+    
+    <string name="delete_check">Are you sure you want to delete this page?</string>
 </resources>