Skip to content

Commit

Permalink
Spring Cleaning! Removal of deprecated files/lines/comments/debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoov committed Dec 2, 2016
1 parent 0ed2a3e commit ddecdf9
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 346 deletions.
1 change: 0 additions & 1 deletion heroku/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
android:label="Main Baseballsim Display" />
<activity android:name=".MainTabbedActivity" />
<activity android:name=".CreateUserActivity"/>
<activity android:name=".CreateNewGameActivity"/>
<activity android:name=".GameEventsActivity">
</activity>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void onActivityCreated(Bundle savedInstanceState) {
apiToken = sPref.getString("apiToken", null);
int userID = sPref.getInt("currentUser", -1);

// new ApprovalOperation().execute(Endpoints.userApprovalsAPI(userID));
new ApprovalOperation().execute(Endpoints.approvalAPI);
}

Expand Down Expand Up @@ -90,7 +89,6 @@ protected void onPostExecute(Void unused) {
JSONArray approvalArray = jObj.getJSONArray("approvals");
for (int i = 0; i < approvalArray.length(); ++i) {
JSONObject item = approvalArray.getJSONObject(i);
// System.out.println("IN APPROVAL FRAGMENT: " + item.toString());
approvalItems.add(new Approval(
item.getInt("id"),
item.getString("approved"),
Expand Down
143 changes: 0 additions & 143 deletions heroku/src/main/java/kylemeyers22/heroku/CreateNewGameActivity.java

This file was deleted.

53 changes: 2 additions & 51 deletions heroku/src/main/java/kylemeyers22/heroku/FieldActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
import java.util.HashMap;
import java.util.Map;

import kylemeyers22.heroku.utils.Endpoints;
import kylemeyers22.heroku.utils.HttpUtils;

/**
* Created by shdw2 on 10/9/2016.
*/
public class FieldActivity extends AppCompatActivity {
private ListView fieldListView;

Expand All @@ -49,28 +47,17 @@ protected void onCreate(Bundle savedInstanceState) {
getFieldButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

//webserver request url
String serverUrl = "https://baseballsim.herokuapp.com/api/fields";

//use AsyncTask execute method to prevent ANR problem
new FieldActivity.LongOperation().execute(serverUrl);
new FieldActivity.LongOperation().execute(Endpoints.fieldsAPI);
}
});
}

private class LongOperation extends AsyncTask<String, Void, Void> {

private String Content;
private String Error = null;
private ProgressDialog Dialog = new ProgressDialog(FieldActivity.this);
private ArrayAdapter<String> listAdapter;

String data = "";
// TextView uiUpdate = (TextView) findViewById(R.id.playerFirstName);
// TextView jsonParsed = (TextView) findViewById(R.id.playerLastName);
// TextView serverText = (TextView) findViewById(R.id.serverText);

// Obtain API Authentication Token from LoginActivity's shared preferences
SharedPreferences sPref = getSharedPreferences("LoginActivity", MODE_PRIVATE);
final String apiToken = sPref.getString("apiToken", null);
Expand All @@ -79,13 +66,6 @@ protected void onPreExecute() {
//start progress dialog message
Dialog.setMessage("Please Wait...");
Dialog.show();

// try {
// //set request parameter
// data += "&" + URLEncoder.encode("data", "UTF-8") + "=" + serverText.getText();
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
}

protected Void doInBackground(String... urls) {
Expand All @@ -101,42 +81,15 @@ protected Void doInBackground(String... urls) {
}

protected void onPostExecute(Void unused) {
//close progress dialog
Dialog.dismiss();
//Intent intent = new Intent(PlayerFragment.this, FieldActivity.class);
// startActivity(intent);
//finish();
//
// if (Error != null) {
// uiUpdate.setText("Output : " + Error);
// } else {
// uiUpdate.setText(Content);

//Receive JSON response
String OutputData;

System.out.println("#---- IN onPostExecute ----#");
System.out.println(Content);

ArrayList<String> fieldList = new ArrayList<>();

try {
JSONObject jObj = new JSONObject(Content);
System.out.println("##########");
// System.out.println(jObj.getJSONArray("users").getJSONObject(0).getString("firstname"));

// OutputData = "Output captured: " + jObj.getJSONArray("users").getJSONObject(0).getString("firstname");

OutputData = jObj.toString();
//show output on screen
//jsonParsed.setText(OutputData);
//System.out.println(OutputData);
JSONArray fieldsArray = jObj.getJSONArray("fields");
for (int i = 0; i < fieldsArray.length(); ++i) {
JSONObject item = fieldsArray.getJSONObject(i);
// System.out.println("PLAYER_FIRST: " + item.getString("firstname"));
// System.out.println("PLAYER_LAST: " + item.getString("lastname"));
// System.out.println("----------");
fieldList.add(item.getString("name"));
}
} catch (JSONException e) {
Expand All @@ -146,8 +99,6 @@ protected void onPostExecute(Void unused) {
System.out.println(fieldList.size());
listAdapter = new ArrayAdapter<>(FieldActivity.this, R.layout.listrow, fieldList);
fieldListView.setAdapter(listAdapter);

// }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.support.v7.app.AppCompatActivity;

import kylemeyers22.heroku.utils.Endpoints;
import kylemeyers22.heroku.utils.TeamVariables;

public class GameEventsActivity extends AppCompatActivity{

Expand All @@ -22,7 +21,6 @@ protected void onCreate(Bundle savedInstanceState)
{
System.out.println("Creating events for the game");
super.onCreate(savedInstanceState);
setContentView(R.layout.create_game);


// teamOneId = TeamVariables.getTeamOneId();
Expand Down
4 changes: 2 additions & 2 deletions heroku/src/main/java/kylemeyers22/heroku/GameFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ private void createStartGameForm() {
public void onClick(View v) {
Team teamOne = (Team) teamOneSpin.getSelectedItem();
Team teamTwo = (Team) teamTwoSpin.getSelectedItem();
System.out.println("Team 1: " + teamOne.toString() + " | " + teamOne.getTeamID());
System.out.println("Team 2: " + teamTwo.toString() + " | " + teamTwo.getTeamID());
// System.out.println("Team 1: " + teamOne.toString() + " | " + teamOne.getTeamID());
// System.out.println("Team 2: " + teamTwo.toString() + " | " + teamTwo.getTeamID());

new StartGameTask().execute(teamOne.getTeamID(), teamTwo.getTeamID());
startGame.dismiss();
Expand Down
Loading

0 comments on commit ddecdf9

Please sign in to comment.