Add in-app qr code scanner

This commit is contained in:
世界
2024-03-16 16:38:42 +08:00
parent df51284af0
commit 29e02d2696
15 changed files with 471 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:tint="#000000"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="@android:color/white"
android:pathData="M20,6h-8l-2,-2L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM19,14h-3v3h-2v-3h-3v-2h3L14,9h2v3h3v2z" />
</vector>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.camera.view.PreviewView
android:id="@+id/preview_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/view_appbar" />
</FrameLayout>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
style="@style/Widget.Material3.BottomSheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?selectableItemBackground"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/drag_handle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/scan_qr_code"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="?selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:layout_width="64dp"
android:padding="18dp"
app:tint="?colorControlNormal"
android:layout_height="match_parent"
android:src="@drawable/ic_qr_code_2_24" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:text="@string/profile_add_scan_qr_code"
android:gravity="center_vertical"
android:layout_height="match_parent">
</TextView>
</LinearLayout>
<LinearLayout
android:id="@+id/create_manually"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="?selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:layout_width="64dp"
android:padding="18dp"
app:tint="?colorControlNormal"
android:layout_height="match_parent"
android:src="@drawable/ic_baseline_create_new_folder_24" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:text="@string/profile_add_create_manually"
android:gravity="center_vertical"
android:layout_height="match_parent">
</TextView>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_disable_vendor_analyzer"
android:title="@string/disable_vendor_analyzer" />
</menu>

View File

@@ -41,6 +41,10 @@
<string name="profile_source_create_new">Create New</string>
<string name="profile_source_import">Import</string>
<string name="profile_add_scan_qr_code">Scan QR code</string>
<string name="profile_add_import_from_clipboard">Import remote profile from clipboard</string>
<string name="profile_add_create_manually">Create Manually</string>
<string name="menu_undo">Undo</string>
<string name="menu_redo">Redo</string>
<string name="menu_format">Format</string>
@@ -185,5 +189,6 @@
<string name="open_settings">Open Settings</string>
<string name="settings_title_core">Core</string>
<string name="disable_vendor_analyzer">Disable Google MLKit</string>
</resources>