Changeset 136014a in orbit for android/src/info
- Timestamp:
- 03/04/13 20:37:18 (9 years ago)
- Branches:
- master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
- Children:
- 5c11ea9
- Parents:
- 47806a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
android/src/info/puzzlebox/orbit/OrbitActivity.java
r47806a1 r136014a 33 33 import android.content.ServiceConnection; 34 34 import android.content.pm.ActivityInfo; 35 import android.content.res.Configuration; 35 36 import android.graphics.Color; 36 37 import android.graphics.drawable.ClipDrawable; 37 38 import android.graphics.drawable.ShapeDrawable; 38 39 import android.graphics.drawable.shapes.RoundRectShape; 40 import android.util.DisplayMetrics; 39 41 //import android.hardware.usb.UsbManager; 40 42 import android.util.Log; 43 import android.view.Display; 41 44 import android.view.Gravity; 42 45 import android.view.View; … … 67 70 * Configuration 68 71 */ 72 Configuration config; 69 73 int eegAttention = 0; 70 74 int eegMeditation = 0; … … 88 92 SeekBar seekBarYaw; 89 93 SeekBar seekBarPitch; 90 Button b; 94 Button connectButton; 95 Button testFlightButton; 96 Button stopTestButton; 91 97 CheckBox checkBoxAdvancedOptions; 92 98 CheckBox checkBoxGenerateAudio; … … 98 104 ImageView imageViewStatus; 99 105 TextView tv; 106 int viewSpaceGenerateAudioWidth = 120; 100 107 101 108 LinearLayout layoutControl; … … 209 216 super.onCreate(savedInstanceState); 210 217 211 // requestWindowFeature(Window.FEATURE_NO_TITLE); 218 config = getResources().getConfiguration(); 219 220 // Log.v(TAG, "screenLayout: " + config.screenLayout); 221 222 switch(config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK){ 223 case Configuration.SCREENLAYOUT_SIZE_SMALL: 224 // Log.v(TAG, "screenLayout: small"); 225 requestWindowFeature(Window.FEATURE_NO_TITLE); 226 break; 227 case Configuration.SCREENLAYOUT_SIZE_NORMAL: 228 // Log.v(TAG, "screenLayout: normal"); 229 requestWindowFeature(Window.FEATURE_NO_TITLE); 230 break; 231 case Configuration.SCREENLAYOUT_SIZE_LARGE: 232 // Log.v(TAG, "screenLayout: large"); 233 break; 234 case Configuration.SCREENLAYOUT_SIZE_XLARGE: 235 // Log.v(TAG, "screenLayout: xlarge"); 236 break; 237 case Configuration.SCREENLAYOUT_SIZE_UNDEFINED: 238 // Log.v(TAG, "screenLayout: undefined"); 239 requestWindowFeature(Window.FEATURE_NO_TITLE); 240 break; 241 } 212 242 213 243 setContentView(R.layout.activity_main); … … 300 330 */ 301 331 332 updateScreenLayout(); 302 333 updateAdvancedOptions(); 334 303 335 updatePowerThresholds(); 304 336 updatePower(); … … 493 525 // ################################################################ 494 526 527 public void updateScreenLayout() { 528 529 switch(config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK){ 530 case Configuration.SCREENLAYOUT_SIZE_SMALL: 531 Log.v(TAG, "screenLayout: small"); 532 updateScreenLayoutSmall(); 533 break; 534 case Configuration.SCREENLAYOUT_SIZE_NORMAL: 535 Log.v(TAG, "screenLayout: normal"); 536 updateScreenLayoutSmall(); 537 break; 538 case Configuration.SCREENLAYOUT_SIZE_LARGE: 539 Log.v(TAG, "screenLayout: large"); 540 break; 541 case Configuration.SCREENLAYOUT_SIZE_XLARGE: 542 Log.v(TAG, "screenLayout: xlarge"); 543 break; 544 case Configuration.SCREENLAYOUT_SIZE_UNDEFINED: 545 Log.v(TAG, "screenLayout: undefined"); 546 updateScreenLayoutSmall(); 547 break; 548 } 549 } // updateScreenLayout 550 551 552 // ################################################################ 553 554 public void updateScreenLayoutSmall() { 555 556 setButtonText(R.id.buttonTestFly, "Test"); 557 radioGroupChannel.setVisibility(View.GONE); 558 checkBoxAdvancedOptions.setText("Advanced"); 559 checkBoxGenerateAudio.setText("Generate Signal"); 560 checkBoxInvertControlSignal.setText("Invert Signal"); 561 // viewSpaceGenerateAudioWidth = LayoutParams.MATCH_PARENT; 562 563 int width = getWindowManager().getDefaultDisplay().getWidth(); 564 int height = getWindowManager().getDefaultDisplay().getHeight(); 565 566 viewSpaceGenerateAudioWidth = width / 4; // approximate center of screen 567 568 } // updateScreenLayoutSmall 569 570 571 // ################################################################ 572 495 573 public void onCheckBoxAdvancedOptionsClicked(View view) { 496 574 … … 539 617 layoutParams = viewSpaceGenerateAudio.getLayoutParams(); 540 618 // layoutParams.width = LayoutParams.MATCH_PARENT; 541 layoutParams.width = 120;619 layoutParams.width = viewSpaceGenerateAudioWidth; 542 620 viewSpaceGenerateAudio.setLayoutParams(layoutParams); 543 621 … … 566 644 */ 567 645 568 Button button = (Button) 646 Button button = (Button)findViewById(buttonId); 569 647 button.setText(text); 570 648 … … 853 931 tgDevice.close(); 854 932 } 855 933 856 934 eegConnecting = false; 857 935 eegConnected = false; 858 936 859 937 stopControl(); 860 938 … … 863 941 eegSignal = 0; 864 942 eegPower = 0; 865 943 866 944 updateStatusImage(); 867 945 868 946 progressBarAttention.setProgress(eegAttention); 869 947 progressBarMeditation.setProgress(eegMeditation);
Note: See TracChangeset
for help on using the changeset viewer.