mirror of
https://github.com/LightningMcK/schafkopfzaehler.git
synced 2026-10-02 07:55:57 +00:00
- Camera support for card recognition
- Added comments - Card capture layout
This commit is contained in:
@@ -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>
|
||||
@@ -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...
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user