private void updateFlightModeButtons() { resetFlightModeButtons(); final Drone drone = getDrone(); final State droneState = drone.getAttribute(AttributeType.STATE); final VehicleMode flightMode = droneState.getVehicleMode(); if (flightMode != null) { switch (flightMode) { case PLANE_AUTO: autoBtn.setActivated(true); break; case PLANE_GUIDED: final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE); final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE); if (guidedState.isInitialized() && !followState.isEnabled()) { pauseBtn.setActivated(true); } break; case PLANE_RTL: homeBtn.setActivated(true); break; } } }
/* onResume greys out and disables point button if fixed point is disabled or makes it appear like other buttons to show it is enabled when fixed point is enabled */ public void onResume() { super.onResume(); if (GlobalVar.fixedPointEnabled == true) { pointButton.setActivated(true); pointButton.setBackgroundResource(R.drawable.buttons_calc); } else if (GlobalVar.fixedPointEnabled == false) { pointButton.setActivated(false); pointButton.setBackgroundResource(R.drawable.buttons_disable); } }
@Override public void onNoBeaconDetected() { mTxtStatus.setText("FAILED"); stopProgressBar(); mBtnStartSearch.setActivated(true); changeViewState(State.SEARCH); }
@Override public void onOtherBeaconTooClose() { mTxtStatus.setText("Beacons are too close"); stopProgressBar(); mBtnStartSearch.setActivated(true); changeViewState(State.SEARCH); }
private void updateFollowButton() { final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE); if (followState == null) return; switch (followState.getState()) { case FollowState.STATE_START: followBtn.setBackgroundColor(orangeColor); break; case FollowState.STATE_RUNNING: followBtn.setActivated(true); followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector); break; default: followBtn.setActivated(false); followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector); break; } }
@OnClick(R.id.btnStartSearch) public void btnSearch_Clicked(View view) { mTxtStatus.setText("Preparing measurements"); mBeaconDetector = new ClosestBeaconDetector(); mBeaconDetector.start(getBaseContext(), (ClosestBeaconDetectedListener) this); mProgressBar.setProgress(0); mProgressStatus = 0; mBtnStartSearch.setActivated(false); changeViewState(State.SEARCH); }
@Override public void onFinish() { if (MyCredentials.Me == null) { // this can only happen, if user is not connected to the internet: msg_txt.setText(getResources().getString(R.string.no_connection)); retry_btn.setVisibility(View.VISIBLE); retry_btn.setActivated(true); return; } LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); if (!service.isProviderEnabled(LocationManager.GPS_PROVIDER)) { msg_txt.setText(getResources().getString(R.string.no_location)); retry_btn.setVisibility(View.VISIBLE); retry_btn.setActivated(true); return; } if (loadingView != null) loadingView.stopAnimation(); if (MyCredentials.Me.getProfile() != null && MyCredentials.Me.getProfile().getCity_id() != null) { Uri data = getIntent().getData(); if (data != null) { List<String> params = data.getPathSegments(); Intent intent = new Intent(this, TabActivity.class); intent.putExtra("USER", params.get(params.size() - 1)); startActivity(intent); } else { startMainActivity(); } } else { if (loadingView != null) loadingView.startAnimation(); Log.i("Entry", "no city for user exists"); getFragmentManager() .beginTransaction() .replace(R.id.select_city_container, new SelectCityFragment()) .commit(); } }
private void initUI() { countrySpinner = (Spinner) findViewById(R.id.country_spinner_register_layout); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( RegisterActivity.this, R.array.countries_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); countrySpinner.setAdapter(adapter); registerBtn = (Button) findViewById(R.id.register_buton); registerBtn.setOnClickListener(this); registerBtn.setActivated(false); phoneNumEdt = (EditText) findViewById(R.id.phone_number_register_layout_edt); phoneNumEdt.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!StringUtils.isEmpty(s.toString())) { registerBtn.setEnabled(true); } else { registerBtn.setEnabled(false); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) {} }); phoneNumEdt.setHint(Tools.getCurrentPhoneNum(RegisterActivity.this)); privacyTv = (TextView) findViewById(R.id.privacy_register_tv); privacyTv.setText( Html.fromHtml( getString(R.string.privacy_policy_register) + " " + "<a href=\"https://play.google.com/store/search?q=dinostudio8891&c=apps\">" + getString(R.string.agree_term_con) + "</a>" + " " + getString(R.string.and) + " " + "<a href=\"https://play.google.com/store/search?q=dinostudio8891&c=apps\">" + getString(R.string.security_policy) + "</a>" + getString(R.string.go_next))); Linkify.addLinks(privacyTv, Linkify.ALL); privacyTv.setMovementMethod(LinkMovementMethod.getInstance()); }
private void resetFlightModeButtons() { homeBtn.setActivated(false); pauseBtn.setActivated(false); autoBtn.setActivated(false); }