Пример #1
0
 private void checkIsPasscodeTurned() {
   if (Utils.getPassCodeTurned(getActivity())) {
     tvTurnPassCode.setText(getActivity().getResources().getString(R.string.turn_pass_code_off));
     btnChangePassCode.setEnabled(true);
   } else {
     tvTurnPassCode.setText(getActivity().getResources().getString(R.string.turn_pass_code_on));
     btnChangePassCode.setEnabled(false);
   }
 }
Пример #2
0
 /**
  * 蓝牙连接断开
  *
  * @param v
  */
 public void btConnect(View v) {
   Log.d("goc", "btConnect");
   btPair.setEnabled(false);
   btPair.setBackgroundColor(Color.GRAY);
   sendBroadcast(
       new Intent(isBTConnected() ? GocMessage.DISCONNECT_PHONE : GocMessage.CONNECT_PHONE));
   handler.postDelayed(r, 60000);
 }
Пример #3
0
  @SuppressWarnings("deprecation")
  private void disableButtons() {
    mLoadButtonContainer.setEnabled(false);
    mLoadImageButton.setEnabled(false);

    mPurgeButtonContainer.setEnabled(false);
    mPurgeImageButton.setEnabled(false);

    mLoadButtonContainer.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.curve_border_disabled_button));
    mPurgeButtonContainer.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.curve_border_disabled_button));

    mLoadImageButton.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.left_border_disabled_part_of_button));
    mPurgeImageButton.setBackgroundDrawable(
        getResources().getDrawable(R.drawable.left_border_disabled_part_of_button));
  }
Пример #4
0
 private void launchEchoCancellerCalibration(boolean sendEcCalibrationResult) {
   boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration();
   if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
     mPrefs.setAccountEnabled(
         mPrefs.getAccountCount() - 1, false); // We'll enable it after the echo calibration
     EchoCancellerCalibrationFragment fragment = new EchoCancellerCalibrationFragment();
     fragment.enableEcCalibrationResultSending(sendEcCalibrationResult);
     changeFragment(fragment);
     currentFragment = SetupFragmentsEnum.ECHO_CANCELLER_CALIBRATION;
     back.setVisibility(View.VISIBLE);
     next.setVisibility(View.GONE);
     next.setEnabled(false);
     cancel.setEnabled(false);
   } else {
     if (mPrefs.isFirstLaunch()) {
       mPrefs.setEchoCancellation(false);
     }
     success();
   }
 }
  protected void tearDownModal() {
    RelativeLayout blackOutLayer = (RelativeLayout) findViewById(R.id.settings_fog);
    RelativeLayout mainBackLayer = (RelativeLayout) findViewById(R.id.backup_restore_main);
    ListView listView = getListView();

    mainBackLayer.setEnabled(true);
    listView.setEnabled(true);
    export.setEnabled(true);
    backup.setEnabled(true);
    restore.setEnabled(true);
    blackOutLayer.setVisibility(View.INVISIBLE);
    alertModal.setVisibility(View.INVISIBLE);
    progressLayout.setVisibility(View.INVISIBLE);
  }
Пример #6
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.rl_back:
        finish();
        break;
      case R.id.rl_reason:
        refundReason();
        break;
      case R.id.rl_publish:
        mRlPublish.setEnabled(false);
        refund();

        break;
    }
  }
Пример #7
0
  public SelectAirportInfoView(Context context, AttributeSet attrs) {
    super(context, attrs);

    LayoutInflater.from(context)
        .inflate(ru.aviasales.template.R.layout.destination_fragment_location_view, this, true);

    this.context = context;

    textView =
        (TextView) findViewById(ru.aviasales.template.R.id.tv_destination_fragment_location_text);
    progressBar =
        (ActivityIndicator)
            findViewById(ru.aviasales.template.R.id.pb_destination_fragment_location_text);
    layout =
        (RelativeLayout) findViewById(ru.aviasales.template.R.id.llDestinationFeagmentLocation);
    layout.setEnabled(false);
  }
Пример #8
0
  public void displayWizardConfirm(String msisdn, String phoneNumberFull) {
    WizardConfirmFragment fragment = new WizardConfirmFragment();

    Bundle extras = new Bundle();
    extras.putString("phoneNumberFull", phoneNumberFull);
    extras.putString("MSISDN", msisdn);
    fragment.setArguments(extras);
    changeFragment(fragment);

    wizardConfirmFragment = fragment;
    currentFragment = SetupFragmentsEnum.WIZARD_CONFIRM;

    next.setVisibility(View.VISIBLE);

    next.setEnabled(false);
    back.setVisibility(View.GONE);
  }
  /**
   * Helper method to dim out the background and make the list view unclickable in preparation to
   * display a modal
   */
  protected void prepForModal() {
    RelativeLayout blackOutLayer = (RelativeLayout) findViewById(R.id.settings_fog);
    RelativeLayout mainBackLayer = (RelativeLayout) findViewById(R.id.backup_restore_main);
    ListView listView = getListView();

    mainBackLayer.setEnabled(false);
    listView.setEnabled(false);
    export.setEnabled(false);
    backup.setEnabled(false);
    restore.setEnabled(false);
    blackOutLayer.setVisibility(View.VISIBLE);

    progressLayout.setVisibility(View.GONE);
    alertSelectors.setVisibility(View.GONE);
    alertListOne.setVisibility(View.GONE);
    alertListTwo.setVisibility(View.GONE);
    alertModal.setVisibility(View.GONE);
    alertText.setVisibility(View.GONE);
    alertOk.setVisibility(View.GONE);
    alertCancel.setVisibility(View.GONE);
  }
 @Override
 public void setEnabled(final boolean enabled) {
   if (mPauseButton != null) {
     mPauseButton.setEnabled(enabled);
   }
   if (mNextButton != null) {
     mNextButton.setEnabled(enabled);
   }
   if (mPrevButton != null) {
     mPrevButton.setEnabled(enabled);
   }
   if (mProgress != null) {
     mProgress.setEnabled(enabled);
   }
   if (mVolume != null) {
     mVolume.setEnabled(enabled);
   }
   if (mBrightness != null) {
     mBrightness.setEnabled(enabled);
   }
   super.setEnabled(enabled);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    enableLocation = true; // <- must be before super.onCreate
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey_details);
    actionBar = getActionBar();
    if (appController.getPreferences().getBaseUrl() == null) {
      baseUrl = SurveyDetailsActivity.this.getResources().getString(R.string.server_url);
    } else baseUrl = appController.getPreferences().getBaseUrl();
    uploadUrl = baseUrl + uploadUrl;
    recordUrl = baseUrl + recordUrl;
    jsonParser = new JSONParser();
    completedResponseIds = new ArrayList<>();

    if (getIntent().hasExtra(IntentConstants.SURVEY)) {
      surveys = new Surveys();
      surveys = (Surveys) getIntent().getExtras().getSerializable(IntentConstants.SURVEY);
      actionBar.setTitle(surveys.getName());
    } else actionBar.setTitle("Survey Detail");
    surveyId = surveys.getId();
    // setting up actionbar
    actionBar.setDisplayHomeAsUpEnabled(true);
    // actionBar.setHomeAsUpIndicator(R.drawable.ic_action_ic_back);
    actionBar.setDisplayShowTitleEnabled(true);
    // setting up views
    uploadButton = (RelativeLayout) findViewById(R.id.upload_button);
    surveyTitleText = (RobotoRegularTextView) findViewById(R.id.survey_title_text);
    surveyDescriptionText = (RobotoRegularTextView) findViewById(R.id.survey_description_text);
    endDateText = (RobotoLightTextView) findViewById(R.id.end_date_text);
    completeTv = (RobotoRegularTextView) findViewById(R.id.complete_response);
    incompleteTv = (RobotoRegularTextView) findViewById(R.id.incomplete_response);
    incompleteResponsesLinearLayout =
        (LinearLayout) findViewById(R.id.incomplete_response_container);
    completeResponsesLinearLayout = (LinearLayout) findViewById(R.id.complete_response_container);
    responses = new Responses();
    dbAdapter = new DBAdapter(SurveyDetailsActivity.this);

    // if no response which is complete hide upload button
    if (dbAdapter.getCompleteResponse(surveys.getId()) == 0) {
      uploadButton.setVisibility(View.GONE);
    }

    // ##
    uploadButton.setEnabled(false);
    // ##

    if (getIntent().hasExtra(IntentConstants.SURVEY)) {

      surveyTitleText.setText(surveys.getName());
      surveyDescriptionText.setText(surveys.getDescription());
      endDateText.setText(surveys.getExpiryDate());
    }

    addResponsesButton = (RobotoRegularButton) findViewById(R.id.add_responses_button);
    incompleteResponsesLinearLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            appController.getPreferences().setBackPressed(false);
            Intent intent =
                new Intent(SurveyDetailsActivity.this, IncompleteResponseActivity.class);
            intent.putExtra(IntentConstants.SURVEY, surveys);
            startActivity(intent);
            finish();
          }
        });

    // on upload button click
    uploadButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            surveyUploadCount = 0;
            surveyUploadFailedCount = 0;
            asynTaskCheck = false;
            Long tsLong = System.currentTimeMillis() / 1000;
            timestamp = tsLong.toString();

            if (completeCount > 0) {
              progressDialog = new ProgressDialog(SurveyDetailsActivity.this);
              progressDialog.setCancelable(false);
              progressDialog.setIndeterminate(true);
              progressDialog.setMessage("Sync in Progress");

              completedResponseIds = dbAdapter.getCompleteResponsesIds(surveyId);

              if (NetworkUtil.iSConnected(getApplicationContext()) == NetworkUtil.TYPE_CONNECTED) {
                progressDialog.show();
                new UploadingMultiRecordResponse().execute();
              } else {
                appController.showToast("Please check your internet connection");
              }
            }
          }
        });

    completeResponsesLinearLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent i = new Intent(SurveyDetailsActivity.this, CompleteResponsesActivity.class);
            i.putExtra(IntentConstants.SURVEY, surveys);
            startActivity(i);
          }
        });

    SetCounts();
    addResponsesButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            requestLocation(null);
          }
        });
  }
Пример #12
0
 public void setViewEnabled(boolean enabled) {
   layout.setEnabled(enabled);
 }
Пример #13
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bt_settings);

    syncContact = (LinearLayout) findViewById(R.id.sync_contact);

    // 蓝牙名称
    btName = (EditText) findViewById(R.id.bt_name);
    btName.setText(Config.BT_NAME);
    btName.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // TODO Auto-generated method stub
            String name = btName.getText().toString();
            if (name == null || name.length() == 0) {
              name = Config.BT_NAME;
              btName.setText(name);
            }
            if (!Config.BT_NAME.equals(name)) {
              Log.d("goc", "input finish " + Config.BT_NAME + " " + name);
              Config.BT_NAME = name;
              if (isBTConnected()) {
                sendBroadcast(new Intent(GocMessage.DISCONNECT_PHONE));
              }
              sendBroadcast(new Intent(GocMessage.SET_BT_NAME));
            }
            return false;
          }
        });
    // 蓝牙密钥
    btPinCode = (EditText) findViewById(R.id.bt_pin_code);
    btPinCode.setText(Config.BT_PIN_CODE);
    btPinCode.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // TODO Auto-generated method stub
            Log.d("goc", "input finish");
            String pin = btPinCode.getText().toString();
            if (pin == null || pin.length() == 0) {
              pin = Config.BT_PIN_CODE;
              btPinCode.setText(pin);
            }
            Config.BT_PIN_CODE = pin;
            sendBroadcast(new Intent(GocMessage.SET_BT_PIN_CODE));
            return false;
          }
        });
    // 蓝牙连接
    btPair = (RelativeLayout) findViewById(R.id.bt_pair);
    btConnectOperate = (TextView) findViewById(R.id.bt_connect_operate);
    btConnectStatus = (TextView) findViewById(R.id.bt_connect_status);
    btConnectOperate.setText(isBTConnected() ? "断开连接" : "开始配对");
    btConnectStatus.setText(Config.BT_PARI_NAME);

    // 蓝牙开关
    switchButton = (SwitchButton) findViewById(R.id.switchBT);
    String btStatus = Settings.System.getString(getContentResolver(), "bt_enable");
    if (BTFileOperater.getAccStatus()) {
      switchButton.setChecked(btStatus.equals("1"));
      switchButton.setEnabled(true);
    } else {
      switchButton.setEnabled(false);
      btName.setEnabled(false);
      btPinCode.setEnabled(false);
      btPair.setEnabled(false);
      btPair.setClickable(false);
    }
    switchButton.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            String status = isChecked ? "1" : "0";
            Settings.System.putString(getContentResolver(), "bt_enable", status);
            if (!isChecked) {
              btPair.setClickable(false);
              syncContact.setClickable(false);
              Settings.System.putString(getContentResolver(), "bt_connect", "0");
              startGocsdkService(OperateCommand.BT_UNFOUND_UNCONNECT);
            } else {
              btPair.setClickable(true);
              syncContact.setClickable(true);
              btConnectOperate.setText(isBTConnected() ? "断开连接" : "开始配对");
              startGocsdkService(OperateCommand.BT_FOUND_CONNECT);
            }
            // BTFileOperater.writeBTFile(status);
            // startGocsdkService(isChecked ? OperateCommand.OPEN_BT : OperateCommand.CLOSE_BT);
            switchButton.setEnabled(false);
            new Handler()
                .postDelayed(
                    new Runnable() {

                      @Override
                      public void run() {
                        // TODO Auto-generated method stub
                        switchButton.setEnabled(true);
                      }
                    },
                    2000);
          }
        });

    initGocReceiver();
  }
Пример #14
0
 @Override
 public void run() {
   // TODO Auto-generated method stub
   btPair.setEnabled(true);
   btPair.setBackgroundResource(R.drawable.settings_list_bg);
 }
Пример #15
0
 public void showProgressBar() {
   layout.setEnabled(false);
   progressBar.setVisibility(View.VISIBLE);
   textView.setVisibility(View.GONE);
 }
Пример #16
0
 /**
  * 点击失效
  *
  * @param index
  */
 private void clickfailure(int index) {
   switch (index) {
     case 0:
       rlHome.setEnabled(false);
       rlType.setEnabled(true);
       rlFood.setEnabled(true);
       rlMine.setEnabled(true);
       break;
     case 1:
       rlHome.setEnabled(true);
       rlType.setEnabled(false);
       rlFood.setEnabled(true);
       rlMine.setEnabled(true);
       break;
     case 2:
       rlHome.setEnabled(true);
       rlType.setEnabled(true);
       rlFood.setEnabled(false);
       rlMine.setEnabled(true);
       break;
     case 3:
       rlHome.setEnabled(true);
       rlType.setEnabled(true);
       rlFood.setEnabled(true);
       rlMine.setEnabled(false);
       break;
     default:
       break;
   }
 }
Пример #17
0
 @Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (enabled) setEnabled();
   else setDisabled();
 }