fixes movement from camera fragment
This commit is contained in:
parent
14e583c164
commit
0a94cb517c
@ -17,7 +17,6 @@ import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.maenle.bump.databinding.FragmentSecondBinding
|
||||
import com.google.mlkit.vision.barcode.Barcode
|
||||
import com.google.mlkit.vision.barcode.BarcodeScanner
|
||||
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
|
||||
@ -31,6 +30,9 @@ import kotlin.math.min
|
||||
import android.view.WindowInsets
|
||||
|
||||
import android.graphics.Insets
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.maenle.bump.R
|
||||
import com.maenle.bump.databinding.FragmentCameraBinding
|
||||
import com.maenle.bump.util.BumpProcessor
|
||||
import com.maenle.bump.util.CameraXViewModel
|
||||
|
||||
@ -44,7 +46,7 @@ class CameraFragment: Fragment() {
|
||||
private var previewUseCase: Preview? = null
|
||||
private var analysisUseCase: ImageAnalysis? = null
|
||||
|
||||
private var _binding: FragmentSecondBinding? = null
|
||||
private var _binding: FragmentCameraBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val screenAspectRatio: Int
|
||||
@ -67,7 +69,7 @@ class CameraFragment: Fragment() {
|
||||
savednstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentSecondBinding.inflate(inflater, container, false)
|
||||
_binding = FragmentCameraBinding.inflate(inflater, container, false)
|
||||
setupCamera()
|
||||
return binding.root
|
||||
}
|
||||
@ -183,7 +185,8 @@ class CameraFragment: Fragment() {
|
||||
Log.d(TAG, it.rawValue!!)
|
||||
val bump = BumpProcessor.getInstance(requireContext())
|
||||
bump.addSecret(requireContext(), it.rawValue!!)
|
||||
fragmentManager?.popBackStack()
|
||||
findNavController().navigateUp()
|
||||
|
||||
}
|
||||
}
|
||||
.addOnFailureListener {
|
||||
|
@ -17,6 +17,7 @@ import com.maenle.bump.util.RestSingleton
|
||||
import com.maenle.bump.util.sendNotification
|
||||
import com.maenle.bump.R
|
||||
import com.maenle.bump.databinding.FragmentFirstBinding
|
||||
import com.maenle.bump.util.LocalData
|
||||
import org.json.JSONArray
|
||||
|
||||
/**
|
||||
@ -65,8 +66,10 @@ class FirstFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.buttonFirst.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_FirstFragment_to_SecondFragment)
|
||||
findNavController().navigate(R.id.action_FirstFragment_to_CameraFragment)
|
||||
}
|
||||
val local = LocalData(requireContext())
|
||||
local.code?.let { binding.textviewFirst.text = it}
|
||||
}
|
||||
|
||||
private fun createChannel(channelId: String, channelName: String) {
|
||||
|
@ -6,9 +6,9 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.maenle.bump.ui.SecondFragment">
|
||||
|
||||
<!--androidx.camera.view.PreviewView
|
||||
<androidx.camera.view.PreviewView
|
||||
android:id="@+id/viewFinder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" /-->
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -12,19 +12,9 @@
|
||||
tools:layout="@layout/fragment_first">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_FirstFragment_to_SecondFragment"
|
||||
android:id="@+id/action_FirstFragment_to_CameraFragment"
|
||||
app:destination="@id/CameraFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/SecondFragment"
|
||||
android:name="com.maenle.bump.ui.SecondFragment"
|
||||
android:label="@string/second_fragment_label"
|
||||
tools:layout="@layout/fragment_second">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_SecondFragment_to_FirstFragment"
|
||||
app:destination="@id/FirstFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/CameraFragment"
|
||||
android:name="com.maenle.bump.ui.CameraFragment"
|
||||
@ -32,7 +22,7 @@
|
||||
tools:layout="@layout/fragment_camera">
|
||||
|
||||
<action
|
||||
android:id="@+id/action_SecondFragment_to_FirstFragment"
|
||||
android:id="@+id/action_CameraFragment_to_FirstFragment"
|
||||
app:destination="@id/FirstFragment" />
|
||||
</fragment>
|
||||
</navigation>
|
Loading…
Reference in New Issue
Block a user