List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_DONE
int IME_ACTION_DONE
To view the source code for android.view.inputmethod EditorInfo IME_ACTION_DONE.
Click Source Link
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java
private Drawable getIconForKeyCode(int keyCode) { Drawable icon = mKeysIcons.get(keyCode); if (icon == null) { // building needed icon Log.d(TAG, "Building icon for key-code %d", keyCode); DrawableBuilder builder = mKeysIconBuilders.get(keyCode); if (builder == null) return null; icon = builder.buildDrawable();/*from w ww.j a v a 2s . co m*/ mKeysIcons.put(keyCode, icon); Log.d(TAG, "Current drawable cache size is %d", mKeysIcons.size()); } // maybe a drawable state is required if (icon != null) { switch (keyCode) { case KeyCodes.ENTER: Log.d(TAG, "Action key action ID is %d", mKeyboardActionType); switch (mKeyboardActionType) { case EditorInfo.IME_ACTION_DONE: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_DONE); break; case EditorInfo.IME_ACTION_GO: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_GO); break; case EditorInfo.IME_ACTION_SEARCH: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_SEARCH); break; case EditorInfo.IME_ACTION_NONE: case EditorInfo.IME_ACTION_UNSPECIFIED: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_NORMAL); break; } break; case KeyCodes.SHIFT: if (mKeyboard.isShiftLocked()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_LOCKED); else if (mKeyboard.isShifted()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_PRESSED); else icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_NORMAL); break; case KeyCodes.CTRL: if (mKeyboard.isControl()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_PRESSED); else icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_NORMAL); break; } } return icon; }
From source file:org.telegram.ui.PassportActivity.java
private void createEmailVerificationInterface(Context context) { actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail)); inputFields = new EditTextBoldCursor[1]; for (int a = 0; a < 1; a++) { ViewGroup container = new FrameLayout(context); linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); inputFields[a] = new EditTextBoldCursor(context); inputFields[a].setTag(a);/* ww w .j av a 2s . c o m*/ inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText)); inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setBackgroundDrawable(null); inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setCursorSize(AndroidUtilities.dp(20)); inputFields[a].setCursorWidth(1.5f); inputFields[a].setInputType(InputType.TYPE_CLASS_PHONE); inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); switch (a) { case FIELD_EMAIL: inputFields[a].setHint(LocaleController.getString("PassportEmailCode", R.string.PassportEmailCode)); break; } inputFields[a].setSelection(inputFields[a].length()); inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6)); inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6)); inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) { doneItem.callOnClick(); return true; } return false; }); inputFields[a].addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (ignoreOnTextChange) { return; } if (emailCodeLength != 0 && inputFields[FIELD_EMAIL].length() == emailCodeLength) { doneItem.callOnClick(); } } }); } bottomCell = new TextInfoPrivacyCell(context); bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, currentValues.get("email"))); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); }
From source file:org.telegram.ui.PassportActivity.java
private void createPasswordInterface(Context context) { TLRPC.User botUser = null;// ww w . j av a2 s . c om if (currentForm != null) { for (int a = 0; a < currentForm.users.size(); a++) { TLRPC.User user = currentForm.users.get(a); if (user.id == currentBotId) { botUser = user; break; } } } else { botUser = UserConfig.getInstance(currentAccount).getCurrentUser(); } FrameLayout frameLayout = (FrameLayout) fragmentView; actionBar.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport)); emptyView = new EmptyTextProgressView(context); emptyView.showProgress(); frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); passwordAvatarContainer = new FrameLayout(context); linearLayout2.addView(passwordAvatarContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 100)); BackupImageView avatarImageView = new BackupImageView(context); avatarImageView.setRoundRadius(AndroidUtilities.dp(32)); passwordAvatarContainer.addView(avatarImageView, LayoutHelper.createFrame(64, 64, Gravity.CENTER, 0, 8, 0, 0)); AvatarDrawable avatarDrawable = new AvatarDrawable(botUser); TLRPC.FileLocation photo = null; if (botUser.photo != null) { photo = botUser.photo.photo_small; } avatarImageView.setImage(photo, "50_50", avatarDrawable, botUser); passwordRequestTextView = new TextInfoPrivacyCell(context); passwordRequestTextView.getTextView().setGravity(Gravity.CENTER_HORIZONTAL); if (currentBotId == 0) { passwordRequestTextView .setText(LocaleController.getString("PassportSelfRequest", R.string.PassportSelfRequest)); } else { passwordRequestTextView.setText(AndroidUtilities.replaceTags(LocaleController .formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(botUser)))); } ((FrameLayout.LayoutParams) passwordRequestTextView.getTextView() .getLayoutParams()).gravity = Gravity.CENTER_HORIZONTAL; linearLayout2.addView(passwordRequestTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0)); noPasswordImageView = new ImageView(context); noPasswordImageView.setImageResource(R.drawable.no_password); noPasswordImageView.setColorFilter(new PorterDuffColorFilter( Theme.getColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY)); linearLayout2.addView(noPasswordImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 13, 0, 0)); noPasswordTextView = new TextView(context); noPasswordTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); noPasswordTextView.setGravity(Gravity.CENTER_HORIZONTAL); noPasswordTextView.setPadding(AndroidUtilities.dp(21), AndroidUtilities.dp(10), AndroidUtilities.dp(21), AndroidUtilities.dp(17)); noPasswordTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4)); noPasswordTextView.setText(LocaleController.getString("TelegramPassportCreatePasswordInfo", R.string.TelegramPassportCreatePasswordInfo)); linearLayout2.addView(noPasswordTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 10, 21, 0)); noPasswordSetTextView = new TextView(context); noPasswordSetTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText5)); noPasswordSetTextView.setGravity(Gravity.CENTER); noPasswordSetTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); noPasswordSetTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); noPasswordSetTextView.setText(LocaleController.getString("TelegramPassportCreatePassword", R.string.TelegramPassportCreatePassword)); linearLayout2.addView(noPasswordSetTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 24, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 9, 21, 0)); noPasswordSetTextView.setOnClickListener(v -> { TwoStepVerificationActivity activity = new TwoStepVerificationActivity(currentAccount, 1); activity.setCloseAfterSet(true); activity.setCurrentPasswordInfo(new byte[0], currentPassword); presentFragment(activity); }); inputFields = new EditTextBoldCursor[1]; inputFieldContainers = new ViewGroup[1]; for (int a = 0; a < 1; a++) { inputFieldContainers[a] = new FrameLayout(context); linearLayout2.addView(inputFieldContainers[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); inputFieldContainers[a].setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); inputFields[a] = new EditTextBoldCursor(context); inputFields[a].setTag(a); inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText)); inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setBackgroundDrawable(null); inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setCursorSize(AndroidUtilities.dp(20)); inputFields[a].setCursorWidth(1.5f); inputFields[a].setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); inputFields[a].setMaxLines(1); inputFields[a].setLines(1); inputFields[a].setSingleLine(true); inputFields[a].setTransformationMethod(PasswordTransformationMethod.getInstance()); inputFields[a].setTypeface(Typeface.DEFAULT); inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6)); inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); inputFieldContainers[a].addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6)); inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_NEXT || i == EditorInfo.IME_ACTION_DONE) { doneItem.callOnClick(); return true; } return false; }); inputFields[a].setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public void onDestroyActionMode(ActionMode mode) { } public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } }); } passwordInfoRequestTextView = new TextInfoPrivacyCell(context); passwordInfoRequestTextView.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); passwordInfoRequestTextView.setText( LocaleController.formatString("PassportRequestPasswordInfo", R.string.PassportRequestPasswordInfo)); linearLayout2.addView(passwordInfoRequestTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); passwordForgotButton = new TextView(context); passwordForgotButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); passwordForgotButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); passwordForgotButton.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword)); passwordForgotButton.setPadding(0, 0, 0, 0); linearLayout2.addView(passwordForgotButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 30, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0)); passwordForgotButton.setOnClickListener(v -> { if (currentPassword.has_recovery) { needShowProgress(); TLRPC.TL_auth_requestPasswordRecovery req = new TLRPC.TL_auth_requestPasswordRecovery(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(); if (error == null) { final TLRPC.TL_auth_passwordRecovery res = (TLRPC.TL_auth_passwordRecovery) response; AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, res.email_pattern)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> { TwoStepVerificationActivity fragment = new TwoStepVerificationActivity( currentAccount, 1); fragment.setRecoveryParams(currentPassword); currentPassword.email_unconfirmed_pattern = res.email_pattern; presentFragment(fragment); }); Dialog dialog = showDialog(builder.create()); if (dialog != null) { dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); } } else { if (error.text.startsWith("FLOOD_WAIT")) { int time = Utilities.parseInt(error.text); String timeString; if (time < 60) { timeString = LocaleController.formatPluralString("Seconds", time); } else { timeString = LocaleController.formatPluralString("Minutes", time / 60); } showAlertWithText(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); } else { showAlertWithText(LocaleController.getString("AppName", R.string.AppName), error.text); } } }), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin); ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid); } else { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); builder.setNegativeButton( LocaleController.getString("RestorePasswordResetAccount", R.string.RestorePasswordResetAccount), (dialog, which) -> Browser.openUrl(getParentActivity(), "https://telegram.org/deactivate?phone=" + UserConfig.getInstance(currentAccount).getClientPhone())); builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle)); builder.setMessage(LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText)); showDialog(builder.create()); } }); updatePasswordInterface(); }
From source file:com.androidaq.AndroiDAQAdapter.java
@Override public Object instantiateItem(View collection, int position) { //Log.e("Test", "instantiateItem"); v = new View(collection.getContext()); LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0:/*from ww w . j a v a 2s. co m*/ resId = R.layout.setup; v = inflater.inflate(resId, null, false); //setupSV = (ObservableScrollView) v.findViewById(R.id.setupSV); setupSV = (ScrollView) v.findViewById(R.id.setupSV); //setupSV.setScrollViewListener(this); setupMenu = (Button) v.findViewById(R.id.setup_menu); setupMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQMain) context).openMenu(); } }); p0 = (CheckBox) v.findViewById(R.id.p0); boolean state0 = Boolean.valueOf(isOutputCh[0]); p0.setChecked(state0); isOutputCh0 = state0; p0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p0.isChecked()) { // channel is output inputsRow0.setVisibility(View.GONE); isOutputCh0 = true; isDigCh0 = true; outputsRow0.setVisibility(View.VISIBLE); out_hiLow0.setVisibility(View.VISIBLE); rg16.check(R.id.out_digital0); out_freq0.setVisibility(View.GONE); outFreqLabel0.setVisibility(View.INVISIBLE); duty_freq0.setVisibility(View.GONE); outDutyLabel0.setVisibility(View.INVISIBLE); allDigOut0.setVisibility(View.VISIBLE); allDigIn0.setVisibility(View.GONE); allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // channel is input outputsRow0.setVisibility(View.GONE); isOutputCh0 = false; isDigCh0 = true; inputsRow0.setVisibility(View.VISIBLE); hiLow0.setVisibility(View.VISIBLE); rg0.check(R.id.digital0); freq0.setVisibility(View.GONE); inFreqLabel0.setVisibility(View.INVISIBLE); allDigIn0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } } }); p1 = (CheckBox) v.findViewById(R.id.p1); boolean state1 = Boolean.valueOf(isOutputCh[1]); p1.setChecked(state1); isOutputCh1 = state1; p1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p1.isChecked()) { inputsRow1.setVisibility(View.GONE); isOutputCh1 = true; isDigCh1 = true; outputsRow1.setVisibility(View.VISIBLE); out_hiLow1.setVisibility(View.VISIBLE); rg17.check(R.id.out_digital1); out_freq1.setVisibility(View.GONE); outFreqLabel1.setVisibility(View.INVISIBLE); allDigOut1.setVisibility(View.VISIBLE); allDigIn1.setVisibility(View.GONE); allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { outputsRow1.setVisibility(View.GONE); isOutputCh1 = false; isDigCh1 = true; inputsRow1.setVisibility(View.VISIBLE); hiLow1.setVisibility(View.VISIBLE); rg1.check(R.id.digital1); freq1.setVisibility(View.GONE); inFreqLabel1.setVisibility(View.INVISIBLE); allDigIn1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } } }); p2 = (CheckBox) v.findViewById(R.id.p2); boolean state2 = Boolean.valueOf(isOutputCh[2]); p2.setChecked(state2); isOutputCh2 = state2; p2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p2.isChecked()) { inputsRow2.setVisibility(View.GONE); isOutputCh2 = true; isDigCh2 = true; outputsRow2.setVisibility(View.VISIBLE); out_hiLow2.setVisibility(View.VISIBLE); rg18.check(R.id.out_digital2); out_freq2.setVisibility(View.GONE); outFreqLabel2.setVisibility(View.INVISIBLE); allDigOut2.setVisibility(View.VISIBLE); allDigIn2.setVisibility(View.GONE); allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { outputsRow2.setVisibility(View.GONE); isOutputCh2 = false; isDigCh2 = true; inputsRow2.setVisibility(View.VISIBLE); hiLow2.setVisibility(View.VISIBLE); rg2.check(R.id.digital2); freq2.setVisibility(View.GONE); inFreqLabel2.setVisibility(View.INVISIBLE); allDigIn2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } } }); p3 = (CheckBox) v.findViewById(R.id.p3); boolean state3 = Boolean.valueOf(isOutputCh[3]); p3.setChecked(state3); isOutputCh3 = state3; p3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p3.isChecked()) { inputsRow3.setVisibility(View.GONE); isOutputCh3 = true; isDigCh3 = true; outputsRow3.setVisibility(View.VISIBLE); out_hiLow3.setVisibility(View.VISIBLE); rg19.check(R.id.out_digital3); out_freq3.setVisibility(View.GONE); outFreqLabel3.setVisibility(View.INVISIBLE); allDigOut3.setVisibility(View.VISIBLE); allDigIn3.setVisibility(View.GONE); allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { outputsRow3.setVisibility(View.GONE); isOutputCh3 = false; isDigCh3 = true; inputsRow3.setVisibility(View.VISIBLE); hiLow3.setVisibility(View.VISIBLE); rg3.check(R.id.digital3); freq3.setVisibility(View.GONE); inFreqLabel3.setVisibility(View.INVISIBLE); allDigIn3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } } }); p4 = (CheckBox) v.findViewById(R.id.p4); boolean state4 = Boolean.valueOf(isOutputCh[4]); p4.setChecked(state4); isOutputCh4 = state4; p4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p4.isChecked()) { inputsRow4.setVisibility(View.GONE); isOutputCh4 = true; isDigCh4 = true; outputsRow4.setVisibility(View.VISIBLE); out_hiLow4.setVisibility(View.VISIBLE); rg20.check(R.id.out_digital4); out_freq4.setVisibility(View.GONE); outFreqLabel4.setVisibility(View.INVISIBLE); allDigOut4.setVisibility(View.VISIBLE); allDigIn4.setVisibility(View.GONE); allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { outputsRow4.setVisibility(View.GONE); isOutputCh4 = false; isDigCh4 = true; inputsRow4.setVisibility(View.VISIBLE); hiLow4.setVisibility(View.VISIBLE); rg4.check(R.id.digital4); freq4.setVisibility(View.GONE); inFreqLabel4.setVisibility(View.INVISIBLE); allDigIn4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } } }); p5 = (CheckBox) v.findViewById(R.id.p5); boolean state5 = Boolean.valueOf(isOutputCh[5]); p5.setChecked(state5); isOutputCh5 = state5; p5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p5.isChecked()) { inputsRow5.setVisibility(View.GONE); isOutputCh5 = true; isDigCh5 = true; outputsRow5.setVisibility(View.VISIBLE); out_hiLow5.setVisibility(View.VISIBLE); rg21.check(R.id.out_digital5); out_freq5.setVisibility(View.GONE); outFreqLabel5.setVisibility(View.INVISIBLE); allDigOut5.setVisibility(View.VISIBLE); allDigIn5.setVisibility(View.GONE); allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { outputsRow5.setVisibility(View.GONE); isOutputCh5 = false; isDigCh5 = true; inputsRow5.setVisibility(View.VISIBLE); hiLow5.setVisibility(View.VISIBLE); rg5.check(R.id.digital5); freq5.setVisibility(View.GONE); inFreqLabel5.setVisibility(View.INVISIBLE); allDigIn5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } } }); p6 = (CheckBox) v.findViewById(R.id.p6); boolean state6 = Boolean.valueOf(isOutputCh[6]); p6.setChecked(state6); isOutputCh6 = state6; p6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p6.isChecked()) { inputsRow6.setVisibility(View.GONE); isOutputCh6 = true; isDigCh6 = true; outputsRow6.setVisibility(View.VISIBLE); out_hiLow6.setVisibility(View.VISIBLE); rg22.check(R.id.out_digital6); out_freq6.setVisibility(View.GONE); outFreqLabel6.setVisibility(View.INVISIBLE); allDigOut6.setVisibility(View.VISIBLE); allDigIn6.setVisibility(View.GONE); allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { outputsRow6.setVisibility(View.GONE); isOutputCh6 = false; isDigCh6 = true; inputsRow6.setVisibility(View.VISIBLE); hiLow6.setVisibility(View.VISIBLE); rg6.check(R.id.digital6); freq6.setVisibility(View.GONE); inFreqLabel6.setVisibility(View.INVISIBLE); allDigIn6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } } }); p7 = (CheckBox) v.findViewById(R.id.p7); boolean state7 = Boolean.valueOf(isOutputCh[7]); p7.setChecked(state7); isOutputCh7 = state7; p7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p7.isChecked()) { inputsRow7.setVisibility(View.GONE); isOutputCh7 = true; isDigCh7 = true; outputsRow7.setVisibility(View.VISIBLE); out_hiLow7.setVisibility(View.VISIBLE); rg23.check(R.id.out_digital7); out_freq7.setVisibility(View.GONE); outFreqLabel7.setVisibility(View.INVISIBLE); allDigOut7.setVisibility(View.VISIBLE); allDigIn7.setVisibility(View.GONE); allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { outputsRow7.setVisibility(View.GONE); isOutputCh7 = false; isDigCh7 = true; inputsRow7.setVisibility(View.VISIBLE); hiLow7.setVisibility(View.VISIBLE); rg7.check(R.id.digital7); freq7.setVisibility(View.GONE); inFreqLabel7.setVisibility(View.INVISIBLE); allDigIn7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } } }); p8 = (CheckBox) v.findViewById(R.id.p8); boolean state8 = Boolean.valueOf(isOutputCh[8]); p8.setChecked(state8); isOutputCh8 = state8; p8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p8.isChecked()) { inputsRow8.setVisibility(View.GONE); isOutputCh8 = true; isDigCh8 = true; outputsRow8.setVisibility(View.VISIBLE); out_hiLow8.setVisibility(View.VISIBLE); rg24.check(R.id.out_digital8); out_freq8.setVisibility(View.GONE); outFreqLabel8.setVisibility(View.INVISIBLE); allDigOut8.setVisibility(View.VISIBLE); allDigIn8.setVisibility(View.GONE); allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { outputsRow8.setVisibility(View.GONE); isOutputCh8 = false; isDigCh8 = true; inputsRow8.setVisibility(View.VISIBLE); hiLow8.setVisibility(View.VISIBLE); rg8.check(R.id.digital8); freq8.setVisibility(View.GONE); inFreqLabel8.setVisibility(View.INVISIBLE); allDigIn8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } } }); p9 = (CheckBox) v.findViewById(R.id.p9); boolean state9 = Boolean.valueOf(isOutputCh[9]); p9.setChecked(state9); isOutputCh9 = state9; p9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p9.isChecked()) { inputsRow9.setVisibility(View.GONE); isOutputCh9 = true; isDigCh9 = true; outputsRow9.setVisibility(View.VISIBLE); out_hiLow9.setVisibility(View.VISIBLE); rg25.check(R.id.out_digital9); out_freq9.setVisibility(View.GONE); outFreqLabel9.setVisibility(View.INVISIBLE); allDigOut9.setVisibility(View.VISIBLE); allDigIn9.setVisibility(View.GONE); allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { outputsRow9.setVisibility(View.GONE); isOutputCh9 = false; isDigCh9 = true; inputsRow9.setVisibility(View.VISIBLE); hiLow9.setVisibility(View.VISIBLE); rg9.check(R.id.digital9); freq9.setVisibility(View.GONE); inFreqLabel9.setVisibility(View.INVISIBLE); allDigIn9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } } }); p10 = (CheckBox) v.findViewById(R.id.p10); boolean state10 = Boolean.valueOf(isOutputCh[10]); p10.setChecked(state10); isOutputCh10 = state10; p10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p10.isChecked()) { inputsRow10.setVisibility(View.GONE); isOutputCh10 = true; isDigCh10 = true; outputsRow10.setVisibility(View.VISIBLE); out_hiLow10.setVisibility(View.VISIBLE); rg26.check(R.id.out_digital10); out_freq10.setVisibility(View.GONE); outFreqLabel10.setVisibility(View.INVISIBLE); allDigOut10.setVisibility(View.VISIBLE); allDigIn10.setVisibility(View.GONE); allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { outputsRow10.setVisibility(View.GONE); isOutputCh10 = false; isDigCh10 = true; inputsRow10.setVisibility(View.VISIBLE); hiLow10.setVisibility(View.VISIBLE); rg10.check(R.id.digital10); freq10.setVisibility(View.GONE); inFreqLabel10.setVisibility(View.INVISIBLE); allDigIn10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } } }); p11 = (CheckBox) v.findViewById(R.id.p11); boolean state11 = Boolean.valueOf(isOutputCh[11]); p11.setChecked(state11); isOutputCh11 = state11; p11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p11.isChecked()) { inputsRow11.setVisibility(View.GONE); isOutputCh11 = true; isDigCh11 = true; outputsRow11.setVisibility(View.VISIBLE); out_hiLow11.setVisibility(View.VISIBLE); rg27.check(R.id.out_digital11); out_freq11.setVisibility(View.GONE); outFreqLabel11.setVisibility(View.INVISIBLE); allDigOut11.setVisibility(View.VISIBLE); allDigIn11.setVisibility(View.GONE); allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { outputsRow11.setVisibility(View.GONE); isOutputCh11 = false; isDigCh11 = true; inputsRow11.setVisibility(View.VISIBLE); hiLow11.setVisibility(View.VISIBLE); rg11.check(R.id.digital11); freq11.setVisibility(View.GONE); inFreqLabel11.setVisibility(View.INVISIBLE); allDigIn11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } } }); p12 = (CheckBox) v.findViewById(R.id.p12); boolean state12 = Boolean.valueOf(isOutputCh[12]); p12.setChecked(state12); isOutputCh12 = state12; p12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p12.isChecked()) { inputsRow12.setVisibility(View.GONE); isOutputCh12 = true; isDigCh12 = true; outputsRow12.setVisibility(View.VISIBLE); out_hiLow12.setVisibility(View.VISIBLE); rg28.check(R.id.out_digital12); out_freq12.setVisibility(View.GONE); outFreqLabel12.setVisibility(View.INVISIBLE); allDigOut12.setVisibility(View.VISIBLE); allDigIn12.setVisibility(View.GONE); allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { outputsRow12.setVisibility(View.GONE); isOutputCh12 = false; isDigCh12 = true; inputsRow12.setVisibility(View.VISIBLE); hiLow12.setVisibility(View.VISIBLE); rg12.check(R.id.digital12); freq12.setVisibility(View.GONE); inFreqLabel12.setVisibility(View.INVISIBLE); allDigIn12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } } }); p13 = (CheckBox) v.findViewById(R.id.p13); boolean state13 = Boolean.valueOf(isOutputCh[13]); p13.setChecked(state13); isOutputCh13 = state13; p13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p13.isChecked()) { inputsRow13.setVisibility(View.GONE); isOutputCh13 = true; isDigCh13 = true; outputsRow13.setVisibility(View.VISIBLE); out_hiLow13.setVisibility(View.VISIBLE); rg29.check(R.id.out_digital13); out_freq13.setVisibility(View.GONE); outFreqLabel13.setVisibility(View.INVISIBLE); allDigOut13.setVisibility(View.VISIBLE); allDigIn13.setVisibility(View.GONE); allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { outputsRow13.setVisibility(View.GONE); isOutputCh13 = false; isDigCh13 = true; inputsRow13.setVisibility(View.VISIBLE); hiLow13.setVisibility(View.VISIBLE); rg13.check(R.id.digital13); freq13.setVisibility(View.GONE); inFreqLabel13.setVisibility(View.INVISIBLE); allDigIn13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } } }); p14 = (CheckBox) v.findViewById(R.id.p14); boolean state14 = Boolean.valueOf(isOutputCh[14]); p14.setChecked(state14); isOutputCh14 = state14; p14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p14.isChecked()) { inputsRow14.setVisibility(View.GONE); isOutputCh14 = true; isDigCh14 = true; outputsRow14.setVisibility(View.VISIBLE); out_hiLow14.setVisibility(View.VISIBLE); rg30.check(R.id.out_digital14); out_freq14.setVisibility(View.GONE); outFreqLabel14.setVisibility(View.INVISIBLE); allDigOut14.setVisibility(View.VISIBLE); allDigIn14.setVisibility(View.GONE); allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { outputsRow14.setVisibility(View.GONE); isOutputCh14 = false; isDigCh14 = true; inputsRow14.setVisibility(View.VISIBLE); hiLow14.setVisibility(View.VISIBLE); rg14.check(R.id.digital14); freq14.setVisibility(View.GONE); inFreqLabel14.setVisibility(View.INVISIBLE); allDigIn14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } } }); p15 = (CheckBox) v.findViewById(R.id.p15); boolean state15 = Boolean.valueOf(isOutputCh[15]); p15.setChecked(state15); isOutputCh15 = state15; p15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p15.isChecked()) { inputsRow15.setVisibility(View.GONE); isOutputCh15 = true; isDigCh15 = true; outputsRow15.setVisibility(View.VISIBLE); out_hiLow15.setVisibility(View.VISIBLE); rg31.check(R.id.out_digital15); out_freq15.setVisibility(View.GONE); outFreqLabel15.setVisibility(View.INVISIBLE); allDigOut15.setVisibility(View.VISIBLE); allDigIn15.setVisibility(View.GONE); allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { outputsRow15.setVisibility(View.GONE); isOutputCh15 = false; isDigCh15 = true; inputsRow15.setVisibility(View.VISIBLE); hiLow15.setVisibility(View.VISIBLE); rg15.check(R.id.digital15); freq15.setVisibility(View.GONE); inFreqLabel15.setVisibility(View.INVISIBLE); allDigIn15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } } }); //((AndroiDAQMain) context).showSetupToast(); break; case 1: //resId = R.layout.inputs; resId = R.layout.inputs; v = inflater.inflate(resId, null, false); inputSetRun = (Button) v.findViewById(R.id.read_inputs); inputSV = (ScrollView) v.findViewById(R.id.scrollViewInputs); inputSV.setScrollbarFadingEnabled(false); inputSetRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runInputs = false; } else { runInputs = true; setProp(); } } }); inputContRun = (Button) v.findViewById(R.id.read_cont_inputs); inputContRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //setPropAndRead(); //TODO setup input reads //((AndroiDAQMain) context).getInputs(true); int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runContInputs = false; inputContRun.setText("Continuous Read Input from AndroiDAQ"); } else { if (!runContInputs) { inputContRun.setText("Stop Cont. Read Input from AndroiDAQ"); runContInputs = true; setProp(); } else { inputContRun.setText("Continuous Read Input from AndroiDAQ"); runContInputs = false; stopContInput(); } } } }); inputsRow0 = (TableRow) v.findViewById(R.id.inputsRow1); if (isOutputCh[0]) { inputsRow0.setVisibility(View.GONE); } hiLow0 = (RadioButton) v.findViewById(R.id.hi_low0); freq0 = (TextView) v.findViewById(R.id.input_freq0); inFreqLabel0 = (TextView) v.findViewById(R.id.infreq_label0); rg0 = (RadioGroup) v.findViewById(R.id.radioGroup0); if (isDigCh[0]) { hiLow0.setVisibility(View.VISIBLE); freq0.setVisibility(View.GONE); isDigCh0 = true; inFreqLabel0.setVisibility(View.INVISIBLE); rg0.check(R.id.digital0); } else { hiLow0.setVisibility(View.GONE); freq0.setVisibility(View.VISIBLE); isDigCh0 = false; inFreqLabel0.setVisibility(View.VISIBLE); rg0.check(R.id.count0); } rg0.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital0) { // if checked channel is digital hiLow0.setVisibility(View.VISIBLE); isDigCh0 = true; freq0.setVisibility(View.GONE); inFreqLabel0.setVisibility(View.INVISIBLE); allDigIn0.setVisibility(View.VISIBLE); allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); } else { hiLow0.setVisibility(View.GONE); isDigCh0 = false; freq0.setVisibility(View.VISIBLE); inFreqLabel0.setVisibility(View.VISIBLE); allDigIn0.setVisibility(View.GONE); allFreqIn0.setVisibility(View.VISIBLE); allFreqLabel0.setVisibility(View.VISIBLE); } } }); inputsRow1 = (TableRow) v.findViewById(R.id.inputsRow2); if (isOutputCh[1]) { inputsRow1.setVisibility(View.GONE); } hiLow1 = (RadioButton) v.findViewById(R.id.hi_low1); freq1 = (TextView) v.findViewById(R.id.input_freq1); inFreqLabel1 = (TextView) v.findViewById(R.id.infreq_label1); rg1 = (RadioGroup) v.findViewById(R.id.radioGroup1); if (isDigCh[1]) { hiLow1.setVisibility(View.VISIBLE); freq1.setVisibility(View.GONE); isDigCh1 = true; inFreqLabel1.setVisibility(View.INVISIBLE); rg1.check(R.id.digital1); } else { hiLow1.setVisibility(View.GONE); freq1.setVisibility(View.VISIBLE); isDigCh1 = false; inFreqLabel1.setVisibility(View.VISIBLE); rg1.check(R.id.count1); } rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital1) { hiLow1.setVisibility(View.VISIBLE); isDigCh1 = true; freq1.setVisibility(View.GONE); inFreqLabel1.setVisibility(View.INVISIBLE); allDigIn1.setVisibility(View.VISIBLE); allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); } else { hiLow1.setVisibility(View.GONE); isDigCh1 = false; freq1.setVisibility(View.VISIBLE); inFreqLabel1.setVisibility(View.VISIBLE); allDigIn1.setVisibility(View.GONE); allFreqIn1.setVisibility(View.VISIBLE); allFreqLabel1.setVisibility(View.VISIBLE); } } }); inputsRow2 = (TableRow) v.findViewById(R.id.inputsRow3); if (isOutputCh[2]) { inputsRow2.setVisibility(View.GONE); } hiLow2 = (RadioButton) v.findViewById(R.id.hi_low2); freq2 = (TextView) v.findViewById(R.id.input_freq2); inFreqLabel2 = (TextView) v.findViewById(R.id.infreq_label2); rg2 = (RadioGroup) v.findViewById(R.id.radioGroup2); if (isDigCh[2]) { hiLow2.setVisibility(View.VISIBLE); freq2.setVisibility(View.GONE); isDigCh2 = true; inFreqLabel2.setVisibility(View.INVISIBLE); rg2.check(R.id.digital2); } else { hiLow2.setVisibility(View.GONE); freq2.setVisibility(View.VISIBLE); isDigCh2 = false; inFreqLabel2.setVisibility(View.VISIBLE); rg2.check(R.id.count2); } rg2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital2) { hiLow2.setVisibility(View.VISIBLE); isDigCh2 = true; freq2.setVisibility(View.GONE); inFreqLabel2.setVisibility(View.INVISIBLE); allDigIn2.setVisibility(View.VISIBLE); allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); } else { hiLow2.setVisibility(View.GONE); isDigCh2 = false; freq2.setVisibility(View.VISIBLE); inFreqLabel2.setVisibility(View.VISIBLE); allDigIn2.setVisibility(View.GONE); allFreqIn2.setVisibility(View.VISIBLE); allFreqLabel2.setVisibility(View.VISIBLE); } } }); inputsRow3 = (TableRow) v.findViewById(R.id.inputsRow4); if (isOutputCh[3]) { inputsRow3.setVisibility(View.GONE); } hiLow3 = (RadioButton) v.findViewById(R.id.hi_low3); freq3 = (TextView) v.findViewById(R.id.input_freq3); inFreqLabel3 = (TextView) v.findViewById(R.id.infreq_label3); rg3 = (RadioGroup) v.findViewById(R.id.radioGroup3); if (isDigCh[3]) { hiLow3.setVisibility(View.VISIBLE); freq3.setVisibility(View.GONE); isDigCh3 = true; inFreqLabel3.setVisibility(View.INVISIBLE); rg3.check(R.id.digital3); } else { hiLow3.setVisibility(View.GONE); freq3.setVisibility(View.VISIBLE); isDigCh3 = false; inFreqLabel3.setVisibility(View.VISIBLE); rg3.check(R.id.count3); } rg3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital3) { hiLow3.setVisibility(View.VISIBLE); isDigCh3 = true; freq3.setVisibility(View.GONE); inFreqLabel3.setVisibility(View.INVISIBLE); allDigIn3.setVisibility(View.VISIBLE); allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); } else { hiLow3.setVisibility(View.GONE); isDigCh3 = false; freq3.setVisibility(View.VISIBLE); inFreqLabel3.setVisibility(View.VISIBLE); allDigIn3.setVisibility(View.GONE); allFreqIn3.setVisibility(View.VISIBLE); allFreqLabel3.setVisibility(View.VISIBLE); } } }); inputsRow4 = (TableRow) v.findViewById(R.id.inputsRow5); if (isOutputCh[4]) { inputsRow4.setVisibility(View.GONE); } hiLow4 = (RadioButton) v.findViewById(R.id.hi_low4); freq4 = (TextView) v.findViewById(R.id.input_freq4); inFreqLabel4 = (TextView) v.findViewById(R.id.infreq_label4); rg4 = (RadioGroup) v.findViewById(R.id.radioGroup4); if (isDigCh[4]) { hiLow4.setVisibility(View.VISIBLE); freq4.setVisibility(View.GONE); isDigCh4 = true; inFreqLabel4.setVisibility(View.INVISIBLE); rg4.check(R.id.digital4); } else { hiLow4.setVisibility(View.GONE); freq4.setVisibility(View.VISIBLE); isDigCh4 = false; inFreqLabel4.setVisibility(View.VISIBLE); rg4.check(R.id.count4); } rg4.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital4) { hiLow4.setVisibility(View.VISIBLE); isDigCh4 = true; freq4.setVisibility(View.GONE); inFreqLabel4.setVisibility(View.INVISIBLE); allDigIn4.setVisibility(View.VISIBLE); allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); } else { hiLow4.setVisibility(View.GONE); isDigCh4 = false; freq4.setVisibility(View.VISIBLE); inFreqLabel4.setVisibility(View.VISIBLE); allDigIn4.setVisibility(View.GONE); allFreqIn4.setVisibility(View.VISIBLE); allFreqLabel4.setVisibility(View.VISIBLE); } } }); inputsRow5 = (TableRow) v.findViewById(R.id.inputsRow6); if (isOutputCh[5]) { inputsRow5.setVisibility(View.GONE); } hiLow5 = (RadioButton) v.findViewById(R.id.hi_low5); freq5 = (TextView) v.findViewById(R.id.input_freq5); inFreqLabel5 = (TextView) v.findViewById(R.id.infreq_label5); rg5 = (RadioGroup) v.findViewById(R.id.radioGroup5); if (isDigCh[5]) { hiLow5.setVisibility(View.VISIBLE); freq5.setVisibility(View.GONE); isDigCh5 = true; inFreqLabel5.setVisibility(View.INVISIBLE); rg5.check(R.id.digital5); } else { hiLow5.setVisibility(View.GONE); freq5.setVisibility(View.VISIBLE); isDigCh5 = false; inFreqLabel5.setVisibility(View.VISIBLE); rg5.check(R.id.count5); } rg5.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital5) { hiLow5.setVisibility(View.VISIBLE); isDigCh5 = true; freq5.setVisibility(View.GONE); inFreqLabel5.setVisibility(View.INVISIBLE); allDigIn5.setVisibility(View.VISIBLE); allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); } else { hiLow5.setVisibility(View.GONE); isDigCh5 = false; freq5.setVisibility(View.VISIBLE); inFreqLabel5.setVisibility(View.VISIBLE); allDigIn5.setVisibility(View.GONE); allFreqIn5.setVisibility(View.VISIBLE); allFreqLabel5.setVisibility(View.VISIBLE); } } }); inputsRow6 = (TableRow) v.findViewById(R.id.inputsRow7); if (isOutputCh[6]) { inputsRow6.setVisibility(View.GONE); } hiLow6 = (RadioButton) v.findViewById(R.id.hi_low6); freq6 = (TextView) v.findViewById(R.id.input_freq6); inFreqLabel6 = (TextView) v.findViewById(R.id.infreq_label6); rg6 = (RadioGroup) v.findViewById(R.id.radioGroup6); if (isDigCh[6]) { hiLow6.setVisibility(View.VISIBLE); freq6.setVisibility(View.GONE); isDigCh6 = true; inFreqLabel6.setVisibility(View.INVISIBLE); rg6.check(R.id.digital6); } else { hiLow6.setVisibility(View.GONE); freq6.setVisibility(View.VISIBLE); isDigCh6 = false; inFreqLabel6.setVisibility(View.VISIBLE); rg6.check(R.id.count6); } rg6.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital6) { hiLow6.setVisibility(View.VISIBLE); isDigCh6 = true; freq6.setVisibility(View.GONE); inFreqLabel6.setVisibility(View.INVISIBLE); allDigIn6.setVisibility(View.VISIBLE); allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); } else { hiLow6.setVisibility(View.GONE); isDigCh6 = false; freq6.setVisibility(View.VISIBLE); inFreqLabel6.setVisibility(View.VISIBLE); allDigIn6.setVisibility(View.GONE); allFreqIn6.setVisibility(View.VISIBLE); allFreqLabel6.setVisibility(View.VISIBLE); } } }); inputsRow7 = (TableRow) v.findViewById(R.id.inputsRow8); if (isOutputCh[7]) { inputsRow7.setVisibility(View.GONE); } hiLow7 = (RadioButton) v.findViewById(R.id.hi_low7); freq7 = (TextView) v.findViewById(R.id.input_freq7); inFreqLabel7 = (TextView) v.findViewById(R.id.infreq_label7); rg7 = (RadioGroup) v.findViewById(R.id.radioGroup7); if (isDigCh[7]) { hiLow7.setVisibility(View.VISIBLE); freq7.setVisibility(View.GONE); isDigCh7 = true; inFreqLabel7.setVisibility(View.INVISIBLE); rg7.check(R.id.digital7); } else { hiLow7.setVisibility(View.GONE); freq7.setVisibility(View.VISIBLE); isDigCh7 = false; inFreqLabel7.setVisibility(View.VISIBLE); rg7.check(R.id.count7); } rg7.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital7) { hiLow7.setVisibility(View.VISIBLE); isDigCh7 = true; freq7.setVisibility(View.GONE); inFreqLabel7.setVisibility(View.INVISIBLE); allDigIn7.setVisibility(View.VISIBLE); allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); } else { hiLow7.setVisibility(View.GONE); isDigCh7 = false; freq7.setVisibility(View.VISIBLE); inFreqLabel7.setVisibility(View.VISIBLE); allDigIn7.setVisibility(View.GONE); allFreqIn7.setVisibility(View.VISIBLE); allFreqLabel7.setVisibility(View.VISIBLE); } } }); inputsRow8 = (TableRow) v.findViewById(R.id.inputsRow9); if (isOutputCh[8]) { inputsRow8.setVisibility(View.GONE); } hiLow8 = (RadioButton) v.findViewById(R.id.hi_low8); freq8 = (TextView) v.findViewById(R.id.input_freq8); inFreqLabel8 = (TextView) v.findViewById(R.id.infreq_label8); rg8 = (RadioGroup) v.findViewById(R.id.radioGroup8); if (isDigCh[8]) { hiLow8.setVisibility(View.VISIBLE); freq8.setVisibility(View.GONE); isDigCh8 = true; inFreqLabel8.setVisibility(View.INVISIBLE); rg8.check(R.id.digital8); } else { hiLow8.setVisibility(View.GONE); freq8.setVisibility(View.VISIBLE); isDigCh8 = false; inFreqLabel8.setVisibility(View.VISIBLE); rg8.check(R.id.count8); } rg8.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital8) { hiLow8.setVisibility(View.VISIBLE); isDigCh8 = true; freq8.setVisibility(View.GONE); inFreqLabel8.setVisibility(View.INVISIBLE); allDigIn8.setVisibility(View.VISIBLE); allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); } else { hiLow8.setVisibility(View.GONE); isDigCh8 = false; freq8.setVisibility(View.VISIBLE); inFreqLabel8.setVisibility(View.VISIBLE); allDigIn8.setVisibility(View.GONE); allFreqIn8.setVisibility(View.VISIBLE); allFreqLabel8.setVisibility(View.VISIBLE); } } }); inputsRow9 = (TableRow) v.findViewById(R.id.inputsRow10); if (isOutputCh[9]) { inputsRow9.setVisibility(View.GONE); } hiLow9 = (RadioButton) v.findViewById(R.id.hi_low9); freq9 = (TextView) v.findViewById(R.id.input_freq9); inFreqLabel9 = (TextView) v.findViewById(R.id.infreq_label9); rg9 = (RadioGroup) v.findViewById(R.id.radioGroup9); if (isDigCh[9]) { hiLow9.setVisibility(View.VISIBLE); freq9.setVisibility(View.GONE); isDigCh9 = true; inFreqLabel9.setVisibility(View.INVISIBLE); rg9.check(R.id.digital9); } else { hiLow9.setVisibility(View.GONE); freq9.setVisibility(View.VISIBLE); isDigCh9 = false; inFreqLabel9.setVisibility(View.VISIBLE); rg9.check(R.id.count9); } rg9.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital9) { hiLow9.setVisibility(View.VISIBLE); isDigCh9 = true; freq9.setVisibility(View.GONE); inFreqLabel9.setVisibility(View.INVISIBLE); allDigIn9.setVisibility(View.VISIBLE); allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); } else { hiLow9.setVisibility(View.GONE); isDigCh9 = false; freq9.setVisibility(View.VISIBLE); inFreqLabel9.setVisibility(View.VISIBLE); allDigIn9.setVisibility(View.GONE); allFreqIn9.setVisibility(View.VISIBLE); allFreqLabel9.setVisibility(View.VISIBLE); } } }); inputsRow10 = (TableRow) v.findViewById(R.id.inputsRow11); if (isOutputCh[10]) { inputsRow10.setVisibility(View.GONE); } hiLow10 = (RadioButton) v.findViewById(R.id.hi_low10); freq10 = (TextView) v.findViewById(R.id.input_freq10); inFreqLabel10 = (TextView) v.findViewById(R.id.infreq_label10); rg10 = (RadioGroup) v.findViewById(R.id.radioGroup10); if (isDigCh[10]) { hiLow10.setVisibility(View.VISIBLE); freq10.setVisibility(View.GONE); isDigCh10 = true; inFreqLabel10.setVisibility(View.INVISIBLE); rg10.check(R.id.digital10); } else { hiLow10.setVisibility(View.GONE); freq10.setVisibility(View.VISIBLE); isDigCh10 = false; inFreqLabel10.setVisibility(View.VISIBLE); rg10.check(R.id.count10); } rg10.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital10) { hiLow10.setVisibility(View.VISIBLE); isDigCh10 = true; freq10.setVisibility(View.GONE); inFreqLabel10.setVisibility(View.INVISIBLE); allDigIn10.setVisibility(View.VISIBLE); allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); } else { hiLow10.setVisibility(View.GONE); isDigCh10 = false; freq10.setVisibility(View.VISIBLE); inFreqLabel10.setVisibility(View.VISIBLE); allDigIn10.setVisibility(View.GONE); allFreqIn10.setVisibility(View.VISIBLE); allFreqLabel10.setVisibility(View.VISIBLE); } } }); inputsRow11 = (TableRow) v.findViewById(R.id.inputsRow12); if (isOutputCh[11]) { inputsRow11.setVisibility(View.GONE); } hiLow11 = (RadioButton) v.findViewById(R.id.hi_low11); freq11 = (TextView) v.findViewById(R.id.input_freq11); inFreqLabel11 = (TextView) v.findViewById(R.id.infreq_label11); rg11 = (RadioGroup) v.findViewById(R.id.radioGroup11); if (isDigCh[11]) { hiLow11.setVisibility(View.VISIBLE); freq11.setVisibility(View.GONE); isDigCh11 = true; inFreqLabel11.setVisibility(View.INVISIBLE); rg11.check(R.id.digital11); } else { hiLow11.setVisibility(View.GONE); freq11.setVisibility(View.VISIBLE); isDigCh11 = false; inFreqLabel11.setVisibility(View.VISIBLE); rg11.check(R.id.count11); } rg11.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital11) { hiLow11.setVisibility(View.VISIBLE); isDigCh11 = true; freq11.setVisibility(View.GONE); inFreqLabel11.setVisibility(View.INVISIBLE); allDigIn11.setVisibility(View.VISIBLE); allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); } else { hiLow11.setVisibility(View.GONE); isDigCh11 = false; freq11.setVisibility(View.VISIBLE); inFreqLabel11.setVisibility(View.VISIBLE); allDigIn11.setVisibility(View.GONE); allFreqIn11.setVisibility(View.VISIBLE); allFreqLabel11.setVisibility(View.VISIBLE); } } }); inputsRow12 = (TableRow) v.findViewById(R.id.inputsRow13); if (isOutputCh[12]) { inputsRow12.setVisibility(View.GONE); } hiLow12 = (RadioButton) v.findViewById(R.id.hi_low12); freq12 = (TextView) v.findViewById(R.id.input_freq12); inFreqLabel12 = (TextView) v.findViewById(R.id.infreq_label12); rg12 = (RadioGroup) v.findViewById(R.id.radioGroup12); if (isDigCh[12]) { hiLow12.setVisibility(View.VISIBLE); freq12.setVisibility(View.GONE); isDigCh12 = true; inFreqLabel12.setVisibility(View.INVISIBLE); rg12.check(R.id.digital12); } else { hiLow12.setVisibility(View.GONE); freq12.setVisibility(View.VISIBLE); isDigCh12 = false; inFreqLabel12.setVisibility(View.VISIBLE); rg12.check(R.id.count12); } rg12.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital12) { hiLow12.setVisibility(View.VISIBLE); isDigCh12 = true; freq12.setVisibility(View.GONE); inFreqLabel12.setVisibility(View.INVISIBLE); allDigIn12.setVisibility(View.VISIBLE); allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); } else { hiLow12.setVisibility(View.GONE); isDigCh12 = false; freq12.setVisibility(View.VISIBLE); inFreqLabel12.setVisibility(View.VISIBLE); allDigIn12.setVisibility(View.GONE); allFreqIn12.setVisibility(View.VISIBLE); allFreqLabel12.setVisibility(View.VISIBLE); } } }); inputsRow13 = (TableRow) v.findViewById(R.id.inputsRow14); if (isOutputCh[13]) { inputsRow13.setVisibility(View.GONE); } hiLow13 = (RadioButton) v.findViewById(R.id.hi_low13); freq13 = (TextView) v.findViewById(R.id.input_freq13); inFreqLabel13 = (TextView) v.findViewById(R.id.infreq_label13); rg13 = (RadioGroup) v.findViewById(R.id.radioGroup13); if (isDigCh[13]) { hiLow13.setVisibility(View.VISIBLE); freq13.setVisibility(View.GONE); isDigCh13 = true; inFreqLabel13.setVisibility(View.INVISIBLE); rg13.check(R.id.digital13); } else { hiLow13.setVisibility(View.GONE); freq13.setVisibility(View.VISIBLE); isDigCh13 = false; inFreqLabel13.setVisibility(View.VISIBLE); rg13.check(R.id.count13); } rg13.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital13) { hiLow13.setVisibility(View.VISIBLE); isDigCh13 = true; freq13.setVisibility(View.GONE); inFreqLabel13.setVisibility(View.INVISIBLE); allDigIn13.setVisibility(View.VISIBLE); allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); } else { hiLow13.setVisibility(View.GONE); isDigCh13 = false; freq13.setVisibility(View.VISIBLE); inFreqLabel13.setVisibility(View.VISIBLE); allDigIn13.setVisibility(View.GONE); allFreqIn13.setVisibility(View.VISIBLE); allFreqLabel13.setVisibility(View.VISIBLE); } } }); inputsRow14 = (TableRow) v.findViewById(R.id.inputsRow15); if (isOutputCh[14]) { inputsRow14.setVisibility(View.GONE); } hiLow14 = (RadioButton) v.findViewById(R.id.hi_low14); freq14 = (TextView) v.findViewById(R.id.input_freq14); inFreqLabel14 = (TextView) v.findViewById(R.id.infreq_label14); rg14 = (RadioGroup) v.findViewById(R.id.radioGroup14); if (isDigCh[14]) { hiLow14.setVisibility(View.VISIBLE); freq14.setVisibility(View.GONE); isDigCh14 = true; inFreqLabel14.setVisibility(View.INVISIBLE); rg14.check(R.id.digital14); } else { hiLow14.setVisibility(View.GONE); freq14.setVisibility(View.VISIBLE); isDigCh14 = false; inFreqLabel14.setVisibility(View.VISIBLE); rg14.check(R.id.count14); } rg14.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital14) { hiLow14.setVisibility(View.VISIBLE); isDigCh14 = true; freq14.setVisibility(View.GONE); inFreqLabel14.setVisibility(View.INVISIBLE); allDigIn14.setVisibility(View.VISIBLE); allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); } else { hiLow14.setVisibility(View.GONE); isDigCh14 = false; freq14.setVisibility(View.VISIBLE); inFreqLabel14.setVisibility(View.VISIBLE); allDigIn14.setVisibility(View.GONE); allFreqIn14.setVisibility(View.VISIBLE); allFreqLabel14.setVisibility(View.VISIBLE); } } }); inputsRow15 = (TableRow) v.findViewById(R.id.inputsRow16); if (isOutputCh[15]) { inputsRow15.setVisibility(View.GONE); } hiLow15 = (RadioButton) v.findViewById(R.id.hi_low15); freq15 = (TextView) v.findViewById(R.id.input_freq15); inFreqLabel15 = (TextView) v.findViewById(R.id.infreq_label15); rg15 = (RadioGroup) v.findViewById(R.id.radioGroup15); if (isDigCh[15]) { hiLow15.setVisibility(View.VISIBLE); freq15.setVisibility(View.GONE); isDigCh15 = true; inFreqLabel15.setVisibility(View.INVISIBLE); rg15.check(R.id.digital15); } else { hiLow15.setVisibility(View.GONE); freq15.setVisibility(View.VISIBLE); isDigCh15 = false; inFreqLabel15.setVisibility(View.VISIBLE); rg15.check(R.id.count15); } rg15.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital15) { hiLow15.setVisibility(View.VISIBLE); isDigCh15 = true; freq15.setVisibility(View.GONE); inFreqLabel15.setVisibility(View.INVISIBLE); allDigIn15.setVisibility(View.VISIBLE); allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); } else { hiLow15.setVisibility(View.GONE); isDigCh15 = false; freq15.setVisibility(View.VISIBLE); inFreqLabel15.setVisibility(View.VISIBLE); allDigIn15.setVisibility(View.GONE); allFreqIn15.setVisibility(View.VISIBLE); allFreqLabel15.setVisibility(View.VISIBLE); } } }); break; case 2: //resId = R.layout.outputs; resId = R.layout.outputs; //TODO v = inflater.inflate(resId, null, false); outputsRow0 = (TableRow) v.findViewById(R.id.outputsRow1); outputSV = (ScrollView) v.findViewById(R.id.scrollViewOutputs); outputSV.setScrollbarFadingEnabled(false); outputReset = (Button) v.findViewById(R.id.reset_outputs); outputReset.setVisibility(View.GONE); outputSend = (Button) v.findViewById(R.id.send_outputs); outputSend.setOnTouchListener(new OnTouchListener() { @Override // This touch method sees both button down and button up events // and sents new settings for both. To disable comment out ACTION UP public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); /** Two button methods to have separtate start and stop buttons. * To use remove comment out tags below and comment out the above * setOnTouchListener method **/ /*outputSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQMain)context).btState(); if ( connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { sendOutputs = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); setProp(); } } }); outputReset = (Button)v.findViewById(R.id.reset_outputs); outputReset.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQMain)context).btState(); if ( connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { sendOutputs = true; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); setProp(); } } }); */ if (!isOutputCh[0]) { outputsRow0.setVisibility(View.GONE); } out_hiLow0 = (CheckBox) v.findViewById(R.id.out_hi_low0); if (outputState[0]) { out_hiLow0.setChecked(true); } out_hiLow0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow0.isChecked()) { allDigOut0.setChecked(true); } else { allDigOut0.setChecked(false); } } }); out_freq0 = (EditText) v.findViewById(R.id.out_freq0); out_freq0.setText(desiredFreq[0]); outFreqLabel0 = (TextView) v.findViewById(R.id.outfreq_label0); duty_freq0 = (EditText) v.findViewById(R.id.out_duty0); duty_freq0.setText(desiredDuty[0]); outDutyLabel0 = (TextView) v.findViewById(R.id.outduty_label0); rg16 = (RadioGroup) v.findViewById(R.id.radioGroupOut0); // Log.e("Test", "isDigCh0 @ output is: " + isDigCh[0]); if (isDigCh[0]) { out_hiLow0.setVisibility(View.VISIBLE); out_freq0.setVisibility(View.GONE); duty_freq0.setVisibility(View.GONE); isDigCh0 = true; outFreqLabel0.setVisibility(View.INVISIBLE); outDutyLabel0.setVisibility(View.INVISIBLE); rg16.check(R.id.out_digital0); } else { out_hiLow0.setVisibility(View.GONE); out_freq0.setVisibility(View.VISIBLE); duty_freq0.setVisibility(View.VISIBLE); isDigCh0 = false; outFreqLabel0.setVisibility(View.VISIBLE); outDutyLabel0.setVisibility(View.VISIBLE); rg16.check(R.id.pulse0); } rg16.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital0) { // if checked channel is digital out_hiLow0.setVisibility(View.VISIBLE); isDigCh0 = true; out_freq0.setVisibility(View.GONE); duty_freq0.setVisibility(View.GONE); outFreqLabel0.setVisibility(View.INVISIBLE); outDutyLabel0.setVisibility(View.INVISIBLE); allDigOut0.setVisibility(View.VISIBLE); allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow0.setVisibility(View.GONE); isDigCh0 = false; out_freq0.setVisibility(View.VISIBLE); duty_freq0.setVisibility(View.VISIBLE); outFreqLabel0.setVisibility(View.VISIBLE); outDutyLabel0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqOut0.setVisibility(View.VISIBLE); allFreqLabel0.setVisibility(View.VISIBLE); allDutyOut0.setVisibility(View.VISIBLE); allDutyLabel0.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg16.check(R.id.out_digital0); } } } }); out_freq0.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq0.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq0.setText("0"); getInputString(); } return true; } return false; } }); out_freq0.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq0.getText().toString().length(); if (inputted > 0l) { getInputString(); } else { out_freq0.setText("0"); getInputString(); } return true; } return false; } }); outputsRow1 = (TableRow) v.findViewById(R.id.outputsRow2); if (!isOutputCh[1]) { outputsRow1.setVisibility(View.GONE); } out_hiLow1 = (CheckBox) v.findViewById(R.id.out_hi_low1); if (outputState[1]) { out_hiLow1.setChecked(true); } out_hiLow1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow1.isChecked()) { allDigOut1.setChecked(true); } else { allDigOut1.setChecked(false); } } }); out_freq1 = (EditText) v.findViewById(R.id.out_freq1); out_freq1.setText(desiredFreq[1]); outFreqLabel1 = (TextView) v.findViewById(R.id.outfreq_label1); duty_freq1 = (EditText) v.findViewById(R.id.out_duty1); duty_freq1.setText(desiredDuty[1]); outDutyLabel1 = (TextView) v.findViewById(R.id.outduty_label1); rg17 = (RadioGroup) v.findViewById(R.id.radioGroupOut1); if (isDigCh[1]) { out_hiLow1.setVisibility(View.VISIBLE); out_freq1.setVisibility(View.GONE); duty_freq1.setVisibility(View.GONE); isDigCh1 = true; outFreqLabel1.setVisibility(View.INVISIBLE); outDutyLabel1.setVisibility(View.INVISIBLE); rg17.check(R.id.out_digital1); } else { out_hiLow1.setVisibility(View.GONE); out_freq1.setVisibility(View.VISIBLE); duty_freq1.setVisibility(View.VISIBLE); isDigCh1 = false; outFreqLabel1.setVisibility(View.VISIBLE); outDutyLabel1.setVisibility(View.VISIBLE); rg17.check(R.id.pulse1); } rg17.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital1) { out_hiLow1.setVisibility(View.VISIBLE); isDigCh1 = true; out_freq1.setVisibility(View.GONE); duty_freq1.setVisibility(View.GONE); outFreqLabel1.setVisibility(View.INVISIBLE); outDutyLabel1.setVisibility(View.INVISIBLE); allDigOut1.setVisibility(View.VISIBLE); allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow1.setVisibility(View.GONE); isDigCh1 = false; out_freq1.setVisibility(View.VISIBLE); duty_freq1.setVisibility(View.VISIBLE); outFreqLabel1.setVisibility(View.VISIBLE); outDutyLabel1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqOut1.setVisibility(View.VISIBLE); allFreqLabel1.setVisibility(View.VISIBLE); allDutyOut1.setVisibility(View.VISIBLE); allDutyLabel1.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg17.check(R.id.out_digital1); } } } }); out_freq1.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq1.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq1.setText("0"); getInputString(); } return true; } return false; } }); out_freq1.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq1.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq1.setText("0"); getInputString(); } return true; } return false; } }); outputsRow2 = (TableRow) v.findViewById(R.id.outputsRow3); if (!isOutputCh[2]) { outputsRow2.setVisibility(View.GONE); } out_hiLow2 = (CheckBox) v.findViewById(R.id.out_hi_low2); if (outputState[2]) { out_hiLow2.setChecked(true); } out_hiLow2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow2.isChecked()) { allDigOut2.setChecked(true); } else { allDigOut2.setChecked(false); } } }); out_freq2 = (EditText) v.findViewById(R.id.out_freq2); out_freq2.setText(desiredFreq[2]); outFreqLabel2 = (TextView) v.findViewById(R.id.outfreq_label2); duty_freq2 = (EditText) v.findViewById(R.id.out_duty2); duty_freq2.setText(desiredDuty[2]); outDutyLabel2 = (TextView) v.findViewById(R.id.outduty_label2); rg18 = (RadioGroup) v.findViewById(R.id.radioGroupOut2); if (isDigCh[2]) { out_hiLow2.setVisibility(View.VISIBLE); out_freq2.setVisibility(View.GONE); duty_freq2.setVisibility(View.GONE); isDigCh2 = true; outFreqLabel2.setVisibility(View.INVISIBLE); outDutyLabel2.setVisibility(View.INVISIBLE); rg18.check(R.id.out_digital2); } else { out_hiLow2.setVisibility(View.GONE); out_freq2.setVisibility(View.VISIBLE); duty_freq2.setVisibility(View.VISIBLE); isDigCh2 = false; outFreqLabel2.setVisibility(View.VISIBLE); outDutyLabel2.setVisibility(View.VISIBLE); rg18.check(R.id.pulse2); } rg18.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital2) { out_hiLow2.setVisibility(View.VISIBLE); isDigCh2 = true; out_freq2.setVisibility(View.GONE); duty_freq2.setVisibility(View.GONE); outFreqLabel2.setVisibility(View.INVISIBLE); outDutyLabel2.setVisibility(View.INVISIBLE); allDigOut2.setVisibility(View.VISIBLE); allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow2.setVisibility(View.GONE); isDigCh2 = false; out_freq2.setVisibility(View.VISIBLE); duty_freq2.setVisibility(View.VISIBLE); outFreqLabel2.setVisibility(View.VISIBLE); outDutyLabel2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqOut2.setVisibility(View.VISIBLE); allFreqLabel2.setVisibility(View.VISIBLE); allDutyOut2.setVisibility(View.VISIBLE); allDutyLabel2.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg18.check(R.id.out_digital2); } } } }); out_freq2.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq2.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq2.setText("0"); getInputString(); } return true; } return false; } }); out_freq2.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq2.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq2.setText("0"); getInputString(); } return true; } return false; } }); outputsRow3 = (TableRow) v.findViewById(R.id.outputsRow4); if (!isOutputCh[3]) { outputsRow3.setVisibility(View.GONE); } out_hiLow3 = (CheckBox) v.findViewById(R.id.out_hi_low3); if (outputState[3]) { out_hiLow3.setChecked(true); } out_hiLow3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow3.isChecked()) { allDigOut3.setChecked(true); } else { allDigOut3.setChecked(false); } } }); out_freq3 = (EditText) v.findViewById(R.id.out_freq3); out_freq3.setText(desiredFreq[3]); outFreqLabel3 = (TextView) v.findViewById(R.id.outfreq_label3); duty_freq3 = (EditText) v.findViewById(R.id.out_duty3); duty_freq3.setText(desiredDuty[3]); outDutyLabel3 = (TextView) v.findViewById(R.id.outduty_label3); rg19 = (RadioGroup) v.findViewById(R.id.radioGroupOut3); if (isDigCh[3]) { out_hiLow3.setVisibility(View.VISIBLE); out_freq3.setVisibility(View.GONE); duty_freq3.setVisibility(View.GONE); isDigCh3 = true; outFreqLabel3.setVisibility(View.INVISIBLE); outDutyLabel3.setVisibility(View.INVISIBLE); rg19.check(R.id.out_digital3); } else { out_hiLow3.setVisibility(View.GONE); out_freq3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); isDigCh3 = false; outFreqLabel3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); rg19.check(R.id.pulse3); } rg19.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital3) { out_hiLow3.setVisibility(View.VISIBLE); isDigCh3 = true; out_freq3.setVisibility(View.GONE); duty_freq3.setVisibility(View.GONE); outFreqLabel3.setVisibility(View.INVISIBLE); outDutyLabel3.setVisibility(View.INVISIBLE); allDigOut3.setVisibility(View.VISIBLE); allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow3.setVisibility(View.GONE); isDigCh3 = false; out_freq3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); outFreqLabel3.setVisibility(View.VISIBLE); outDutyLabel3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqOut3.setVisibility(View.VISIBLE); allFreqLabel3.setVisibility(View.VISIBLE); allDutyOut3.setVisibility(View.VISIBLE); allDutyLabel3.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg19.check(R.id.out_digital3); } } } }); out_freq3.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq3.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq3.setText("0"); getInputString(); } return true; } return false; } }); out_freq3.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq3.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq3.setText("0"); getInputString(); } return true; } return false; } }); outputsRow4 = (TableRow) v.findViewById(R.id.outputsRow5); if (!isOutputCh[4]) { outputsRow4.setVisibility(View.GONE); } out_hiLow4 = (CheckBox) v.findViewById(R.id.out_hi_low4); if (outputState[4]) { out_hiLow4.setChecked(true); } out_hiLow4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow4.isChecked()) { allDigOut4.setChecked(true); } else { allDigOut4.setChecked(false); } } }); out_freq4 = (EditText) v.findViewById(R.id.out_freq4); out_freq4.setText(desiredFreq[4]); outFreqLabel4 = (TextView) v.findViewById(R.id.outfreq_label4); duty_freq4 = (EditText) v.findViewById(R.id.out_duty4); duty_freq4.setText(desiredDuty[4]); outDutyLabel4 = (TextView) v.findViewById(R.id.outduty_label4); rg20 = (RadioGroup) v.findViewById(R.id.radioGroupOut4); if (isDigCh[4]) { out_hiLow4.setVisibility(View.VISIBLE); out_freq4.setVisibility(View.GONE); duty_freq4.setVisibility(View.GONE); isDigCh4 = true; outFreqLabel4.setVisibility(View.INVISIBLE); outDutyLabel4.setVisibility(View.INVISIBLE); rg20.check(R.id.out_digital4); } else { out_hiLow4.setVisibility(View.GONE); out_freq4.setVisibility(View.VISIBLE); duty_freq4.setVisibility(View.VISIBLE); isDigCh4 = false; outFreqLabel4.setVisibility(View.VISIBLE); outDutyLabel4.setVisibility(View.VISIBLE); rg20.check(R.id.pulse4); } rg20.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital4) { out_hiLow4.setVisibility(View.VISIBLE); isDigCh4 = true; out_freq4.setVisibility(View.GONE); duty_freq4.setVisibility(View.GONE); outFreqLabel4.setVisibility(View.INVISIBLE); outDutyLabel4.setVisibility(View.INVISIBLE); allDigOut4.setVisibility(View.VISIBLE); allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow4.setVisibility(View.GONE); isDigCh4 = false; out_freq4.setVisibility(View.VISIBLE); duty_freq4.setVisibility(View.VISIBLE); outFreqLabel4.setVisibility(View.VISIBLE); outDutyLabel4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqOut4.setVisibility(View.VISIBLE); allFreqLabel4.setVisibility(View.VISIBLE); allDutyOut4.setVisibility(View.VISIBLE); allDutyLabel4.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg20.check(R.id.out_digital4); } } } }); out_freq4.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq4.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq4.setText("0"); getInputString(); } return true; } return false; } }); out_freq4.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq4.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq4.setText("0"); getInputString(); } return true; } return false; } }); outputsRow5 = (TableRow) v.findViewById(R.id.outputsRow6); if (!isOutputCh[5]) { outputsRow5.setVisibility(View.GONE); } out_hiLow5 = (CheckBox) v.findViewById(R.id.out_hi_low5); if (outputState[5]) { out_hiLow5.setChecked(true); } out_hiLow5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow5.isChecked()) { allDigOut5.setChecked(true); } else { allDigOut5.setChecked(false); } } }); out_freq5 = (EditText) v.findViewById(R.id.out_freq5); out_freq5.setText(desiredFreq[5]); outFreqLabel5 = (TextView) v.findViewById(R.id.outfreq_label5); duty_freq5 = (EditText) v.findViewById(R.id.out_duty5); duty_freq5.setText(desiredDuty[5]); outDutyLabel5 = (TextView) v.findViewById(R.id.outduty_label5); rg21 = (RadioGroup) v.findViewById(R.id.radioGroupOut5); if (isDigCh[5]) { out_hiLow5.setVisibility(View.VISIBLE); out_freq5.setVisibility(View.GONE); duty_freq5.setVisibility(View.GONE); isDigCh5 = true; outFreqLabel5.setVisibility(View.INVISIBLE); outDutyLabel5.setVisibility(View.INVISIBLE); rg21.check(R.id.out_digital5); } else { out_hiLow5.setVisibility(View.GONE); out_freq5.setVisibility(View.VISIBLE); duty_freq5.setVisibility(View.VISIBLE); isDigCh5 = false; outFreqLabel5.setVisibility(View.VISIBLE); outDutyLabel5.setVisibility(View.VISIBLE); rg21.check(R.id.pulse5); } rg21.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital5) { out_hiLow5.setVisibility(View.VISIBLE); isDigCh5 = true; out_freq5.setVisibility(View.GONE); duty_freq5.setVisibility(View.GONE); outFreqLabel5.setVisibility(View.INVISIBLE); outDutyLabel5.setVisibility(View.INVISIBLE); allDigOut5.setVisibility(View.VISIBLE); allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow5.setVisibility(View.GONE); isDigCh5 = false; out_freq5.setVisibility(View.VISIBLE); duty_freq5.setVisibility(View.VISIBLE); outFreqLabel5.setVisibility(View.VISIBLE); outDutyLabel5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqOut5.setVisibility(View.VISIBLE); allFreqLabel5.setVisibility(View.VISIBLE); allDutyOut5.setVisibility(View.VISIBLE); allDutyLabel5.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg21.check(R.id.out_digital5); } } } }); out_freq5.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq5.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq5.setText("0"); getInputString(); } return true; } return false; } }); out_freq5.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq5.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq5.setText("0"); getInputString(); } return true; } return false; } }); outputsRow6 = (TableRow) v.findViewById(R.id.outputsRow7); if (!isOutputCh[6]) { outputsRow6.setVisibility(View.GONE); } out_hiLow6 = (CheckBox) v.findViewById(R.id.out_hi_low6); if (outputState[6]) { out_hiLow6.setChecked(true); } out_hiLow6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow6.isChecked()) { allDigOut6.setChecked(true); } else { allDigOut6.setChecked(false); } } }); out_freq6 = (EditText) v.findViewById(R.id.out_freq6); out_freq6.setText(desiredFreq[6]); outFreqLabel6 = (TextView) v.findViewById(R.id.outfreq_label6); duty_freq6 = (EditText) v.findViewById(R.id.out_duty6); duty_freq6.setText(desiredDuty[6]); outDutyLabel6 = (TextView) v.findViewById(R.id.outduty_label6); rg22 = (RadioGroup) v.findViewById(R.id.radioGroupOut6); if (isDigCh[6]) { out_hiLow6.setVisibility(View.VISIBLE); out_freq6.setVisibility(View.GONE); duty_freq6.setVisibility(View.GONE); isDigCh6 = true; outFreqLabel6.setVisibility(View.INVISIBLE); outDutyLabel6.setVisibility(View.INVISIBLE); rg22.check(R.id.out_digital6); } else { out_hiLow6.setVisibility(View.GONE); out_freq6.setVisibility(View.VISIBLE); duty_freq6.setVisibility(View.VISIBLE); isDigCh6 = false; outFreqLabel6.setVisibility(View.VISIBLE); outDutyLabel6.setVisibility(View.VISIBLE); rg22.check(R.id.pulse6); } rg22.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital6) { out_hiLow6.setVisibility(View.VISIBLE); isDigCh6 = true; out_freq6.setVisibility(View.GONE); duty_freq6.setVisibility(View.GONE); outFreqLabel6.setVisibility(View.INVISIBLE); outDutyLabel6.setVisibility(View.INVISIBLE); allDigOut6.setVisibility(View.VISIBLE); allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow6.setVisibility(View.GONE); isDigCh6 = false; out_freq6.setVisibility(View.VISIBLE); duty_freq6.setVisibility(View.VISIBLE); outFreqLabel6.setVisibility(View.VISIBLE); outDutyLabel6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqOut6.setVisibility(View.VISIBLE); allFreqLabel6.setVisibility(View.VISIBLE); allDutyOut6.setVisibility(View.VISIBLE); allDutyLabel6.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg22.check(R.id.out_digital6); } } } }); out_freq6.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq6.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq6.setText("0"); getInputString(); } return true; } return false; } }); out_freq6.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq6.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq6.setText("0"); getInputString(); } return true; } return false; } }); outputsRow7 = (TableRow) v.findViewById(R.id.outputsRow8); if (!isOutputCh[7]) { outputsRow7.setVisibility(View.GONE); } out_hiLow7 = (CheckBox) v.findViewById(R.id.out_hi_low7); if (outputState[7]) { out_hiLow7.setChecked(true); } out_hiLow7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow7.isChecked()) { allDigOut7.setChecked(true); } else { allDigOut7.setChecked(false); } } }); out_freq7 = (EditText) v.findViewById(R.id.out_freq7); out_freq7.setText(desiredFreq[7]); outFreqLabel7 = (TextView) v.findViewById(R.id.outfreq_label7); duty_freq7 = (EditText) v.findViewById(R.id.out_duty7); duty_freq7.setText(desiredDuty[7]); outDutyLabel7 = (TextView) v.findViewById(R.id.outduty_label7); rg23 = (RadioGroup) v.findViewById(R.id.radioGroupOut7); if (isDigCh[7]) { out_hiLow7.setVisibility(View.VISIBLE); out_freq7.setVisibility(View.GONE); duty_freq7.setVisibility(View.GONE); isDigCh7 = true; outFreqLabel7.setVisibility(View.INVISIBLE); outDutyLabel7.setVisibility(View.INVISIBLE); rg23.check(R.id.out_digital7); } else { out_hiLow7.setVisibility(View.GONE); out_freq7.setVisibility(View.VISIBLE); duty_freq7.setVisibility(View.VISIBLE); isDigCh7 = false; outFreqLabel7.setVisibility(View.VISIBLE); outDutyLabel7.setVisibility(View.VISIBLE); rg23.check(R.id.pulse7); } rg23.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital7) { out_hiLow7.setVisibility(View.VISIBLE); isDigCh7 = true; out_freq7.setVisibility(View.GONE); duty_freq7.setVisibility(View.GONE); outFreqLabel7.setVisibility(View.INVISIBLE); outDutyLabel7.setVisibility(View.INVISIBLE); allDigOut7.setVisibility(View.VISIBLE); allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow7.setVisibility(View.GONE); isDigCh7 = false; out_freq7.setVisibility(View.VISIBLE); duty_freq7.setVisibility(View.VISIBLE); outFreqLabel7.setVisibility(View.VISIBLE); outDutyLabel7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqOut7.setVisibility(View.VISIBLE); allFreqLabel7.setVisibility(View.VISIBLE); allDutyOut7.setVisibility(View.VISIBLE); allDutyLabel7.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg23.check(R.id.out_digital7); } } } }); out_freq7.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq7.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq7.setText("0"); getInputString(); } return true; } return false; } }); out_freq7.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq7.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq7.setText("0"); getInputString(); } return true; } return false; } }); outputsRow8 = (TableRow) v.findViewById(R.id.outputsRow9); if (!isOutputCh[8]) { outputsRow8.setVisibility(View.GONE); } out_hiLow8 = (CheckBox) v.findViewById(R.id.out_hi_low8); if (outputState[8]) { out_hiLow8.setChecked(true); } out_hiLow8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow8.isChecked()) { allDigOut8.setChecked(true); } else { allDigOut8.setChecked(false); } } }); out_freq8 = (EditText) v.findViewById(R.id.out_freq8); out_freq8.setText(desiredFreq[8]); outFreqLabel8 = (TextView) v.findViewById(R.id.outfreq_label8); duty_freq8 = (EditText) v.findViewById(R.id.out_duty8); duty_freq8.setText(desiredDuty[8]); outDutyLabel8 = (TextView) v.findViewById(R.id.outduty_label8); rg24 = (RadioGroup) v.findViewById(R.id.radioGroupOut8); if (isDigCh[8]) { out_hiLow8.setVisibility(View.VISIBLE); out_freq8.setVisibility(View.GONE); duty_freq8.setVisibility(View.GONE); isDigCh8 = true; outFreqLabel8.setVisibility(View.INVISIBLE); outDutyLabel8.setVisibility(View.INVISIBLE); rg24.check(R.id.out_digital8); } else { out_hiLow8.setVisibility(View.GONE); out_freq8.setVisibility(View.VISIBLE); duty_freq8.setVisibility(View.VISIBLE); isDigCh8 = false; outFreqLabel8.setVisibility(View.VISIBLE); outDutyLabel8.setVisibility(View.VISIBLE); rg24.check(R.id.pulse8); } rg24.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital8) { out_hiLow8.setVisibility(View.VISIBLE); isDigCh8 = true; out_freq8.setVisibility(View.GONE); duty_freq8.setVisibility(View.GONE); outFreqLabel8.setVisibility(View.INVISIBLE); outDutyLabel8.setVisibility(View.INVISIBLE); allDigOut8.setVisibility(View.VISIBLE); allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); ; } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow8.setVisibility(View.GONE); isDigCh8 = false; out_freq8.setVisibility(View.VISIBLE); duty_freq8.setVisibility(View.VISIBLE); outFreqLabel8.setVisibility(View.VISIBLE); outDutyLabel8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqOut8.setVisibility(View.VISIBLE); allFreqLabel8.setVisibility(View.VISIBLE); allDutyOut8.setVisibility(View.VISIBLE); allDutyLabel8.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg24.check(R.id.out_digital8); } } } }); out_freq8.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq8.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq8.setText("0"); getInputString(); } return true; } return false; } }); out_freq8.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq8.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq8.setText("0"); getInputString(); } return true; } return false; } }); outputsRow9 = (TableRow) v.findViewById(R.id.outputsRow10); if (!isOutputCh[9]) { outputsRow9.setVisibility(View.GONE); } out_hiLow9 = (CheckBox) v.findViewById(R.id.out_hi_low9); if (outputState[9]) { out_hiLow9.setChecked(true); } out_hiLow9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow9.isChecked()) { allDigOut9.setChecked(true); } else { allDigOut9.setChecked(false); } } }); out_freq9 = (EditText) v.findViewById(R.id.out_freq9); out_freq9.setText(desiredFreq[9]); outFreqLabel9 = (TextView) v.findViewById(R.id.outfreq_label9); duty_freq9 = (EditText) v.findViewById(R.id.out_duty9); duty_freq9.setText(desiredDuty[9]); outDutyLabel9 = (TextView) v.findViewById(R.id.outduty_label9); rg25 = (RadioGroup) v.findViewById(R.id.radioGroupOut9); if (isDigCh[9]) { out_hiLow9.setVisibility(View.VISIBLE); out_freq9.setVisibility(View.GONE); duty_freq9.setVisibility(View.GONE); isDigCh9 = true; outFreqLabel9.setVisibility(View.INVISIBLE); outDutyLabel9.setVisibility(View.INVISIBLE); rg25.check(R.id.out_digital9); } else { out_hiLow9.setVisibility(View.GONE); out_freq9.setVisibility(View.VISIBLE); duty_freq9.setVisibility(View.VISIBLE); isDigCh9 = false; outFreqLabel9.setVisibility(View.VISIBLE); outDutyLabel9.setVisibility(View.VISIBLE); rg25.check(R.id.pulse9); } rg25.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital9) { out_hiLow9.setVisibility(View.VISIBLE); isDigCh9 = true; out_freq9.setVisibility(View.GONE); duty_freq9.setVisibility(View.GONE); outFreqLabel9.setVisibility(View.INVISIBLE); outDutyLabel9.setVisibility(View.INVISIBLE); allDigOut9.setVisibility(View.VISIBLE); allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow9.setVisibility(View.GONE); isDigCh9 = false; out_freq9.setVisibility(View.VISIBLE); duty_freq9.setVisibility(View.VISIBLE); outFreqLabel9.setVisibility(View.VISIBLE); outDutyLabel9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqOut9.setVisibility(View.VISIBLE); allFreqLabel9.setVisibility(View.VISIBLE); allDutyOut9.setVisibility(View.VISIBLE); allDutyLabel9.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg25.check(R.id.out_digital9); } } } }); out_freq9.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq9.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq9.setText("0"); getInputString(); } return true; } return false; } }); out_freq9.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq9.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq9.setText("0"); getInputString(); } return true; } return false; } }); outputsRow10 = (TableRow) v.findViewById(R.id.outputsRow11); if (!isOutputCh[10]) { outputsRow10.setVisibility(View.GONE); } out_hiLow10 = (CheckBox) v.findViewById(R.id.out_hi_low10); if (outputState[10]) { out_hiLow10.setChecked(true); } out_hiLow10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow10.isChecked()) { allDigOut10.setChecked(true); } else { allDigOut10.setChecked(false); } } }); out_freq10 = (EditText) v.findViewById(R.id.out_freq10); out_freq10.setText(desiredFreq[10]); outFreqLabel10 = (TextView) v.findViewById(R.id.outfreq_label10); duty_freq10 = (EditText) v.findViewById(R.id.out_duty10); duty_freq10.setText(desiredDuty[10]); outDutyLabel10 = (TextView) v.findViewById(R.id.outduty_label10); rg26 = (RadioGroup) v.findViewById(R.id.radioGroupOut10); if (isDigCh[10]) { out_hiLow10.setVisibility(View.VISIBLE); out_freq10.setVisibility(View.GONE); duty_freq10.setVisibility(View.GONE); isDigCh10 = true; outFreqLabel10.setVisibility(View.INVISIBLE); outDutyLabel10.setVisibility(View.INVISIBLE); rg26.check(R.id.out_digital10); } else { out_hiLow10.setVisibility(View.GONE); out_freq10.setVisibility(View.VISIBLE); duty_freq10.setVisibility(View.VISIBLE); isDigCh10 = false; outFreqLabel10.setVisibility(View.VISIBLE); outDutyLabel10.setVisibility(View.VISIBLE); rg26.check(R.id.pulse10); } rg26.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital10) { out_hiLow10.setVisibility(View.VISIBLE); isDigCh10 = true; out_freq10.setVisibility(View.GONE); duty_freq10.setVisibility(View.GONE); outFreqLabel10.setVisibility(View.INVISIBLE); outDutyLabel10.setVisibility(View.INVISIBLE); allDigOut10.setVisibility(View.VISIBLE); allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow10.setVisibility(View.GONE); isDigCh10 = false; out_freq10.setVisibility(View.VISIBLE); duty_freq10.setVisibility(View.VISIBLE); outFreqLabel10.setVisibility(View.VISIBLE); outDutyLabel10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqOut10.setVisibility(View.VISIBLE); allFreqLabel10.setVisibility(View.VISIBLE); allDutyOut10.setVisibility(View.VISIBLE); allDutyLabel10.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg26.check(R.id.out_digital10); } } } }); out_freq10.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq10.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq10.setText("0"); getInputString(); } return true; } return false; } }); out_freq10.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq10.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq10.setText("0"); getInputString(); } return true; } return false; } }); outputsRow11 = (TableRow) v.findViewById(R.id.outputsRow12); if (!isOutputCh[11]) { outputsRow11.setVisibility(View.GONE); } out_hiLow11 = (CheckBox) v.findViewById(R.id.out_hi_low11); if (outputState[11]) { out_hiLow11.setChecked(true); } out_hiLow11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow11.isChecked()) { allDigOut11.setChecked(true); } else { allDigOut11.setChecked(false); } } }); out_freq11 = (EditText) v.findViewById(R.id.out_freq11); out_freq11.setText(desiredFreq[11]); outFreqLabel11 = (TextView) v.findViewById(R.id.outfreq_label11); duty_freq11 = (EditText) v.findViewById(R.id.out_duty11); duty_freq11.setText(desiredDuty[11]); outDutyLabel11 = (TextView) v.findViewById(R.id.outduty_label11); rg27 = (RadioGroup) v.findViewById(R.id.radioGroupOut11); if (isDigCh[11]) { out_hiLow11.setVisibility(View.VISIBLE); out_freq11.setVisibility(View.GONE); duty_freq11.setVisibility(View.GONE); isDigCh11 = true; outFreqLabel11.setVisibility(View.INVISIBLE); outDutyLabel11.setVisibility(View.INVISIBLE); rg27.check(R.id.out_digital11); } else { out_hiLow11.setVisibility(View.GONE); out_freq11.setVisibility(View.VISIBLE); duty_freq11.setVisibility(View.VISIBLE); isDigCh11 = false; outFreqLabel11.setVisibility(View.VISIBLE); outDutyLabel11.setVisibility(View.VISIBLE); rg27.check(R.id.pulse11); } rg27.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital11) { out_hiLow11.setVisibility(View.VISIBLE); isDigCh11 = true; out_freq11.setVisibility(View.GONE); duty_freq11.setVisibility(View.GONE); outFreqLabel11.setVisibility(View.INVISIBLE); outDutyLabel11.setVisibility(View.INVISIBLE); allDigOut11.setVisibility(View.VISIBLE); allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow11.setVisibility(View.GONE); isDigCh11 = false; out_freq11.setVisibility(View.VISIBLE); duty_freq11.setVisibility(View.VISIBLE); outFreqLabel11.setVisibility(View.VISIBLE); outDutyLabel11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqOut11.setVisibility(View.VISIBLE); allFreqLabel11.setVisibility(View.VISIBLE); allDutyOut11.setVisibility(View.VISIBLE); allDutyLabel11.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg27.check(R.id.out_digital11); } } } }); out_freq11.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq11.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq11.setText("0"); getInputString(); } return true; } return false; } }); out_freq11.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq11.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq11.setText("0"); getInputString(); } return true; } return false; } }); outputsRow12 = (TableRow) v.findViewById(R.id.outputsRow13); if (!isOutputCh[12]) { outputsRow12.setVisibility(View.GONE); } out_hiLow12 = (CheckBox) v.findViewById(R.id.out_hi_low12); if (outputState[12]) { out_hiLow12.setChecked(true); } out_hiLow12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow12.isChecked()) { allDigOut12.setChecked(true); } else { allDigOut12.setChecked(false); } } }); out_freq12 = (EditText) v.findViewById(R.id.out_freq12); out_freq12.setText(desiredFreq[12]); outFreqLabel12 = (TextView) v.findViewById(R.id.outfreq_label12); duty_freq12 = (EditText) v.findViewById(R.id.out_duty12); duty_freq12.setText(desiredDuty[12]); outDutyLabel12 = (TextView) v.findViewById(R.id.outduty_label12); rg28 = (RadioGroup) v.findViewById(R.id.radioGroupOut12); if (isDigCh[12]) { out_hiLow12.setVisibility(View.VISIBLE); out_freq12.setVisibility(View.GONE); duty_freq12.setVisibility(View.GONE); isDigCh12 = true; outFreqLabel12.setVisibility(View.INVISIBLE); outDutyLabel12.setVisibility(View.INVISIBLE); rg28.check(R.id.out_digital12); } else { out_hiLow12.setVisibility(View.GONE); out_freq12.setVisibility(View.VISIBLE); duty_freq12.setVisibility(View.VISIBLE); isDigCh12 = false; outFreqLabel12.setVisibility(View.VISIBLE); outDutyLabel12.setVisibility(View.VISIBLE); rg28.check(R.id.pulse12); } rg28.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital12) { out_hiLow12.setVisibility(View.VISIBLE); isDigCh12 = true; out_freq12.setVisibility(View.GONE); duty_freq12.setVisibility(View.GONE); outFreqLabel12.setVisibility(View.INVISIBLE); outDutyLabel12.setVisibility(View.INVISIBLE); allDigOut12.setVisibility(View.VISIBLE); allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow12.setVisibility(View.GONE); isDigCh12 = false; out_freq12.setVisibility(View.VISIBLE); duty_freq12.setVisibility(View.VISIBLE); outFreqLabel12.setVisibility(View.VISIBLE); outDutyLabel12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqOut12.setVisibility(View.VISIBLE); allFreqLabel12.setVisibility(View.VISIBLE); allDutyOut12.setVisibility(View.VISIBLE); allDutyLabel12.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg28.check(R.id.out_digital12); } } } }); out_freq12.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq12.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq12.setText("0"); getInputString(); } return true; } return false; } }); out_freq12.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq12.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq12.setText("0"); getInputString(); } return true; } return false; } }); outputsRow13 = (TableRow) v.findViewById(R.id.outputsRow14); if (!isOutputCh[13]) { outputsRow13.setVisibility(View.GONE); } out_hiLow13 = (CheckBox) v.findViewById(R.id.out_hi_low13); if (outputState[13]) { out_hiLow13.setChecked(true); } out_hiLow13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow13.isChecked()) { allDigOut13.setChecked(true); } else { allDigOut13.setChecked(false); } } }); out_freq13 = (EditText) v.findViewById(R.id.out_freq13); out_freq13.setText(desiredFreq[13]); outFreqLabel13 = (TextView) v.findViewById(R.id.outfreq_label13); duty_freq13 = (EditText) v.findViewById(R.id.out_duty13); duty_freq13.setText(desiredDuty[13]); outDutyLabel13 = (TextView) v.findViewById(R.id.outduty_label13); rg29 = (RadioGroup) v.findViewById(R.id.radioGroupOut13); if (isDigCh[13]) { out_hiLow13.setVisibility(View.VISIBLE); out_freq13.setVisibility(View.GONE); duty_freq13.setVisibility(View.GONE); isDigCh13 = true; outFreqLabel13.setVisibility(View.INVISIBLE); outDutyLabel13.setVisibility(View.INVISIBLE); rg29.check(R.id.out_digital13); } else { out_hiLow13.setVisibility(View.GONE); out_freq13.setVisibility(View.VISIBLE); duty_freq13.setVisibility(View.VISIBLE); isDigCh13 = false; outFreqLabel13.setVisibility(View.VISIBLE); outDutyLabel13.setVisibility(View.VISIBLE); rg29.check(R.id.pulse13); } rg29.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital13) { out_hiLow13.setVisibility(View.VISIBLE); isDigCh13 = true; out_freq13.setVisibility(View.GONE); duty_freq13.setVisibility(View.GONE); outFreqLabel13.setVisibility(View.INVISIBLE); outDutyLabel13.setVisibility(View.INVISIBLE); allDigOut13.setVisibility(View.VISIBLE); allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow13.setVisibility(View.GONE); isDigCh13 = false; out_freq13.setVisibility(View.VISIBLE); duty_freq13.setVisibility(View.VISIBLE); outFreqLabel13.setVisibility(View.VISIBLE); outDutyLabel13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqOut13.setVisibility(View.VISIBLE); allFreqLabel13.setVisibility(View.VISIBLE); allDutyOut13.setVisibility(View.VISIBLE); allDutyLabel13.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg29.check(R.id.out_digital13); } } } }); out_freq13.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq13.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq13.setText("0"); getInputString(); } return true; } return false; } }); out_freq13.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq13.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq13.setText("0"); getInputString(); } return true; } return false; } }); outputsRow14 = (TableRow) v.findViewById(R.id.outputsRow15); if (!isOutputCh[14]) { outputsRow14.setVisibility(View.GONE); } out_hiLow14 = (CheckBox) v.findViewById(R.id.out_hi_low14); if (outputState[14]) { out_hiLow14.setChecked(true); } out_hiLow14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow14.isChecked()) { allDigOut14.setChecked(true); } else { allDigOut14.setChecked(false); } } }); out_freq14 = (EditText) v.findViewById(R.id.out_freq14); out_freq14.setText(desiredFreq[14]); outFreqLabel14 = (TextView) v.findViewById(R.id.outfreq_label14); duty_freq14 = (EditText) v.findViewById(R.id.out_duty14); duty_freq14.setText(desiredDuty[14]); outDutyLabel14 = (TextView) v.findViewById(R.id.outduty_label14); rg30 = (RadioGroup) v.findViewById(R.id.radioGroupOut14); if (isDigCh[14]) { out_hiLow14.setVisibility(View.VISIBLE); out_freq14.setVisibility(View.GONE); duty_freq14.setVisibility(View.GONE); isDigCh14 = true; outFreqLabel14.setVisibility(View.INVISIBLE); outDutyLabel14.setVisibility(View.INVISIBLE); rg30.check(R.id.out_digital14); } else { out_hiLow14.setVisibility(View.GONE); out_freq14.setVisibility(View.VISIBLE); duty_freq14.setVisibility(View.VISIBLE); isDigCh14 = false; outFreqLabel14.setVisibility(View.VISIBLE); outDutyLabel14.setVisibility(View.VISIBLE); rg30.check(R.id.pulse14); } rg30.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital14) { out_hiLow14.setVisibility(View.VISIBLE); isDigCh14 = true; out_freq14.setVisibility(View.GONE); duty_freq14.setVisibility(View.GONE); outFreqLabel14.setVisibility(View.INVISIBLE); outDutyLabel14.setVisibility(View.INVISIBLE); allDigOut14.setVisibility(View.VISIBLE); allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { //Log.e("Test", "Number of pulsed inputs: " + getPulsedOutputs(getOutputChannels()).size()); if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow14.setVisibility(View.GONE); isDigCh14 = false; out_freq14.setVisibility(View.VISIBLE); duty_freq14.setVisibility(View.VISIBLE); outFreqLabel14.setVisibility(View.VISIBLE); outDutyLabel14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqOut14.setVisibility(View.VISIBLE); allFreqLabel14.setVisibility(View.VISIBLE); allDutyOut14.setVisibility(View.VISIBLE); allDutyLabel14.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg30.check(R.id.out_digital14); } } } }); out_freq14.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq14.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq14.setText("0"); getInputString(); } return true; } return false; } }); out_freq14.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq14.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq14.setText("0"); getInputString(); } return true; } return false; } }); outputsRow15 = (TableRow) v.findViewById(R.id.outputsRow16); if (!isOutputCh[15]) { outputsRow15.setVisibility(View.GONE); } out_hiLow15 = (CheckBox) v.findViewById(R.id.out_hi_low15); if (outputState[15]) { out_hiLow15.setChecked(true); } out_hiLow15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow15.isChecked()) { allDigOut15.setChecked(true); } else { allDigOut15.setChecked(false); } } }); out_freq15 = (EditText) v.findViewById(R.id.out_freq15); out_freq15.setText(desiredFreq[15]); outFreqLabel15 = (TextView) v.findViewById(R.id.outfreq_label15); duty_freq15 = (EditText) v.findViewById(R.id.out_duty15); duty_freq15.setText(desiredDuty[15]); outDutyLabel15 = (TextView) v.findViewById(R.id.outduty_label15); rg31 = (RadioGroup) v.findViewById(R.id.radioGroupOut15); if (isDigCh[15]) { out_hiLow15.setVisibility(View.VISIBLE); out_freq15.setVisibility(View.GONE); duty_freq15.setVisibility(View.GONE); isDigCh15 = true; outFreqLabel15.setVisibility(View.INVISIBLE); outDutyLabel15.setVisibility(View.INVISIBLE); rg31.check(R.id.out_digital15); } else { out_hiLow15.setVisibility(View.GONE); out_freq15.setVisibility(View.VISIBLE); duty_freq15.setVisibility(View.VISIBLE); isDigCh15 = false; outFreqLabel15.setVisibility(View.VISIBLE); outDutyLabel15.setVisibility(View.VISIBLE); rg31.check(R.id.pulse15); } rg31.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital15) { out_hiLow15.setVisibility(View.VISIBLE); isDigCh15 = true; out_freq15.setVisibility(View.GONE); duty_freq15.setVisibility(View.GONE); outFreqLabel15.setVisibility(View.INVISIBLE); outDutyLabel15.setVisibility(View.INVISIBLE); allDigOut15.setVisibility(View.VISIBLE); allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow15.setVisibility(View.GONE); isDigCh15 = false; out_freq15.setVisibility(View.VISIBLE); duty_freq15.setVisibility(View.VISIBLE); outFreqLabel15.setVisibility(View.VISIBLE); outDutyLabel15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqOut15.setVisibility(View.VISIBLE); allFreqLabel15.setVisibility(View.VISIBLE); allDutyOut15.setVisibility(View.VISIBLE); allDutyLabel15.setVisibility(View.VISIBLE); } else { ((AndroiDAQMain) context).showDialog(2); rg31.check(R.id.out_digital15); } } } }); out_freq15.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq15.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq15.setText("0"); getInputString(); } return true; } return false; } }); out_freq15.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq15.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq15.setText("0"); getInputString(); } return true; } return false; } }); break; case 3: resId = R.layout.voltages; v = inflater.inflate(resId, null, false); readVolts = (Button) v.findViewById(R.id.read_volts); voltsSV = (ScrollView) v.findViewById(R.id.scrollViewVolts); voltsSV.setScrollbarFadingEnabled(false); readVolts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //((AndroiDAQMain) context).getVolts(true); int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runVolts = false; } else { runVolts = true; ((AndroiDAQMain) context).getVolts(true); } } }); readContVolts = (Button) v.findViewById(R.id.read_cont_volts); readContVolts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //((AndroiDAQMain) context).getVolts(true); int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runContVolts = false; } else { if (!runContVolts) { readContVolts.setText("Stop Cont. Read Volts from AndroiDAQ"); runContVolts = true; ((AndroiDAQMain) context).getVoltsCont(true); } else { readContVolts.setText("Continuous Read Volts from AndroiDAQ"); runContVolts = false; ((AndroiDAQMain) context).stopContVolts(); } } } }); voltagesRow0 = (TableRow) v.findViewById(R.id.voltagesRow1); voltagesRow0.setVisibility(View.VISIBLE); volts1 = (TextView) v.findViewById(R.id.voltageReading1); voltagesRow1 = (TableRow) v.findViewById(R.id.voltagesRow2); voltagesRow1.setVisibility(View.VISIBLE); volts2 = (TextView) v.findViewById(R.id.voltageReading2); voltagesRow2 = (TableRow) v.findViewById(R.id.voltagesRow3); voltagesRow2.setVisibility(View.VISIBLE); volts3 = (TextView) v.findViewById(R.id.voltageReading3); voltagesRow3 = (TableRow) v.findViewById(R.id.voltagesRow4); voltagesRow3.setVisibility(View.VISIBLE); volts4 = (TextView) v.findViewById(R.id.voltageReading4); voltagesRow4 = (TableRow) v.findViewById(R.id.voltagesRow5); voltagesRow4.setVisibility(View.VISIBLE); volts5 = (TextView) v.findViewById(R.id.voltageReading5); voltagesRow5 = (TableRow) v.findViewById(R.id.voltagesRow6); voltagesRow5.setVisibility(View.VISIBLE); volts6 = (TextView) v.findViewById(R.id.voltageReading6); voltagesRow6 = (TableRow) v.findViewById(R.id.voltagesRow7); voltagesRow6.setVisibility(View.VISIBLE); volts7 = (TextView) v.findViewById(R.id.voltageReading7); voltagesRow7 = (TableRow) v.findViewById(R.id.voltagesRow8); voltagesRow7.setVisibility(View.VISIBLE); volts8 = (TextView) v.findViewById(R.id.voltageReading8); break; case 4: //TODO resId = R.layout.all; v = inflater.inflate(resId, null, false); setRun = (Button) v.findViewById(R.id.set_and_run); allSV = (ScrollView) v.findViewById(R.id.scrollViewAll); allSV.setScrollbarFadingEnabled(false); setRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runAll = false; } else { runAll = true; setProp(); } } }); allDigIn0 = (RadioButton) v.findViewById(R.id.all_hi_low0); allFreqIn0 = (TextView) v.findViewById(R.id.all_input_freq0); allDigOut0 = (CheckBox) v.findViewById(R.id.all_out_hi_low0); if (outputState[0]) { allDigOut0.setChecked(true); } allDigOut0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut0.isChecked()) { out_hiLow0.setChecked(true); } else { out_hiLow0.setChecked(false); } } }); allFreqOut0 = (EditText) v.findViewById(R.id.all_out_freq0); allFreqOut0.setText(desiredFreq[0]); allFreqLabel0 = (TextView) v.findViewById(R.id.all_freq_label0); allDutyOut0 = (EditText) v.findViewById(R.id.all_out_duty0); allDutyOut0.setText(desiredDuty[0]); allDutyLabel0 = (TextView) v.findViewById(R.id.all_outduty_label0); if (isOutputCh[0]) { // if channel is output allDigIn0.setVisibility(View.GONE); //don't display input widgets allFreqIn0.setVisibility(View.GONE); if (isDigCh0) { // if channel is digital allDigOut0.setVisibility(View.VISIBLE); //display digital widget allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut0.setVisibility(View.VISIBLE); //display count widget allDutyOut0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.VISIBLE); allDutyLabel0.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut0.setVisibility(View.GONE); //don't display output widgets allFreqOut0.setVisibility(View.GONE); allDutyOut0.setVisibility(View.GONE); if (isDigCh0) { // if channel is digital allDigIn0.setVisibility(View.VISIBLE); //display digital out widget allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn0.setVisibility(View.VISIBLE); // display pulse widget allDigIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.VISIBLE); } } allFreqOut0.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut0.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut0.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut0.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut0.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut0.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn1 = (RadioButton) v.findViewById(R.id.all_hi_low1); allFreqIn1 = (TextView) v.findViewById(R.id.all_input_freq1); allDigOut1 = (CheckBox) v.findViewById(R.id.all_out_hi_low1); if (outputState[1]) { allDigOut1.setChecked(true); } allDigOut1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut1.isChecked()) { out_hiLow1.setChecked(true); } else { out_hiLow1.setChecked(false); } } }); allFreqOut1 = (EditText) v.findViewById(R.id.all_out_freq1); allFreqOut1.setText(desiredFreq[1]); allFreqLabel1 = (TextView) v.findViewById(R.id.all_freq_label1); allDutyOut1 = (EditText) v.findViewById(R.id.all_out_duty1); allDutyOut1.setText(desiredDuty[1]); allDutyLabel1 = (TextView) v.findViewById(R.id.all_outduty_label1); if (isOutputCh[1]) { // if channel is output allDigIn1.setVisibility(View.GONE); //don't display input widgets allFreqIn1.setVisibility(View.GONE); if (isDigCh1) { // if channel is digital allDigOut1.setVisibility(View.VISIBLE); //display digital widget allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut1.setVisibility(View.VISIBLE); //display count widget allDutyOut1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.VISIBLE); allDutyLabel1.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut1.setVisibility(View.GONE); //don't display output widgets allFreqOut1.setVisibility(View.GONE); allDutyOut1.setVisibility(View.GONE); if (isDigCh1) { // if channel is digital allDigIn1.setVisibility(View.VISIBLE); //display digital out widget allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn1.setVisibility(View.VISIBLE); // display pulse widget allDigIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.VISIBLE); } } allFreqOut1.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut1.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut1.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut1.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut1.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut1.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn2 = (RadioButton) v.findViewById(R.id.all_hi_low2); allFreqIn2 = (TextView) v.findViewById(R.id.all_input_freq2); allDigOut2 = (CheckBox) v.findViewById(R.id.all_out_hi_low2); if (outputState[2]) { allDigOut2.setChecked(true); } allDigOut2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut2.isChecked()) { out_hiLow2.setChecked(true); } else { out_hiLow2.setChecked(false); } } }); allFreqOut2 = (EditText) v.findViewById(R.id.all_out_freq2); allFreqOut2.setText(desiredFreq[2]); allFreqLabel2 = (TextView) v.findViewById(R.id.all_freq_label2); allDutyOut2 = (EditText) v.findViewById(R.id.all_out_duty2); allDutyOut2.setText(desiredDuty[2]); allDutyLabel2 = (TextView) v.findViewById(R.id.all_outduty_label2); if (isOutputCh[2]) { // if channel is output allDigIn2.setVisibility(View.GONE); //don't display input widgets allFreqIn2.setVisibility(View.GONE); if (isDigCh2) { // if channel is digital allDigOut2.setVisibility(View.VISIBLE); //display digital widget allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut2.setVisibility(View.VISIBLE); //display count widget allDutyOut2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.VISIBLE); allDutyLabel2.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut2.setVisibility(View.GONE); //don't display output widgets allFreqOut2.setVisibility(View.GONE); allDutyOut2.setVisibility(View.GONE); if (isDigCh2) { // if channel is digital allDigIn2.setVisibility(View.VISIBLE); //display digital out widget allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn2.setVisibility(View.VISIBLE); // display pulse widget allDigIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.VISIBLE); } } allFreqOut2.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut2.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut2.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut2.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut2.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut2.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn3 = (RadioButton) v.findViewById(R.id.all_hi_low3); allFreqIn3 = (TextView) v.findViewById(R.id.all_input_freq3); allDigOut3 = (CheckBox) v.findViewById(R.id.all_out_hi_low3); if (outputState[3]) { allDigOut3.setChecked(true); } allDigOut3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut3.isChecked()) { out_hiLow3.setChecked(true); } else { out_hiLow3.setChecked(false); } } }); allFreqOut3 = (EditText) v.findViewById(R.id.all_out_freq3); allFreqOut3.setText(desiredFreq[3]); allFreqLabel3 = (TextView) v.findViewById(R.id.all_freq_label3); allDutyOut3 = (EditText) v.findViewById(R.id.all_out_duty3); allDutyOut3.setText(desiredDuty[3]); allDutyLabel3 = (TextView) v.findViewById(R.id.all_outduty_label3); if (isOutputCh[3]) { // if channel is output allDigIn3.setVisibility(View.GONE); //don't display input widgets allFreqIn3.setVisibility(View.GONE); if (isDigCh3) { // if channel is digital allDigOut3.setVisibility(View.VISIBLE); //display digital widget allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut3.setVisibility(View.VISIBLE); //display count widget allDutyOut3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.VISIBLE); allDutyLabel3.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut3.setVisibility(View.GONE); //don't display output widgets allFreqOut3.setVisibility(View.GONE); allDutyOut3.setVisibility(View.GONE); if (isDigCh3) { // if channel is digital allDigIn3.setVisibility(View.VISIBLE); //display digital out widget allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn3.setVisibility(View.VISIBLE); // display pulse widget allDigIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.VISIBLE); } } allFreqOut3.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut3.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut3.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut3.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut3.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut3.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn4 = (RadioButton) v.findViewById(R.id.all_hi_low4); allFreqIn4 = (TextView) v.findViewById(R.id.all_input_freq4); allDigOut4 = (CheckBox) v.findViewById(R.id.all_out_hi_low4); if (outputState[4]) { allDigOut4.setChecked(true); } allDigOut4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut4.isChecked()) { out_hiLow4.setChecked(true); } else { out_hiLow4.setChecked(false); } } }); allFreqOut4 = (EditText) v.findViewById(R.id.all_out_freq4); allFreqOut4.setText(desiredFreq[4]); allFreqLabel4 = (TextView) v.findViewById(R.id.all_freq_label4); allDutyOut4 = (EditText) v.findViewById(R.id.all_out_duty4); allDutyOut4.setText(desiredDuty[4]); allDutyLabel4 = (TextView) v.findViewById(R.id.all_outduty_label4); if (isOutputCh[4]) { // if channel is output allDigIn4.setVisibility(View.GONE); //don't display input widgets allFreqIn4.setVisibility(View.GONE); if (isDigCh4) { // if channel is digital allDigOut4.setVisibility(View.VISIBLE); //display digital widget allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut4.setVisibility(View.VISIBLE); //display count widget allDutyOut4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.VISIBLE); allDutyLabel4.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut4.setVisibility(View.GONE); //don't display output widgets allFreqOut4.setVisibility(View.GONE); allDutyOut4.setVisibility(View.GONE); if (isDigCh4) { // if channel is digital allDigIn4.setVisibility(View.VISIBLE); //display digital out widget allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn4.setVisibility(View.VISIBLE); // display pulse widget allDigIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.VISIBLE); } } allFreqOut4.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut4.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut4.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut4.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut4.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut4.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn5 = (RadioButton) v.findViewById(R.id.all_hi_low5); allFreqIn5 = (TextView) v.findViewById(R.id.all_input_freq5); allDigOut5 = (CheckBox) v.findViewById(R.id.all_out_hi_low5); if (outputState[5]) { allDigOut5.setChecked(true); } allDigOut5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut5.isChecked()) { out_hiLow5.setChecked(true); } else { out_hiLow5.setChecked(false); } } }); allFreqOut5 = (EditText) v.findViewById(R.id.all_out_freq5); allFreqOut5.setText(desiredFreq[5]); allFreqLabel5 = (TextView) v.findViewById(R.id.all_freq_label5); allDutyOut5 = (EditText) v.findViewById(R.id.all_out_duty5); allDutyOut5.setText(desiredDuty[5]); allDutyLabel5 = (TextView) v.findViewById(R.id.all_outduty_label5); if (isOutputCh[5]) { // if channel is output allDigIn5.setVisibility(View.GONE); //don't display input widgets allFreqIn5.setVisibility(View.GONE); if (isDigCh5) { // if channel is digital allDigOut5.setVisibility(View.VISIBLE); //display digital widget allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut5.setVisibility(View.VISIBLE); //display count widget allDutyOut5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.VISIBLE); allDutyLabel5.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut5.setVisibility(View.GONE); //don't display output widgets allFreqOut5.setVisibility(View.GONE); allDutyOut5.setVisibility(View.GONE); if (isDigCh5) { // if channel is digital allDigIn5.setVisibility(View.VISIBLE); //display digital out widget allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn5.setVisibility(View.VISIBLE); // display pulse widget allDigIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.VISIBLE); } } allFreqOut5.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut5.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut5.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut5.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut5.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut5.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn6 = (RadioButton) v.findViewById(R.id.all_hi_low6); allFreqIn6 = (TextView) v.findViewById(R.id.all_input_freq6); allDigOut6 = (CheckBox) v.findViewById(R.id.all_out_hi_low6); if (outputState[6]) { allDigOut6.setChecked(true); } allDigOut6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut6.isChecked()) { out_hiLow6.setChecked(true); } else { out_hiLow6.setChecked(false); } } }); allFreqOut6 = (EditText) v.findViewById(R.id.all_out_freq6); allFreqOut6.setText(desiredFreq[6]); allFreqLabel6 = (TextView) v.findViewById(R.id.all_freq_label6); allDutyOut6 = (EditText) v.findViewById(R.id.all_out_duty6); allDutyOut6.setText(desiredDuty[6]); allDutyLabel6 = (TextView) v.findViewById(R.id.all_outduty_label6); if (isOutputCh[6]) { // if channel is output allDigIn6.setVisibility(View.GONE); //don't display input widgets allFreqIn6.setVisibility(View.GONE); if (isDigCh6) { // if channel is digital allDigOut6.setVisibility(View.VISIBLE); //display digital widget allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut6.setVisibility(View.VISIBLE); //display count widget allDutyOut6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.VISIBLE); allDutyLabel6.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut6.setVisibility(View.GONE); //don't display output widgets allFreqOut6.setVisibility(View.GONE); allDutyOut6.setVisibility(View.GONE); if (isDigCh6) { // if channel is digital allDigIn6.setVisibility(View.VISIBLE); //display digital out widget allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn6.setVisibility(View.VISIBLE); // display pulse widget allDigIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.VISIBLE); } } allFreqOut6.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut6.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut6.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut6.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut6.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut6.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn7 = (RadioButton) v.findViewById(R.id.all_hi_low7); allFreqIn7 = (TextView) v.findViewById(R.id.all_input_freq7); allDigOut7 = (CheckBox) v.findViewById(R.id.all_out_hi_low7); if (outputState[7]) { allDigOut7.setChecked(true); } allDigOut7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut7.isChecked()) { out_hiLow7.setChecked(true); } else { out_hiLow7.setChecked(false); } } }); allFreqOut7 = (EditText) v.findViewById(R.id.all_out_freq7); allFreqOut7.setText(desiredFreq[7]); allFreqLabel7 = (TextView) v.findViewById(R.id.all_freq_label7); allDutyOut7 = (EditText) v.findViewById(R.id.all_out_duty7); allDutyOut7.setText(desiredDuty[7]); allDutyLabel7 = (TextView) v.findViewById(R.id.all_outduty_label7); if (isOutputCh[7]) { // if channel is output allDigIn7.setVisibility(View.GONE); //don't display input widgets allFreqIn7.setVisibility(View.GONE); if (isDigCh7) { // if channel is digital allDigOut7.setVisibility(View.VISIBLE); //display digital widget allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut7.setVisibility(View.VISIBLE); //display count widget allDutyOut7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.VISIBLE); allDutyLabel7.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut7.setVisibility(View.GONE); //don't display output widgets allFreqOut7.setVisibility(View.GONE); allDutyOut7.setVisibility(View.GONE); if (isDigCh7) { // if channel is digital allDigIn7.setVisibility(View.VISIBLE); //display digital out widget allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn7.setVisibility(View.VISIBLE); // display pulse widget allDigIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.VISIBLE); } } allFreqOut7.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut7.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut7.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut7.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut7.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut7.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn8 = (RadioButton) v.findViewById(R.id.all_hi_low8); allFreqIn8 = (TextView) v.findViewById(R.id.all_input_freq8); allDigOut8 = (CheckBox) v.findViewById(R.id.all_out_hi_low8); if (outputState[8]) { allDigOut8.setChecked(true); } allDigOut8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut8.isChecked()) { out_hiLow8.setChecked(true); } else { out_hiLow8.setChecked(false); } } }); allFreqOut8 = (EditText) v.findViewById(R.id.all_out_freq8); allFreqOut8.setText(desiredFreq[8]); allFreqLabel8 = (TextView) v.findViewById(R.id.all_freq_label8); allDutyOut8 = (EditText) v.findViewById(R.id.all_out_duty8); allDutyOut8.setText(desiredDuty[8]); allDutyLabel8 = (TextView) v.findViewById(R.id.all_outduty_label8); if (isOutputCh[8]) { // if channel is output allDigIn8.setVisibility(View.GONE); //don't display input widgets allFreqIn8.setVisibility(View.GONE); if (isDigCh8) { // if channel is digital allDigOut8.setVisibility(View.VISIBLE); //display digital widget allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut8.setVisibility(View.VISIBLE); //display count widget allDutyOut8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.VISIBLE); allDutyLabel8.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut8.setVisibility(View.GONE); //don't display output widgets allFreqOut8.setVisibility(View.GONE); allDutyOut8.setVisibility(View.GONE); if (isDigCh8) { // if channel is digital allDigIn8.setVisibility(View.VISIBLE); //display digital out widget allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn8.setVisibility(View.VISIBLE); // display pulse widget allDigIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.VISIBLE); } } allFreqOut8.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut8.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut8.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut8.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut8.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut8.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn9 = (RadioButton) v.findViewById(R.id.all_hi_low9); allFreqIn9 = (TextView) v.findViewById(R.id.all_input_freq9); allDigOut9 = (CheckBox) v.findViewById(R.id.all_out_hi_low9); if (outputState[9]) { allDigOut9.setChecked(true); } allDigOut9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut9.isChecked()) { out_hiLow9.setChecked(true); } else { out_hiLow9.setChecked(false); } } }); allFreqOut9 = (EditText) v.findViewById(R.id.all_out_freq9); allFreqOut9.setText(desiredFreq[9]); allFreqLabel9 = (TextView) v.findViewById(R.id.all_freq_label9); allDutyOut9 = (EditText) v.findViewById(R.id.all_out_duty9); allDutyOut9.setText(desiredDuty[9]); allDutyLabel9 = (TextView) v.findViewById(R.id.all_outduty_label9); if (isOutputCh[9]) { // if channel is output allDigIn9.setVisibility(View.GONE); //don't display input widgets allFreqIn9.setVisibility(View.GONE); if (isDigCh9) { // if channel is digital allDigOut9.setVisibility(View.VISIBLE); //display digital widget allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut9.setVisibility(View.VISIBLE); //display count widget allDutyOut9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.VISIBLE); allDutyLabel9.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut9.setVisibility(View.GONE); //don't display output widgets allFreqOut9.setVisibility(View.GONE); allDutyOut9.setVisibility(View.GONE); if (isDigCh9) { // if channel is digital allDigIn9.setVisibility(View.VISIBLE); //display digital out widget allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn9.setVisibility(View.VISIBLE); // display pulse widget allDigIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.VISIBLE); } } allFreqOut9.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut9.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut9.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut9.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut9.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut9.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn10 = (RadioButton) v.findViewById(R.id.all_hi_low10); allFreqIn10 = (TextView) v.findViewById(R.id.all_input_freq10); allDigOut10 = (CheckBox) v.findViewById(R.id.all_out_hi_low10); if (outputState[10]) { allDigOut10.setChecked(true); } allDigOut10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut10.isChecked()) { out_hiLow10.setChecked(true); } else { out_hiLow10.setChecked(false); } } }); allFreqOut10 = (EditText) v.findViewById(R.id.all_out_freq10); allFreqOut10.setText(desiredFreq[10]); allFreqLabel10 = (TextView) v.findViewById(R.id.all_freq_label10); allDutyOut10 = (EditText) v.findViewById(R.id.all_out_duty10); allDutyOut10.setText(desiredDuty[10]); allDutyLabel10 = (TextView) v.findViewById(R.id.all_outduty_label10); if (isOutputCh[10]) { // if channel is output allDigIn10.setVisibility(View.GONE); //don't display input widgets allFreqIn10.setVisibility(View.GONE); if (isDigCh10) { // if channel is digital allDigOut10.setVisibility(View.VISIBLE); //display digital widget allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut10.setVisibility(View.VISIBLE); //display count widget allDutyOut10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.VISIBLE); allDutyLabel10.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut10.setVisibility(View.GONE); //don't display output widgets allFreqOut10.setVisibility(View.GONE); allDutyOut10.setVisibility(View.GONE); if (isDigCh10) { // if channel is digital allDigIn10.setVisibility(View.VISIBLE); //display digital out widget allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn10.setVisibility(View.VISIBLE); // display pulse widget allDigIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.VISIBLE); } } allFreqOut10.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut10.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut10.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut10.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut10.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut10.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn11 = (RadioButton) v.findViewById(R.id.all_hi_low11); allFreqIn11 = (TextView) v.findViewById(R.id.all_input_freq11); allDigOut11 = (CheckBox) v.findViewById(R.id.all_out_hi_low11); if (outputState[11]) { allDigOut11.setChecked(true); } allDigOut11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut11.isChecked()) { out_hiLow11.setChecked(true); } else { out_hiLow11.setChecked(false); } } }); allFreqOut11 = (EditText) v.findViewById(R.id.all_out_freq11); allFreqOut11.setText(desiredFreq[11]); allFreqLabel11 = (TextView) v.findViewById(R.id.all_freq_label11); allDutyOut11 = (EditText) v.findViewById(R.id.all_out_duty11); allDutyOut11.setText(desiredDuty[11]); allDutyLabel11 = (TextView) v.findViewById(R.id.all_outduty_label11); if (isOutputCh[11]) { // if channel is output allDigIn11.setVisibility(View.GONE); //don't display input widgets allFreqIn11.setVisibility(View.GONE); if (isDigCh11) { // if channel is digital allDigOut11.setVisibility(View.VISIBLE); //display digital widget allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut11.setVisibility(View.VISIBLE); //display count widget allDutyOut11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.VISIBLE); allDutyLabel11.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut11.setVisibility(View.GONE); //don't display output widgets allFreqOut11.setVisibility(View.GONE); allDutyOut11.setVisibility(View.GONE); if (isDigCh11) { // if channel is digital allDigIn11.setVisibility(View.VISIBLE); //display digital out widget allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn11.setVisibility(View.VISIBLE); // display pulse widget allDigIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.VISIBLE); } } allFreqOut11.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut11.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut11.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut11.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut11.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut11.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn12 = (RadioButton) v.findViewById(R.id.all_hi_low12); allFreqIn12 = (TextView) v.findViewById(R.id.all_input_freq12); allDigOut12 = (CheckBox) v.findViewById(R.id.all_out_hi_low12); if (outputState[12]) { allDigOut12.setChecked(true); } allDigOut12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut12.isChecked()) { out_hiLow12.setChecked(true); } else { out_hiLow12.setChecked(false); } } }); allFreqOut12 = (EditText) v.findViewById(R.id.all_out_freq12); allFreqOut12.setText(desiredFreq[12]); allFreqLabel12 = (TextView) v.findViewById(R.id.all_freq_label12); allDutyOut12 = (EditText) v.findViewById(R.id.all_out_duty12); allDutyOut12.setText(desiredDuty[12]); allDutyLabel12 = (TextView) v.findViewById(R.id.all_outduty_label12); if (isOutputCh[12]) { // if channel is output allDigIn12.setVisibility(View.GONE); //don't display input widgets allFreqIn12.setVisibility(View.GONE); if (isDigCh12) { // if channel is digital allDigOut12.setVisibility(View.VISIBLE); //display digital widget allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut12.setVisibility(View.VISIBLE); //display count widget allDutyOut12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.VISIBLE); allDutyLabel12.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut12.setVisibility(View.GONE); //don't display output widgets allFreqOut12.setVisibility(View.GONE); allDutyOut12.setVisibility(View.GONE); if (isDigCh12) { // if channel is digital allDigIn12.setVisibility(View.VISIBLE); //display digital out widget allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn12.setVisibility(View.VISIBLE); // display pulse widget allDigIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.VISIBLE); } } allFreqOut12.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut12.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut12.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut12.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut12.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut12.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn13 = (RadioButton) v.findViewById(R.id.all_hi_low13); allFreqIn13 = (TextView) v.findViewById(R.id.all_input_freq13); allDigOut13 = (CheckBox) v.findViewById(R.id.all_out_hi_low13); if (outputState[13]) { allDigOut13.setChecked(true); } allDigOut13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut13.isChecked()) { out_hiLow13.setChecked(true); } else { out_hiLow13.setChecked(false); } } }); allFreqOut13 = (EditText) v.findViewById(R.id.all_out_freq13); allFreqOut13.setText(desiredFreq[13]); allFreqLabel13 = (TextView) v.findViewById(R.id.all_freq_label13); allDutyOut13 = (EditText) v.findViewById(R.id.all_out_duty13); allDutyOut13.setText(desiredDuty[13]); allDutyLabel13 = (TextView) v.findViewById(R.id.all_outduty_label13); if (isOutputCh[13]) { // if channel is output allDigIn13.setVisibility(View.GONE); //don't display input widgets allFreqIn13.setVisibility(View.GONE); if (isDigCh13) { // if channel is digital allDigOut13.setVisibility(View.VISIBLE); //display digital widget allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut13.setVisibility(View.VISIBLE); //display count widget allDutyOut13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.VISIBLE); allDutyLabel13.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut13.setVisibility(View.GONE); //don't display output widgets allFreqOut13.setVisibility(View.GONE); allDutyOut13.setVisibility(View.GONE); if (isDigCh13) { // if channel is digital allDigIn13.setVisibility(View.VISIBLE); //display digital out widget allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn13.setVisibility(View.VISIBLE); // display pulse widget allDigIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.VISIBLE); } } allFreqOut13.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut13.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut13.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut13.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut13.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut13.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn14 = (RadioButton) v.findViewById(R.id.all_hi_low14); allFreqIn14 = (TextView) v.findViewById(R.id.all_input_freq14); allDigOut14 = (CheckBox) v.findViewById(R.id.all_out_hi_low14); if (outputState[14]) { allDigOut14.setChecked(true); } allDigOut14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut14.isChecked()) { out_hiLow14.setChecked(true); } else { out_hiLow14.setChecked(false); } } }); allFreqOut14 = (EditText) v.findViewById(R.id.all_out_freq14); allFreqOut14.setText(desiredFreq[14]); allFreqLabel14 = (TextView) v.findViewById(R.id.all_freq_label14); allDutyOut14 = (EditText) v.findViewById(R.id.all_out_duty14); allDutyOut14.setText(desiredDuty[14]); allDutyLabel14 = (TextView) v.findViewById(R.id.all_outduty_label14); if (isOutputCh[14]) { // if channel is output allDigIn14.setVisibility(View.GONE); //don't display input widgets allFreqIn14.setVisibility(View.GONE); if (isDigCh14) { // if channel is digital allDigOut14.setVisibility(View.VISIBLE); //display digital widget allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut14.setVisibility(View.VISIBLE); //display count widget allDutyOut14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.VISIBLE); allDutyLabel14.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut14.setVisibility(View.GONE); //don't display output widgets allFreqOut14.setVisibility(View.GONE); allDutyOut14.setVisibility(View.GONE); if (isDigCh14) { // if channel is digital allDigIn14.setVisibility(View.VISIBLE); //display digital out widget allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn14.setVisibility(View.VISIBLE); // display pulse widget allDigIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.VISIBLE); } } allFreqOut14.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut14.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut14.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut14.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut14.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut14.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn15 = (RadioButton) v.findViewById(R.id.all_hi_low15); allFreqIn15 = (TextView) v.findViewById(R.id.all_input_freq15); allDigOut15 = (CheckBox) v.findViewById(R.id.all_out_hi_low15); if (outputState[15]) { allDigOut15.setChecked(true); } allDigOut15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut15.isChecked()) { out_hiLow15.setChecked(true); } else { out_hiLow15.setChecked(false); } } }); allFreqOut15 = (EditText) v.findViewById(R.id.all_out_freq15); allFreqOut15.setText(desiredFreq[15]); allFreqLabel15 = (TextView) v.findViewById(R.id.all_freq_label15); allDutyOut15 = (EditText) v.findViewById(R.id.all_out_duty15); allDutyOut15.setText(desiredDuty[15]); allDutyLabel15 = (TextView) v.findViewById(R.id.all_outduty_label15); if (isOutputCh[15]) { // if channel is output allDigIn15.setVisibility(View.GONE); //don't display input widgets allFreqIn15.setVisibility(View.GONE); if (isDigCh15) { // if channel is digital allDigOut15.setVisibility(View.VISIBLE); //display digital widget allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut15.setVisibility(View.VISIBLE); //display count widget allDutyOut15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.VISIBLE); allDutyLabel15.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut15.setVisibility(View.GONE); //don't display output widgets allFreqOut15.setVisibility(View.GONE); allDutyOut15.setVisibility(View.GONE); if (isDigCh15) { // if channel is digital allDigIn15.setVisibility(View.VISIBLE); //display digital out widget allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn15.setVisibility(View.VISIBLE); // display pulse widget allDigIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.VISIBLE); } } allFreqOut15.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut15.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut15.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut15.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut15.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut15.setText("0"); getAllInputString(); } return true; } return false; } }); allVoltCh0 = (TextView) v.findViewById(R.id.volt_ch_0); allVoltReading0 = (TextView) v.findViewById(R.id.all_input_volts0); allVoltLabel0 = (TextView) v.findViewById(R.id.volt_label_0); allVoltCh1 = (TextView) v.findViewById(R.id.volt_ch_1); allVoltReading1 = (TextView) v.findViewById(R.id.all_input_volts1); allVoltLabel1 = (TextView) v.findViewById(R.id.volt_label_1); allVoltCh2 = (TextView) v.findViewById(R.id.volt_ch_2); allVoltReading2 = (TextView) v.findViewById(R.id.all_input_volts2); allVoltLabel2 = (TextView) v.findViewById(R.id.volt_label_2); allVoltCh3 = (TextView) v.findViewById(R.id.volt_ch_3); allVoltReading3 = (TextView) v.findViewById(R.id.all_input_volts3); allVoltLabel3 = (TextView) v.findViewById(R.id.volt_label_3); allVoltCh4 = (TextView) v.findViewById(R.id.volt_ch_4); allVoltReading4 = (TextView) v.findViewById(R.id.all_input_volts4); allVoltLabel4 = (TextView) v.findViewById(R.id.volt_label_4); allVoltCh5 = (TextView) v.findViewById(R.id.volt_ch_5); allVoltReading5 = (TextView) v.findViewById(R.id.all_input_volts5); allVoltLabel5 = (TextView) v.findViewById(R.id.volt_label_5); allVoltCh6 = (TextView) v.findViewById(R.id.volt_ch_6); allVoltReading6 = (TextView) v.findViewById(R.id.all_input_volts6); allVoltLabel6 = (TextView) v.findViewById(R.id.volt_label_6); allVoltCh7 = (TextView) v.findViewById(R.id.volt_ch_7); allVoltReading7 = (TextView) v.findViewById(R.id.all_input_volts7); allVoltLabel7 = (TextView) v.findViewById(R.id.volt_label_7); break; /*case 5: //resId = R.layout.remote; resId = R.layout.setup; break; */ case 5: resId = R.layout.log; v = inflater.inflate(resId, null, false); logText = (TextView) v.findViewById(R.id.logtext); logText.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View arg0) { String listText = logText.getText().toString(); Log.v("LongClick: ", listText); ((AndroiDAQMain) context).writeToFile(listText); return false; } }); logSV = (ScrollView) v.findViewById(R.id.scrollViewLog); logSV.setScrollbarFadingEnabled(false); refreshLog = (Button) v.findViewById(R.id.refreshlog); refreshLog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQMain) context).setFromMenu(true); ((AndroiDAQMain) context).sendMessage("07\r"); } }); openMenu = (Button) v.findViewById(R.id.open_menu); openMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQMain) context).openMenu(); } }); break; case 6: resId = R.layout.adc; v = inflater.inflate(resId, null, false); adcSV = (ScrollView) v.findViewById(R.id.scrollViewADC); adcSV.setScrollbarFadingEnabled(false); samples = (EditText) v.findViewById(R.id.samples1); samples.setFilters(new InputFilter[] { new InputFilterMinMax("1", "4096") }); samples.setSelectAllOnFocus(true); samples.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { //Toast.makeText(context, samples.getText(), Toast.LENGTH_SHORT).show(); String theText = samples.getText().toString(); samples.clearFocus(); if (theText.matches("")) { samples.setText("100"); samples.selectAll(); } return false; } return false; } }); ratesList = (Spinner) v.findViewById(R.id.rates); ArrayAdapter<String> adap = new ArrayAdapter<String>(this.context, R.layout.spinner_item, new String[] { "100uSecs", "500uSecs", "1mSec", "10mSecs", "50mSecs", "100mSecs", "500mSecs", "1-Sec" }); adap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); ratesList.setAdapter(adap); ratesList.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { itemText = ratesList.getSelectedItem().toString(); if (waveRate != null) waveRate.setText("Longpress to take 448 samples at: " + itemText); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); readSamples = (Button) v.findViewById(R.id.readSamples); readSamples.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String sampleNum = samples.getText().toString(); Log.v("EditText: ", sampleNum); int itemNum = ratesList.getSelectedItemPosition(); String[] values = { "10000", "2000", "1000", "100", "20", "10", "2", "1" }; String rateText = values[itemNum]; Log.v("Spinner: ", rateText); int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { ((AndroiDAQMain) context).getADCSample(true, sampleNum, rateText); } } }); break; case 7: resId = R.layout.waveform; v = inflater.inflate(resId, null, false); waveRate = (TextView) v.findViewById(R.id.waveRate); waveRate.setText("Longpress to take 448 samples at: " + ratesList.getSelectedItem().toString()); mWaveform = (WaveFormView) v.findViewById(R.id.WaveformArea); mWaveform.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View arg0) { String sampleNum = samples.getText().toString(); Log.v("EditText: ", sampleNum); int itemNum = ratesList.getSelectedItemPosition(); String[] values = { "10000", "2000", "1000", "100", "20", "10", "2", "1" }; String rateText = values[itemNum]; Log.v("Spinner: ", rateText); Toast.makeText(context, "Getting Samples", Toast.LENGTH_SHORT).show(); ((AndroiDAQMain) context).getOscopeSample(true, rateText); return false; } }); sendOutputs = false; break; case 8: resId = R.layout.remote; v = inflater.inflate(resId, null, false); speed = (SeekBar) v.findViewById(R.id.seekBar1); speed.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub speedPercent = progress; out_freq0.setText(Integer.toString(speedPercent)); allFreqOut0.setText(Integer.toString(speedPercent)); } }); forward = (Button) v.findViewById(R.id.button1); forward.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(true); out_hiLow2.setChecked(true); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); reverse = (Button) v.findViewById(R.id.button5); reverse.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(false); out_hiLow2.setChecked(false); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); left = (Button) v.findViewById(R.id.button2); left.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(false); out_hiLow2.setChecked(true); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); right = (Button) v.findViewById(R.id.button4); right.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(true); out_hiLow2.setChecked(false); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); break; case 9: resId = R.layout.quickset; v = inflater.inflate(resId, null, false); resetValues = (Button) v.findViewById(R.id.reset1); resetValues.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //TODO set all values to default boolean[] areInputs = new boolean[16]; Arrays.fill(areInputs, Boolean.FALSE); boolean[] areDigital = new boolean[16]; Arrays.fill(areDigital, Boolean.TRUE); boolean[] areOutputs = new boolean[16]; Arrays.fill(areOutputs, Boolean.FALSE); String[] freqs = new String[16]; String[] duties = new String[16]; Arrays.fill(freqs, "0"); Bundle myBundle = new Bundle(); myBundle.putBooleanArray("isInput", areInputs); myBundle.putBooleanArray("isDig", areDigital); myBundle.putBooleanArray("outputState", areOutputs); myBundle.putStringArray("desiredFreqs", freqs); myBundle.putStringArray("desiredDutys", duties); setUIStates(myBundle); notifyDataSetChanged(); } }); break; } //View view = inflater.inflate(resId, null); ((ViewPager) collection).addView(v, 0); return v; }
From source file:com.androidaq.AndroiDAQTCPAdapter.java
@Override public Object instantiateItem(View collection, int position) { //Log.e("Test", "instantiateItem"); v = new View(collection.getContext()); LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0://from ww w. j av a 2 s. c o m resId = R.layout.setup; v = inflater.inflate(resId, null, false); //setupSV = (ObservableScrollView) v.findViewById(R.id.setupSV); setupSV = (ScrollView) v.findViewById(R.id.setupSV); //setupSV.setScrollViewListener(this); setupMenu = (Button) v.findViewById(R.id.setup_menu); setupMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQTCPMain) context).openMenu(); } }); p0 = (CheckBox) v.findViewById(R.id.p0); boolean state0 = Boolean.valueOf(isOutputCh[0]); p0.setChecked(state0); isOutputCh0 = state0; p0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p0.isChecked()) { // channel is output inputsRow0.setVisibility(View.GONE); isOutputCh0 = true; isDigCh0 = true; outputsRow0.setVisibility(View.VISIBLE); out_hiLow0.setVisibility(View.VISIBLE); rg16.check(R.id.out_digital0); out_freq0.setVisibility(View.GONE); outFreqLabel0.setVisibility(View.INVISIBLE); duty_freq0.setVisibility(View.GONE); outDutyLabel0.setVisibility(View.INVISIBLE); allDigOut0.setVisibility(View.VISIBLE); allDigIn0.setVisibility(View.GONE); allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // channel is input outputsRow0.setVisibility(View.GONE); isOutputCh0 = false; isDigCh0 = true; inputsRow0.setVisibility(View.VISIBLE); hiLow0.setVisibility(View.VISIBLE); rg0.check(R.id.digital0); freq0.setVisibility(View.GONE); inFreqLabel0.setVisibility(View.INVISIBLE); allDigIn0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } } }); p1 = (CheckBox) v.findViewById(R.id.p1); boolean state1 = Boolean.valueOf(isOutputCh[1]); p1.setChecked(state1); isOutputCh1 = state1; p1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p1.isChecked()) { inputsRow1.setVisibility(View.GONE); isOutputCh1 = true; isDigCh1 = true; outputsRow1.setVisibility(View.VISIBLE); out_hiLow1.setVisibility(View.VISIBLE); rg17.check(R.id.out_digital1); out_freq1.setVisibility(View.GONE); outFreqLabel1.setVisibility(View.INVISIBLE); allDigOut1.setVisibility(View.VISIBLE); allDigIn1.setVisibility(View.GONE); allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { outputsRow1.setVisibility(View.GONE); isOutputCh1 = false; isDigCh1 = true; inputsRow1.setVisibility(View.VISIBLE); hiLow1.setVisibility(View.VISIBLE); rg1.check(R.id.digital1); freq1.setVisibility(View.GONE); inFreqLabel1.setVisibility(View.INVISIBLE); allDigIn1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } } }); p2 = (CheckBox) v.findViewById(R.id.p2); boolean state2 = Boolean.valueOf(isOutputCh[2]); p2.setChecked(state2); isOutputCh2 = state2; p2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p2.isChecked()) { inputsRow2.setVisibility(View.GONE); isOutputCh2 = true; isDigCh2 = true; outputsRow2.setVisibility(View.VISIBLE); out_hiLow2.setVisibility(View.VISIBLE); rg18.check(R.id.out_digital2); out_freq2.setVisibility(View.GONE); outFreqLabel2.setVisibility(View.INVISIBLE); allDigOut2.setVisibility(View.VISIBLE); allDigIn2.setVisibility(View.GONE); allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { outputsRow2.setVisibility(View.GONE); isOutputCh2 = false; isDigCh2 = true; inputsRow2.setVisibility(View.VISIBLE); hiLow2.setVisibility(View.VISIBLE); rg2.check(R.id.digital2); freq2.setVisibility(View.GONE); inFreqLabel2.setVisibility(View.INVISIBLE); allDigIn2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } } }); p3 = (CheckBox) v.findViewById(R.id.p3); boolean state3 = Boolean.valueOf(isOutputCh[3]); p3.setChecked(state3); isOutputCh3 = state3; p3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p3.isChecked()) { inputsRow3.setVisibility(View.GONE); isOutputCh3 = true; isDigCh3 = true; outputsRow3.setVisibility(View.VISIBLE); out_hiLow3.setVisibility(View.VISIBLE); rg19.check(R.id.out_digital3); out_freq3.setVisibility(View.GONE); outFreqLabel3.setVisibility(View.INVISIBLE); allDigOut3.setVisibility(View.VISIBLE); allDigIn3.setVisibility(View.GONE); allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { outputsRow3.setVisibility(View.GONE); isOutputCh3 = false; isDigCh3 = true; inputsRow3.setVisibility(View.VISIBLE); hiLow3.setVisibility(View.VISIBLE); rg3.check(R.id.digital3); freq3.setVisibility(View.GONE); inFreqLabel3.setVisibility(View.INVISIBLE); allDigIn3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } } }); p4 = (CheckBox) v.findViewById(R.id.p4); boolean state4 = Boolean.valueOf(isOutputCh[4]); p4.setChecked(state4); isOutputCh4 = state4; p4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p4.isChecked()) { inputsRow4.setVisibility(View.GONE); isOutputCh4 = true; isDigCh4 = true; outputsRow4.setVisibility(View.VISIBLE); out_hiLow4.setVisibility(View.VISIBLE); rg20.check(R.id.out_digital4); out_freq4.setVisibility(View.GONE); outFreqLabel4.setVisibility(View.INVISIBLE); allDigOut4.setVisibility(View.VISIBLE); allDigIn4.setVisibility(View.GONE); allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { outputsRow4.setVisibility(View.GONE); isOutputCh4 = false; isDigCh4 = true; inputsRow4.setVisibility(View.VISIBLE); hiLow4.setVisibility(View.VISIBLE); rg4.check(R.id.digital4); freq4.setVisibility(View.GONE); inFreqLabel4.setVisibility(View.INVISIBLE); allDigIn4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } } }); p5 = (CheckBox) v.findViewById(R.id.p5); boolean state5 = Boolean.valueOf(isOutputCh[5]); p5.setChecked(state5); isOutputCh5 = state5; p5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p5.isChecked()) { inputsRow5.setVisibility(View.GONE); isOutputCh5 = true; isDigCh5 = true; outputsRow5.setVisibility(View.VISIBLE); out_hiLow5.setVisibility(View.VISIBLE); rg21.check(R.id.out_digital5); out_freq5.setVisibility(View.GONE); outFreqLabel5.setVisibility(View.INVISIBLE); allDigOut5.setVisibility(View.VISIBLE); allDigIn5.setVisibility(View.GONE); allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { outputsRow5.setVisibility(View.GONE); isOutputCh5 = false; isDigCh5 = true; inputsRow5.setVisibility(View.VISIBLE); hiLow5.setVisibility(View.VISIBLE); rg5.check(R.id.digital5); freq5.setVisibility(View.GONE); inFreqLabel5.setVisibility(View.INVISIBLE); allDigIn5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } } }); p6 = (CheckBox) v.findViewById(R.id.p6); boolean state6 = Boolean.valueOf(isOutputCh[6]); p6.setChecked(state6); isOutputCh6 = state6; p6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p6.isChecked()) { inputsRow6.setVisibility(View.GONE); isOutputCh6 = true; isDigCh6 = true; outputsRow6.setVisibility(View.VISIBLE); out_hiLow6.setVisibility(View.VISIBLE); rg22.check(R.id.out_digital6); out_freq6.setVisibility(View.GONE); outFreqLabel6.setVisibility(View.INVISIBLE); allDigOut6.setVisibility(View.VISIBLE); allDigIn6.setVisibility(View.GONE); allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { outputsRow6.setVisibility(View.GONE); isOutputCh6 = false; isDigCh6 = true; inputsRow6.setVisibility(View.VISIBLE); hiLow6.setVisibility(View.VISIBLE); rg6.check(R.id.digital6); freq6.setVisibility(View.GONE); inFreqLabel6.setVisibility(View.INVISIBLE); allDigIn6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } } }); p7 = (CheckBox) v.findViewById(R.id.p7); boolean state7 = Boolean.valueOf(isOutputCh[7]); p7.setChecked(state7); isOutputCh7 = state7; p7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p7.isChecked()) { inputsRow7.setVisibility(View.GONE); isOutputCh7 = true; isDigCh7 = true; outputsRow7.setVisibility(View.VISIBLE); out_hiLow7.setVisibility(View.VISIBLE); rg23.check(R.id.out_digital7); out_freq7.setVisibility(View.GONE); outFreqLabel7.setVisibility(View.INVISIBLE); allDigOut7.setVisibility(View.VISIBLE); allDigIn7.setVisibility(View.GONE); allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { outputsRow7.setVisibility(View.GONE); isOutputCh7 = false; isDigCh7 = true; inputsRow7.setVisibility(View.VISIBLE); hiLow7.setVisibility(View.VISIBLE); rg7.check(R.id.digital7); freq7.setVisibility(View.GONE); inFreqLabel7.setVisibility(View.INVISIBLE); allDigIn7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } } }); p8 = (CheckBox) v.findViewById(R.id.p8); boolean state8 = Boolean.valueOf(isOutputCh[8]); p8.setChecked(state8); isOutputCh8 = state8; p8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p8.isChecked()) { inputsRow8.setVisibility(View.GONE); isOutputCh8 = true; isDigCh8 = true; outputsRow8.setVisibility(View.VISIBLE); out_hiLow8.setVisibility(View.VISIBLE); rg24.check(R.id.out_digital8); out_freq8.setVisibility(View.GONE); outFreqLabel8.setVisibility(View.INVISIBLE); allDigOut8.setVisibility(View.VISIBLE); allDigIn8.setVisibility(View.GONE); allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { outputsRow8.setVisibility(View.GONE); isOutputCh8 = false; isDigCh8 = true; inputsRow8.setVisibility(View.VISIBLE); hiLow8.setVisibility(View.VISIBLE); rg8.check(R.id.digital8); freq8.setVisibility(View.GONE); inFreqLabel8.setVisibility(View.INVISIBLE); allDigIn8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } } }); p9 = (CheckBox) v.findViewById(R.id.p9); boolean state9 = Boolean.valueOf(isOutputCh[9]); p9.setChecked(state9); isOutputCh9 = state9; p9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p9.isChecked()) { inputsRow9.setVisibility(View.GONE); isOutputCh9 = true; isDigCh9 = true; outputsRow9.setVisibility(View.VISIBLE); out_hiLow9.setVisibility(View.VISIBLE); rg25.check(R.id.out_digital9); out_freq9.setVisibility(View.GONE); outFreqLabel9.setVisibility(View.INVISIBLE); allDigOut9.setVisibility(View.VISIBLE); allDigIn9.setVisibility(View.GONE); allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { outputsRow9.setVisibility(View.GONE); isOutputCh9 = false; isDigCh9 = true; inputsRow9.setVisibility(View.VISIBLE); hiLow9.setVisibility(View.VISIBLE); rg9.check(R.id.digital9); freq9.setVisibility(View.GONE); inFreqLabel9.setVisibility(View.INVISIBLE); allDigIn9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } } }); p10 = (CheckBox) v.findViewById(R.id.p10); boolean state10 = Boolean.valueOf(isOutputCh[10]); p10.setChecked(state10); isOutputCh10 = state10; p10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p10.isChecked()) { inputsRow10.setVisibility(View.GONE); isOutputCh10 = true; isDigCh10 = true; outputsRow10.setVisibility(View.VISIBLE); out_hiLow10.setVisibility(View.VISIBLE); rg26.check(R.id.out_digital10); out_freq10.setVisibility(View.GONE); outFreqLabel10.setVisibility(View.INVISIBLE); allDigOut10.setVisibility(View.VISIBLE); allDigIn10.setVisibility(View.GONE); allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { outputsRow10.setVisibility(View.GONE); isOutputCh10 = false; isDigCh10 = true; inputsRow10.setVisibility(View.VISIBLE); hiLow10.setVisibility(View.VISIBLE); rg10.check(R.id.digital10); freq10.setVisibility(View.GONE); inFreqLabel10.setVisibility(View.INVISIBLE); allDigIn10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } } }); p11 = (CheckBox) v.findViewById(R.id.p11); boolean state11 = Boolean.valueOf(isOutputCh[11]); p11.setChecked(state11); isOutputCh11 = state11; p11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p11.isChecked()) { inputsRow11.setVisibility(View.GONE); isOutputCh11 = true; isDigCh11 = true; outputsRow11.setVisibility(View.VISIBLE); out_hiLow11.setVisibility(View.VISIBLE); rg27.check(R.id.out_digital11); out_freq11.setVisibility(View.GONE); outFreqLabel11.setVisibility(View.INVISIBLE); allDigOut11.setVisibility(View.VISIBLE); allDigIn11.setVisibility(View.GONE); allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { outputsRow11.setVisibility(View.GONE); isOutputCh11 = false; isDigCh11 = true; inputsRow11.setVisibility(View.VISIBLE); hiLow11.setVisibility(View.VISIBLE); rg11.check(R.id.digital11); freq11.setVisibility(View.GONE); inFreqLabel11.setVisibility(View.INVISIBLE); allDigIn11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } } }); p12 = (CheckBox) v.findViewById(R.id.p12); boolean state12 = Boolean.valueOf(isOutputCh[12]); p12.setChecked(state12); isOutputCh12 = state12; p12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p12.isChecked()) { inputsRow12.setVisibility(View.GONE); isOutputCh12 = true; isDigCh12 = true; outputsRow12.setVisibility(View.VISIBLE); out_hiLow12.setVisibility(View.VISIBLE); rg28.check(R.id.out_digital12); out_freq12.setVisibility(View.GONE); outFreqLabel12.setVisibility(View.INVISIBLE); allDigOut12.setVisibility(View.VISIBLE); allDigIn12.setVisibility(View.GONE); allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { outputsRow12.setVisibility(View.GONE); isOutputCh12 = false; isDigCh12 = true; inputsRow12.setVisibility(View.VISIBLE); hiLow12.setVisibility(View.VISIBLE); rg12.check(R.id.digital12); freq12.setVisibility(View.GONE); inFreqLabel12.setVisibility(View.INVISIBLE); allDigIn12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } } }); p13 = (CheckBox) v.findViewById(R.id.p13); boolean state13 = Boolean.valueOf(isOutputCh[13]); p13.setChecked(state13); isOutputCh13 = state13; p13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p13.isChecked()) { inputsRow13.setVisibility(View.GONE); isOutputCh13 = true; isDigCh13 = true; outputsRow13.setVisibility(View.VISIBLE); out_hiLow13.setVisibility(View.VISIBLE); rg29.check(R.id.out_digital13); out_freq13.setVisibility(View.GONE); outFreqLabel13.setVisibility(View.INVISIBLE); allDigOut13.setVisibility(View.VISIBLE); allDigIn13.setVisibility(View.GONE); allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { outputsRow13.setVisibility(View.GONE); isOutputCh13 = false; isDigCh13 = true; inputsRow13.setVisibility(View.VISIBLE); hiLow13.setVisibility(View.VISIBLE); rg13.check(R.id.digital13); freq13.setVisibility(View.GONE); inFreqLabel13.setVisibility(View.INVISIBLE); allDigIn13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } } }); p14 = (CheckBox) v.findViewById(R.id.p14); boolean state14 = Boolean.valueOf(isOutputCh[14]); p14.setChecked(state14); isOutputCh14 = state14; p14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p14.isChecked()) { inputsRow14.setVisibility(View.GONE); isOutputCh14 = true; isDigCh14 = true; outputsRow14.setVisibility(View.VISIBLE); out_hiLow14.setVisibility(View.VISIBLE); rg30.check(R.id.out_digital14); out_freq14.setVisibility(View.GONE); outFreqLabel14.setVisibility(View.INVISIBLE); allDigOut14.setVisibility(View.VISIBLE); allDigIn14.setVisibility(View.GONE); allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { outputsRow14.setVisibility(View.GONE); isOutputCh14 = false; isDigCh14 = true; inputsRow14.setVisibility(View.VISIBLE); hiLow14.setVisibility(View.VISIBLE); rg14.check(R.id.digital14); freq14.setVisibility(View.GONE); inFreqLabel14.setVisibility(View.INVISIBLE); allDigIn14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } } }); p15 = (CheckBox) v.findViewById(R.id.p15); boolean state15 = Boolean.valueOf(isOutputCh[15]); p15.setChecked(state15); isOutputCh15 = state15; p15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (p15.isChecked()) { inputsRow15.setVisibility(View.GONE); isOutputCh15 = true; isDigCh15 = true; outputsRow15.setVisibility(View.VISIBLE); out_hiLow15.setVisibility(View.VISIBLE); rg31.check(R.id.out_digital15); out_freq15.setVisibility(View.GONE); outFreqLabel15.setVisibility(View.INVISIBLE); allDigOut15.setVisibility(View.VISIBLE); allDigIn15.setVisibility(View.GONE); allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { outputsRow15.setVisibility(View.GONE); isOutputCh15 = false; isDigCh15 = true; inputsRow15.setVisibility(View.VISIBLE); hiLow15.setVisibility(View.VISIBLE); rg15.check(R.id.digital15); freq15.setVisibility(View.GONE); inFreqLabel15.setVisibility(View.INVISIBLE); allDigIn15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } } }); //((AndroiDAQTCPMain) context).showSetupToast(); break; case 1: //resId = R.layout.inputs; resId = R.layout.inputs; v = inflater.inflate(resId, null, false); inputSetRun = (Button) v.findViewById(R.id.read_inputs); inputSV = (ScrollView) v.findViewById(R.id.scrollViewInputs); inputSV.setScrollbarFadingEnabled(false); inputSetRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runInputs = false; } else { runInputs = true; setProp(); } } }); inputContRun = (Button) v.findViewById(R.id.read_cont_inputs); inputContRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //setPropAndRead(); //TODO setup input reads //((AndroiDAQTCPMain) context).getInputs(true); int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runContInputs = false; inputContRun.setText("Continuous Read Input from AndroiDAQ"); } else { if (!runContInputs) { inputContRun.setText("Stop Cont. Read Input from AndroiDAQ"); runContInputs = true; setProp(); } else { inputContRun.setText("Continuous Read Input from AndroiDAQ"); runContInputs = false; stopContInput(); } } } }); inputsRow0 = (TableRow) v.findViewById(R.id.inputsRow1); if (isOutputCh[0]) { inputsRow0.setVisibility(View.GONE); } hiLow0 = (RadioButton) v.findViewById(R.id.hi_low0); freq0 = (TextView) v.findViewById(R.id.input_freq0); inFreqLabel0 = (TextView) v.findViewById(R.id.infreq_label0); rg0 = (RadioGroup) v.findViewById(R.id.radioGroup0); if (isDigCh[0]) { hiLow0.setVisibility(View.VISIBLE); freq0.setVisibility(View.GONE); isDigCh0 = true; inFreqLabel0.setVisibility(View.INVISIBLE); rg0.check(R.id.digital0); } else { hiLow0.setVisibility(View.GONE); freq0.setVisibility(View.VISIBLE); isDigCh0 = false; inFreqLabel0.setVisibility(View.VISIBLE); rg0.check(R.id.count0); } rg0.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital0) { // if checked channel is digital hiLow0.setVisibility(View.VISIBLE); isDigCh0 = true; freq0.setVisibility(View.GONE); inFreqLabel0.setVisibility(View.INVISIBLE); allDigIn0.setVisibility(View.VISIBLE); allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); } else { hiLow0.setVisibility(View.GONE); isDigCh0 = false; freq0.setVisibility(View.VISIBLE); inFreqLabel0.setVisibility(View.VISIBLE); allDigIn0.setVisibility(View.GONE); allFreqIn0.setVisibility(View.VISIBLE); allFreqLabel0.setVisibility(View.VISIBLE); } } }); inputsRow1 = (TableRow) v.findViewById(R.id.inputsRow2); if (isOutputCh[1]) { inputsRow1.setVisibility(View.GONE); } hiLow1 = (RadioButton) v.findViewById(R.id.hi_low1); freq1 = (TextView) v.findViewById(R.id.input_freq1); inFreqLabel1 = (TextView) v.findViewById(R.id.infreq_label1); rg1 = (RadioGroup) v.findViewById(R.id.radioGroup1); if (isDigCh[1]) { hiLow1.setVisibility(View.VISIBLE); freq1.setVisibility(View.GONE); isDigCh1 = true; inFreqLabel1.setVisibility(View.INVISIBLE); rg1.check(R.id.digital1); } else { hiLow1.setVisibility(View.GONE); freq1.setVisibility(View.VISIBLE); isDigCh1 = false; inFreqLabel1.setVisibility(View.VISIBLE); rg1.check(R.id.count1); } rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital1) { hiLow1.setVisibility(View.VISIBLE); isDigCh1 = true; freq1.setVisibility(View.GONE); inFreqLabel1.setVisibility(View.INVISIBLE); allDigIn1.setVisibility(View.VISIBLE); allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); } else { hiLow1.setVisibility(View.GONE); isDigCh1 = false; freq1.setVisibility(View.VISIBLE); inFreqLabel1.setVisibility(View.VISIBLE); allDigIn1.setVisibility(View.GONE); allFreqIn1.setVisibility(View.VISIBLE); allFreqLabel1.setVisibility(View.VISIBLE); } } }); inputsRow2 = (TableRow) v.findViewById(R.id.inputsRow3); if (isOutputCh[2]) { inputsRow2.setVisibility(View.GONE); } hiLow2 = (RadioButton) v.findViewById(R.id.hi_low2); freq2 = (TextView) v.findViewById(R.id.input_freq2); inFreqLabel2 = (TextView) v.findViewById(R.id.infreq_label2); rg2 = (RadioGroup) v.findViewById(R.id.radioGroup2); if (isDigCh[2]) { hiLow2.setVisibility(View.VISIBLE); freq2.setVisibility(View.GONE); isDigCh2 = true; inFreqLabel2.setVisibility(View.INVISIBLE); rg2.check(R.id.digital2); } else { hiLow2.setVisibility(View.GONE); freq2.setVisibility(View.VISIBLE); isDigCh2 = false; inFreqLabel2.setVisibility(View.VISIBLE); rg2.check(R.id.count2); } rg2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital2) { hiLow2.setVisibility(View.VISIBLE); isDigCh2 = true; freq2.setVisibility(View.GONE); inFreqLabel2.setVisibility(View.INVISIBLE); allDigIn2.setVisibility(View.VISIBLE); allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); } else { hiLow2.setVisibility(View.GONE); isDigCh2 = false; freq2.setVisibility(View.VISIBLE); inFreqLabel2.setVisibility(View.VISIBLE); allDigIn2.setVisibility(View.GONE); allFreqIn2.setVisibility(View.VISIBLE); allFreqLabel2.setVisibility(View.VISIBLE); } } }); inputsRow3 = (TableRow) v.findViewById(R.id.inputsRow4); if (isOutputCh[3]) { inputsRow3.setVisibility(View.GONE); } hiLow3 = (RadioButton) v.findViewById(R.id.hi_low3); freq3 = (TextView) v.findViewById(R.id.input_freq3); inFreqLabel3 = (TextView) v.findViewById(R.id.infreq_label3); rg3 = (RadioGroup) v.findViewById(R.id.radioGroup3); if (isDigCh[3]) { hiLow3.setVisibility(View.VISIBLE); freq3.setVisibility(View.GONE); isDigCh3 = true; inFreqLabel3.setVisibility(View.INVISIBLE); rg3.check(R.id.digital3); } else { hiLow3.setVisibility(View.GONE); freq3.setVisibility(View.VISIBLE); isDigCh3 = false; inFreqLabel3.setVisibility(View.VISIBLE); rg3.check(R.id.count3); } rg3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital3) { hiLow3.setVisibility(View.VISIBLE); isDigCh3 = true; freq3.setVisibility(View.GONE); inFreqLabel3.setVisibility(View.INVISIBLE); allDigIn3.setVisibility(View.VISIBLE); allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); } else { hiLow3.setVisibility(View.GONE); isDigCh3 = false; freq3.setVisibility(View.VISIBLE); inFreqLabel3.setVisibility(View.VISIBLE); allDigIn3.setVisibility(View.GONE); allFreqIn3.setVisibility(View.VISIBLE); allFreqLabel3.setVisibility(View.VISIBLE); } } }); inputsRow4 = (TableRow) v.findViewById(R.id.inputsRow5); if (isOutputCh[4]) { inputsRow4.setVisibility(View.GONE); } hiLow4 = (RadioButton) v.findViewById(R.id.hi_low4); freq4 = (TextView) v.findViewById(R.id.input_freq4); inFreqLabel4 = (TextView) v.findViewById(R.id.infreq_label4); rg4 = (RadioGroup) v.findViewById(R.id.radioGroup4); if (isDigCh[4]) { hiLow4.setVisibility(View.VISIBLE); freq4.setVisibility(View.GONE); isDigCh4 = true; inFreqLabel4.setVisibility(View.INVISIBLE); rg4.check(R.id.digital4); } else { hiLow4.setVisibility(View.GONE); freq4.setVisibility(View.VISIBLE); isDigCh4 = false; inFreqLabel4.setVisibility(View.VISIBLE); rg4.check(R.id.count4); } rg4.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital4) { hiLow4.setVisibility(View.VISIBLE); isDigCh4 = true; freq4.setVisibility(View.GONE); inFreqLabel4.setVisibility(View.INVISIBLE); allDigIn4.setVisibility(View.VISIBLE); allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); } else { hiLow4.setVisibility(View.GONE); isDigCh4 = false; freq4.setVisibility(View.VISIBLE); inFreqLabel4.setVisibility(View.VISIBLE); allDigIn4.setVisibility(View.GONE); allFreqIn4.setVisibility(View.VISIBLE); allFreqLabel4.setVisibility(View.VISIBLE); } } }); inputsRow5 = (TableRow) v.findViewById(R.id.inputsRow6); if (isOutputCh[5]) { inputsRow5.setVisibility(View.GONE); } hiLow5 = (RadioButton) v.findViewById(R.id.hi_low5); freq5 = (TextView) v.findViewById(R.id.input_freq5); inFreqLabel5 = (TextView) v.findViewById(R.id.infreq_label5); rg5 = (RadioGroup) v.findViewById(R.id.radioGroup5); if (isDigCh[5]) { hiLow5.setVisibility(View.VISIBLE); freq5.setVisibility(View.GONE); isDigCh5 = true; inFreqLabel5.setVisibility(View.INVISIBLE); rg5.check(R.id.digital5); } else { hiLow5.setVisibility(View.GONE); freq5.setVisibility(View.VISIBLE); isDigCh5 = false; inFreqLabel5.setVisibility(View.VISIBLE); rg5.check(R.id.count5); } rg5.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital5) { hiLow5.setVisibility(View.VISIBLE); isDigCh5 = true; freq5.setVisibility(View.GONE); inFreqLabel5.setVisibility(View.INVISIBLE); allDigIn5.setVisibility(View.VISIBLE); allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); } else { hiLow5.setVisibility(View.GONE); isDigCh5 = false; freq5.setVisibility(View.VISIBLE); inFreqLabel5.setVisibility(View.VISIBLE); allDigIn5.setVisibility(View.GONE); allFreqIn5.setVisibility(View.VISIBLE); allFreqLabel5.setVisibility(View.VISIBLE); } } }); inputsRow6 = (TableRow) v.findViewById(R.id.inputsRow7); if (isOutputCh[6]) { inputsRow6.setVisibility(View.GONE); } hiLow6 = (RadioButton) v.findViewById(R.id.hi_low6); freq6 = (TextView) v.findViewById(R.id.input_freq6); inFreqLabel6 = (TextView) v.findViewById(R.id.infreq_label6); rg6 = (RadioGroup) v.findViewById(R.id.radioGroup6); if (isDigCh[6]) { hiLow6.setVisibility(View.VISIBLE); freq6.setVisibility(View.GONE); isDigCh6 = true; inFreqLabel6.setVisibility(View.INVISIBLE); rg6.check(R.id.digital6); } else { hiLow6.setVisibility(View.GONE); freq6.setVisibility(View.VISIBLE); isDigCh6 = false; inFreqLabel6.setVisibility(View.VISIBLE); rg6.check(R.id.count6); } rg6.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital6) { hiLow6.setVisibility(View.VISIBLE); isDigCh6 = true; freq6.setVisibility(View.GONE); inFreqLabel6.setVisibility(View.INVISIBLE); allDigIn6.setVisibility(View.VISIBLE); allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); } else { hiLow6.setVisibility(View.GONE); isDigCh6 = false; freq6.setVisibility(View.VISIBLE); inFreqLabel6.setVisibility(View.VISIBLE); allDigIn6.setVisibility(View.GONE); allFreqIn6.setVisibility(View.VISIBLE); allFreqLabel6.setVisibility(View.VISIBLE); } } }); inputsRow7 = (TableRow) v.findViewById(R.id.inputsRow8); if (isOutputCh[7]) { inputsRow7.setVisibility(View.GONE); } hiLow7 = (RadioButton) v.findViewById(R.id.hi_low7); freq7 = (TextView) v.findViewById(R.id.input_freq7); inFreqLabel7 = (TextView) v.findViewById(R.id.infreq_label7); rg7 = (RadioGroup) v.findViewById(R.id.radioGroup7); if (isDigCh[7]) { hiLow7.setVisibility(View.VISIBLE); freq7.setVisibility(View.GONE); isDigCh7 = true; inFreqLabel7.setVisibility(View.INVISIBLE); rg7.check(R.id.digital7); } else { hiLow7.setVisibility(View.GONE); freq7.setVisibility(View.VISIBLE); isDigCh7 = false; inFreqLabel7.setVisibility(View.VISIBLE); rg7.check(R.id.count7); } rg7.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital7) { hiLow7.setVisibility(View.VISIBLE); isDigCh7 = true; freq7.setVisibility(View.GONE); inFreqLabel7.setVisibility(View.INVISIBLE); allDigIn7.setVisibility(View.VISIBLE); allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); } else { hiLow7.setVisibility(View.GONE); isDigCh7 = false; freq7.setVisibility(View.VISIBLE); inFreqLabel7.setVisibility(View.VISIBLE); allDigIn7.setVisibility(View.GONE); allFreqIn7.setVisibility(View.VISIBLE); allFreqLabel7.setVisibility(View.VISIBLE); } } }); inputsRow8 = (TableRow) v.findViewById(R.id.inputsRow9); if (isOutputCh[8]) { inputsRow8.setVisibility(View.GONE); } hiLow8 = (RadioButton) v.findViewById(R.id.hi_low8); freq8 = (TextView) v.findViewById(R.id.input_freq8); inFreqLabel8 = (TextView) v.findViewById(R.id.infreq_label8); rg8 = (RadioGroup) v.findViewById(R.id.radioGroup8); if (isDigCh[8]) { hiLow8.setVisibility(View.VISIBLE); freq8.setVisibility(View.GONE); isDigCh8 = true; inFreqLabel8.setVisibility(View.INVISIBLE); rg8.check(R.id.digital8); } else { hiLow8.setVisibility(View.GONE); freq8.setVisibility(View.VISIBLE); isDigCh8 = false; inFreqLabel8.setVisibility(View.VISIBLE); rg8.check(R.id.count8); } rg8.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital8) { hiLow8.setVisibility(View.VISIBLE); isDigCh8 = true; freq8.setVisibility(View.GONE); inFreqLabel8.setVisibility(View.INVISIBLE); allDigIn8.setVisibility(View.VISIBLE); allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); } else { hiLow8.setVisibility(View.GONE); isDigCh8 = false; freq8.setVisibility(View.VISIBLE); inFreqLabel8.setVisibility(View.VISIBLE); allDigIn8.setVisibility(View.GONE); allFreqIn8.setVisibility(View.VISIBLE); allFreqLabel8.setVisibility(View.VISIBLE); } } }); inputsRow9 = (TableRow) v.findViewById(R.id.inputsRow10); if (isOutputCh[9]) { inputsRow9.setVisibility(View.GONE); } hiLow9 = (RadioButton) v.findViewById(R.id.hi_low9); freq9 = (TextView) v.findViewById(R.id.input_freq9); inFreqLabel9 = (TextView) v.findViewById(R.id.infreq_label9); rg9 = (RadioGroup) v.findViewById(R.id.radioGroup9); if (isDigCh[9]) { hiLow9.setVisibility(View.VISIBLE); freq9.setVisibility(View.GONE); isDigCh9 = true; inFreqLabel9.setVisibility(View.INVISIBLE); rg9.check(R.id.digital9); } else { hiLow9.setVisibility(View.GONE); freq9.setVisibility(View.VISIBLE); isDigCh9 = false; inFreqLabel9.setVisibility(View.VISIBLE); rg9.check(R.id.count9); } rg9.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital9) { hiLow9.setVisibility(View.VISIBLE); isDigCh9 = true; freq9.setVisibility(View.GONE); inFreqLabel9.setVisibility(View.INVISIBLE); allDigIn9.setVisibility(View.VISIBLE); allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); } else { hiLow9.setVisibility(View.GONE); isDigCh9 = false; freq9.setVisibility(View.VISIBLE); inFreqLabel9.setVisibility(View.VISIBLE); allDigIn9.setVisibility(View.GONE); allFreqIn9.setVisibility(View.VISIBLE); allFreqLabel9.setVisibility(View.VISIBLE); } } }); inputsRow10 = (TableRow) v.findViewById(R.id.inputsRow11); if (isOutputCh[10]) { inputsRow10.setVisibility(View.GONE); } hiLow10 = (RadioButton) v.findViewById(R.id.hi_low10); freq10 = (TextView) v.findViewById(R.id.input_freq10); inFreqLabel10 = (TextView) v.findViewById(R.id.infreq_label10); rg10 = (RadioGroup) v.findViewById(R.id.radioGroup10); if (isDigCh[10]) { hiLow10.setVisibility(View.VISIBLE); freq10.setVisibility(View.GONE); isDigCh10 = true; inFreqLabel10.setVisibility(View.INVISIBLE); rg10.check(R.id.digital10); } else { hiLow10.setVisibility(View.GONE); freq10.setVisibility(View.VISIBLE); isDigCh10 = false; inFreqLabel10.setVisibility(View.VISIBLE); rg10.check(R.id.count10); } rg10.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital10) { hiLow10.setVisibility(View.VISIBLE); isDigCh10 = true; freq10.setVisibility(View.GONE); inFreqLabel10.setVisibility(View.INVISIBLE); allDigIn10.setVisibility(View.VISIBLE); allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); } else { hiLow10.setVisibility(View.GONE); isDigCh10 = false; freq10.setVisibility(View.VISIBLE); inFreqLabel10.setVisibility(View.VISIBLE); allDigIn10.setVisibility(View.GONE); allFreqIn10.setVisibility(View.VISIBLE); allFreqLabel10.setVisibility(View.VISIBLE); } } }); inputsRow11 = (TableRow) v.findViewById(R.id.inputsRow12); if (isOutputCh[11]) { inputsRow11.setVisibility(View.GONE); } hiLow11 = (RadioButton) v.findViewById(R.id.hi_low11); freq11 = (TextView) v.findViewById(R.id.input_freq11); inFreqLabel11 = (TextView) v.findViewById(R.id.infreq_label11); rg11 = (RadioGroup) v.findViewById(R.id.radioGroup11); if (isDigCh[11]) { hiLow11.setVisibility(View.VISIBLE); freq11.setVisibility(View.GONE); isDigCh11 = true; inFreqLabel11.setVisibility(View.INVISIBLE); rg11.check(R.id.digital11); } else { hiLow11.setVisibility(View.GONE); freq11.setVisibility(View.VISIBLE); isDigCh11 = false; inFreqLabel11.setVisibility(View.VISIBLE); rg11.check(R.id.count11); } rg11.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital11) { hiLow11.setVisibility(View.VISIBLE); isDigCh11 = true; freq11.setVisibility(View.GONE); inFreqLabel11.setVisibility(View.INVISIBLE); allDigIn11.setVisibility(View.VISIBLE); allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); } else { hiLow11.setVisibility(View.GONE); isDigCh11 = false; freq11.setVisibility(View.VISIBLE); inFreqLabel11.setVisibility(View.VISIBLE); allDigIn11.setVisibility(View.GONE); allFreqIn11.setVisibility(View.VISIBLE); allFreqLabel11.setVisibility(View.VISIBLE); } } }); inputsRow12 = (TableRow) v.findViewById(R.id.inputsRow13); if (isOutputCh[12]) { inputsRow12.setVisibility(View.GONE); } hiLow12 = (RadioButton) v.findViewById(R.id.hi_low12); freq12 = (TextView) v.findViewById(R.id.input_freq12); inFreqLabel12 = (TextView) v.findViewById(R.id.infreq_label12); rg12 = (RadioGroup) v.findViewById(R.id.radioGroup12); if (isDigCh[12]) { hiLow12.setVisibility(View.VISIBLE); freq12.setVisibility(View.GONE); isDigCh12 = true; inFreqLabel12.setVisibility(View.INVISIBLE); rg12.check(R.id.digital12); } else { hiLow12.setVisibility(View.GONE); freq12.setVisibility(View.VISIBLE); isDigCh12 = false; inFreqLabel12.setVisibility(View.VISIBLE); rg12.check(R.id.count12); } rg12.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital12) { hiLow12.setVisibility(View.VISIBLE); isDigCh12 = true; freq12.setVisibility(View.GONE); inFreqLabel12.setVisibility(View.INVISIBLE); allDigIn12.setVisibility(View.VISIBLE); allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); } else { hiLow12.setVisibility(View.GONE); isDigCh12 = false; freq12.setVisibility(View.VISIBLE); inFreqLabel12.setVisibility(View.VISIBLE); allDigIn12.setVisibility(View.GONE); allFreqIn12.setVisibility(View.VISIBLE); allFreqLabel12.setVisibility(View.VISIBLE); } } }); inputsRow13 = (TableRow) v.findViewById(R.id.inputsRow14); if (isOutputCh[13]) { inputsRow13.setVisibility(View.GONE); } hiLow13 = (RadioButton) v.findViewById(R.id.hi_low13); freq13 = (TextView) v.findViewById(R.id.input_freq13); inFreqLabel13 = (TextView) v.findViewById(R.id.infreq_label13); rg13 = (RadioGroup) v.findViewById(R.id.radioGroup13); if (isDigCh[13]) { hiLow13.setVisibility(View.VISIBLE); freq13.setVisibility(View.GONE); isDigCh13 = true; inFreqLabel13.setVisibility(View.INVISIBLE); rg13.check(R.id.digital13); } else { hiLow13.setVisibility(View.GONE); freq13.setVisibility(View.VISIBLE); isDigCh13 = false; inFreqLabel13.setVisibility(View.VISIBLE); rg13.check(R.id.count13); } rg13.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital13) { hiLow13.setVisibility(View.VISIBLE); isDigCh13 = true; freq13.setVisibility(View.GONE); inFreqLabel13.setVisibility(View.INVISIBLE); allDigIn13.setVisibility(View.VISIBLE); allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); } else { hiLow13.setVisibility(View.GONE); isDigCh13 = false; freq13.setVisibility(View.VISIBLE); inFreqLabel13.setVisibility(View.VISIBLE); allDigIn13.setVisibility(View.GONE); allFreqIn13.setVisibility(View.VISIBLE); allFreqLabel13.setVisibility(View.VISIBLE); } } }); inputsRow14 = (TableRow) v.findViewById(R.id.inputsRow15); if (isOutputCh[14]) { inputsRow14.setVisibility(View.GONE); } hiLow14 = (RadioButton) v.findViewById(R.id.hi_low14); freq14 = (TextView) v.findViewById(R.id.input_freq14); inFreqLabel14 = (TextView) v.findViewById(R.id.infreq_label14); rg14 = (RadioGroup) v.findViewById(R.id.radioGroup14); if (isDigCh[14]) { hiLow14.setVisibility(View.VISIBLE); freq14.setVisibility(View.GONE); isDigCh14 = true; inFreqLabel14.setVisibility(View.INVISIBLE); rg14.check(R.id.digital14); } else { hiLow14.setVisibility(View.GONE); freq14.setVisibility(View.VISIBLE); isDigCh14 = false; inFreqLabel14.setVisibility(View.VISIBLE); rg14.check(R.id.count14); } rg14.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital14) { hiLow14.setVisibility(View.VISIBLE); isDigCh14 = true; freq14.setVisibility(View.GONE); inFreqLabel14.setVisibility(View.INVISIBLE); allDigIn14.setVisibility(View.VISIBLE); allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); } else { hiLow14.setVisibility(View.GONE); isDigCh14 = false; freq14.setVisibility(View.VISIBLE); inFreqLabel14.setVisibility(View.VISIBLE); allDigIn14.setVisibility(View.GONE); allFreqIn14.setVisibility(View.VISIBLE); allFreqLabel14.setVisibility(View.VISIBLE); } } }); inputsRow15 = (TableRow) v.findViewById(R.id.inputsRow16); if (isOutputCh[15]) { inputsRow15.setVisibility(View.GONE); } hiLow15 = (RadioButton) v.findViewById(R.id.hi_low15); freq15 = (TextView) v.findViewById(R.id.input_freq15); inFreqLabel15 = (TextView) v.findViewById(R.id.infreq_label15); rg15 = (RadioGroup) v.findViewById(R.id.radioGroup15); if (isDigCh[15]) { hiLow15.setVisibility(View.VISIBLE); freq15.setVisibility(View.GONE); isDigCh15 = true; inFreqLabel15.setVisibility(View.INVISIBLE); rg15.check(R.id.digital15); } else { hiLow15.setVisibility(View.GONE); freq15.setVisibility(View.VISIBLE); isDigCh15 = false; inFreqLabel15.setVisibility(View.VISIBLE); rg15.check(R.id.count15); } rg15.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.digital15) { hiLow15.setVisibility(View.VISIBLE); isDigCh15 = true; freq15.setVisibility(View.GONE); inFreqLabel15.setVisibility(View.INVISIBLE); allDigIn15.setVisibility(View.VISIBLE); allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); } else { hiLow15.setVisibility(View.GONE); isDigCh15 = false; freq15.setVisibility(View.VISIBLE); inFreqLabel15.setVisibility(View.VISIBLE); allDigIn15.setVisibility(View.GONE); allFreqIn15.setVisibility(View.VISIBLE); allFreqLabel15.setVisibility(View.VISIBLE); } } }); break; case 2: //resId = R.layout.outputs; resId = R.layout.outputs; //TODO v = inflater.inflate(resId, null, false); outputsRow0 = (TableRow) v.findViewById(R.id.outputsRow1); outputSV = (ScrollView) v.findViewById(R.id.scrollViewOutputs); outputSV.setScrollbarFadingEnabled(false); outputReset = (Button) v.findViewById(R.id.reset_outputs); outputReset.setVisibility(View.GONE); outputSend = (Button) v.findViewById(R.id.send_outputs); outputSend.setOnTouchListener(new OnTouchListener() { @Override // This touch method sees both button down and button up events // and sents new settings for both. To disable comment out ACTION UP public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); /** Two button methods to have separtate start and stop buttons. * To use remove comment out tags below and comment out the above * setOnTouchListener method **/ /*outputSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQTCPMain)context).btState(); if ( connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { sendOutputs = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); setProp(); } } }); outputReset = (Button)v.findViewById(R.id.reset_outputs); outputReset.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQTCPMain)context).btState(); if ( connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { sendOutputs = true; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); setProp(); } } }); */ if (!isOutputCh[0]) { outputsRow0.setVisibility(View.GONE); } out_hiLow0 = (CheckBox) v.findViewById(R.id.out_hi_low0); if (outputState[0]) { out_hiLow0.setChecked(true); } out_hiLow0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow0.isChecked()) { allDigOut0.setChecked(true); } else { allDigOut0.setChecked(false); } } }); out_freq0 = (EditText) v.findViewById(R.id.out_freq0); Log.e("Test", "desiredFreq[0] is: " + desiredFreq[0]); out_freq0.setText(desiredFreq[0]); outFreqLabel0 = (TextView) v.findViewById(R.id.outfreq_label0); duty_freq0 = (EditText) v.findViewById(R.id.out_duty0); Log.e("Test", "desiredDuty[0] is: " + desiredDuty[0]); duty_freq0.setText(desiredDuty[0]); outDutyLabel0 = (TextView) v.findViewById(R.id.outduty_label0); rg16 = (RadioGroup) v.findViewById(R.id.radioGroupOut0); // Log.e("Test", "isDigCh0 @ output is: " + isDigCh[0]); if (isDigCh[0]) { out_hiLow0.setVisibility(View.VISIBLE); out_freq0.setVisibility(View.GONE); duty_freq0.setVisibility(View.GONE); isDigCh0 = true; outFreqLabel0.setVisibility(View.INVISIBLE); outDutyLabel0.setVisibility(View.INVISIBLE); rg16.check(R.id.out_digital0); } else { out_hiLow0.setVisibility(View.GONE); out_freq0.setVisibility(View.VISIBLE); duty_freq0.setVisibility(View.VISIBLE); isDigCh0 = false; outFreqLabel0.setVisibility(View.VISIBLE); outDutyLabel0.setVisibility(View.VISIBLE); rg16.check(R.id.pulse0); } rg16.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital0) { // if checked channel is digital out_hiLow0.setVisibility(View.VISIBLE); isDigCh0 = true; out_freq0.setVisibility(View.GONE); duty_freq0.setVisibility(View.GONE); outFreqLabel0.setVisibility(View.INVISIBLE); outDutyLabel0.setVisibility(View.INVISIBLE); allDigOut0.setVisibility(View.VISIBLE); allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow0.setVisibility(View.GONE); isDigCh0 = false; out_freq0.setVisibility(View.VISIBLE); duty_freq0.setVisibility(View.VISIBLE); outFreqLabel0.setVisibility(View.VISIBLE); outDutyLabel0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqOut0.setVisibility(View.VISIBLE); allFreqLabel0.setVisibility(View.VISIBLE); allDutyOut0.setVisibility(View.VISIBLE); allDutyLabel0.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg16.check(R.id.out_digital0); } } } }); out_freq0.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq0.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq0.setText("0"); getInputString(); } return true; } return false; } }); out_freq0.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq0.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq0.setText("0"); getInputString(); } return true; } return false; } }); outputsRow1 = (TableRow) v.findViewById(R.id.outputsRow2); if (!isOutputCh[1]) { outputsRow1.setVisibility(View.GONE); } out_hiLow1 = (CheckBox) v.findViewById(R.id.out_hi_low1); if (outputState[1]) { out_hiLow1.setChecked(true); } out_hiLow1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow1.isChecked()) { allDigOut1.setChecked(true); } else { allDigOut1.setChecked(false); } } }); out_freq1 = (EditText) v.findViewById(R.id.out_freq1); out_freq1.setText(desiredFreq[1]); outFreqLabel1 = (TextView) v.findViewById(R.id.outfreq_label1); duty_freq1 = (EditText) v.findViewById(R.id.out_duty1); duty_freq1.setText(desiredDuty[1]); outDutyLabel1 = (TextView) v.findViewById(R.id.outduty_label1); rg17 = (RadioGroup) v.findViewById(R.id.radioGroupOut1); if (isDigCh[1]) { out_hiLow1.setVisibility(View.VISIBLE); out_freq1.setVisibility(View.GONE); duty_freq1.setVisibility(View.GONE); isDigCh1 = true; outFreqLabel1.setVisibility(View.INVISIBLE); outDutyLabel1.setVisibility(View.INVISIBLE); rg17.check(R.id.out_digital1); } else { out_hiLow1.setVisibility(View.GONE); out_freq1.setVisibility(View.VISIBLE); duty_freq1.setVisibility(View.VISIBLE); isDigCh1 = false; outFreqLabel1.setVisibility(View.VISIBLE); outDutyLabel1.setVisibility(View.VISIBLE); rg17.check(R.id.pulse1); } rg17.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital1) { out_hiLow1.setVisibility(View.VISIBLE); isDigCh1 = true; out_freq1.setVisibility(View.GONE); duty_freq1.setVisibility(View.GONE); outFreqLabel1.setVisibility(View.INVISIBLE); outDutyLabel1.setVisibility(View.INVISIBLE); allDigOut1.setVisibility(View.VISIBLE); allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow1.setVisibility(View.GONE); isDigCh1 = false; out_freq1.setVisibility(View.VISIBLE); duty_freq1.setVisibility(View.VISIBLE); outFreqLabel1.setVisibility(View.VISIBLE); outDutyLabel1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqOut1.setVisibility(View.VISIBLE); allFreqLabel1.setVisibility(View.VISIBLE); allDutyOut1.setVisibility(View.VISIBLE); allDutyLabel1.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg17.check(R.id.out_digital1); } } } }); out_freq1.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq1.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq1.setText("0"); getInputString(); } return true; } return false; } }); out_freq1.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq1.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq1.setText("0"); getInputString(); } return true; } return false; } }); outputsRow2 = (TableRow) v.findViewById(R.id.outputsRow3); if (!isOutputCh[2]) { outputsRow2.setVisibility(View.GONE); } out_hiLow2 = (CheckBox) v.findViewById(R.id.out_hi_low2); if (outputState[2]) { out_hiLow2.setChecked(true); } out_hiLow2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow2.isChecked()) { allDigOut2.setChecked(true); } else { allDigOut2.setChecked(false); } } }); out_freq2 = (EditText) v.findViewById(R.id.out_freq2); out_freq2.setText(desiredFreq[2]); outFreqLabel2 = (TextView) v.findViewById(R.id.outfreq_label2); duty_freq2 = (EditText) v.findViewById(R.id.out_duty2); duty_freq2.setText(desiredDuty[2]); outDutyLabel2 = (TextView) v.findViewById(R.id.outduty_label2); rg18 = (RadioGroup) v.findViewById(R.id.radioGroupOut2); if (isDigCh[2]) { out_hiLow2.setVisibility(View.VISIBLE); out_freq2.setVisibility(View.GONE); duty_freq2.setVisibility(View.GONE); isDigCh2 = true; outFreqLabel2.setVisibility(View.INVISIBLE); outDutyLabel2.setVisibility(View.INVISIBLE); rg18.check(R.id.out_digital2); } else { out_hiLow2.setVisibility(View.GONE); out_freq2.setVisibility(View.VISIBLE); duty_freq2.setVisibility(View.VISIBLE); isDigCh2 = false; outFreqLabel2.setVisibility(View.VISIBLE); outDutyLabel2.setVisibility(View.VISIBLE); rg18.check(R.id.pulse2); } rg18.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital2) { out_hiLow2.setVisibility(View.VISIBLE); isDigCh2 = true; out_freq2.setVisibility(View.GONE); duty_freq2.setVisibility(View.GONE); outFreqLabel2.setVisibility(View.INVISIBLE); outDutyLabel2.setVisibility(View.INVISIBLE); allDigOut2.setVisibility(View.VISIBLE); allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow2.setVisibility(View.GONE); isDigCh2 = false; out_freq2.setVisibility(View.VISIBLE); duty_freq2.setVisibility(View.VISIBLE); outFreqLabel2.setVisibility(View.VISIBLE); outDutyLabel2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqOut2.setVisibility(View.VISIBLE); allFreqLabel2.setVisibility(View.VISIBLE); allDutyOut2.setVisibility(View.VISIBLE); allDutyLabel2.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg18.check(R.id.out_digital2); } } } }); out_freq2.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq2.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq2.setText("0"); getInputString(); } return true; } return false; } }); out_freq2.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq2.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq2.setText("0"); getInputString(); } return true; } return false; } }); outputsRow3 = (TableRow) v.findViewById(R.id.outputsRow4); if (!isOutputCh[3]) { outputsRow3.setVisibility(View.GONE); } out_hiLow3 = (CheckBox) v.findViewById(R.id.out_hi_low3); if (outputState[3]) { out_hiLow3.setChecked(true); } out_hiLow3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow3.isChecked()) { allDigOut3.setChecked(true); } else { allDigOut3.setChecked(false); } } }); out_freq3 = (EditText) v.findViewById(R.id.out_freq3); out_freq3.setText(desiredFreq[3]); outFreqLabel3 = (TextView) v.findViewById(R.id.outfreq_label3); duty_freq3 = (EditText) v.findViewById(R.id.out_duty3); duty_freq3.setText(desiredDuty[3]); outDutyLabel3 = (TextView) v.findViewById(R.id.outduty_label3); rg19 = (RadioGroup) v.findViewById(R.id.radioGroupOut3); if (isDigCh[3]) { out_hiLow3.setVisibility(View.VISIBLE); out_freq3.setVisibility(View.GONE); duty_freq3.setVisibility(View.GONE); isDigCh3 = true; outFreqLabel3.setVisibility(View.INVISIBLE); outDutyLabel3.setVisibility(View.INVISIBLE); rg19.check(R.id.out_digital3); } else { out_hiLow3.setVisibility(View.GONE); out_freq3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); isDigCh3 = false; outFreqLabel3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); rg19.check(R.id.pulse3); } rg19.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital3) { out_hiLow3.setVisibility(View.VISIBLE); isDigCh3 = true; out_freq3.setVisibility(View.GONE); duty_freq3.setVisibility(View.GONE); outFreqLabel3.setVisibility(View.INVISIBLE); outDutyLabel3.setVisibility(View.INVISIBLE); allDigOut3.setVisibility(View.VISIBLE); allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow3.setVisibility(View.GONE); isDigCh3 = false; out_freq3.setVisibility(View.VISIBLE); duty_freq3.setVisibility(View.VISIBLE); outFreqLabel3.setVisibility(View.VISIBLE); outDutyLabel3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqOut3.setVisibility(View.VISIBLE); allFreqLabel3.setVisibility(View.VISIBLE); allDutyOut3.setVisibility(View.VISIBLE); allDutyLabel3.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg19.check(R.id.out_digital3); } } } }); out_freq3.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq3.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq3.setText("0"); getInputString(); } return true; } return false; } }); out_freq3.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq3.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq3.setText("0"); getInputString(); } return true; } return false; } }); outputsRow4 = (TableRow) v.findViewById(R.id.outputsRow5); if (!isOutputCh[4]) { outputsRow4.setVisibility(View.GONE); } out_hiLow4 = (CheckBox) v.findViewById(R.id.out_hi_low4); if (outputState[4]) { out_hiLow4.setChecked(true); } out_hiLow4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow4.isChecked()) { allDigOut4.setChecked(true); } else { allDigOut4.setChecked(false); } } }); out_freq4 = (EditText) v.findViewById(R.id.out_freq4); out_freq4.setText(desiredFreq[4]); outFreqLabel4 = (TextView) v.findViewById(R.id.outfreq_label4); duty_freq4 = (EditText) v.findViewById(R.id.out_duty4); duty_freq4.setText(desiredDuty[4]); outDutyLabel4 = (TextView) v.findViewById(R.id.outduty_label4); rg20 = (RadioGroup) v.findViewById(R.id.radioGroupOut4); if (isDigCh[4]) { out_hiLow4.setVisibility(View.VISIBLE); out_freq4.setVisibility(View.GONE); duty_freq4.setVisibility(View.GONE); isDigCh4 = true; outFreqLabel4.setVisibility(View.INVISIBLE); outDutyLabel4.setVisibility(View.INVISIBLE); rg20.check(R.id.out_digital4); } else { out_hiLow4.setVisibility(View.GONE); out_freq4.setVisibility(View.VISIBLE); duty_freq4.setVisibility(View.VISIBLE); isDigCh4 = false; outFreqLabel4.setVisibility(View.VISIBLE); outDutyLabel4.setVisibility(View.VISIBLE); rg20.check(R.id.pulse4); } rg20.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital4) { out_hiLow4.setVisibility(View.VISIBLE); isDigCh4 = true; out_freq4.setVisibility(View.GONE); duty_freq4.setVisibility(View.GONE); outFreqLabel4.setVisibility(View.INVISIBLE); outDutyLabel4.setVisibility(View.INVISIBLE); allDigOut4.setVisibility(View.VISIBLE); allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow4.setVisibility(View.GONE); isDigCh4 = false; out_freq4.setVisibility(View.VISIBLE); duty_freq4.setVisibility(View.VISIBLE); outFreqLabel4.setVisibility(View.VISIBLE); outDutyLabel4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqOut4.setVisibility(View.VISIBLE); allFreqLabel4.setVisibility(View.VISIBLE); allDutyOut4.setVisibility(View.VISIBLE); allDutyLabel4.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg20.check(R.id.out_digital4); } } } }); out_freq4.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq4.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq4.setText("0"); getInputString(); } return true; } return false; } }); out_freq4.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq4.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq4.setText("0"); getInputString(); } return true; } return false; } }); outputsRow5 = (TableRow) v.findViewById(R.id.outputsRow6); if (!isOutputCh[5]) { outputsRow5.setVisibility(View.GONE); } out_hiLow5 = (CheckBox) v.findViewById(R.id.out_hi_low5); if (outputState[5]) { out_hiLow5.setChecked(true); } out_hiLow5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow5.isChecked()) { allDigOut5.setChecked(true); } else { allDigOut5.setChecked(false); } } }); out_freq5 = (EditText) v.findViewById(R.id.out_freq5); out_freq5.setText(desiredFreq[5]); outFreqLabel5 = (TextView) v.findViewById(R.id.outfreq_label5); duty_freq5 = (EditText) v.findViewById(R.id.out_duty5); duty_freq5.setText(desiredDuty[5]); outDutyLabel5 = (TextView) v.findViewById(R.id.outduty_label5); rg21 = (RadioGroup) v.findViewById(R.id.radioGroupOut5); if (isDigCh[5]) { out_hiLow5.setVisibility(View.VISIBLE); out_freq5.setVisibility(View.GONE); duty_freq5.setVisibility(View.GONE); isDigCh5 = true; outFreqLabel5.setVisibility(View.INVISIBLE); outDutyLabel5.setVisibility(View.INVISIBLE); rg21.check(R.id.out_digital5); } else { out_hiLow5.setVisibility(View.GONE); out_freq5.setVisibility(View.VISIBLE); duty_freq5.setVisibility(View.VISIBLE); isDigCh5 = false; outFreqLabel5.setVisibility(View.VISIBLE); outDutyLabel5.setVisibility(View.VISIBLE); rg21.check(R.id.pulse5); } rg21.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital5) { out_hiLow5.setVisibility(View.VISIBLE); isDigCh5 = true; out_freq5.setVisibility(View.GONE); duty_freq5.setVisibility(View.GONE); outFreqLabel5.setVisibility(View.INVISIBLE); outDutyLabel5.setVisibility(View.INVISIBLE); allDigOut5.setVisibility(View.VISIBLE); allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow5.setVisibility(View.GONE); isDigCh5 = false; out_freq5.setVisibility(View.VISIBLE); duty_freq5.setVisibility(View.VISIBLE); outFreqLabel5.setVisibility(View.VISIBLE); outDutyLabel5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqOut5.setVisibility(View.VISIBLE); allFreqLabel5.setVisibility(View.VISIBLE); allDutyOut5.setVisibility(View.VISIBLE); allDutyLabel5.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg21.check(R.id.out_digital5); } } } }); out_freq5.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq5.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq5.setText("0"); getInputString(); } return true; } return false; } }); out_freq5.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq5.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq5.setText("0"); getInputString(); } return true; } return false; } }); outputsRow6 = (TableRow) v.findViewById(R.id.outputsRow7); if (!isOutputCh[6]) { outputsRow6.setVisibility(View.GONE); } out_hiLow6 = (CheckBox) v.findViewById(R.id.out_hi_low6); if (outputState[6]) { out_hiLow6.setChecked(true); } out_hiLow6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow6.isChecked()) { allDigOut6.setChecked(true); } else { allDigOut6.setChecked(false); } } }); out_freq6 = (EditText) v.findViewById(R.id.out_freq6); out_freq6.setText(desiredFreq[6]); outFreqLabel6 = (TextView) v.findViewById(R.id.outfreq_label6); duty_freq6 = (EditText) v.findViewById(R.id.out_duty6); duty_freq6.setText(desiredDuty[6]); outDutyLabel6 = (TextView) v.findViewById(R.id.outduty_label6); rg22 = (RadioGroup) v.findViewById(R.id.radioGroupOut6); if (isDigCh[6]) { out_hiLow6.setVisibility(View.VISIBLE); out_freq6.setVisibility(View.GONE); duty_freq6.setVisibility(View.GONE); isDigCh6 = true; outFreqLabel6.setVisibility(View.INVISIBLE); outDutyLabel6.setVisibility(View.INVISIBLE); rg22.check(R.id.out_digital6); } else { out_hiLow6.setVisibility(View.GONE); out_freq6.setVisibility(View.VISIBLE); duty_freq6.setVisibility(View.VISIBLE); isDigCh6 = false; outFreqLabel6.setVisibility(View.VISIBLE); outDutyLabel6.setVisibility(View.VISIBLE); rg22.check(R.id.pulse6); } rg22.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital6) { out_hiLow6.setVisibility(View.VISIBLE); isDigCh6 = true; out_freq6.setVisibility(View.GONE); duty_freq6.setVisibility(View.GONE); outFreqLabel6.setVisibility(View.INVISIBLE); outDutyLabel6.setVisibility(View.INVISIBLE); allDigOut6.setVisibility(View.VISIBLE); allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow6.setVisibility(View.GONE); isDigCh6 = false; out_freq6.setVisibility(View.VISIBLE); duty_freq6.setVisibility(View.VISIBLE); outFreqLabel6.setVisibility(View.VISIBLE); outDutyLabel6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqOut6.setVisibility(View.VISIBLE); allFreqLabel6.setVisibility(View.VISIBLE); allDutyOut6.setVisibility(View.VISIBLE); allDutyLabel6.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg22.check(R.id.out_digital6); } } } }); out_freq6.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq6.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq6.setText("0"); getInputString(); } return true; } return false; } }); out_freq6.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq6.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq6.setText("0"); getInputString(); } return true; } return false; } }); outputsRow7 = (TableRow) v.findViewById(R.id.outputsRow8); if (!isOutputCh[7]) { outputsRow7.setVisibility(View.GONE); } out_hiLow7 = (CheckBox) v.findViewById(R.id.out_hi_low7); if (outputState[7]) { out_hiLow7.setChecked(true); } out_hiLow7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow7.isChecked()) { allDigOut7.setChecked(true); } else { allDigOut7.setChecked(false); } } }); out_freq7 = (EditText) v.findViewById(R.id.out_freq7); out_freq7.setText(desiredFreq[7]); outFreqLabel7 = (TextView) v.findViewById(R.id.outfreq_label7); duty_freq7 = (EditText) v.findViewById(R.id.out_duty7); duty_freq7.setText(desiredDuty[7]); outDutyLabel7 = (TextView) v.findViewById(R.id.outduty_label7); rg23 = (RadioGroup) v.findViewById(R.id.radioGroupOut7); if (isDigCh[7]) { out_hiLow7.setVisibility(View.VISIBLE); out_freq7.setVisibility(View.GONE); duty_freq7.setVisibility(View.GONE); isDigCh7 = true; outFreqLabel7.setVisibility(View.INVISIBLE); outDutyLabel7.setVisibility(View.INVISIBLE); rg23.check(R.id.out_digital7); } else { out_hiLow7.setVisibility(View.GONE); out_freq7.setVisibility(View.VISIBLE); duty_freq7.setVisibility(View.VISIBLE); isDigCh7 = false; outFreqLabel7.setVisibility(View.VISIBLE); outDutyLabel7.setVisibility(View.VISIBLE); rg23.check(R.id.pulse7); } rg23.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital7) { out_hiLow7.setVisibility(View.VISIBLE); isDigCh7 = true; out_freq7.setVisibility(View.GONE); duty_freq7.setVisibility(View.GONE); outFreqLabel7.setVisibility(View.INVISIBLE); outDutyLabel7.setVisibility(View.INVISIBLE); allDigOut7.setVisibility(View.VISIBLE); allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow7.setVisibility(View.GONE); isDigCh7 = false; out_freq7.setVisibility(View.VISIBLE); duty_freq7.setVisibility(View.VISIBLE); outFreqLabel7.setVisibility(View.VISIBLE); outDutyLabel7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqOut7.setVisibility(View.VISIBLE); allFreqLabel7.setVisibility(View.VISIBLE); allDutyOut7.setVisibility(View.VISIBLE); allDutyLabel7.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg23.check(R.id.out_digital7); } } } }); out_freq7.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq7.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq7.setText("0"); getInputString(); } return true; } return false; } }); out_freq7.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq7.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq7.setText("0"); getInputString(); } return true; } return false; } }); outputsRow8 = (TableRow) v.findViewById(R.id.outputsRow9); if (!isOutputCh[8]) { outputsRow8.setVisibility(View.GONE); } out_hiLow8 = (CheckBox) v.findViewById(R.id.out_hi_low8); if (outputState[8]) { out_hiLow8.setChecked(true); } out_hiLow8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow8.isChecked()) { allDigOut8.setChecked(true); } else { allDigOut8.setChecked(false); } } }); out_freq8 = (EditText) v.findViewById(R.id.out_freq8); out_freq8.setText(desiredFreq[8]); outFreqLabel8 = (TextView) v.findViewById(R.id.outfreq_label8); duty_freq8 = (EditText) v.findViewById(R.id.out_duty8); duty_freq8.setText(desiredDuty[8]); outDutyLabel8 = (TextView) v.findViewById(R.id.outduty_label8); rg24 = (RadioGroup) v.findViewById(R.id.radioGroupOut8); if (isDigCh[8]) { out_hiLow8.setVisibility(View.VISIBLE); out_freq8.setVisibility(View.GONE); duty_freq8.setVisibility(View.GONE); isDigCh8 = true; outFreqLabel8.setVisibility(View.INVISIBLE); outDutyLabel8.setVisibility(View.INVISIBLE); rg24.check(R.id.out_digital8); } else { out_hiLow8.setVisibility(View.GONE); out_freq8.setVisibility(View.VISIBLE); duty_freq8.setVisibility(View.VISIBLE); isDigCh8 = false; outFreqLabel8.setVisibility(View.VISIBLE); outDutyLabel8.setVisibility(View.VISIBLE); rg24.check(R.id.pulse8); } rg24.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital8) { out_hiLow8.setVisibility(View.VISIBLE); isDigCh8 = true; out_freq8.setVisibility(View.GONE); duty_freq8.setVisibility(View.GONE); outFreqLabel8.setVisibility(View.INVISIBLE); outDutyLabel8.setVisibility(View.INVISIBLE); allDigOut8.setVisibility(View.VISIBLE); allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow8.setVisibility(View.GONE); isDigCh8 = false; out_freq8.setVisibility(View.VISIBLE); duty_freq8.setVisibility(View.VISIBLE); outFreqLabel8.setVisibility(View.VISIBLE); outDutyLabel8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqOut8.setVisibility(View.VISIBLE); allFreqLabel8.setVisibility(View.VISIBLE); allDutyOut8.setVisibility(View.VISIBLE); allDutyLabel8.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg24.check(R.id.out_digital8); } } } }); out_freq8.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq8.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq8.setText("0"); getInputString(); } return true; } return false; } }); out_freq8.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq8.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq8.setText("0"); getInputString(); } return true; } return false; } }); outputsRow9 = (TableRow) v.findViewById(R.id.outputsRow10); if (!isOutputCh[9]) { outputsRow9.setVisibility(View.GONE); } out_hiLow9 = (CheckBox) v.findViewById(R.id.out_hi_low9); if (outputState[9]) { out_hiLow9.setChecked(true); } out_hiLow9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow9.isChecked()) { allDigOut9.setChecked(true); } else { allDigOut9.setChecked(false); } } }); out_freq9 = (EditText) v.findViewById(R.id.out_freq9); out_freq9.setText(desiredFreq[9]); outFreqLabel9 = (TextView) v.findViewById(R.id.outfreq_label9); duty_freq9 = (EditText) v.findViewById(R.id.out_duty9); duty_freq9.setText(desiredDuty[9]); outDutyLabel9 = (TextView) v.findViewById(R.id.outduty_label9); rg25 = (RadioGroup) v.findViewById(R.id.radioGroupOut9); if (isDigCh[9]) { out_hiLow9.setVisibility(View.VISIBLE); out_freq9.setVisibility(View.GONE); duty_freq9.setVisibility(View.GONE); isDigCh9 = true; outFreqLabel9.setVisibility(View.INVISIBLE); outDutyLabel9.setVisibility(View.INVISIBLE); rg25.check(R.id.out_digital9); } else { out_hiLow9.setVisibility(View.GONE); out_freq9.setVisibility(View.VISIBLE); duty_freq9.setVisibility(View.VISIBLE); isDigCh9 = false; outFreqLabel9.setVisibility(View.VISIBLE); outDutyLabel9.setVisibility(View.VISIBLE); rg25.check(R.id.pulse9); } rg25.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital9) { out_hiLow9.setVisibility(View.VISIBLE); isDigCh9 = true; out_freq9.setVisibility(View.GONE); duty_freq9.setVisibility(View.GONE); outFreqLabel9.setVisibility(View.INVISIBLE); outDutyLabel9.setVisibility(View.INVISIBLE); allDigOut9.setVisibility(View.VISIBLE); allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow9.setVisibility(View.GONE); isDigCh9 = false; out_freq9.setVisibility(View.VISIBLE); duty_freq9.setVisibility(View.VISIBLE); outFreqLabel9.setVisibility(View.VISIBLE); outDutyLabel9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqOut9.setVisibility(View.VISIBLE); allFreqLabel9.setVisibility(View.VISIBLE); allDutyOut9.setVisibility(View.VISIBLE); allDutyLabel9.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg25.check(R.id.out_digital9); } } } }); out_freq9.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq9.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq9.setText("0"); getInputString(); } return true; } return false; } }); out_freq9.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq9.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq9.setText("0"); getInputString(); } return true; } return false; } }); outputsRow10 = (TableRow) v.findViewById(R.id.outputsRow11); if (!isOutputCh[10]) { outputsRow10.setVisibility(View.GONE); } out_hiLow10 = (CheckBox) v.findViewById(R.id.out_hi_low10); if (outputState[10]) { out_hiLow10.setChecked(true); } out_hiLow10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow10.isChecked()) { allDigOut10.setChecked(true); } else { allDigOut10.setChecked(false); } } }); out_freq10 = (EditText) v.findViewById(R.id.out_freq10); out_freq10.setText(desiredFreq[10]); outFreqLabel10 = (TextView) v.findViewById(R.id.outfreq_label10); duty_freq10 = (EditText) v.findViewById(R.id.out_duty10); duty_freq10.setText(desiredDuty[10]); outDutyLabel10 = (TextView) v.findViewById(R.id.outduty_label10); rg26 = (RadioGroup) v.findViewById(R.id.radioGroupOut10); if (isDigCh[10]) { out_hiLow10.setVisibility(View.VISIBLE); out_freq10.setVisibility(View.GONE); duty_freq10.setVisibility(View.GONE); isDigCh10 = true; outFreqLabel10.setVisibility(View.INVISIBLE); outDutyLabel10.setVisibility(View.INVISIBLE); rg26.check(R.id.out_digital10); } else { out_hiLow10.setVisibility(View.GONE); out_freq10.setVisibility(View.VISIBLE); duty_freq10.setVisibility(View.VISIBLE); isDigCh10 = false; outFreqLabel10.setVisibility(View.VISIBLE); outDutyLabel10.setVisibility(View.VISIBLE); rg26.check(R.id.pulse10); } rg26.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital10) { out_hiLow10.setVisibility(View.VISIBLE); isDigCh10 = true; out_freq10.setVisibility(View.GONE); duty_freq10.setVisibility(View.GONE); outFreqLabel10.setVisibility(View.INVISIBLE); outDutyLabel10.setVisibility(View.INVISIBLE); allDigOut10.setVisibility(View.VISIBLE); allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow10.setVisibility(View.GONE); isDigCh10 = false; out_freq10.setVisibility(View.VISIBLE); duty_freq10.setVisibility(View.VISIBLE); outFreqLabel10.setVisibility(View.VISIBLE); outDutyLabel10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqOut10.setVisibility(View.VISIBLE); allFreqLabel10.setVisibility(View.VISIBLE); allDutyOut10.setVisibility(View.VISIBLE); allDutyLabel10.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg26.check(R.id.out_digital10); } } } }); out_freq10.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq10.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq10.setText("0"); getInputString(); } return true; } return false; } }); out_freq10.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq10.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq10.setText("0"); getInputString(); } return true; } return false; } }); outputsRow11 = (TableRow) v.findViewById(R.id.outputsRow12); if (!isOutputCh[11]) { outputsRow11.setVisibility(View.GONE); } out_hiLow11 = (CheckBox) v.findViewById(R.id.out_hi_low11); if (outputState[11]) { out_hiLow11.setChecked(true); } out_hiLow11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow11.isChecked()) { allDigOut11.setChecked(true); } else { allDigOut11.setChecked(false); } } }); out_freq11 = (EditText) v.findViewById(R.id.out_freq11); out_freq11.setText(desiredFreq[11]); outFreqLabel11 = (TextView) v.findViewById(R.id.outfreq_label11); duty_freq11 = (EditText) v.findViewById(R.id.out_duty11); duty_freq11.setText(desiredDuty[11]); outDutyLabel11 = (TextView) v.findViewById(R.id.outduty_label11); rg27 = (RadioGroup) v.findViewById(R.id.radioGroupOut11); if (isDigCh[11]) { out_hiLow11.setVisibility(View.VISIBLE); out_freq11.setVisibility(View.GONE); duty_freq11.setVisibility(View.GONE); isDigCh11 = true; outFreqLabel11.setVisibility(View.INVISIBLE); outDutyLabel11.setVisibility(View.INVISIBLE); rg27.check(R.id.out_digital11); } else { out_hiLow11.setVisibility(View.GONE); out_freq11.setVisibility(View.VISIBLE); duty_freq11.setVisibility(View.VISIBLE); isDigCh11 = false; outFreqLabel11.setVisibility(View.VISIBLE); outDutyLabel11.setVisibility(View.VISIBLE); rg27.check(R.id.pulse11); } rg27.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital11) { out_hiLow11.setVisibility(View.VISIBLE); isDigCh11 = true; out_freq11.setVisibility(View.GONE); duty_freq11.setVisibility(View.GONE); outFreqLabel11.setVisibility(View.INVISIBLE); outDutyLabel11.setVisibility(View.INVISIBLE); allDigOut11.setVisibility(View.VISIBLE); allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow11.setVisibility(View.GONE); isDigCh11 = false; out_freq11.setVisibility(View.VISIBLE); duty_freq11.setVisibility(View.VISIBLE); outFreqLabel11.setVisibility(View.VISIBLE); outDutyLabel11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqOut11.setVisibility(View.VISIBLE); allFreqLabel11.setVisibility(View.VISIBLE); allDutyOut11.setVisibility(View.VISIBLE); allDutyLabel11.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg27.check(R.id.out_digital11); } } } }); out_freq11.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq11.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq11.setText("0"); getInputString(); } return true; } return false; } }); out_freq11.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq11.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq11.setText("0"); getInputString(); } return true; } return false; } }); outputsRow12 = (TableRow) v.findViewById(R.id.outputsRow13); if (!isOutputCh[12]) { outputsRow12.setVisibility(View.GONE); } out_hiLow12 = (CheckBox) v.findViewById(R.id.out_hi_low12); if (outputState[12]) { out_hiLow12.setChecked(true); } out_hiLow12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow12.isChecked()) { allDigOut12.setChecked(true); } else { allDigOut12.setChecked(false); } } }); out_freq12 = (EditText) v.findViewById(R.id.out_freq12); out_freq12.setText(desiredFreq[12]); outFreqLabel12 = (TextView) v.findViewById(R.id.outfreq_label12); duty_freq12 = (EditText) v.findViewById(R.id.out_duty12); duty_freq12.setText(desiredDuty[12]); outDutyLabel12 = (TextView) v.findViewById(R.id.outduty_label12); rg28 = (RadioGroup) v.findViewById(R.id.radioGroupOut12); if (isDigCh[12]) { out_hiLow12.setVisibility(View.VISIBLE); out_freq12.setVisibility(View.GONE); duty_freq12.setVisibility(View.GONE); isDigCh12 = true; outFreqLabel12.setVisibility(View.INVISIBLE); outDutyLabel12.setVisibility(View.INVISIBLE); rg28.check(R.id.out_digital12); } else { out_hiLow12.setVisibility(View.GONE); out_freq12.setVisibility(View.VISIBLE); duty_freq12.setVisibility(View.VISIBLE); isDigCh12 = false; outFreqLabel12.setVisibility(View.VISIBLE); outDutyLabel12.setVisibility(View.VISIBLE); rg28.check(R.id.pulse12); } rg28.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital12) { out_hiLow12.setVisibility(View.VISIBLE); isDigCh12 = true; out_freq12.setVisibility(View.GONE); duty_freq12.setVisibility(View.GONE); outFreqLabel12.setVisibility(View.INVISIBLE); outDutyLabel12.setVisibility(View.INVISIBLE); allDigOut12.setVisibility(View.VISIBLE); allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow12.setVisibility(View.GONE); isDigCh12 = false; out_freq12.setVisibility(View.VISIBLE); duty_freq12.setVisibility(View.VISIBLE); outFreqLabel12.setVisibility(View.VISIBLE); outDutyLabel12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqOut12.setVisibility(View.VISIBLE); allFreqLabel12.setVisibility(View.VISIBLE); allDutyOut12.setVisibility(View.VISIBLE); allDutyLabel12.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg28.check(R.id.out_digital12); } } } }); out_freq12.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq12.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq12.setText("0"); getInputString(); } return true; } return false; } }); out_freq12.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq12.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq12.setText("0"); getInputString(); } return true; } return false; } }); outputsRow13 = (TableRow) v.findViewById(R.id.outputsRow14); if (!isOutputCh[13]) { outputsRow13.setVisibility(View.GONE); } out_hiLow13 = (CheckBox) v.findViewById(R.id.out_hi_low13); if (outputState[13]) { out_hiLow13.setChecked(true); } out_hiLow13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow13.isChecked()) { allDigOut13.setChecked(true); } else { allDigOut13.setChecked(false); } } }); out_freq13 = (EditText) v.findViewById(R.id.out_freq13); out_freq13.setText(desiredFreq[13]); outFreqLabel13 = (TextView) v.findViewById(R.id.outfreq_label13); duty_freq13 = (EditText) v.findViewById(R.id.out_duty13); duty_freq13.setText(desiredDuty[13]); outDutyLabel13 = (TextView) v.findViewById(R.id.outduty_label13); rg29 = (RadioGroup) v.findViewById(R.id.radioGroupOut13); if (isDigCh[13]) { out_hiLow13.setVisibility(View.VISIBLE); out_freq13.setVisibility(View.GONE); duty_freq13.setVisibility(View.GONE); isDigCh13 = true; outFreqLabel13.setVisibility(View.INVISIBLE); outDutyLabel13.setVisibility(View.INVISIBLE); rg29.check(R.id.out_digital13); } else { out_hiLow13.setVisibility(View.GONE); out_freq13.setVisibility(View.VISIBLE); duty_freq13.setVisibility(View.VISIBLE); isDigCh13 = false; outFreqLabel13.setVisibility(View.VISIBLE); outDutyLabel13.setVisibility(View.VISIBLE); rg29.check(R.id.pulse13); } rg29.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital13) { out_hiLow13.setVisibility(View.VISIBLE); isDigCh13 = true; out_freq13.setVisibility(View.GONE); duty_freq13.setVisibility(View.GONE); outFreqLabel13.setVisibility(View.INVISIBLE); outDutyLabel13.setVisibility(View.INVISIBLE); allDigOut13.setVisibility(View.VISIBLE); allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow13.setVisibility(View.GONE); isDigCh13 = false; out_freq13.setVisibility(View.VISIBLE); duty_freq13.setVisibility(View.VISIBLE); outFreqLabel13.setVisibility(View.VISIBLE); outDutyLabel13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqOut13.setVisibility(View.VISIBLE); allFreqLabel13.setVisibility(View.VISIBLE); allDutyOut13.setVisibility(View.VISIBLE); allDutyLabel13.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg29.check(R.id.out_digital13); } } } }); out_freq13.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq13.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq13.setText("0"); getInputString(); } return true; } return false; } }); out_freq13.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq13.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq13.setText("0"); getInputString(); } return true; } return false; } }); outputsRow14 = (TableRow) v.findViewById(R.id.outputsRow15); if (!isOutputCh[14]) { outputsRow14.setVisibility(View.GONE); } out_hiLow14 = (CheckBox) v.findViewById(R.id.out_hi_low14); if (outputState[14]) { out_hiLow14.setChecked(true); } out_hiLow14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow14.isChecked()) { allDigOut14.setChecked(true); } else { allDigOut14.setChecked(false); } } }); out_freq14 = (EditText) v.findViewById(R.id.out_freq14); out_freq14.setText(desiredFreq[14]); outFreqLabel14 = (TextView) v.findViewById(R.id.outfreq_label14); duty_freq14 = (EditText) v.findViewById(R.id.out_duty14); duty_freq14.setText(desiredDuty[14]); outDutyLabel14 = (TextView) v.findViewById(R.id.outduty_label14); rg30 = (RadioGroup) v.findViewById(R.id.radioGroupOut14); if (isDigCh[14]) { out_hiLow14.setVisibility(View.VISIBLE); out_freq14.setVisibility(View.GONE); duty_freq14.setVisibility(View.GONE); isDigCh14 = true; outFreqLabel14.setVisibility(View.INVISIBLE); outDutyLabel14.setVisibility(View.INVISIBLE); rg30.check(R.id.out_digital14); } else { out_hiLow14.setVisibility(View.GONE); out_freq14.setVisibility(View.VISIBLE); duty_freq14.setVisibility(View.VISIBLE); isDigCh14 = false; outFreqLabel14.setVisibility(View.VISIBLE); outDutyLabel14.setVisibility(View.VISIBLE); rg30.check(R.id.pulse14); } rg30.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital14) { out_hiLow14.setVisibility(View.VISIBLE); isDigCh14 = true; out_freq14.setVisibility(View.GONE); duty_freq14.setVisibility(View.GONE); outFreqLabel14.setVisibility(View.INVISIBLE); outDutyLabel14.setVisibility(View.INVISIBLE); allDigOut14.setVisibility(View.VISIBLE); allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { //Log.e("Test", "Number of pulsed inputs: " + getPulsedOutputs(getOutputChannels()).size()); if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow14.setVisibility(View.GONE); isDigCh14 = false; out_freq14.setVisibility(View.VISIBLE); duty_freq14.setVisibility(View.VISIBLE); outFreqLabel14.setVisibility(View.VISIBLE); outDutyLabel14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqOut14.setVisibility(View.VISIBLE); allFreqLabel14.setVisibility(View.VISIBLE); allDutyOut14.setVisibility(View.VISIBLE); allDutyLabel14.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg30.check(R.id.out_digital14); } } } }); out_freq14.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq14.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq14.setText("0"); getInputString(); } return true; } return false; } }); out_freq14.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq14.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq14.setText("0"); getInputString(); } return true; } return false; } }); outputsRow15 = (TableRow) v.findViewById(R.id.outputsRow16); if (!isOutputCh[15]) { outputsRow15.setVisibility(View.GONE); } out_hiLow15 = (CheckBox) v.findViewById(R.id.out_hi_low15); if (outputState[15]) { out_hiLow15.setChecked(true); } out_hiLow15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (out_hiLow15.isChecked()) { allDigOut15.setChecked(true); } else { allDigOut15.setChecked(false); } } }); out_freq15 = (EditText) v.findViewById(R.id.out_freq15); out_freq15.setText(desiredFreq[15]); outFreqLabel15 = (TextView) v.findViewById(R.id.outfreq_label15); duty_freq15 = (EditText) v.findViewById(R.id.out_duty15); duty_freq15.setText(desiredDuty[15]); outDutyLabel15 = (TextView) v.findViewById(R.id.outduty_label15); rg31 = (RadioGroup) v.findViewById(R.id.radioGroupOut15); if (isDigCh[15]) { out_hiLow15.setVisibility(View.VISIBLE); out_freq15.setVisibility(View.GONE); duty_freq15.setVisibility(View.GONE); isDigCh15 = true; outFreqLabel15.setVisibility(View.INVISIBLE); outDutyLabel15.setVisibility(View.INVISIBLE); rg31.check(R.id.out_digital15); } else { out_hiLow15.setVisibility(View.GONE); out_freq15.setVisibility(View.VISIBLE); duty_freq15.setVisibility(View.VISIBLE); isDigCh15 = false; outFreqLabel15.setVisibility(View.VISIBLE); outDutyLabel15.setVisibility(View.VISIBLE); rg31.check(R.id.pulse15); } rg31.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.out_digital15) { out_hiLow15.setVisibility(View.VISIBLE); isDigCh15 = true; out_freq15.setVisibility(View.GONE); duty_freq15.setVisibility(View.GONE); outFreqLabel15.setVisibility(View.INVISIBLE); outDutyLabel15.setVisibility(View.INVISIBLE); allDigOut15.setVisibility(View.VISIBLE); allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { if (getPulsedOutputs(getOutputChannels()).size() + 1 <= 8) { out_hiLow15.setVisibility(View.GONE); isDigCh15 = false; out_freq15.setVisibility(View.VISIBLE); duty_freq15.setVisibility(View.VISIBLE); outFreqLabel15.setVisibility(View.VISIBLE); outDutyLabel15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqOut15.setVisibility(View.VISIBLE); allFreqLabel15.setVisibility(View.VISIBLE); allDutyOut15.setVisibility(View.VISIBLE); allDutyLabel15.setVisibility(View.VISIBLE); } else { ((AndroiDAQTCPMain) context).showDialog(2); rg31.check(R.id.out_digital15); } } } }); out_freq15.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = out_freq15.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq15.setText("0"); getInputString(); } return true; } return false; } }); out_freq15.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = out_freq15.getText().toString().length(); if (inputted > 0) { getInputString(); } else { out_freq15.setText("0"); getInputString(); } return true; } return false; } }); break; case 3: resId = R.layout.voltages; v = inflater.inflate(resId, null, false); readVolts = (Button) v.findViewById(R.id.read_volts); voltsSV = (ScrollView) v.findViewById(R.id.scrollViewVolts); voltsSV.setScrollbarFadingEnabled(false); readVolts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //((AndroiDAQTCPMain) context).getVolts(true); int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runVolts = false; } else { runVolts = true; setProp(); } } }); readContVolts = (Button) v.findViewById(R.id.read_cont_volts); readContVolts.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //((AndroiDAQTCPMain) context).getVolts(true); int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runContVolts = false; } else { if (!runContVolts) { readContVolts.setText("Stop Cont. Read Volts from AndroiDAQ"); runContVolts = true; ((AndroiDAQTCPMain) context).getVoltsCont(true); } else { readContVolts.setText("Continuous Read Volts from AndroiDAQ"); runContVolts = false; ((AndroiDAQTCPMain) context).stopContVolts(); } } } }); voltagesRow0 = (TableRow) v.findViewById(R.id.voltagesRow1); voltagesRow0.setVisibility(View.VISIBLE); volts1 = (TextView) v.findViewById(R.id.voltageReading1); voltagesRow1 = (TableRow) v.findViewById(R.id.voltagesRow2); voltagesRow1.setVisibility(View.VISIBLE); volts2 = (TextView) v.findViewById(R.id.voltageReading2); voltagesRow2 = (TableRow) v.findViewById(R.id.voltagesRow3); voltagesRow2.setVisibility(View.VISIBLE); volts3 = (TextView) v.findViewById(R.id.voltageReading3); voltagesRow3 = (TableRow) v.findViewById(R.id.voltagesRow4); voltagesRow3.setVisibility(View.VISIBLE); volts4 = (TextView) v.findViewById(R.id.voltageReading4); voltagesRow4 = (TableRow) v.findViewById(R.id.voltagesRow5); voltagesRow4.setVisibility(View.VISIBLE); volts5 = (TextView) v.findViewById(R.id.voltageReading5); voltagesRow5 = (TableRow) v.findViewById(R.id.voltagesRow6); voltagesRow5.setVisibility(View.VISIBLE); volts6 = (TextView) v.findViewById(R.id.voltageReading6); voltagesRow6 = (TableRow) v.findViewById(R.id.voltagesRow7); voltagesRow6.setVisibility(View.VISIBLE); volts7 = (TextView) v.findViewById(R.id.voltageReading7); voltagesRow7 = (TableRow) v.findViewById(R.id.voltagesRow8); voltagesRow7.setVisibility(View.VISIBLE); volts8 = (TextView) v.findViewById(R.id.voltageReading8); break; case 4: //TODO resId = R.layout.all; v = inflater.inflate(resId, null, false); setRun = (Button) v.findViewById(R.id.set_and_run); allSV = (ScrollView) v.findViewById(R.id.scrollViewAll); allSV.setScrollbarFadingEnabled(false); setRun.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); runAll = false; } else { runAll = true; setProp(); } } }); allDigIn0 = (RadioButton) v.findViewById(R.id.all_hi_low0); allFreqIn0 = (TextView) v.findViewById(R.id.all_input_freq0); allDigOut0 = (CheckBox) v.findViewById(R.id.all_out_hi_low0); if (outputState[0]) { allDigOut0.setChecked(true); } allDigOut0.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut0.isChecked()) { out_hiLow0.setChecked(true); } else { out_hiLow0.setChecked(false); } } }); allFreqOut0 = (EditText) v.findViewById(R.id.all_out_freq0); allFreqOut0.setText(desiredFreq[0]); allFreqLabel0 = (TextView) v.findViewById(R.id.all_freq_label0); allDutyOut0 = (EditText) v.findViewById(R.id.all_out_duty0); allDutyOut0.setText(desiredDuty[0]); allDutyLabel0 = (TextView) v.findViewById(R.id.all_outduty_label0); if (isOutputCh[0]) { // if channel is output allDigIn0.setVisibility(View.GONE); //don't display input widgets allFreqIn0.setVisibility(View.GONE); if (isDigCh0) { // if channel is digital allDigOut0.setVisibility(View.VISIBLE); //display digital widget allFreqOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut0.setVisibility(View.VISIBLE); //display count widget allDutyOut0.setVisibility(View.VISIBLE); allDigOut0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.VISIBLE); allDutyLabel0.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut0.setVisibility(View.GONE); //don't display output widgets allFreqOut0.setVisibility(View.GONE); allDutyOut0.setVisibility(View.GONE); if (isDigCh0) { // if channel is digital allDigIn0.setVisibility(View.VISIBLE); //display digital out widget allFreqIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.INVISIBLE); allDutyOut0.setVisibility(View.GONE); allDutyLabel0.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn0.setVisibility(View.VISIBLE); // display pulse widget allDigIn0.setVisibility(View.GONE); allFreqLabel0.setVisibility(View.VISIBLE); } } allFreqOut0.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut0.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut0.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut0.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut0.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut0.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn1 = (RadioButton) v.findViewById(R.id.all_hi_low1); allFreqIn1 = (TextView) v.findViewById(R.id.all_input_freq1); allDigOut1 = (CheckBox) v.findViewById(R.id.all_out_hi_low1); if (outputState[1]) { allDigOut1.setChecked(true); } allDigOut1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut1.isChecked()) { out_hiLow1.setChecked(true); } else { out_hiLow1.setChecked(false); } } }); allFreqOut1 = (EditText) v.findViewById(R.id.all_out_freq1); allFreqOut1.setText(desiredFreq[1]); allFreqLabel1 = (TextView) v.findViewById(R.id.all_freq_label1); allDutyOut1 = (EditText) v.findViewById(R.id.all_out_duty1); allDutyOut1.setText(desiredDuty[1]); allDutyLabel1 = (TextView) v.findViewById(R.id.all_outduty_label1); if (isOutputCh[1]) { // if channel is output allDigIn1.setVisibility(View.GONE); //don't display input widgets allFreqIn1.setVisibility(View.GONE); if (isDigCh1) { // if channel is digital allDigOut1.setVisibility(View.VISIBLE); //display digital widget allFreqOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut1.setVisibility(View.VISIBLE); //display count widget allDutyOut1.setVisibility(View.VISIBLE); allDigOut1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.VISIBLE); allDutyLabel1.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut1.setVisibility(View.GONE); //don't display output widgets allFreqOut1.setVisibility(View.GONE); allDutyOut1.setVisibility(View.GONE); if (isDigCh1) { // if channel is digital allDigIn1.setVisibility(View.VISIBLE); //display digital out widget allFreqIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.INVISIBLE); allDutyOut1.setVisibility(View.GONE); allDutyLabel1.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn1.setVisibility(View.VISIBLE); // display pulse widget allDigIn1.setVisibility(View.GONE); allFreqLabel1.setVisibility(View.VISIBLE); } } allFreqOut1.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut1.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut1.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut1.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut1.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut1.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn2 = (RadioButton) v.findViewById(R.id.all_hi_low2); allFreqIn2 = (TextView) v.findViewById(R.id.all_input_freq2); allDigOut2 = (CheckBox) v.findViewById(R.id.all_out_hi_low2); if (outputState[2]) { allDigOut2.setChecked(true); } allDigOut2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut2.isChecked()) { out_hiLow2.setChecked(true); } else { out_hiLow2.setChecked(false); } } }); allFreqOut2 = (EditText) v.findViewById(R.id.all_out_freq2); allFreqOut2.setText(desiredFreq[2]); allFreqLabel2 = (TextView) v.findViewById(R.id.all_freq_label2); allDutyOut2 = (EditText) v.findViewById(R.id.all_out_duty2); allDutyOut2.setText(desiredDuty[2]); allDutyLabel2 = (TextView) v.findViewById(R.id.all_outduty_label2); if (isOutputCh[2]) { // if channel is output allDigIn2.setVisibility(View.GONE); //don't display input widgets allFreqIn2.setVisibility(View.GONE); if (isDigCh2) { // if channel is digital allDigOut2.setVisibility(View.VISIBLE); //display digital widget allFreqOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut2.setVisibility(View.VISIBLE); //display count widget allDutyOut2.setVisibility(View.VISIBLE); allDigOut2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.VISIBLE); allDutyLabel2.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut2.setVisibility(View.GONE); //don't display output widgets allFreqOut2.setVisibility(View.GONE); allDutyOut2.setVisibility(View.GONE); if (isDigCh2) { // if channel is digital allDigIn2.setVisibility(View.VISIBLE); //display digital out widget allFreqIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.INVISIBLE); allDutyOut2.setVisibility(View.GONE); allDutyLabel2.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn2.setVisibility(View.VISIBLE); // display pulse widget allDigIn2.setVisibility(View.GONE); allFreqLabel2.setVisibility(View.VISIBLE); } } allFreqOut2.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut2.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut2.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut2.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut2.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut2.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn3 = (RadioButton) v.findViewById(R.id.all_hi_low3); allFreqIn3 = (TextView) v.findViewById(R.id.all_input_freq3); allDigOut3 = (CheckBox) v.findViewById(R.id.all_out_hi_low3); if (outputState[3]) { allDigOut3.setChecked(true); } allDigOut3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut3.isChecked()) { out_hiLow3.setChecked(true); } else { out_hiLow3.setChecked(false); } } }); allFreqOut3 = (EditText) v.findViewById(R.id.all_out_freq3); allFreqOut3.setText(desiredFreq[3]); allFreqLabel3 = (TextView) v.findViewById(R.id.all_freq_label3); allDutyOut3 = (EditText) v.findViewById(R.id.all_out_duty3); allDutyOut3.setText(desiredDuty[3]); allDutyLabel3 = (TextView) v.findViewById(R.id.all_outduty_label3); if (isOutputCh[3]) { // if channel is output allDigIn3.setVisibility(View.GONE); //don't display input widgets allFreqIn3.setVisibility(View.GONE); if (isDigCh3) { // if channel is digital allDigOut3.setVisibility(View.VISIBLE); //display digital widget allFreqOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut3.setVisibility(View.VISIBLE); //display count widget allDutyOut3.setVisibility(View.VISIBLE); allDigOut3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.VISIBLE); allDutyLabel3.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut3.setVisibility(View.GONE); //don't display output widgets allFreqOut3.setVisibility(View.GONE); allDutyOut3.setVisibility(View.GONE); if (isDigCh3) { // if channel is digital allDigIn3.setVisibility(View.VISIBLE); //display digital out widget allFreqIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.INVISIBLE); allDutyOut3.setVisibility(View.GONE); allDutyLabel3.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn3.setVisibility(View.VISIBLE); // display pulse widget allDigIn3.setVisibility(View.GONE); allFreqLabel3.setVisibility(View.VISIBLE); } } allFreqOut3.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut3.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut3.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut3.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut3.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut3.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn4 = (RadioButton) v.findViewById(R.id.all_hi_low4); allFreqIn4 = (TextView) v.findViewById(R.id.all_input_freq4); allDigOut4 = (CheckBox) v.findViewById(R.id.all_out_hi_low4); if (outputState[4]) { allDigOut4.setChecked(true); } allDigOut4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut4.isChecked()) { out_hiLow4.setChecked(true); } else { out_hiLow4.setChecked(false); } } }); allFreqOut4 = (EditText) v.findViewById(R.id.all_out_freq4); allFreqOut4.setText(desiredFreq[4]); allFreqLabel4 = (TextView) v.findViewById(R.id.all_freq_label4); allDutyOut4 = (EditText) v.findViewById(R.id.all_out_duty4); allDutyOut4.setText(desiredDuty[4]); allDutyLabel4 = (TextView) v.findViewById(R.id.all_outduty_label4); if (isOutputCh[4]) { // if channel is output allDigIn4.setVisibility(View.GONE); //don't display input widgets allFreqIn4.setVisibility(View.GONE); if (isDigCh4) { // if channel is digital allDigOut4.setVisibility(View.VISIBLE); //display digital widget allFreqOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut4.setVisibility(View.VISIBLE); //display count widget allDutyOut4.setVisibility(View.VISIBLE); allDigOut4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.VISIBLE); allDutyLabel4.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut4.setVisibility(View.GONE); //don't display output widgets allFreqOut4.setVisibility(View.GONE); allDutyOut4.setVisibility(View.GONE); if (isDigCh4) { // if channel is digital allDigIn4.setVisibility(View.VISIBLE); //display digital out widget allFreqIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.INVISIBLE); allDutyOut4.setVisibility(View.GONE); allDutyLabel4.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn4.setVisibility(View.VISIBLE); // display pulse widget allDigIn4.setVisibility(View.GONE); allFreqLabel4.setVisibility(View.VISIBLE); } } allFreqOut4.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut4.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut4.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut4.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut4.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut4.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn5 = (RadioButton) v.findViewById(R.id.all_hi_low5); allFreqIn5 = (TextView) v.findViewById(R.id.all_input_freq5); allDigOut5 = (CheckBox) v.findViewById(R.id.all_out_hi_low5); if (outputState[5]) { allDigOut5.setChecked(true); } allDigOut5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut5.isChecked()) { out_hiLow5.setChecked(true); } else { out_hiLow5.setChecked(false); } } }); allFreqOut5 = (EditText) v.findViewById(R.id.all_out_freq5); allFreqOut5.setText(desiredFreq[5]); allFreqLabel5 = (TextView) v.findViewById(R.id.all_freq_label5); allDutyOut5 = (EditText) v.findViewById(R.id.all_out_duty5); allDutyOut5.setText(desiredDuty[5]); allDutyLabel5 = (TextView) v.findViewById(R.id.all_outduty_label5); if (isOutputCh[5]) { // if channel is output allDigIn5.setVisibility(View.GONE); //don't display input widgets allFreqIn5.setVisibility(View.GONE); if (isDigCh5) { // if channel is digital allDigOut5.setVisibility(View.VISIBLE); //display digital widget allFreqOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut5.setVisibility(View.VISIBLE); //display count widget allDutyOut5.setVisibility(View.VISIBLE); allDigOut5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.VISIBLE); allDutyLabel5.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut5.setVisibility(View.GONE); //don't display output widgets allFreqOut5.setVisibility(View.GONE); allDutyOut5.setVisibility(View.GONE); if (isDigCh5) { // if channel is digital allDigIn5.setVisibility(View.VISIBLE); //display digital out widget allFreqIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.INVISIBLE); allDutyOut5.setVisibility(View.GONE); allDutyLabel5.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn5.setVisibility(View.VISIBLE); // display pulse widget allDigIn5.setVisibility(View.GONE); allFreqLabel5.setVisibility(View.VISIBLE); } } allFreqOut5.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut5.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut5.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut5.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut5.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut5.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn6 = (RadioButton) v.findViewById(R.id.all_hi_low6); allFreqIn6 = (TextView) v.findViewById(R.id.all_input_freq6); allDigOut6 = (CheckBox) v.findViewById(R.id.all_out_hi_low6); if (outputState[6]) { allDigOut6.setChecked(true); } allDigOut6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut6.isChecked()) { out_hiLow6.setChecked(true); } else { out_hiLow6.setChecked(false); } } }); allFreqOut6 = (EditText) v.findViewById(R.id.all_out_freq6); allFreqOut6.setText(desiredFreq[6]); allFreqLabel6 = (TextView) v.findViewById(R.id.all_freq_label6); allDutyOut6 = (EditText) v.findViewById(R.id.all_out_duty6); allDutyOut6.setText(desiredDuty[6]); allDutyLabel6 = (TextView) v.findViewById(R.id.all_outduty_label6); if (isOutputCh[6]) { // if channel is output allDigIn6.setVisibility(View.GONE); //don't display input widgets allFreqIn6.setVisibility(View.GONE); if (isDigCh6) { // if channel is digital allDigOut6.setVisibility(View.VISIBLE); //display digital widget allFreqOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut6.setVisibility(View.VISIBLE); //display count widget allDutyOut6.setVisibility(View.VISIBLE); allDigOut6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.VISIBLE); allDutyLabel6.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut6.setVisibility(View.GONE); //don't display output widgets allFreqOut6.setVisibility(View.GONE); allDutyOut6.setVisibility(View.GONE); if (isDigCh6) { // if channel is digital allDigIn6.setVisibility(View.VISIBLE); //display digital out widget allFreqIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.INVISIBLE); allDutyOut6.setVisibility(View.GONE); allDutyLabel6.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn6.setVisibility(View.VISIBLE); // display pulse widget allDigIn6.setVisibility(View.GONE); allFreqLabel6.setVisibility(View.VISIBLE); } } allFreqOut6.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut6.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut6.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut6.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut6.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut6.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn7 = (RadioButton) v.findViewById(R.id.all_hi_low7); allFreqIn7 = (TextView) v.findViewById(R.id.all_input_freq7); allDigOut7 = (CheckBox) v.findViewById(R.id.all_out_hi_low7); if (outputState[7]) { allDigOut7.setChecked(true); } allDigOut7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut7.isChecked()) { out_hiLow7.setChecked(true); } else { out_hiLow7.setChecked(false); } } }); allFreqOut7 = (EditText) v.findViewById(R.id.all_out_freq7); allFreqOut7.setText(desiredFreq[7]); allFreqLabel7 = (TextView) v.findViewById(R.id.all_freq_label7); allDutyOut7 = (EditText) v.findViewById(R.id.all_out_duty7); allDutyOut7.setText(desiredDuty[7]); allDutyLabel7 = (TextView) v.findViewById(R.id.all_outduty_label7); if (isOutputCh[7]) { // if channel is output allDigIn7.setVisibility(View.GONE); //don't display input widgets allFreqIn7.setVisibility(View.GONE); if (isDigCh7) { // if channel is digital allDigOut7.setVisibility(View.VISIBLE); //display digital widget allFreqOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut7.setVisibility(View.VISIBLE); //display count widget allDutyOut7.setVisibility(View.VISIBLE); allDigOut7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.VISIBLE); allDutyLabel7.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut7.setVisibility(View.GONE); //don't display output widgets allFreqOut7.setVisibility(View.GONE); allDutyOut7.setVisibility(View.GONE); if (isDigCh7) { // if channel is digital allDigIn7.setVisibility(View.VISIBLE); //display digital out widget allFreqIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.INVISIBLE); allDutyOut7.setVisibility(View.GONE); allDutyLabel7.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn7.setVisibility(View.VISIBLE); // display pulse widget allDigIn7.setVisibility(View.GONE); allFreqLabel7.setVisibility(View.VISIBLE); } } allFreqOut7.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut7.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut7.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut7.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut7.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut7.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn8 = (RadioButton) v.findViewById(R.id.all_hi_low8); allFreqIn8 = (TextView) v.findViewById(R.id.all_input_freq8); allDigOut8 = (CheckBox) v.findViewById(R.id.all_out_hi_low8); if (outputState[8]) { allDigOut8.setChecked(true); } allDigOut8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut8.isChecked()) { out_hiLow8.setChecked(true); } else { out_hiLow8.setChecked(false); } } }); allFreqOut8 = (EditText) v.findViewById(R.id.all_out_freq8); allFreqOut8.setText(desiredFreq[8]); allFreqLabel8 = (TextView) v.findViewById(R.id.all_freq_label8); allDutyOut8 = (EditText) v.findViewById(R.id.all_out_duty8); allDutyOut8.setText(desiredDuty[8]); allDutyLabel8 = (TextView) v.findViewById(R.id.all_outduty_label8); if (isOutputCh[8]) { // if channel is output allDigIn8.setVisibility(View.GONE); //don't display input widgets allFreqIn8.setVisibility(View.GONE); if (isDigCh8) { // if channel is digital allDigOut8.setVisibility(View.VISIBLE); //display digital widget allFreqOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut8.setVisibility(View.VISIBLE); //display count widget allDutyOut8.setVisibility(View.VISIBLE); allDigOut8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.VISIBLE); allDutyLabel8.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut8.setVisibility(View.GONE); //don't display output widgets allFreqOut8.setVisibility(View.GONE); allDutyOut8.setVisibility(View.GONE); if (isDigCh8) { // if channel is digital allDigIn8.setVisibility(View.VISIBLE); //display digital out widget allFreqIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.INVISIBLE); allDutyOut8.setVisibility(View.GONE); allDutyLabel8.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn8.setVisibility(View.VISIBLE); // display pulse widget allDigIn8.setVisibility(View.GONE); allFreqLabel8.setVisibility(View.VISIBLE); } } allFreqOut8.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut8.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut8.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut8.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut8.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut8.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn9 = (RadioButton) v.findViewById(R.id.all_hi_low9); allFreqIn9 = (TextView) v.findViewById(R.id.all_input_freq9); allDigOut9 = (CheckBox) v.findViewById(R.id.all_out_hi_low9); if (outputState[9]) { allDigOut9.setChecked(true); } allDigOut9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut9.isChecked()) { out_hiLow9.setChecked(true); } else { out_hiLow9.setChecked(false); } } }); allFreqOut9 = (EditText) v.findViewById(R.id.all_out_freq9); allFreqOut9.setText(desiredFreq[9]); allFreqLabel9 = (TextView) v.findViewById(R.id.all_freq_label9); allDutyOut9 = (EditText) v.findViewById(R.id.all_out_duty9); allDutyOut9.setText(desiredDuty[9]); allDutyLabel9 = (TextView) v.findViewById(R.id.all_outduty_label9); if (isOutputCh[9]) { // if channel is output allDigIn9.setVisibility(View.GONE); //don't display input widgets allFreqIn9.setVisibility(View.GONE); if (isDigCh9) { // if channel is digital allDigOut9.setVisibility(View.VISIBLE); //display digital widget allFreqOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut9.setVisibility(View.VISIBLE); //display count widget allDutyOut9.setVisibility(View.VISIBLE); allDigOut9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.VISIBLE); allDutyLabel9.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut9.setVisibility(View.GONE); //don't display output widgets allFreqOut9.setVisibility(View.GONE); allDutyOut9.setVisibility(View.GONE); if (isDigCh9) { // if channel is digital allDigIn9.setVisibility(View.VISIBLE); //display digital out widget allFreqIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.INVISIBLE); allDutyOut9.setVisibility(View.GONE); allDutyLabel9.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn9.setVisibility(View.VISIBLE); // display pulse widget allDigIn9.setVisibility(View.GONE); allFreqLabel9.setVisibility(View.VISIBLE); } } allFreqOut9.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut9.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut9.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut9.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut9.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut9.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn10 = (RadioButton) v.findViewById(R.id.all_hi_low10); allFreqIn10 = (TextView) v.findViewById(R.id.all_input_freq10); allDigOut10 = (CheckBox) v.findViewById(R.id.all_out_hi_low10); if (outputState[10]) { allDigOut10.setChecked(true); } allDigOut10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut10.isChecked()) { out_hiLow10.setChecked(true); } else { out_hiLow10.setChecked(false); } } }); allFreqOut10 = (EditText) v.findViewById(R.id.all_out_freq10); allFreqOut10.setText(desiredFreq[10]); allFreqLabel10 = (TextView) v.findViewById(R.id.all_freq_label10); allDutyOut10 = (EditText) v.findViewById(R.id.all_out_duty10); allDutyOut10.setText(desiredDuty[10]); allDutyLabel10 = (TextView) v.findViewById(R.id.all_outduty_label10); if (isOutputCh[10]) { // if channel is output allDigIn10.setVisibility(View.GONE); //don't display input widgets allFreqIn10.setVisibility(View.GONE); if (isDigCh10) { // if channel is digital allDigOut10.setVisibility(View.VISIBLE); //display digital widget allFreqOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut10.setVisibility(View.VISIBLE); //display count widget allDutyOut10.setVisibility(View.VISIBLE); allDigOut10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.VISIBLE); allDutyLabel10.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut10.setVisibility(View.GONE); //don't display output widgets allFreqOut10.setVisibility(View.GONE); allDutyOut10.setVisibility(View.GONE); if (isDigCh10) { // if channel is digital allDigIn10.setVisibility(View.VISIBLE); //display digital out widget allFreqIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.INVISIBLE); allDutyOut10.setVisibility(View.GONE); allDutyLabel10.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn10.setVisibility(View.VISIBLE); // display pulse widget allDigIn10.setVisibility(View.GONE); allFreqLabel10.setVisibility(View.VISIBLE); } } allFreqOut10.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut10.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut10.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut10.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut10.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut10.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn11 = (RadioButton) v.findViewById(R.id.all_hi_low11); allFreqIn11 = (TextView) v.findViewById(R.id.all_input_freq11); allDigOut11 = (CheckBox) v.findViewById(R.id.all_out_hi_low11); if (outputState[11]) { allDigOut11.setChecked(true); } allDigOut11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut11.isChecked()) { out_hiLow11.setChecked(true); } else { out_hiLow11.setChecked(false); } } }); allFreqOut11 = (EditText) v.findViewById(R.id.all_out_freq11); allFreqOut11.setText(desiredFreq[11]); allFreqLabel11 = (TextView) v.findViewById(R.id.all_freq_label11); allDutyOut11 = (EditText) v.findViewById(R.id.all_out_duty11); allDutyOut11.setText(desiredDuty[11]); allDutyLabel11 = (TextView) v.findViewById(R.id.all_outduty_label11); if (isOutputCh[11]) { // if channel is output allDigIn11.setVisibility(View.GONE); //don't display input widgets allFreqIn11.setVisibility(View.GONE); if (isDigCh11) { // if channel is digital allDigOut11.setVisibility(View.VISIBLE); //display digital widget allFreqOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut11.setVisibility(View.VISIBLE); //display count widget allDutyOut11.setVisibility(View.VISIBLE); allDigOut11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.VISIBLE); allDutyLabel11.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut11.setVisibility(View.GONE); //don't display output widgets allFreqOut11.setVisibility(View.GONE); allDutyOut11.setVisibility(View.GONE); if (isDigCh11) { // if channel is digital allDigIn11.setVisibility(View.VISIBLE); //display digital out widget allFreqIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.INVISIBLE); allDutyOut11.setVisibility(View.GONE); allDutyLabel11.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn11.setVisibility(View.VISIBLE); // display pulse widget allDigIn11.setVisibility(View.GONE); allFreqLabel11.setVisibility(View.VISIBLE); } } allFreqOut11.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut11.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut11.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut11.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut11.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut11.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn12 = (RadioButton) v.findViewById(R.id.all_hi_low12); allFreqIn12 = (TextView) v.findViewById(R.id.all_input_freq12); allDigOut12 = (CheckBox) v.findViewById(R.id.all_out_hi_low12); if (outputState[12]) { allDigOut12.setChecked(true); } allDigOut12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut12.isChecked()) { out_hiLow12.setChecked(true); } else { out_hiLow12.setChecked(false); } } }); allFreqOut12 = (EditText) v.findViewById(R.id.all_out_freq12); allFreqOut12.setText(desiredFreq[12]); allFreqLabel12 = (TextView) v.findViewById(R.id.all_freq_label12); allDutyOut12 = (EditText) v.findViewById(R.id.all_out_duty12); allDutyOut12.setText(desiredDuty[12]); allDutyLabel12 = (TextView) v.findViewById(R.id.all_outduty_label12); if (isOutputCh[12]) { // if channel is output allDigIn12.setVisibility(View.GONE); //don't display input widgets allFreqIn12.setVisibility(View.GONE); if (isDigCh12) { // if channel is digital allDigOut12.setVisibility(View.VISIBLE); //display digital widget allFreqOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut12.setVisibility(View.VISIBLE); //display count widget allDutyOut12.setVisibility(View.VISIBLE); allDigOut12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.VISIBLE); allDutyLabel12.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut12.setVisibility(View.GONE); //don't display output widgets allFreqOut12.setVisibility(View.GONE); allDutyOut12.setVisibility(View.GONE); if (isDigCh12) { // if channel is digital allDigIn12.setVisibility(View.VISIBLE); //display digital out widget allFreqIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.INVISIBLE); allDutyOut12.setVisibility(View.GONE); allDutyLabel12.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn12.setVisibility(View.VISIBLE); // display pulse widget allDigIn12.setVisibility(View.GONE); allFreqLabel12.setVisibility(View.VISIBLE); } } allFreqOut12.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut12.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut12.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut12.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut12.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut12.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn13 = (RadioButton) v.findViewById(R.id.all_hi_low13); allFreqIn13 = (TextView) v.findViewById(R.id.all_input_freq13); allDigOut13 = (CheckBox) v.findViewById(R.id.all_out_hi_low13); if (outputState[13]) { allDigOut13.setChecked(true); } allDigOut13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut13.isChecked()) { out_hiLow13.setChecked(true); } else { out_hiLow13.setChecked(false); } } }); allFreqOut13 = (EditText) v.findViewById(R.id.all_out_freq13); allFreqOut13.setText(desiredFreq[13]); allFreqLabel13 = (TextView) v.findViewById(R.id.all_freq_label13); allDutyOut13 = (EditText) v.findViewById(R.id.all_out_duty13); allDutyOut13.setText(desiredDuty[13]); allDutyLabel13 = (TextView) v.findViewById(R.id.all_outduty_label13); if (isOutputCh[13]) { // if channel is output allDigIn13.setVisibility(View.GONE); //don't display input widgets allFreqIn13.setVisibility(View.GONE); if (isDigCh13) { // if channel is digital allDigOut13.setVisibility(View.VISIBLE); //display digital widget allFreqOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut13.setVisibility(View.VISIBLE); //display count widget allDutyOut13.setVisibility(View.VISIBLE); allDigOut13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.VISIBLE); allDutyLabel13.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut13.setVisibility(View.GONE); //don't display output widgets allFreqOut13.setVisibility(View.GONE); allDutyOut13.setVisibility(View.GONE); if (isDigCh13) { // if channel is digital allDigIn13.setVisibility(View.VISIBLE); //display digital out widget allFreqIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.INVISIBLE); allDutyOut13.setVisibility(View.GONE); allDutyLabel13.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn13.setVisibility(View.VISIBLE); // display pulse widget allDigIn13.setVisibility(View.GONE); allFreqLabel13.setVisibility(View.VISIBLE); } } allFreqOut13.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut13.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut13.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut13.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut13.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut13.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn14 = (RadioButton) v.findViewById(R.id.all_hi_low14); allFreqIn14 = (TextView) v.findViewById(R.id.all_input_freq14); allDigOut14 = (CheckBox) v.findViewById(R.id.all_out_hi_low14); if (outputState[14]) { allDigOut14.setChecked(true); } allDigOut14.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut14.isChecked()) { out_hiLow14.setChecked(true); } else { out_hiLow14.setChecked(false); } } }); allFreqOut14 = (EditText) v.findViewById(R.id.all_out_freq14); allFreqOut14.setText(desiredFreq[14]); allFreqLabel14 = (TextView) v.findViewById(R.id.all_freq_label14); allDutyOut14 = (EditText) v.findViewById(R.id.all_out_duty14); allDutyOut14.setText(desiredDuty[14]); allDutyLabel14 = (TextView) v.findViewById(R.id.all_outduty_label14); if (isOutputCh[14]) { // if channel is output allDigIn14.setVisibility(View.GONE); //don't display input widgets allFreqIn14.setVisibility(View.GONE); if (isDigCh14) { // if channel is digital allDigOut14.setVisibility(View.VISIBLE); //display digital widget allFreqOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut14.setVisibility(View.VISIBLE); //display count widget allDutyOut14.setVisibility(View.VISIBLE); allDigOut14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.VISIBLE); allDutyLabel14.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut14.setVisibility(View.GONE); //don't display output widgets allFreqOut14.setVisibility(View.GONE); allDutyOut14.setVisibility(View.GONE); if (isDigCh14) { // if channel is digital allDigIn14.setVisibility(View.VISIBLE); //display digital out widget allFreqIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.INVISIBLE); allDutyOut14.setVisibility(View.GONE); allDutyLabel14.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn14.setVisibility(View.VISIBLE); // display pulse widget allDigIn14.setVisibility(View.GONE); allFreqLabel14.setVisibility(View.VISIBLE); } } allFreqOut14.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut14.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut14.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut14.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut14.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut14.setText("0"); getAllInputString(); } return true; } return false; } }); allDigIn15 = (RadioButton) v.findViewById(R.id.all_hi_low15); allFreqIn15 = (TextView) v.findViewById(R.id.all_input_freq15); allDigOut15 = (CheckBox) v.findViewById(R.id.all_out_hi_low15); if (outputState[15]) { allDigOut15.setChecked(true); } allDigOut15.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (allDigOut15.isChecked()) { out_hiLow15.setChecked(true); } else { out_hiLow15.setChecked(false); } } }); allFreqOut15 = (EditText) v.findViewById(R.id.all_out_freq15); allFreqOut15.setText(desiredFreq[15]); allFreqLabel15 = (TextView) v.findViewById(R.id.all_freq_label15); allDutyOut15 = (EditText) v.findViewById(R.id.all_out_duty15); allDutyOut15.setText(desiredDuty[15]); allDutyLabel15 = (TextView) v.findViewById(R.id.all_outduty_label15); if (isOutputCh[15]) { // if channel is output allDigIn15.setVisibility(View.GONE); //don't display input widgets allFreqIn15.setVisibility(View.GONE); if (isDigCh15) { // if channel is digital allDigOut15.setVisibility(View.VISIBLE); //display digital widget allFreqOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { // if channel is count allFreqOut15.setVisibility(View.VISIBLE); //display count widget allDutyOut15.setVisibility(View.VISIBLE); allDigOut15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.VISIBLE); allDutyLabel15.setVisibility(View.VISIBLE); } } else { // if channel is input allDigOut15.setVisibility(View.GONE); //don't display output widgets allFreqOut15.setVisibility(View.GONE); allDutyOut15.setVisibility(View.GONE); if (isDigCh15) { // if channel is digital allDigIn15.setVisibility(View.VISIBLE); //display digital out widget allFreqIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.INVISIBLE); allDutyOut15.setVisibility(View.GONE); allDutyLabel15.setVisibility(View.INVISIBLE); } else { // if channel is pulse allFreqIn15.setVisibility(View.VISIBLE); // display pulse widget allDigIn15.setVisibility(View.GONE); allFreqLabel15.setVisibility(View.VISIBLE); } } allFreqOut15.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_ENTER: int inputted = allFreqOut15.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut15.setText("0"); getAllInputString(); } return true; } return false; } }); allFreqOut15.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { int inputted = allFreqOut15.getText().toString().length(); if (inputted > 0) { getAllInputString(); } else { allFreqOut15.setText("0"); getAllInputString(); } return true; } return false; } }); allVoltCh0 = (TextView) v.findViewById(R.id.volt_ch_0); allVoltReading0 = (TextView) v.findViewById(R.id.all_input_volts0); allVoltLabel0 = (TextView) v.findViewById(R.id.volt_label_0); allVoltCh1 = (TextView) v.findViewById(R.id.volt_ch_1); allVoltReading1 = (TextView) v.findViewById(R.id.all_input_volts1); allVoltLabel1 = (TextView) v.findViewById(R.id.volt_label_1); allVoltCh2 = (TextView) v.findViewById(R.id.volt_ch_2); allVoltReading2 = (TextView) v.findViewById(R.id.all_input_volts2); allVoltLabel2 = (TextView) v.findViewById(R.id.volt_label_2); allVoltCh3 = (TextView) v.findViewById(R.id.volt_ch_3); allVoltReading3 = (TextView) v.findViewById(R.id.all_input_volts3); allVoltLabel3 = (TextView) v.findViewById(R.id.volt_label_3); allVoltCh4 = (TextView) v.findViewById(R.id.volt_ch_4); allVoltReading4 = (TextView) v.findViewById(R.id.all_input_volts4); allVoltLabel4 = (TextView) v.findViewById(R.id.volt_label_4); allVoltCh5 = (TextView) v.findViewById(R.id.volt_ch_5); allVoltReading5 = (TextView) v.findViewById(R.id.all_input_volts5); allVoltLabel5 = (TextView) v.findViewById(R.id.volt_label_5); allVoltCh6 = (TextView) v.findViewById(R.id.volt_ch_6); allVoltReading6 = (TextView) v.findViewById(R.id.all_input_volts6); allVoltLabel6 = (TextView) v.findViewById(R.id.volt_label_6); allVoltCh7 = (TextView) v.findViewById(R.id.volt_ch_7); allVoltReading7 = (TextView) v.findViewById(R.id.all_input_volts7); allVoltLabel7 = (TextView) v.findViewById(R.id.volt_label_7); break; /*case 5: //resId = R.layout.remote; resId = R.layout.setup; break; */ case 5: resId = R.layout.log; v = inflater.inflate(resId, null, false); logText = (TextView) v.findViewById(R.id.logtext); logText.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View arg0) { String listText = logText.getText().toString(); //Log.v("LongClick: ", listText); ((AndroiDAQTCPMain) context).writeToFile(listText); return false; } }); logSV = (ScrollView) v.findViewById(R.id.scrollViewLog); logSV.setScrollbarFadingEnabled(false); refreshLog = (Button) v.findViewById(R.id.refreshlog); refreshLog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQTCPMain) context).setFromMenu(true); ((AndroiDAQTCPMain) context).sendMessage("07\r"); } }); openMenu = (Button) v.findViewById(R.id.open_menu); openMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((AndroiDAQTCPMain) context).openMenu(); } }); break; case 6: resId = R.layout.adc; v = inflater.inflate(resId, null, false); adcSV = (ScrollView) v.findViewById(R.id.scrollViewADC); adcSV.setScrollbarFadingEnabled(false); samples = (EditText) v.findViewById(R.id.samples1); samples.setFilters(new InputFilter[] { new InputFilterMinMax("1", "4096") }); samples.setSelectAllOnFocus(true); samples.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { //Toast.makeText(context, samples.getText(), Toast.LENGTH_SHORT).show(); String theText = samples.getText().toString(); samples.clearFocus(); if (theText.matches("")) { samples.setText("100"); samples.selectAll(); } return false; } return false; } }); ratesList = (Spinner) v.findViewById(R.id.rates); ArrayAdapter<String> adap = new ArrayAdapter<String>(this.context, R.layout.spinner_item, new String[] { "100uSecs", "500uSecs", "1mSec", "10mSecs", "50mSecs", "100mSecs", "500mSecs", "1-Sec" }); adap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); ratesList.setAdapter(adap); ratesList.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { itemText = ratesList.getSelectedItem().toString(); if (waveRate != null) waveRate.setText("Longpress to take 448 samples at: " + itemText); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); readSamples = (Button) v.findViewById(R.id.readSamples); readSamples.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String sampleNum = samples.getText().toString(); Log.v("EditText: ", sampleNum); int itemNum = ratesList.getSelectedItemPosition(); String[] values = { "10000", "2000", "1000", "100", "20", "10", "2", "1" }; String rateText = values[itemNum]; Log.v("Spinner: ", rateText); int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { ((AndroiDAQTCPMain) context).getADCSample(true, sampleNum, rateText); } } }); break; case 7: resId = R.layout.waveform; v = inflater.inflate(resId, null, false); waveRate = (TextView) v.findViewById(R.id.waveRate); waveRate.setText("Longpress to take 448 samples at: " + ratesList.getSelectedItem().toString()); mWaveform = (WaveFormView) v.findViewById(R.id.WaveformArea); mWaveform.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View arg0) { String sampleNum = samples.getText().toString(); Log.v("EditText: ", sampleNum); int itemNum = ratesList.getSelectedItemPosition(); String[] values = { "10000", "2000", "1000", "100", "20", "10", "2", "1" }; String rateText = values[itemNum]; Log.v("Spinner: ", rateText); Toast.makeText(context, "Getting Samples", Toast.LENGTH_SHORT).show(); ((AndroiDAQTCPMain) context).getOscopeSample(true, rateText); return false; } }); sendOutputs = false; break; case 8: resId = R.layout.remote; v = inflater.inflate(resId, null, false); speed = (SeekBar) v.findViewById(R.id.seekBar1); speed.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub speedPercent = progress; out_freq0.setText(Integer.toString(speedPercent)); allFreqOut0.setText(Integer.toString(speedPercent)); } }); forward = (Button) v.findViewById(R.id.button1); forward.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(true); out_hiLow2.setChecked(true); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); reverse = (Button) v.findViewById(R.id.button5); reverse.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(false); out_hiLow2.setChecked(false); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); left = (Button) v.findViewById(R.id.button2); left.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(false); out_hiLow2.setChecked(true); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); right = (Button) v.findViewById(R.id.button4); right.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int connected = ((AndroiDAQTCPMain) context).btState(); if (connected != 3) { Toast.makeText(context, R.string.not_connected, Toast.LENGTH_SHORT).show(); sendOutputs = false; } else { switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (!buttonDown) { sendOutputs = true; buttonDown = true; allFreqOut0.setText(out_freq0.getText()); allFreqOut1.setText(out_freq1.getText()); allFreqOut2.setText(out_freq2.getText()); allFreqOut3.setText(out_freq3.getText()); allFreqOut4.setText(out_freq4.getText()); allFreqOut5.setText(out_freq5.getText()); allFreqOut6.setText(out_freq6.getText()); allFreqOut7.setText(out_freq7.getText()); allFreqOut8.setText(out_freq8.getText()); allFreqOut9.setText(out_freq9.getText()); allFreqOut10.setText(out_freq10.getText()); allFreqOut11.setText(out_freq11.getText()); allFreqOut12.setText(out_freq12.getText()); allFreqOut13.setText(out_freq13.getText()); allFreqOut14.setText(out_freq14.getText()); allFreqOut15.setText(out_freq15.getText()); allDutyOut0.setText(duty_freq0.getText()); allDutyOut1.setText(duty_freq1.getText()); allDutyOut2.setText(duty_freq2.getText()); allDutyOut3.setText(duty_freq3.getText()); allDutyOut4.setText(duty_freq4.getText()); allDutyOut5.setText(duty_freq5.getText()); allDutyOut6.setText(duty_freq6.getText()); allDutyOut7.setText(duty_freq7.getText()); allDutyOut8.setText(duty_freq8.getText()); allDutyOut9.setText(duty_freq9.getText()); allDutyOut10.setText(duty_freq10.getText()); allDutyOut11.setText(duty_freq11.getText()); allDutyOut12.setText(duty_freq12.getText()); allDutyOut13.setText(duty_freq13.getText()); allDutyOut14.setText(duty_freq14.getText()); allDutyOut15.setText(duty_freq15.getText()); out_hiLow1.setChecked(true); out_hiLow2.setChecked(false); setProp(); } return true; case MotionEvent.ACTION_UP: if (buttonDown) { sendOutputs = true; buttonDown = false; allFreqOut0.setText("0"); allFreqOut1.setText("0"); allFreqOut2.setText("0"); allFreqOut3.setText("0"); allFreqOut4.setText("0"); allFreqOut5.setText("0"); allFreqOut6.setText("0"); allFreqOut7.setText("0"); allFreqOut8.setText("0"); allFreqOut9.setText("0"); allFreqOut10.setText("0"); allFreqOut11.setText("0"); allFreqOut12.setText("0"); allFreqOut13.setText("0"); allFreqOut14.setText("0"); allFreqOut15.setText("0"); allDutyOut0.setText("50"); allDutyOut1.setText("50"); allDutyOut2.setText("50"); allDutyOut3.setText("50"); allDutyOut4.setText("50"); allDutyOut5.setText("50"); allDutyOut6.setText("50"); allDutyOut7.setText("50"); allDutyOut8.setText("50"); allDutyOut9.setText("50"); allDutyOut10.setText("50"); allDutyOut11.setText("50"); allDutyOut12.setText("50"); allDutyOut13.setText("50"); allDutyOut14.setText("50"); allDutyOut15.setText("50"); setProp(); } return true; } } return true; } }); break; case 9: resId = R.layout.quickset; v = inflater.inflate(resId, null, false); resetValues = (Button) v.findViewById(R.id.reset1); resetValues.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //TODO set all values to default boolean[] areInputs = new boolean[16]; Arrays.fill(areInputs, Boolean.FALSE); boolean[] areDigital = new boolean[16]; Arrays.fill(areDigital, Boolean.TRUE); boolean[] areOutputs = new boolean[16]; Arrays.fill(areOutputs, Boolean.FALSE); String[] freqs = new String[16]; String[] duties = new String[16]; Arrays.fill(freqs, "0"); Bundle myBundle = new Bundle(); myBundle.putBooleanArray("isInput", areInputs); myBundle.putBooleanArray("isDig", areDigital); myBundle.putBooleanArray("outputState", areOutputs); myBundle.putStringArray("desiredFreqs", freqs); myBundle.putStringArray("desiredDutys", duties); setUIStates(myBundle); notifyDataSetChanged(); } }); break; } //View view = inflater.inflate(resId, null); ((ViewPager) collection).addView(v, 0); return v; }
From source file:org.telegram.ui.PassportActivity.java
private void createEmailInterface(Context context) { actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail)); if (!TextUtils.isEmpty(currentEmail)) { TextSettingsCell settingsCell1 = new TextSettingsCell(context); settingsCell1.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); settingsCell1.setBackgroundDrawable(Theme.getSelectorDrawable(true)); settingsCell1.setText(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, currentEmail), false); linearLayout2.addView(settingsCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); settingsCell1.setOnClickListener(v -> { useCurrentValue = true;// w w w . j a v a2s .c om doneItem.callOnClick(); useCurrentValue = false; }); bottomCell = new TextInfoPrivacyCell(context); bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", R.string.PassportPhoneUseSameEmailInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } inputFields = new EditTextBoldCursor[1]; for (int a = 0; a < 1; a++) { ViewGroup container = new FrameLayout(context); linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); inputFields[a] = new EditTextBoldCursor(context); inputFields[a].setTag(a); inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText)); inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setBackgroundDrawable(null); inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setCursorSize(AndroidUtilities.dp(20)); inputFields[a].setCursorWidth(1.5f); inputFields[a].setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); switch (a) { case FIELD_EMAIL: inputFields[a].setHint(LocaleController.getString("PaymentShippingEmailPlaceholder", R.string.PaymentShippingEmailPlaceholder)); if (currentTypeValue != null && currentTypeValue.plain_data instanceof TLRPC.TL_securePlainEmail) { TLRPC.TL_securePlainEmail securePlainEmail = (TLRPC.TL_securePlainEmail) currentTypeValue.plain_data; if (!TextUtils.isEmpty(securePlainEmail.email)) { inputFields[a].setText(securePlainEmail.email); } } break; } inputFields[a].setSelection(inputFields[a].length()); inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6)); inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6)); inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) { doneItem.callOnClick(); return true; } return false; }); } bottomCell = new TextInfoPrivacyCell(context); bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.getString("PassportEmailUploadInfo", R.string.PassportEmailUploadInfo)); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); }
From source file:com.example.libwidgettv.bak.AbsListView.java
/** * Return an InputConnection for editing of the filter text. */// w ww. j a va 2s.c o m @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { if (isTextFilterEnabled()) { // XXX we need to have the text filter created, so we can get an // InputConnection to proxy to. Unfortunately this means we pretty // much need to make it as soon as a list view gets focus. createTextFilter(false); if (mPublicInputConnection == null) { mDefInputConnection = new BaseInputConnection(this, false); mPublicInputConnection = new InputConnectionWrapper(mTextFilter.onCreateInputConnection(outAttrs), true) { @Override public boolean reportFullscreenMode(boolean enabled) { // Use our own input connection, since it is // the "real" one the IME is talking with. return mDefInputConnection.reportFullscreenMode(enabled); } @Override public boolean performEditorAction(int editorAction) { // The editor is off in its own window; we need to be // the one that does this. if (editorAction == EditorInfo.IME_ACTION_DONE) { InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(getWindowToken(), 0); } return true; } return false; } @Override public boolean sendKeyEvent(KeyEvent event) { // Use our own input connection, since the filter // text view may not be shown in a window so has // no ViewAncestor to dispatch events with. return mDefInputConnection.sendKeyEvent(event); } }; } outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_FILTER; outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; return mPublicInputConnection; } return null; }
From source file:com.appunite.list.AbsHorizontalListView.java
/** * Return an InputConnection for editing of the filter text. *//*from w w w. ja va 2 s . c o m*/ @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { if (isTextFilterEnabled()) { // XXX we need to have the text filter created, so we can get an // InputConnection to proxy to. Unfortunately this means we pretty // much need to make it as soon as a list view gets focus. createTextFilter(false); if (mPublicInputConnection == null) { mDefInputConnection = new BaseInputConnection(this, false); mPublicInputConnection = new InputConnectionWrapper(mTextFilter.onCreateInputConnection(outAttrs), true) { @Override public boolean reportFullscreenMode(boolean enabled) { // Use our own input connection, since it is // the "real" one the IME is talking with. return mDefInputConnection.reportFullscreenMode(enabled); } @Override public boolean performEditorAction(int editorAction) { // The editor is off in its own window; we need to be // the one that does this. if (editorAction == EditorInfo.IME_ACTION_DONE) { InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(getWindowToken(), 0); } return true; } return false; } @Override public boolean sendKeyEvent(KeyEvent event) { // Use our own input connection, since the filter // text view may not be shown in a window so has // no ViewAncestor to dispatch events with. return mDefInputConnection.sendKeyEvent(event); } }; } outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_FILTER; outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; return mPublicInputConnection; } return null; }