-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ba4be5
Showing
212 changed files
with
41,689 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches/build_file_checksums.ser | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId "com.example.user.tesseracttess_twoocr" | ||
minSdkVersion 19 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
|
||
implementation 'com.rmtheis:tess-two:9.0.0' | ||
|
||
implementation 'com.otaliastudios:cameraview:1.6.0' | ||
implementation 'com.android.support:exifinterface:27.1.1' | ||
|
||
implementation 'com.android.support:appcompat-v7:27.1.1' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
implementation project(path: ':openCVLibrary342') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
...p/src/androidTest/java/com/example/user/tesseracttess_twoocr/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.user.tesseracttess_twoocr; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.example.user.tesseracttess_twoocr", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.example.user.tesseracttess_twoocr"> | ||
|
||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.CAMERA" android:required="true"/> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO" android:required="true"/> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
|
||
<activity android:name=".Camera2API.Camera2Activity" | ||
android:screenOrientation="portrait"/> | ||
|
||
|
||
</application> | ||
|
||
</manifest> |
Binary file not shown.
97 changes: 97 additions & 0 deletions
97
...pp/src/main/java/com/example/user/tesseracttess_twoocr/Camera2API/AutoFitTextureView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.example.user.tesseracttess_twoocr.Camera2API; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.TextureView; | ||
|
||
/** | ||
* A {@link TextureView} that can be adjusted to a specified aspect ratio. | ||
*/ | ||
public class AutoFitTextureView extends TextureView { | ||
|
||
private int mRatioWidth = 0; | ||
private int mRatioHeight = 0; | ||
|
||
public AutoFitTextureView(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public AutoFitTextureView(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
/** | ||
* Sets the aspect ratio for this view. The size of the view will be measured based on the ratio | ||
* calculated from the parameters. Note that the actual sizes of parameters don't matter, that | ||
* is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result. | ||
* | ||
* @param width Relative horizontal size | ||
* @param height Relative vertical size | ||
*/ | ||
public void setAspectRatio(int width, int height) { | ||
if (width < 0 || height < 0) { | ||
throw new IllegalArgumentException("Size cannot be negative."); | ||
} | ||
mRatioWidth = width; | ||
mRatioHeight = height; | ||
requestLayout(); | ||
} | ||
|
||
// @Override | ||
// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
// super.onMeasure(widthMeasureSpec, heightMeasureSpec); | ||
// int width = MeasureSpec.getSize(widthMeasureSpec); | ||
// int height = MeasureSpec.getSize(heightMeasureSpec); | ||
// if (0 == mRatioWidth || 0 == mRatioHeight) { | ||
// setMeasuredDimension(width, height); | ||
// } else { | ||
// if (width < height * mRatioWidth / mRatioHeight) { | ||
// setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); | ||
// } else { | ||
// setMeasuredDimension(height * mRatioWidth / mRatioHeight, height); | ||
// } | ||
// } | ||
// } | ||
|
||
//full screen preview | ||
@Override | ||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | ||
int width = MeasureSpec.getSize(widthMeasureSpec); | ||
int height = MeasureSpec.getSize(heightMeasureSpec); | ||
if (0 == mRatioWidth || 0 == mRatioHeight) { | ||
setMeasuredDimension(width, height); | ||
} else { | ||
if (width < height * mRatioWidth / mRatioHeight) { | ||
// setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); | ||
setMeasuredDimension(height * mRatioWidth / mRatioHeight, height); | ||
} else { | ||
//setMeasuredDimension(height * mRatioWidth / mRatioHeight, height); | ||
setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
} |
86 changes: 86 additions & 0 deletions
86
...R/app/src/main/java/com/example/user/tesseracttess_twoocr/Camera2API/Camera2Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.example.user.tesseracttess_twoocr.Camera2API; | ||
|
||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.support.annotation.RequiresApi; | ||
import android.support.v7.app.ActionBar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import android.view.WindowManager; | ||
|
||
import com.example.user.tesseracttess_twoocr.R; | ||
public class Camera2Activity extends AppCompatActivity { | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_camera2api); | ||
|
||
//Hide the status bar | ||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
|
||
//Hide the ActionBar | ||
ActionBar actionBar = getSupportActionBar(); | ||
actionBar.hide(); | ||
|
||
|
||
if (null == savedInstanceState) { | ||
getSupportFragmentManager().beginTransaction().replace(R.id.container, Camera2BasicFragment.newInstance()).commit(); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
Log.d("debug","onStart()"); | ||
} | ||
|
||
|
||
@Override | ||
protected void onRestart() { | ||
super.onRestart(); | ||
Log.d("debug","onRestart()"); | ||
|
||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
Log.d("debug","onResume()"); | ||
} | ||
|
||
|
||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
Log.d("debug","onPause()"); | ||
|
||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
super.onStop(); | ||
Log.d("debug","onStop()"); | ||
|
||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
Log.d("debug","onDestroy()"); | ||
} | ||
|
||
|
||
|
||
@Override | ||
public void onBackPressed() { // on Back_Key | ||
|
||
finish(); | ||
} | ||
|
||
} |
Oops, something went wrong.