詹子聪 5 lat temu
rodzic
commit
cee84b7589

+ 1 - 0
app/src/main/java/com/miekir/ocr/ui/OperationActivity.java

@@ -19,6 +19,7 @@ import com.miekir.ocr.R;
 import com.miekir.ocr.bean.OcrResult;
 import com.miekir.ocr.tool.AnimateManager;
 import com.miekir.ocr.tool.SystemTool;
+import com.miekir.ocr.ui.camera.CameraActivity;
 import com.miekir.ocr.widget.CropView;
 import com.miekir.ocr.widget.GlideV4ImageEngine;
 import com.miekir.ocr.widget.IndicatorText;

+ 1 - 1
app/src/main/java/com/miekir/ocr/ui/CameraActivity.java

@@ -1,4 +1,4 @@
-package com.miekir.ocr.ui;
+package com.miekir.ocr.ui.camera;
 
 import android.Manifest;
 import android.annotation.SuppressLint;

Plik diff jest za duży
+ 1034 - 0
app/src/main/java/com/miekir/ocr/ui/camera/google/Camera2BasicFragment.java


+ 38 - 0
app/src/main/java/com/miekir/ocr/ui/camera/google/GoogleCameraActivity.java

@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.miekir.ocr.ui.camera.google;
+
+import android.os.Bundle;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.miekir.ocr.R;
+
+public class GoogleCameraActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_google_camera);
+        if (null == savedInstanceState) {
+            getSupportFragmentManager().beginTransaction()
+                    .replace(R.id.container, Camera2BasicFragment.newInstance())
+                    .commit();
+        }
+    }
+
+}

+ 22 - 0
app/src/main/res/layout/activity_google_camera.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/container"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#000"
+    tools:context="com.example.android.camera2basic.CameraActivity" />

+ 44 - 0
app/src/main/res/layout/fragment_camera2_basic.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <com.example.android.camera2basic.AutoFitTextureView
+        android:id="@+id/texture"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentTop="true" />
+
+    <FrameLayout
+        android:id="@+id/control"
+        android:layout_width="match_parent"
+        android:layout_height="112dp"
+        android:layout_alignParentBottom="true"
+        android:layout_alignParentStart="true">
+
+        <Button
+            android:id="@+id/picture"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="Capture" />
+
+
+    </FrameLayout>
+
+</RelativeLayout>