From fa03f894c30531ab1a5f1a1097b726ae8c7efa2d Mon Sep 17 00:00:00 2001 From: H Malik Date: Mon, 5 Jun 2017 17:19:28 +0100 Subject: [PATCH] Initial commit --- .gitignore | 9 + .idea/compiler.xml | 22 +++ .idea/copyright/profiles_settings.xml | 3 + .idea/gradle.xml | 18 ++ .idea/misc.xml | 9 + .idea/modules.xml | 9 + .idea/runConfigurations.xml | 12 ++ app/.gitignore | 1 + app/build.gradle | 29 +++ app/proguard-rules.pro | 17 ++ .../courtcounter/ExampleInstrumentedTest.java | 26 +++ app/src/main/AndroidManifest.xml | 20 ++ .../h_mal/courtcounter/MainActivity.java | 145 ++++++++++++++ app/src/main/res/layout/activity_main.xml | 182 ++++++++++++++++++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes app/src/main/res/values-w820dp/dimens.xml | 6 + app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/dimens.xml | 5 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 9 + .../h_mal/courtcounter/ExampleUnitTest.java | 17 ++ build.gradle | 23 +++ gradle.properties | 17 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 160 +++++++++++++++ gradlew.bat | 90 +++++++++ settings.gradle | 1 + 32 files changed, 845 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/h_mal/courtcounter/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/example/h_mal/courtcounter/MainActivity.java create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/values-w820dp/dimens.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/test/java/com/example/h_mal/courtcounter/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1d6606a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8892318 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..6c12510 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 24 + buildToolsVersion "25.0.0" + defaultConfig { + applicationId "com.example.h_mal.courtcounter" + minSdkVersion 15 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:24.2.1' + testCompile 'junit:junit:4.12' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..05e856b --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\h_mal\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# 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 *; +#} diff --git a/app/src/androidTest/java/com/example/h_mal/courtcounter/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/h_mal/courtcounter/ExampleInstrumentedTest.java new file mode 100644 index 0000000..b4cede9 --- /dev/null +++ b/app/src/androidTest/java/com/example/h_mal/courtcounter/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.h_mal.courtcounter; + +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.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.h_mal.courtcounter", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..fee1cf2 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/h_mal/courtcounter/MainActivity.java b/app/src/main/java/com/example/h_mal/courtcounter/MainActivity.java new file mode 100644 index 0000000..948be59 --- /dev/null +++ b/app/src/main/java/com/example/h_mal/courtcounter/MainActivity.java @@ -0,0 +1,145 @@ +package com.example.h_mal.courtcounter; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.TextView; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + /** + * code for team A side + */ + int goalsTeamA = 0; + + /** + * Displays the given goals for Team A. + */ + public void goalsForTeamA(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_a_goals); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add goals for team A. + */ + public void addGoalA(View v) { + goalsTeamA = goalsTeamA + 1; + goalsForTeamA(goalsTeamA); + } + + int redTeamA = 0; + + /** + * Displays the given red cards for Team A. + */ + public void redForTeamA(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_a_red); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add red card for team A. + */ + public void redCardA(View v) { + redTeamA = redTeamA + 1; + redForTeamA(redTeamA); + } + + int yellowTeamA = 0; + + /** + * Displays the given yellow cards for Team A. + */ + public void yellowForTeamA(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_a_yellow); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add yellow card for team A. + */ + public void yellowCardA(View v) { + yellowTeamA = yellowTeamA + 1; + yellowForTeamA(yellowTeamA); + } + + /** + * code for team B side + */ + int goalsTeamB = 0; + + /** + * Displays the given goals for Team B. + */ + public void goalsForTeamB(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_b_goals); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add goals for team B. + */ + public void addGoalB(View v) { + goalsTeamB = goalsTeamB + 1; + goalsForTeamB(goalsTeamB); + } + + int redTeamB = 0; + + /** + * Displays the given red cards for Team B. + */ + public void redForTeamB(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_b_red); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add red card for team B. + */ + public void redCardB(View v) { + redTeamB = redTeamB + 1; + redForTeamB(redTeamB); + } + + int yellowTeamB = 0; + + /** + * Displays the given yellow cards for Team A. + */ + public void yellowForTeamB(int score) { + TextView scoreView = (TextView) findViewById(R.id.team_b_yellow); + scoreView.setText(String.valueOf(score)); + } + + /** + * Add yellow card for team B. + */ + public void yellowCardB(View v) { + yellowTeamB = yellowTeamB + 1; + yellowForTeamB(yellowTeamB); + } + + public void reset(View v) { + goalsTeamA = 0; + goalsForTeamA(goalsTeamA); + redTeamA = 0; + redForTeamA(redTeamA); + yellowTeamA = 0; + yellowForTeamA(yellowTeamA); + goalsTeamB = 0; + goalsForTeamB(goalsTeamB); + redTeamB = 0; + redForTeamB(redTeamB); + yellowTeamB = 0; + yellowForTeamB(yellowTeamB); + } + +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..d3530a2 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + +