-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
55 changed files
with
1,896 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
cs498teamassign5-master/AndroidStudioProjects/cs498teamassign5/app/build.gradle
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,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
defaultConfig { | ||
applicationId "com.example.cs498teamassign5" | ||
minSdkVersion 15 | ||
targetSdkVersion 26 | ||
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(include: ['*.jar'], dir: 'libs') | ||
implementation 'com.android.support:appcompat-v7:26.1.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
implementation 'com.android.support:design:26.1.0' | ||
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 'com.android.support:recyclerview-v7:26.1.0' | ||
} |
21 changes: 21 additions & 0 deletions
21
cs498teamassign5-master/AndroidStudioProjects/cs498teamassign5/app/proguard-rules.pro
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
...ssign5/app/src/androidTest/java/com/example/cs498teamassign5/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.cs498teamassign5; | ||
|
||
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() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.example.cs498teamassign5", appContext.getPackageName()); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...eamassign5-master/AndroidStudioProjects/cs498teamassign5/app/src/main/AndroidManifest.xml
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.cs498teamassign5"> | ||
|
||
<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"> | ||
<activity android:name=".MainActivity" /> | ||
<activity android:name=".SelectTeamActivity" /> | ||
<activity android:name=".SelectScoreActivity" /> | ||
<activity android:name=".PlayerStat" /> | ||
<activity android:name=".HomePageActivity"> | ||
MainActivity | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
103 changes: 103 additions & 0 deletions
103
...ioProjects/cs498teamassign5/app/src/main/java/com/example/cs498teamassign5/GameEvent.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,103 @@ | ||
package com.example.cs498teamassign5; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* this is the struct for game event | ||
* Point 1, 2, 3 | ||
* and different attributes for other event | ||
* WARNING: need to update parseStrForInfo if new info is added | ||
*/ | ||
|
||
enum Player | ||
{ | ||
MyPlayer, OpposingTeam, MyTeam | ||
} | ||
|
||
enum Stat | ||
{ | ||
rebound, foul, block, assist, illegal, turnover | ||
} | ||
|
||
enum Point | ||
{ | ||
onePoint, twoPoint, threePoint | ||
} | ||
|
||
public class GameEvent implements Serializable { | ||
int time; //Placeholder for actual time | ||
Player player; | ||
Stat stat; | ||
Boolean score = false; | ||
Boolean miss = false; | ||
Point point; | ||
public GameEvent(String str, int time){ | ||
this.time = time; | ||
parseStrForInfo(str); | ||
} | ||
|
||
/** | ||
* | ||
* @param str info generate during user interaction | ||
* format should be XXX:XXX:XXX:XXX: | ||
* e.g. "Team1:Player1:foul:" | ||
*/ | ||
private void parseStrForInfo(String str){ | ||
String [] arr = str.split(":"); | ||
for(String info : arr){ | ||
switch(info){ | ||
case "MyPlayer": | ||
this.player = Player.MyPlayer; | ||
break; | ||
case "MyTeam": | ||
this.player = Player.MyTeam; | ||
break; | ||
case "OpposingTeam": | ||
this.player = Player.OpposingTeam; | ||
break; | ||
case "Miss": | ||
this.miss = true; | ||
break; | ||
case "Score": | ||
this.score = true; | ||
break; | ||
case "1Point": | ||
this.point = Point.onePoint; | ||
break; | ||
case "2Point": | ||
this.point = Point.twoPoint; | ||
break; | ||
case "3Point": | ||
this.point = Point.threePoint; | ||
break; | ||
case "foul": | ||
this.stat = Stat.foul; | ||
break; | ||
case "block": | ||
this.stat = Stat.block; | ||
break; | ||
case "Rebound": | ||
this.stat = Stat.rebound; | ||
break; | ||
case "assist": | ||
this.stat = Stat.assist; | ||
break; | ||
case "Illegal": | ||
this.stat = Stat.illegal; | ||
break; | ||
case "Turnover": | ||
this.stat = Stat.turnover; | ||
break; | ||
default: | ||
} | ||
} | ||
} | ||
|
||
public Stat getStat(){ | ||
return this.stat; | ||
} | ||
|
||
public Player getPlayer(){ | ||
return this.player; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...dioProjects/cs498teamassign5/app/src/main/java/com/example/cs498teamassign5/GameInfo.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,42 @@ | ||
package com.example.cs498teamassign5; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.Calendar; | ||
|
||
/** | ||
* This is the structure for an entire game | ||
*/ | ||
public class GameInfo implements Serializable { | ||
ArrayList<QuarterlyGameLog> quarterlyGameLogs; | ||
Calendar calendar; | ||
public GameInfo(){ | ||
this.calendar = Calendar.getInstance(); | ||
this.quarterlyGameLogs = new ArrayList<>(); | ||
} | ||
|
||
public void set(int index, QuarterlyGameLog quarterlyGameLog){ | ||
if(index == quarterlyGameLogs.size()){ | ||
quarterlyGameLogs.add(quarterlyGameLog); | ||
} else { | ||
quarterlyGameLogs.set(index, quarterlyGameLog); | ||
} | ||
} | ||
|
||
public QuarterlyGameLog get(int index){ | ||
System.out.printf("QuarterlyGameLog get %d, size(): %d\n", index, quarterlyGameLogs.size()); | ||
if(quarterlyGameLogs.size() <= index){ | ||
System.out.printf("test test\n"); | ||
quarterlyGameLogs.add(new QuarterlyGameLog()); | ||
} | ||
return quarterlyGameLogs.get(index); | ||
} | ||
|
||
public int myPlayerScore(){ | ||
int score = 0; | ||
for(QuarterlyGameLog gamelog : quarterlyGameLogs){ | ||
score+= gamelog.myPlayerScore(); | ||
} | ||
return score; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...cts/cs498teamassign5/app/src/main/java/com/example/cs498teamassign5/HomePageActivity.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,35 @@ | ||
package com.example.cs498teamassign5; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class HomePageActivity extends Activity implements View.OnClickListener { | ||
private Button NewGameButton; | ||
private ArrayList<GameInfo> allGames; | ||
private static final int MAIN_ACTIVITY_REQUEST = 1; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_home_page); | ||
|
||
allGames = new ArrayList<>(); | ||
|
||
NewGameButton = (Button) findViewById(R.id.NewGameButton); | ||
NewGameButton.setOnClickListener(this); | ||
} | ||
|
||
public void onClick(View v){ | ||
if(v.getId() == R.id.NewGameButton) { | ||
Intent intent = new Intent(this, MainActivity.class); | ||
GameInfo gameInfo = new GameInfo(); | ||
intent.putExtra("gameInfo", gameInfo); | ||
startActivityForResult(intent, MAIN_ACTIVITY_REQUEST); | ||
} | ||
} | ||
} |
Oops, something went wrong.