- Camera support for card recognition

- Added comments
- Card capture layout
This commit is contained in:
Felix Kramer 2018-10-21 14:36:17 +02:00
parent a2455af788
commit e6602d3d4e
9 changed files with 63 additions and 5 deletions

Binary file not shown.

1
.idea/gradle.xml generated
View File

@ -9,6 +9,7 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/openCVLibrary343" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />

2
.idea/misc.xml generated
View File

@ -25,7 +25,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -19,11 +19,12 @@ android {
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
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(':openCVLibrary343')
}

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="project.schafkopfzaehler_2">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@ -24,12 +29,14 @@
android:name=".MainGameActivity"
android:label="@string/title_activity_main_game"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
android:theme="@style/AppTheme.NoActionBar"
/>
<activity
android:name=".ChooseGame"
android:label="@string/title_choose_game"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
></activity>
/>
</application>
</manifest>

View File

@ -2,6 +2,7 @@ package project.schafkopfzaehler_2;
import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
@ -16,6 +17,7 @@ public class MainGameActivity extends AppCompatActivity {
private Button p1, p2, p3, p4, chooseGame; // Button init
private TextView choice;
private String playerNames[] = {"", "", "", ""}; // Player names init
static final int REQUEST_VIDEO_CAPTURE = 1;
private View.OnClickListener startClickListener = new View.OnClickListener() {
@ -85,6 +87,11 @@ public class MainGameActivity extends AppCompatActivity {
private void playerButtonClicked (View v) {
Log.d("MainGame", v + " clicked...");
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
}
}
@ -102,6 +109,10 @@ public class MainGameActivity extends AppCompatActivity {
choice.setText(announcement);
}
}
if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK) {
// Do nothing...
}
}
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/woodentable">
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button_capture"
android:layout_alignParentTop="true">
</FrameLayout>
<Button
android:id="@+id/button_capture"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@android:color/holo_green_dark"
android:fontFamily="@font/germania_one"
android:text="@string/announcement"
android:textColor="@android:color/black"
android:textSize="24sp" />
<TextView
android:id="@+id/capture_log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_below="@+id/button_capture"
android:text="TextView" />
</RelativeLayout>

View File

@ -20,6 +20,7 @@
<string name="call">Was wurde gerufen?</string>
<string name="soloCall">Was war die Trumpffarbe?</string>
<string name="title_activity_main_game">ActivityMainGame</string>
<string name="title_choose_game">ChooseGame</string>
<string name="announcement">Neue Ansage</string>
<string name="announcementMade">Angesagt\:</string>
<string name="noChoice">Es wurde noch nichts angesagt...</string>

View File

@ -1 +1,2 @@
include ':app'
include ':openCVLibrary343'