Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Android/UI/SYCORowLayouts/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<activity
android:name=".LeaguesActivity"
android:label="Administrative Dashboard"
android:parentActivityName=".MainActivity"
android:launchMode="singleTop"
android:windowActionBar="false"></activity>
<activity
android:name=".LoginActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ public class LeaguesActivity extends AppCompatActivity implements AdapterView.On
private ArrayAdapter adapterSpinnerUsers;
private Spinner spinnerUsers;

@Override
public void onResume(){
super.onResume();
loadSpinners();
// onSpinnerSportsChange (selectChoiceBuilder(currentSport , "sport" , "sport_name"));
// onSpinnerLeaguesChange(selectChoiceBuilder(currentLeague, "league", "league_name"));
// onSpinnerTeamsChange (selectChoiceBuilder(currentTeam , "team" , "team_name"));
// onSpinnerUsersChange (selectChoiceBuilder(currentUser , "users" , "user_name"));
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -84,8 +94,11 @@ protected void onCreate(Bundle savedInstanceState) {
textViewLeaguesEmail.setText(email);
textViewLeaguesAdmin.setText(name + ", please choose a sport...");

loadSpinners();
}
/* Call the database and ask for the sports we have leagues for, insert into the first spinner
* through a series of arraylists and a hashmap */
public void loadSpinners(){

spinnerSports = (Spinner) findViewById(R.id.spinnerMyLeaguesSports);
hashMapSports = new HashMap<>();
Expand Down Expand Up @@ -209,6 +222,26 @@ private void unlockViews(){
}
}

// public String selectChoiceBuilder(int i, String table, String column){
// if(table.equals("users"))
// cursor = db.rawQuery("SELECT " + column + " FROM users WHERE user_id = " + i + ";", null);
// else if(table.equals("team"))
// cursor = db.rawQuery("SELECT " + column + " FROM team WHERE team_id = " + i + ";", null);
// else if(table.equals("league"))
// cursor = db.rawQuery("SELECT " + column + " FROM league WHERE league_id = " + i + ";", null);
// else
// cursor = db.rawQuery("SELECT " + column + " FROM sport WHERE sport_id = " + i + ";", null);
//
// if(cursor.moveToFirst()){
// do{
// return cursor.getString(cursor.getColumnIndexOrThrow(column));
// }while(cursor.moveToNext());
// }
//
// cursor.close();
// return null;
// }

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String choice = parent.getItemAtPosition(position).toString();
Expand Down Expand Up @@ -239,9 +272,6 @@ public void onItemSelected(AdapterView<?> parent, View view, int position, long
if(parent == spinnerUsers){
onSpinnerUsersChange(choice);
}



}

private void onSpinnerSportsChange(String choiceSportName){
Expand Down Expand Up @@ -421,7 +451,7 @@ public void goToEditPlayerFromLeagues(View view){
builder.setContentIntent(pendingIntent);

startActivity(intent);
db.close();

}

public void goToAddPlayerFromLeagues(View view){
Expand All @@ -439,7 +469,7 @@ public void goToAddPlayerFromLeagues(View view){
builder.setContentIntent(pendingIntent);

startActivity(intent);
db.close();

}

public void goToQuickAddTeams(View view){
Expand All @@ -448,8 +478,8 @@ public void goToQuickAddTeams(View view){
intent.putExtra( ADMIN_KEY, currentAdmin);
intent.putExtra(LEAGUE_KEY, currentLeague);
intent.putExtra( TEAM_KEY, currentTeam);
intent.putExtra( EMAIL_KEY, email);
intent.putExtra(EMAIL_KEY, email);
startActivity(intent);
db.close();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SQLiteDatabase db = helper.getWritableDatabase();
db.beginTransaction();
for(String q: DatabaseDummyLoader.boom){
db.execSQL(q);
}
// for(String q: DatabaseDummyLoader.boom){
// db.execSQL(q);
// }
db.setTransactionSuccessful();
db.endTransaction();
db.close();
Expand Down Expand Up @@ -84,7 +84,7 @@ public void sendToLeaguesActivity(String email){
intent.putExtra(NAME_KEY, name);
startActivity(intent);
cursor.close();
db.close();

}

public void sendToCoachHomeActivity(String email){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.text.SimpleDateFormat;
import java.util.Date;

import string.utils.ProperCase;

public class QuickAddPlayersActivity extends AppCompatActivity {

/* Set up private fields so that each method can call them. Getters and setters for another day... */
Expand Down Expand Up @@ -175,13 +177,13 @@ public void quickAddPlayer(View view){
* taking in strings from edittexts
*/
ContentValues insertValues = new ContentValues();
String first = et1.getText().toString();
String last = et2.getText().toString();
String childFirst = et3.getText().toString();
String childLast = et4.getText().toString();
String phone = et5.getText().toString();
String email = et6.getText().toString();
String emergency = et7.getText().toString();
String first = ProperCase.toProperCase(et1.getText().toString());
String last = ProperCase.toProperCase(et2.getText().toString());
String childFirst = ProperCase.toProperCase(et3.getText().toString());
String childLast = ProperCase.toProperCase(et4.getText().toString());
String phone = ProperCase.toProperCase(et5.getText().toString());
String email = ProperCase.toProperCase(et6.getText().toString());
String emergency = ProperCase.toProperCase(et7.getText().toString());

/**
* loading the contentvalues for insert into user
Expand All @@ -190,9 +192,9 @@ public void quickAddPlayer(View view){
insertValues.put("emergency", Long.parseLong(emergency));
insertValues.put("phone", Long.parseLong(phone));
insertValues.putNull("user_id");
insertValues.put("fname", first);
insertValues.put("lname", last);
insertValues.put("email", email);
insertValues.put("fname", ProperCase.toProperCase(first));
insertValues.put("lname", ProperCase.toProperCase(last));
insertValues.put("email", ProperCase.toProperCase(email));
insertValues.put("user_type", "USER");
insertValues.put("pass", "PASS");
dbw.insert("users", null, insertValues);
Expand Down Expand Up @@ -231,8 +233,8 @@ public void quickAddPlayer(View view){
*/
ContentValues playerValues = new ContentValues();
playerValues.putNull("player_id");
playerValues.put("fname", childFirst);
playerValues.put("lname", childLast);
playerValues.put("fname", ProperCase.toProperCase(childFirst));
playerValues.put("lname", ProperCase.toProperCase(childLast));
playerValues.put("user_id", userId);

dbw.insert("player", null, playerValues);
Expand Down Expand Up @@ -305,7 +307,7 @@ public void quickAddPlayer(View view){
TextView textViewSuccess = (TextView) findViewById(R.id.textViewSuccessfulInsert);
textViewSuccess.setText(successfulEID + " " + successfulUID + " " + successfulPID);

dbw.close();


/**
* All Exceptions are caught and displayed here, with a toast, and inside of the catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ protected void onCreate(Bundle savedInstanceState) {
db = helper.getWritableDatabase();

Intent intent = getIntent();
email = intent.getStringExtra(EMAIL_KEY);
adminId = Integer.parseInt(intent.getStringExtra(ADMIN_KEY));
currentLeague = Integer.parseInt(intent.getStringExtra(LEAGUE_KEY));
team = Integer.parseInt(intent.getStringExtra(TEAM_KEY));
name = intent.getStringExtra(NAME_KEY);
email = intent.getStringExtra(EMAIL_KEY );
adminId = intent.getIntExtra (ADMIN_KEY , 0);
currentLeague = intent.getIntExtra (LEAGUE_KEY, 0);
team = intent.getIntExtra (TEAM_KEY , 0);
name = intent.getStringExtra(NAME_KEY );

Cursor cursor = db.rawQuery(
"SELECT e.user_id, u.fname, u.lname " +
"SELECT e.user_id, u.fname, u.lname " +
" FROM enrollment e, users u " +
" WHERE e.user_id = u.user_id " +
" AND u.user_type = 'COACH' " +
Expand Down Expand Up @@ -103,6 +103,7 @@ public void createTeam(View view){
cv.put("league_id", currentLeague);
cv.put("null", "none");
cv.put("user_id", currentCoach);

db.insert("team", null, cv);
//insert into TEAM table

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="New Team Name: [The...]"
android:id="@+id/textView4"
android:textAlignment="center"
Expand Down Expand Up @@ -52,7 +52,7 @@

<TextView
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_height="45dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="You Must Assign A Coach When Creating a Team. Please choose from the Coach Roster Below..."
android:id="@+id/textView5"
Expand All @@ -66,7 +66,7 @@
android:layout_height="match_parent">

<Spinner
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/spinnerCoachesQuickAddTeams"
android:layout_weight="1"
Expand All @@ -85,5 +85,148 @@
android:onClick="createTeam"/>
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Add a Coach Here"
android:id="@+id/textViewAddCoach"
android:layout_weight="1"
android:textAlignment="center" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Contact Name"
android:id="@+id/textView10" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editTextCoachFirst"
android:hint="First"
android:layout_weight="1" />

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editTextCoachLast"
android:hint="Last"
android:layout_weight="1" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Contact Phone"
android:id="@+id/textView11"
android:layout_weight="1" />

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Emergency Phone"
android:id="@+id/textView12"
android:layout_weight="1" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editTextCoachPhone"
android:hint="(666)999-YETI"
android:layout_weight="1"
android:numeric="integer" />

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editTextEmergency"
android:layout_weight="1"
android:hint="(919)555-0666"
android:numeric="integer" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Email Address"
android:id="@+id/textView13"
android:layout_weight="1" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editTextCoachEmail"
android:hint="bark@theyeti.edu"
android:layout_weight="1" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="ADD COACH"
android:id="@+id/buttonAddCoach"
android:layout_weight="1"
android:onClick="quickAddCoach" />

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="CLEAR"
android:id="@+id/buttonClearCoach"
android:layout_weight="1"
android:onClick="clearFormCoach" />
</TableRow>

</TableLayout>
</RelativeLayout>