Changeset de61e47 in orbit for android/src
- Timestamp:
- 12/25/13 16:38:53 (9 years ago)
- Branches:
- master, Servo
- Children:
- 005b954
- Parents:
- 7ec2d63
- Location:
- android/src/info/puzzlebox/orbit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
android/src/info/puzzlebox/orbit/FragmentTabFlightThinkGear.java
r3444b8e rde61e47 28 28 import android.widget.ProgressBar; 29 29 import android.widget.SeekBar; 30 import android.widget.TextView; 30 31 import android.widget.Toast; 31 32 … … 71 72 Number[] rawEEG = new Number[512]; 72 73 int arrayIndex = 0; 74 75 int minimumScoreTarget = 40; 76 int scoreCurrent = 0; 77 int scoreHigh = 0; 73 78 74 79 … … 86 91 Button testFlightButton; 87 92 Button stopTestButton; 93 TextView textViewScore; 94 TextView textViewHighScore; 88 95 89 96 ImageView imageViewStatus; … … 259 266 connectButton.setOnClickListener(this); 260 267 268 textViewScore = (TextView) v.findViewById(R.id.textViewScore); 269 textViewHighScore = (TextView) v.findViewById(R.id.textViewHighScore); 270 261 271 262 272 /** … … 266 276 bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 267 277 268 if (bluetoothAdapter == null) {278 if (bluetoothAdapter == null) { 269 279 // Alert user that Bluetooth is not available 270 280 Toast.makeText(((OrbitTabActivity)getActivity()), "Bluetooth not available", Toast.LENGTH_LONG).show(); … … 980 990 } // updateEEGRawHistory 981 991 992 // ################################################################ 993 994 public void updateScore() { 995 996 int eegAttentionScore = 0; 997 int eegAttention = progressBarAttention.getProgress(); 998 int eegAttentionTarget = seekBarAttention.getProgress(); 999 1000 int eegMeditationScore = 0; 1001 int eegMeditation = progressBarMeditation.getProgress(); 1002 int eegMeditationTarget = seekBarMeditation.getProgress(); 1003 1004 if ((eegAttention >= eegAttentionTarget) && 1005 (eegAttentionTarget > minimumScoreTarget)) 1006 eegAttentionScore = eegAttention; 1007 1008 if ((eegMeditation >= eegMeditationTarget) && 1009 (eegMeditationTarget > minimumScoreTarget)) 1010 eegMeditationScore = eegMeditation; 1011 1012 if (eegAttentionScore > eegMeditationScore) 1013 scoreCurrent = scoreCurrent + eegAttentionScore; 1014 else 1015 scoreCurrent = scoreCurrent + eegMeditationScore; 1016 1017 textViewScore.setText(Integer.toString(scoreCurrent)); 1018 1019 if (scoreCurrent > scoreHigh) { 1020 scoreHigh = scoreCurrent; 1021 textViewHighScore.setText(Integer.toString(scoreHigh)); 1022 } 1023 1024 } // updateScore 1025 1026 1027 // ################################################################ 1028 1029 public void resetCurrentScore() { 1030 1031 scoreCurrent = 0; 1032 textViewScore.setText(Integer.toString(scoreCurrent)); 1033 1034 } // resetCurrentScore 1035 982 1036 983 1037 } // FragmentTabFlightThinkGear -
android/src/info/puzzlebox/orbit/OrbitTabActivity.java
r8b32216 rde61e47 15 15 import java.util.ArrayList; 16 16 import java.util.List; 17 import java.util.Locale;18 17 19 18 import org.apache.http.HttpResponse; … … 780 779 } 781 780 781 updateScore(); 782 782 783 command = "hover"; 783 784 … … 786 787 /** Land the helicopter */ 787 788 stopControl(); 789 790 resetCurrentScore(); 788 791 789 792 command = "neutral"; … … 964 967 // ################################################################ 965 968 969 public void updateScore() { 970 971 FragmentTabFlightThinkGear fragmentFlight = 972 (FragmentTabFlightThinkGear) getSupportFragmentManager().findFragmentByTag( getTabFragmentFlightThinkGear() ); 973 974 if (fragmentFlight != null) 975 fragmentFlight.updateScore(); 976 977 } // updateScore 978 979 980 // ################################################################ 981 982 public void resetCurrentScore() { 983 984 FragmentTabFlightThinkGear fragmentFlight = 985 (FragmentTabFlightThinkGear) getSupportFragmentManager().findFragmentByTag( getTabFragmentFlightThinkGear() ); 986 987 if (fragmentFlight != null) 988 fragmentFlight.resetCurrentScore(); 989 990 } // resetCurrentScore 991 992 993 // ################################################################ 994 966 995 /** 967 996 * @param audioHandler the audioHandler to update command
Note: See TracChangeset
for help on using the changeset viewer.