Update plugin com.android.application to v8.3.1 #3
| @@ -1,5 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     xmlns:tools="http://schemas.android.com/tools" | ||||||
|     android:versionCode="1" |     android:versionCode="1" | ||||||
|     android:versionName="1.0"> |     android:versionName="1.0"> | ||||||
|  |  | ||||||
| @@ -21,7 +22,8 @@ | |||||||
|  |  | ||||||
|         <receiver |         <receiver | ||||||
|             android:name=".pluginSDK.PluginAccessReceiver" |             android:name=".pluginSDK.PluginAccessReceiver" | ||||||
|             android:exported="true"> |             android:exported="true" | ||||||
|  |             tools:ignore="ExportedReceiver"> | ||||||
|             <intent-filter> |             <intent-filter> | ||||||
|                 <action android:name="keepass2android.ACTION_TRIGGER_REQUEST_ACCESS" /> |                 <action android:name="keepass2android.ACTION_TRIGGER_REQUEST_ACCESS" /> | ||||||
|                 <action android:name="keepass2android.ACTION_RECEIVE_ACCESS" /> |                 <action android:name="keepass2android.ACTION_RECEIVE_ACCESS" /> | ||||||
| @@ -31,7 +33,8 @@ | |||||||
|  |  | ||||||
|         <receiver |         <receiver | ||||||
|             android:name=".pluginSDK.PluginActionBroadcastReceiver" |             android:name=".pluginSDK.PluginActionBroadcastReceiver" | ||||||
|             android:exported="true"> |             android:exported="true" | ||||||
|  |             tools:ignore="ExportedReceiver"> | ||||||
|             <intent-filter> |             <intent-filter> | ||||||
|                 <action android:name="keepass2android.ACTION_OPEN_ENTRY" /> |                 <action android:name="keepass2android.ACTION_OPEN_ENTRY" /> | ||||||
|                 <action android:name="keepass2android.ACTION_CLOSE_ENTRY_VIEW" /> |                 <action android:name="keepass2android.ACTION_CLOSE_ENTRY_VIEW" /> | ||||||
|   | |||||||
| @@ -1,7 +1,9 @@ | |||||||
| package net.helcel.fidelity.activity | package net.helcel.fidelity.activity | ||||||
|  |  | ||||||
|  | import android.annotation.SuppressLint | ||||||
| import android.content.Context | import android.content.Context | ||||||
| import android.content.SharedPreferences | import android.content.SharedPreferences | ||||||
|  | import android.content.pm.ActivityInfo | ||||||
| import android.os.Bundle | import android.os.Bundle | ||||||
| import androidx.activity.addCallback | import androidx.activity.addCallback | ||||||
| import androidx.appcompat.app.AppCompatActivity | import androidx.appcompat.app.AppCompatActivity | ||||||
| @@ -10,38 +12,38 @@ import net.helcel.fidelity.activity.fragment.Launcher | |||||||
| import net.helcel.fidelity.databinding.ActMainBinding | import net.helcel.fidelity.databinding.ActMainBinding | ||||||
| import net.helcel.fidelity.tools.CacheManager | import net.helcel.fidelity.tools.CacheManager | ||||||
|  |  | ||||||
|  | @SuppressLint("SourceLockedOrientationActivity") | ||||||
| class MainActivity : AppCompatActivity() { | class MainActivity : AppCompatActivity() { | ||||||
|  |  | ||||||
|     private lateinit var binding: ActMainBinding |     private lateinit var binding: ActMainBinding | ||||||
|  |  | ||||||
|     private lateinit var sharedPreferences: SharedPreferences |     private lateinit var sharedPreferences: SharedPreferences | ||||||
|  |  | ||||||
|  |  | ||||||
|     override fun onCreate(savedInstanceState: Bundle?) { |     override fun onCreate(savedInstanceState: Bundle?) { | ||||||
|         super.onCreate(savedInstanceState) |         super.onCreate(savedInstanceState) | ||||||
|         sharedPreferences = |         sharedPreferences = | ||||||
|             this.getSharedPreferences(CacheManager.PREF_NAME, Context.MODE_PRIVATE) |             this.getSharedPreferences(CacheManager.PREF_NAME, Context.MODE_PRIVATE) | ||||||
|         CacheManager.loadFidelity(sharedPreferences) |         CacheManager.loadFidelity(sharedPreferences) | ||||||
|  |  | ||||||
|          |  | ||||||
|         binding = ActMainBinding.inflate(layoutInflater) |         binding = ActMainBinding.inflate(layoutInflater) | ||||||
|         setContentView(binding.root) |         setContentView(binding.root) | ||||||
|  |  | ||||||
|         onBackPressedDispatcher.addCallback(this) { |         onBackPressedDispatcher.addCallback(this) { | ||||||
|             if (supportFragmentManager.backStackEntryCount > 0) { |             if (supportFragmentManager.backStackEntryCount > 0) { | ||||||
|                 supportFragmentManager.popBackStackImmediate() |                 supportFragmentManager.popBackStackImmediate() | ||||||
|  |                 loadLauncher() | ||||||
|  |                 requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT | ||||||
|             } else { |             } else { | ||||||
|                 finish() |                 finish() | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (savedInstanceState == null) |         if (savedInstanceState == null) | ||||||
|             loadLauncher() |             loadLauncher() | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun loadLauncher() { |     private fun loadLauncher() { | ||||||
|         supportFragmentManager.beginTransaction() |         supportFragmentManager.beginTransaction() | ||||||
|             .add(R.id.container, Launcher()) |             .replace(R.id.container, Launcher()) | ||||||
|             .commit() |             .commit() | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ class CreateEntry : Fragment() { | |||||||
|                 ErrorToaster.formIncomplete(requireActivity()) |                 ErrorToaster.formIncomplete(requireActivity()) | ||||||
|  |  | ||||||
|             } else { |             } else { | ||||||
|                 val kpentry = KeepassWrapper.entryCreate( |                 val kpEntry = KeepassWrapper.entryCreate( | ||||||
|                     this, |                     this, | ||||||
|                     binding.editTextTitle.text.toString(), |                     binding.editTextTitle.text.toString(), | ||||||
|                     binding.editTextCode.text.toString(), |                     binding.editTextCode.text.toString(), | ||||||
| @@ -77,8 +77,8 @@ class CreateEntry : Fragment() { | |||||||
|                 try { |                 try { | ||||||
|                     resultLauncherAdd.launch( |                     resultLauncherAdd.launch( | ||||||
|                         Kp2aControl.getAddEntryIntent( |                         Kp2aControl.getAddEntryIntent( | ||||||
|                             kpentry.first, |                             kpEntry.first, | ||||||
|                             kpentry.second |                             kpEntry.second | ||||||
|                         ) |                         ) | ||||||
|                     ) |                     ) | ||||||
|                 } catch (e: ActivityNotFoundException) { |                 } catch (e: ActivityNotFoundException) { | ||||||
| @@ -108,23 +108,21 @@ class CreateEntry : Fragment() { | |||||||
|             binding.editTextCode.error = e.message |             binding.editTextCode.error = e.message | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
|             binding.imageViewPreview.setImageBitmap(null) |             binding.imageViewPreview.setImageBitmap(null) | ||||||
|             println(e.javaClass) |  | ||||||
|             println(e.message) |  | ||||||
|             e.printStackTrace() |             e.printStackTrace() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun isValid(): Boolean { |     private fun isValid(): Boolean { | ||||||
|         var valid = true |         var valid = true | ||||||
|         if (binding.editTextTitle.text!!.isEmpty()) { |         if (binding.editTextTitle.text.isNullOrEmpty()) { | ||||||
|             valid = false |             valid = false | ||||||
|             binding.editTextTitle.error = "Title cannot be empty" |             binding.editTextTitle.error = "Title cannot be empty" | ||||||
|         } |         } | ||||||
|         if (binding.editTextCode.text!!.isEmpty()) { |         if (binding.editTextCode.text.isNullOrEmpty()) { | ||||||
|             valid = false |             valid = false | ||||||
|             binding.editTextCode.error = "Code cannot be empty" |             binding.editTextCode.error = "Code cannot be empty" | ||||||
|         } |         } | ||||||
|         if (binding.editTextFormat.text!!.isEmpty()) { |         if (binding.editTextFormat.text.isNullOrEmpty()) { | ||||||
|             valid = false |             valid = false | ||||||
|             binding.editTextFormat.error = "Format cannot be empty" |             binding.editTextFormat.error = "Format cannot be empty" | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -27,7 +27,6 @@ class Scanner : Fragment() { | |||||||
|  |  | ||||||
|     private var code: String = "" |     private var code: String = "" | ||||||
|     private var fmt: String = "" |     private var fmt: String = "" | ||||||
|     private var valid: Boolean = false |  | ||||||
|  |  | ||||||
|     override fun onCreateView( |     override fun onCreateView( | ||||||
|         inflater: LayoutInflater, |         inflater: LayoutInflater, | ||||||
| @@ -35,13 +34,14 @@ class Scanner : Fragment() { | |||||||
|         savedInstanceState: Bundle? |         savedInstanceState: Bundle? | ||||||
|     ): View { |     ): View { | ||||||
|         binding = FragScannerBinding.inflate(layoutInflater) |         binding = FragScannerBinding.inflate(layoutInflater) | ||||||
|         binding.bottomText.setOnClickListener { |         binding.btnScanDone.setOnClickListener { | ||||||
|             startCreateEntry() |             startCreateEntry() | ||||||
|         } |         } | ||||||
|         when (hasCameraPermission()) { |         when (hasCameraPermission()) { | ||||||
|             true -> bindCameraUseCases() |             true -> bindCameraUseCases() | ||||||
|             else -> requestPermission() |             else -> requestPermission() | ||||||
|         } |         } | ||||||
|  |         binding.btnScanDone.isEnabled = false | ||||||
|         return binding.root |         return binding.root | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -92,9 +92,10 @@ class Scanner : Fragment() { | |||||||
|                 if (code != null && format != null) { |                 if (code != null && format != null) { | ||||||
|                     this.code = code |                     this.code = code | ||||||
|                     this.fmt = format |                     this.fmt = format | ||||||
|                     this.valid = true |                     binding.btnScanDone.isEnabled = true | ||||||
|  |  | ||||||
|                 } else { |                 } else { | ||||||
|                     this.valid = false |                     binding.btnScanDone.isEnabled = false | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             try { |             try { | ||||||
| @@ -111,6 +112,4 @@ class Scanner : Fragment() { | |||||||
|             } |             } | ||||||
|         }, ContextCompat.getMainExecutor(requireContext())) |         }, ContextCompat.getMainExecutor(requireContext())) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -1,10 +1,14 @@ | |||||||
| package net.helcel.fidelity.activity.fragment | package net.helcel.fidelity.activity.fragment | ||||||
|  |  | ||||||
|  | import android.annotation.SuppressLint | ||||||
|  | import android.content.pm.ActivityInfo | ||||||
| import android.content.res.Configuration | import android.content.res.Configuration | ||||||
| import android.os.Bundle | import android.os.Bundle | ||||||
| import android.view.LayoutInflater | import android.view.LayoutInflater | ||||||
| import android.view.View | import android.view.View | ||||||
| import android.view.ViewGroup | import android.view.ViewGroup | ||||||
|  | import android.view.WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL | ||||||
|  | import android.view.WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE | ||||||
| import androidx.fragment.app.Fragment | import androidx.fragment.app.Fragment | ||||||
| import com.google.zxing.FormatException | import com.google.zxing.FormatException | ||||||
| import net.helcel.fidelity.databinding.FragViewEntryBinding | import net.helcel.fidelity.databinding.FragViewEntryBinding | ||||||
| @@ -12,16 +16,14 @@ import net.helcel.fidelity.tools.BarcodeGenerator.generateBarcode | |||||||
| import net.helcel.fidelity.tools.ErrorToaster | import net.helcel.fidelity.tools.ErrorToaster | ||||||
| import net.helcel.fidelity.tools.KeepassWrapper | import net.helcel.fidelity.tools.KeepassWrapper | ||||||
|  |  | ||||||
|  | @SuppressLint("SourceLockedOrientationActivity") | ||||||
| class ViewEntry : Fragment() { | class ViewEntry : Fragment() { | ||||||
|  |  | ||||||
|     private lateinit var binding: FragViewEntryBinding |     private lateinit var binding: FragViewEntryBinding | ||||||
|  |  | ||||||
|     private var title: String? = null |     private var title: String? = null | ||||||
|     private var code: String? = null |     private var code: String? = null | ||||||
|     private var fmt: String? = null |     private var fmt: String? = null | ||||||
|  |  | ||||||
|  |  | ||||||
|     override fun onCreateView( |     override fun onCreateView( | ||||||
|         inflater: LayoutInflater, |         inflater: LayoutInflater, | ||||||
|         container: ViewGroup?, |         container: ViewGroup?, | ||||||
| @@ -33,8 +35,15 @@ class ViewEntry : Fragment() { | |||||||
|         code = res.second |         code = res.second | ||||||
|         fmt = res.third |         fmt = res.third | ||||||
|  |  | ||||||
|         adjustLayout() |  | ||||||
|         updatePreview() |         updatePreview() | ||||||
|  |         updateLayout() | ||||||
|  |  | ||||||
|  |         binding.imageViewPreview.setOnClickListener { | ||||||
|  |             requireActivity().requestedOrientation = | ||||||
|  |                 if (isLandscape()) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT | ||||||
|  |                 else ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE | ||||||
|  |         } | ||||||
|  |  | ||||||
|         return binding.root |         return binding.root | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -42,7 +51,7 @@ class ViewEntry : Fragment() { | |||||||
|         binding.title.text = title |         binding.title.text = title | ||||||
|         try { |         try { | ||||||
|             val barcodeBitmap = generateBarcode( |             val barcodeBitmap = generateBarcode( | ||||||
|                 code!!, fmt!!, 1024 |                 code, fmt, 1024 | ||||||
|             ) |             ) | ||||||
|             binding.imageViewPreview.setImageBitmap(barcodeBitmap) |             binding.imageViewPreview.setImageBitmap(barcodeBitmap) | ||||||
|         } catch (e: FormatException) { |         } catch (e: FormatException) { | ||||||
| @@ -53,23 +62,25 @@ class ViewEntry : Fragment() { | |||||||
|             ErrorToaster.invalidFormat(requireActivity()) |             ErrorToaster.invalidFormat(requireActivity()) | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
|             binding.imageViewPreview.setImageBitmap(null) |             binding.imageViewPreview.setImageBitmap(null) | ||||||
|             println(e.javaClass) |  | ||||||
|             println(e.message) |  | ||||||
|             e.printStackTrace() |             e.printStackTrace() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     private fun updateLayout() { | ||||||
|     override fun onConfigurationChanged(newConfig: Configuration) { |         if (isLandscape()) { | ||||||
|         super.onConfigurationChanged(newConfig) |  | ||||||
|         adjustLayout() |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private fun adjustLayout() { |  | ||||||
|         if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { |  | ||||||
|             binding.title.visibility = View.GONE |             binding.title.visibility = View.GONE | ||||||
|  |             setScreenBrightness(BRIGHTNESS_OVERRIDE_FULL) | ||||||
|         } else { |         } else { | ||||||
|             binding.title.visibility = View.VISIBLE |             binding.title.visibility = View.VISIBLE | ||||||
|  |             setScreenBrightness(BRIGHTNESS_OVERRIDE_NONE) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     private fun isLandscape(): Boolean { | ||||||
|  |         return (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun setScreenBrightness(brightness: Float?) { | ||||||
|  |         requireActivity().window?.attributes?.screenBrightness = brightness | ||||||
|  |     } | ||||||
| } | } | ||||||
| @@ -0,0 +1,45 @@ | |||||||
|  | package net.helcel.fidelity.activity.view | ||||||
|  |  | ||||||
|  | import android.content.Context | ||||||
|  | import android.graphics.Canvas | ||||||
|  | import android.graphics.Color | ||||||
|  | import android.graphics.Paint | ||||||
|  | import android.graphics.PorterDuff | ||||||
|  | import android.graphics.PorterDuffXfermode | ||||||
|  | import android.util.AttributeSet | ||||||
|  | import android.view.View | ||||||
|  |  | ||||||
|  | class ScannerView : View { | ||||||
|  |  | ||||||
|  |     private val overlayPaint = Paint().apply { | ||||||
|  |         color = Color.parseColor("#80000000") // Semi-transparent black | ||||||
|  |         style = Paint.Style.FILL | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private val clearPaint = Paint().apply { | ||||||
|  |         xfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     constructor(context: Context) : super(context) | ||||||
|  |     constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) | ||||||
|  |     constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( | ||||||
|  |         context, | ||||||
|  |         attrs, | ||||||
|  |         defStyleAttr | ||||||
|  |     ) | ||||||
|  |  | ||||||
|  |     override fun onDraw(canvas: Canvas) { | ||||||
|  |         super.onDraw(canvas) | ||||||
|  |  | ||||||
|  |         canvas.drawRect(0f, 0f, width.toFloat(), height.toFloat(), overlayPaint) | ||||||
|  |  | ||||||
|  |         val centerX = width / 2f | ||||||
|  |         val centerY = height / 2f | ||||||
|  |         val squareSize = 0.75f * width.coerceAtMost(height) | ||||||
|  |         canvas.drawRect( | ||||||
|  |             centerX - squareSize / 2, centerY - squareSize / 2, | ||||||
|  |             centerX + squareSize / 2, centerY + squareSize / 2, clearPaint | ||||||
|  |         ) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
| @@ -15,9 +15,9 @@ import net.helcel.fidelity.tools.BarcodeFormatConverter.formatToString | |||||||
| import java.util.concurrent.Executors | import java.util.concurrent.Executors | ||||||
|  |  | ||||||
|  |  | ||||||
| @OptIn(ExperimentalGetImage::class) |  | ||||||
| object BarcodeScanner { | object BarcodeScanner { | ||||||
|  |  | ||||||
|  |     @OptIn(ExperimentalGetImage::class) | ||||||
|     private fun processImageProxy( |     private fun processImageProxy( | ||||||
|         barcodeScanner: BarcodeScanner, |         barcodeScanner: BarcodeScanner, | ||||||
|         imageProxy: ImageProxy, |         imageProxy: ImageProxy, | ||||||
| @@ -33,8 +33,6 @@ object BarcodeScanner { | |||||||
|  |  | ||||||
|             barcodeScanner.process(inputImage) |             barcodeScanner.process(inputImage) | ||||||
|                 .addOnSuccessListener { barcodeList -> |                 .addOnSuccessListener { barcodeList -> | ||||||
|                     println(barcodeList.map { e -> e.displayValue }) |  | ||||||
|                     println(barcodeList.map { e -> e.format }) |  | ||||||
|                     val barcode = |                     val barcode = | ||||||
|                         barcodeList.getOrNull(0) |                         barcodeList.getOrNull(0) | ||||||
|                     if (barcode != null) |                     if (barcode != null) | ||||||
|   | |||||||
| @@ -20,7 +20,6 @@ object BarcodeFormatConverter { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     fun formatToString(f: Int): String { |     fun formatToString(f: Int): String { | ||||||
|         return when (f) { |         return when (f) { | ||||||
|             Barcode.FORMAT_CODE_128 -> "CODE_128" |             Barcode.FORMAT_CODE_128 -> "CODE_128" | ||||||
|   | |||||||
| @@ -19,8 +19,8 @@ object BarcodeGenerator { | |||||||
|             android.graphics.Color.WHITE |             android.graphics.Color.WHITE | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun generateBarcode(content: String, f: String, width: Int): Bitmap? { |     fun generateBarcode(content: String?, f: String?, width: Int): Bitmap? { | ||||||
|         if (content.isEmpty() || f.isEmpty()) { |         if (content.isNullOrEmpty() || f.isNullOrEmpty()) { | ||||||
|             return null |             return null | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
| @@ -33,11 +33,8 @@ object BarcodeGenerator { | |||||||
|             for (x in 0 until width) { |             for (x in 0 until width) { | ||||||
|                 for (y in 0 until height) { |                 for (y in 0 until height) { | ||||||
|                     bitmap.setPixel( |                     bitmap.setPixel( | ||||||
|                         x, |                         x, y, getPixelColor(bitMatrix, x, y) | ||||||
|                         y, |  | ||||||
|                         getPixelColor(bitMatrix, x, y) |  | ||||||
|                     ) |                     ) | ||||||
|  |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             return bitmap |             return bitmap | ||||||
|   | |||||||
| @@ -42,12 +42,11 @@ object KeepassWrapper { | |||||||
|         callback: (HashMap<String, String>) -> Unit |         callback: (HashMap<String, String>) -> Unit | ||||||
|     ): ActivityResultLauncher<Intent> { |     ): ActivityResultLauncher<Intent> { | ||||||
|         return fragment.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> |         return fragment.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> | ||||||
|  |  | ||||||
|  |             println(result.toString()) | ||||||
|             if (result.resultCode == Activity.RESULT_OK) { |             if (result.resultCode == Activity.RESULT_OK) { | ||||||
|                 val data: Intent? = result.data |                 val credentials = Kp2aControl.getEntryFieldsFromIntent(result.data) | ||||||
|                 val credentials = Kp2aControl.getEntryFieldsFromIntent( |                 println(credentials.toList().toString()) | ||||||
|                     data!! |  | ||||||
|                 ) |  | ||||||
|                 println(credentials) |  | ||||||
|                 callback(credentials) |                 callback(credentials) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -59,11 +58,8 @@ object KeepassWrapper { | |||||||
|     ): ActivityResultLauncher<Intent> { |     ): ActivityResultLauncher<Intent> { | ||||||
|         return fragment.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> |         return fragment.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> | ||||||
|             if (result.resultCode == Activity.RESULT_OK) { |             if (result.resultCode == Activity.RESULT_OK) { | ||||||
|                 val data: Intent? = result.data |                 val credentials = Kp2aControl.getEntryFieldsFromIntent(result.data) | ||||||
|                 val credentials = Kp2aControl.getEntryFieldsFromIntent( |                 println(credentials.toList().toString()) | ||||||
|                     data!! |  | ||||||
|                 ) |  | ||||||
|                 println(credentials) |  | ||||||
|                 callback(credentials) |                 callback(credentials) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -1,21 +0,0 @@ | |||||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:width="72dp" |  | ||||||
|     android:height="72dp" |  | ||||||
|     android:viewportWidth="52" |  | ||||||
|     android:viewportHeight="52"> |  | ||||||
|  |  | ||||||
|     <group |  | ||||||
|         android:translateX="-10" |  | ||||||
|         android:translateY="-10"> |  | ||||||
|         <path |  | ||||||
|             android:fillColor="#EA5A47" |  | ||||||
|             android:pathData="M60.7,26.2c0,-7.2 -5.9,-13.1 -13.1,-13.1c-5,0 -9.3,2.8 -11.5,6.9c-2.2,-4.1 -6.6,-6.9 -11.5,-6.9c-7.2,0 -13.1,5.9 -13.1,13.1c0,3.1 1.1,6 2.9,8.2l0,0l21.8,27l21.8,-27l0,0C59.6,32.2 60.7,29.4 60.7,26.2z" /> |  | ||||||
|         <path |  | ||||||
|             android:fillColor="#00000000" |  | ||||||
|             android:pathData="M60.7,26.2c0,-7.2 -5.9,-13.1 -13.1,-13.1c-5,0 -9.3,2.8 -11.5,6.9c-2.2,-4.1 -6.6,-6.9 -11.5,-6.9c-7.2,0 -13.1,5.9 -13.1,13.1c0,3.1 1.1,6 2.9,8.2l0,0l21.8,27l21.8,-27l0,0C59.6,32.2 60.7,29.4 60.7,26.2z" |  | ||||||
|             android:strokeWidth="2" |  | ||||||
|             android:strokeColor="#000000" |  | ||||||
|             android:strokeLineCap="round" |  | ||||||
|             android:strokeLineJoin="round" /> |  | ||||||
|     </group> |  | ||||||
| </vector> |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:width="72dp" |  | ||||||
|     android:height="72dp" |  | ||||||
|     android:viewportWidth="52" |  | ||||||
|     android:viewportHeight="52"> |  | ||||||
|     <group |  | ||||||
|         android:translateX="-10" |  | ||||||
|         android:translateY="-10"> |  | ||||||
|         <path |  | ||||||
|             android:fillColor="#00000000" |  | ||||||
|             android:pathData="M30.735,34.656l-16.432,16.026l0,7.24l7.565,0l0,-4.637l5.125,0l0,-5.857l5.098,0l2.404,-2.404l0,-4.358l2.015,0" |  | ||||||
|             android:strokeWidth="2" |  | ||||||
|             android:strokeColor="#000000" |  | ||||||
|             android:strokeLineCap="round" |  | ||||||
|             android:strokeLineJoin="round" /> |  | ||||||
|         <path |  | ||||||
|             android:fillColor="#00000000" |  | ||||||
|             android:pathData="M48.52,23.998m-3.952,0a3.952,3.952 0,1 1,7.904 0a3.952,3.952 0,1 1,-7.904 0" |  | ||||||
|             android:strokeWidth="2" |  | ||||||
|             android:strokeColor="#000000" |  | ||||||
|             android:strokeLineCap="round" |  | ||||||
|             android:strokeLineJoin="round" /> |  | ||||||
|         <path |  | ||||||
|             android:fillColor="#00000000" |  | ||||||
|             android:pathData="M34.226,31.178c-1.43,-4.238 -0.347,-9.221 3.18,-12.695c4.845,-4.772 12.465,-4.889 17.022,-0.263s4.322,12.244 -0.522,17.016c-3.917,3.858 -9.648,4.674 -14.108,2.4" |  | ||||||
|             android:strokeWidth="2" |  | ||||||
|             android:strokeColor="#000000" |  | ||||||
|             android:strokeLineCap="round" |  | ||||||
|             android:strokeLineJoin="round" /> |  | ||||||
|     </group> |  | ||||||
| </vector> |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:width="72dp" |  | ||||||
|     android:height="72dp" |  | ||||||
|     android:viewportWidth="52" |  | ||||||
|     android:viewportHeight="52"> |  | ||||||
|   <group |  | ||||||
|       android:translateX="-10" |  | ||||||
|       android:translateY="-10"> |  | ||||||
|   <path |  | ||||||
|       android:pathData="M53,32.25l1.875,0l0,26.875l-38,0l0,-26.875l1.875,0z" |  | ||||||
|       android:strokeLineJoin="round" |  | ||||||
|       android:strokeWidth="2" |  | ||||||
|       android:fillColor="#00000000" |  | ||||||
|       android:strokeColor="#000000" |  | ||||||
|       android:strokeLineCap="round"/> |  | ||||||
|   <path |  | ||||||
|       android:pathData="M21.375,28.915c0,-8.379 6.415,-16.274 14.318,-16.523c7.97,-0.251 15.41,7.285 14.742,16.523" |  | ||||||
|       android:strokeLineJoin="round" |  | ||||||
|       android:strokeWidth="2" |  | ||||||
|       android:fillColor="#00000000" |  | ||||||
|       android:strokeColor="#000000" |  | ||||||
|       android:strokeLineCap="round"/> |  | ||||||
|   <path |  | ||||||
|       android:pathData="M25.548,28.915c0,-6.335 4.576,-12.305 10.212,-12.493c5.684,-0.19 10.991,5.508 10.514,12.493" |  | ||||||
|       android:strokeLineJoin="round" |  | ||||||
|       android:strokeWidth="2" |  | ||||||
|       android:fillColor="#00000000" |  | ||||||
|       android:strokeColor="#000000" |  | ||||||
|       android:strokeLineCap="round"/> |  | ||||||
|   </group> |  | ||||||
| </vector> |  | ||||||
| @@ -1,8 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <androidx.coordinatorlayout.widget.CoordinatorLayout | <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|     xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     xmlns:tools="http://schemas.android.com/tools" |     xmlns:tools="http://schemas.android.com/tools" | ||||||
|     android:id="@+id/coordinator" |  | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="match_parent" |     android:layout_height="match_parent" | ||||||
|     android:fitsSystemWindows="true" |     android:fitsSystemWindows="true" | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ | |||||||
|         android:padding="16dp"> |         android:padding="16dp"> | ||||||
|  |  | ||||||
|         <com.google.android.material.textfield.TextInputLayout |         <com.google.android.material.textfield.TextInputLayout | ||||||
|             android:id="@+id/nameInputLayout" |  | ||||||
|             android:layout_width="match_parent" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:layout_marginTop="16dp" |             android:layout_marginTop="16dp" | ||||||
| @@ -64,7 +63,6 @@ | |||||||
|         </androidx.constraintlayout.widget.ConstraintLayout> |         </androidx.constraintlayout.widget.ConstraintLayout> | ||||||
|  |  | ||||||
|         <com.google.android.material.textfield.TextInputLayout |         <com.google.android.material.textfield.TextInputLayout | ||||||
|             android:id="@+id/formatInputLayout" |  | ||||||
|             style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu" |             style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu" | ||||||
|             android:layout_width="match_parent" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|   | |||||||
| @@ -9,7 +9,8 @@ | |||||||
|     <androidx.recyclerview.widget.RecyclerView |     <androidx.recyclerview.widget.RecyclerView | ||||||
|         android:id="@+id/fidelityList" |         android:id="@+id/fidelityList" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" /> |         android:layout_height="match_parent" | ||||||
|  |         android:layout_margin="24dp" /> | ||||||
|  |  | ||||||
|  |  | ||||||
|     <com.google.android.material.floatingactionbutton.FloatingActionButton |     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||||
| @@ -25,7 +26,6 @@ | |||||||
|         app:srcCompat="@drawable/search" /> |         app:srcCompat="@drawable/search" /> | ||||||
|  |  | ||||||
|     <LinearLayout |     <LinearLayout | ||||||
|         android:id="@+id/expandedMenuContainer" |  | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:layout_alignParentEnd="true" |         android:layout_alignParentEnd="true" | ||||||
|   | |||||||
| @@ -11,12 +11,26 @@ | |||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" /> |         android:layout_height="match_parent" /> | ||||||
|  |  | ||||||
|     <com.google.android.material.textview.MaterialTextView |     <net.helcel.fidelity.activity.view.ScannerView | ||||||
|         android:id="@+id/bottomText" |  | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="64dp" |         android:layout_height="match_parent" /> | ||||||
|  |  | ||||||
|  |     <com.google.android.material.floatingactionbutton.FloatingActionButton | ||||||
|  |         android:id="@+id/btnScanDone" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="wrap_content" | ||||||
|         android:layout_alignParentBottom="true" |         android:layout_alignParentBottom="true" | ||||||
|         android:background="#ffffff" |         android:layout_centerHorizontal="true" | ||||||
|         android:textSize="24sp" /> |         android:layout_margin="24dp" | ||||||
|  |         android:contentDescription="@string/manual" /> | ||||||
|  |  | ||||||
|  |     <com.google.android.material.progressindicator.CircularProgressIndicator | ||||||
|  |         android:layout_width="wrap_content" | ||||||
|  |         android:layout_height="wrap_content" | ||||||
|  |         android:layout_alignParentBottom="true" | ||||||
|  |         android:layout_centerHorizontal="true" | ||||||
|  |         android:layout_margin="28dp" | ||||||
|  |         android:indeterminate="true" /> | ||||||
|  |  | ||||||
|  |  | ||||||
| </RelativeLayout> | </RelativeLayout> | ||||||
| @@ -1,7 +1,5 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <TextView | <TextView xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|     xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:id="@+id/textViewFeelings" |  | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="wrap_content" |     android:layout_height="wrap_content" | ||||||
|     android:padding="15dp" |     android:padding="15dp" | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <resources xmlns:tools="http://schemas.android.com/tools"> | <resources xmlns:tools="http://schemas.android.com/tools"> | ||||||
|     <string name="kp2aplugin_title" tools:keep="@string/kp2aplugin_title">Fidelity</string> |     <string name="kp2aplugin_title" tools:keep="@string/kp2aplugin_title">Fidelity</string> | ||||||
|     <string name="kp2aplugin_shortdesc">Stores and Displays fidelity and other cards</string> |     <string name="kp2aplugin_shortdesc" tools:keep="@string/kp2aplugin_shortdesc">Fidelity adds an interface to manage fidelity cards and other barcodes to Keepass2Android</string> | ||||||
|     <string name="kp2aplugin_author" tools:keep="@string/kp2aplugin_author">[soraefir](soraefir)</string> |     <string name="kp2aplugin_author" tools:keep="@string/kp2aplugin_author">Soraefir</string> | ||||||
|  |  | ||||||
|     <string name="app_name">Keepass Fidelity</string> |     <string name="app_name">Keepass Fidelity</string> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +0,0 @@ | |||||||
| <resources> |  | ||||||
|  |  | ||||||
| </resources> |  | ||||||
| @@ -1,9 +1,12 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <resources> | <resources> | ||||||
|  |  | ||||||
|     <style name="Theme.Fidelity" parent="Theme.Material3.DayNight.NoActionBar"> |     <style name="Theme.Fidelity" parent="Theme.MaterialComponents.DayNight.NoActionBar"> | ||||||
|  |  | ||||||
|         <item name="colorPrimary">?attr/colorAccent</item> |  | ||||||
|  |  | ||||||
|  |         <item name="colorPrimary">#7DB9F5</item> | ||||||
|  |         <item name="colorPrimaryVariant">#7DB9F5</item> | ||||||
|  |         <item name="colorSecondary">#7DB9F5</item> | ||||||
|  |         <item name="colorSecondaryVariant">#7DB9F5</item> | ||||||
|  |         <item name="colorOnPrimary">#030B12</item> | ||||||
|     </style> |     </style> | ||||||
| </resources> | </resources> | ||||||
| @@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 | |||||||
| # Android operating system, and which are packaged with your app's APK | # Android operating system, and which are packaged with your app's APK | ||||||
| # https://developer.android.com/topic/libraries/support-library/androidx-rn | # https://developer.android.com/topic/libraries/support-library/androidx-rn | ||||||
| android.useAndroidX=true | android.useAndroidX=true | ||||||
| android.enableJetifier=true | android.enableJetifier=false | ||||||
| # Kotlin code style for this project: "official" or "obsolete": | # Kotlin code style for this project: "official" or "obsolete": | ||||||
| kotlin.code.style=official | kotlin.code.style=official | ||||||
| # Enables namespacing of each library's R class so that its R class includes only the | # Enables namespacing of each library's R class so that its R class includes only the | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user