diff --git a/android-example/src/main/java/io/xconn/androidexample/fragment/CameraFragment.java b/android-example/src/main/java/io/xconn/androidexample/fragment/CameraFragment.java index e5e7572..d4847b3 100644 --- a/android-example/src/main/java/io/xconn/androidexample/fragment/CameraFragment.java +++ b/android-example/src/main/java/io/xconn/androidexample/fragment/CameraFragment.java @@ -34,10 +34,8 @@ import io.xconn.androidexample.R; import io.xconn.androidexample.util.App; - public class CameraFragment extends Fragment { - private ActivityResultLauncher cameraPermissionLauncher; private ActivityResultLauncher cameraLauncher; private ActivityResultLauncher galleryLauncher; diff --git a/android-example/src/main/java/io/xconn/androidexample/fragment/GalleryFragment.java b/android-example/src/main/java/io/xconn/androidexample/fragment/GalleryFragment.java index afa121c..46b8b00 100644 --- a/android-example/src/main/java/io/xconn/androidexample/fragment/GalleryFragment.java +++ b/android-example/src/main/java/io/xconn/androidexample/fragment/GalleryFragment.java @@ -8,7 +8,6 @@ import android.os.Looper; import android.text.TextUtils; import android.util.Log; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -32,11 +31,11 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import io.xconn.cryptology.SealedBox; -import io.xconn.cryptology.SecretBox; import io.xconn.androidexample.R; import io.xconn.androidexample.util.App; import io.xconn.androidexample.util.Helpers; +import io.xconn.cryptology.SealedBox; +import io.xconn.cryptology.SecretBox; public class GalleryFragment extends Fragment implements Helpers.PasswordDialogListener { @@ -60,18 +59,10 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat super.onViewCreated(view, savedInstanceState); requireActivity().findViewById(R.id.frameLayout).setFocusableInTouchMode(true); requireActivity().findViewById(R.id.frameLayout).requestFocus(); - requireActivity().findViewById(R.id.frameLayout).setOnKeyListener((v, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { - onBackPressed(); - return true; - } - return false; - }); Helpers.showPasswordDialog(requireContext(), this, true); } - @Override public boolean onPasswordSubmit(String password) { boolean isPrivateKeyDecrypted = decryptPrivateKey(password); @@ -104,14 +95,6 @@ public void onDismissed(boolean dismissedAfterSubmit) { } - private void onBackPressed() { - if (isCameraFragmentFocused()) { - focusOnCameraFragment(); - } - navigateToCameraFragment(); - } - - private boolean decryptPrivateKey(String password) { String encryptedPrivateKeyHex = App.getString(App.PREF_PRIVATE_KEY); String nonceHex = App.getString(App.PREF_NONCE); @@ -136,7 +119,6 @@ private boolean decryptPrivateKey(String password) { } private boolean isCameraFragmentFocused() { - if (isAdded()) { return !requireActivity().findViewById(R.id.menu_camera).isSelected(); }