コード例 #1
0
  private boolean IsValid() {
    boolean ret = true;
    if (firstName.getText().toString().matches("")) {
      firstName.setError(null);
      firstName.setError("Please enter your first name");
      firstName.requestFocus();
      ret = false;
    } else if (lastName.getText().toString().matches("")) {
      lastName.setError(null);
      lastName.setError("Please enter your last name");
      lastName.requestFocus();
      ret = false;
    } else if (email.getText().toString().matches("")) {
      email.setError(null);
      email.setError("Please enter email");
      email.requestFocus();
      ret = false;
    }

    // finally lets validate the email we already checked for null
    if (ret == true) {
      ret = android.util.Patterns.EMAIL_ADDRESS.matcher(email.getText()).matches();
      if (ret != true) {
        email.setError(null);
        email.setError("Please enter valid email");
        email.requestFocus();
      }
    }

    return ret;
  }
コード例 #2
0
ファイル: RegistActivity.java プロジェクト: bingdon/MyLineBu
  private void registByPhone() {
    String phone = phone_edit.getText().toString();
    if (TextUtils.isEmpty(phone)) {
      phone_edit.setError(getString(R.string.nullcontentnotice));
      phone_edit.requestFocus();
      return;
    } else if (!PhoneInfoUtils.isPhoneNum(phone)) {
      phone_edit.setError(getString(R.string.phone_notice_));
      phone_edit.requestFocus();
      return;
    }

    String passwordostr = passWordo.getText().toString();
    String passwordtstr = passWordt.getText().toString();
    if (TextUtils.isEmpty(passwordostr)) {
      passWordo.setError(getString(R.string.nullcontentnotice));
      passWordo.requestFocus();
      return;
    }

    if (!passwordostr.equals(passwordtstr)) {
      passWordt.setError(getString(R.string.password_notice_t));
      passWordt.requestFocus();
      return;
    }

    HealthHttpClient.registerByphone(phone, MD5.MD5jm(passwordtstr), handler);
  }
コード例 #3
0
  @Override
  public boolean okForLogin() {
    if (!DeviceUtil.hasInternet()) {
      ToastUtil.toast(R.string.tip_no_internet);
      return false;
    }
    if (etUserName.length() == 0) {
      etUserName.setError("请输入邮箱/用户名");
      etUserName.requestFocus();
      return false;
    } else if (etUserName.length() < 4) {
      etUserName.setError("用户名长度过短");
      etUserName.requestFocus();
      return false;
    }

    if (etPassword.length() == 0) {
      etPassword.setError("请输入密码");
      etPassword.requestFocus();
      return false;
    } else if (etPassword.length() <= 7) {
      etPassword.setError("密码长度过短");
      etPassword.requestFocus();
      return false;
    }

    return true;
  }
コード例 #4
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_valider:
       String sPts = etPoint.getText().toString();
       if (sPts.isEmpty()) {
         etPoint.requestFocus();
         Toast.makeText(
                 getActivity(), getString(R.string.jeux_msg_error_point), Toast.LENGTH_SHORT)
             .show();
       } else {
         int pts = Integer.valueOf(sPts);
         if (pts < 0 || pts > 162) {
           etPoint.setText("");
           etPoint.requestFocus();
           Toast.makeText(
                   getActivity(),
                   getString(R.string.jeux_msg_error_point_borne),
                   Toast.LENGTH_SHORT)
               .show();
         } else {
           partie.addScorePartieEnCours(
               getSelectedTeamPris(), pts, cbBeloteRebelote.isChecked(), getSelectedTeaBR());
           activity.showFragment(PageEnum.SCORE_JEUX);
         }
       }
       break;
     case R.id.btn_quit:
       activity.showFragment(PageEnum.ACCUEIL);
       break;
   }
 }
コード例 #5
0
 @Override
 protected void onResume() {
   if (action.equals("new")) {
     if (StringUtil.isEmpty(toText.getText().toString())) {
       toText.requestFocus();
     } else {
       titleText.requestFocus();
     }
   } else {
     bodyText.requestFocus();
   }
   if (uploadTask != null) {
     FileUploadTask temp = uploadTask;
     uploadTask = null;
     if (ActivityUtil.isGreaterThan_2_3_3()) {
       RunParallel(temp);
     } else {
       temp.execute();
     }
   }
   if (PhoneConfiguration.getInstance().fullscreen) {
     ActivityUtil.getInstance().setFullScreen(v);
   }
   super.onResume();
 }
コード例 #6
0
  private boolean checkEditText() {
    // TODO Auto-generated method stub
    boolean flag = true;
    phone_edit.setError(null);
    pass_edit.setError(null);
    phoneString = phone_edit.getText().toString().trim();
    passString = pass_edit.getText().toString().trim();

    if (TextUtils.isEmpty(phoneString)) {
      phone_edit.requestFocus();
      phone_edit.setError(getString(R.string.input_phone_string));
      flag = false;
      return flag;
    }
    if (phoneString.length() < 11) {
      phone_edit.requestFocus();
      phone_edit.setError(getString(R.string.error_string1));
      flag = false;
      return flag;
    }
    if (TextUtils.isEmpty(passString)) {
      pass_edit.requestFocus();
      pass_edit.setError(getString(R.string.input_pass_string));
      flag = false;
      return flag;
    }
    if (passString.length() > 12 || passString.length() < 6) {
      pass_edit.requestFocus();
      pass_edit.setError(getString(R.string.set_pass_string));
      flag = false;
      return flag;
    }
    return flag;
  }
コード例 #7
0
ファイル: LoginFragment.java プロジェクト: kronismax/Note
  @Override
  public void onViewCreated(View view, Bundle saveInstanceState) {
    super.onViewCreated(view, saveInstanceState);
    eLogin = (EditText) view.findViewById(R.id.logText);
    ePassword = (EditText) view.findViewById(R.id.passText);
    Login = (Button) view.findViewById(R.id.button_login);
    Demo = (Button) view.findViewById(R.id.ButtonDemo);
    textView1 = (TextView) view.findViewById(R.id.textView1);

    //		String fontShortcuts = "fonts/CANON.ttf";
    //		Typeface font = Typeface.createFromAsset(getActivity().getAssets(), fontShortcuts);
    //		Demo.setTypeface(font);

    if (saveInstanceState == null) {
      SharedPreferences preferences =
          getActivity().getSharedPreferences(PREF_SETTINGS, Context.MODE_PRIVATE);
      String stringPreference = preferences.getString("login", "");
      eLogin.setText(stringPreference);
      if (!TextUtils.isEmpty(eLogin.getText())) {
        ePassword.requestFocus();
      } else {
        eLogin.requestFocus();
      }
    }
    Login.setOnClickListener(this);
    Demo.setOnClickListener(this);
  }
コード例 #8
0
  /** 检测输入的密码是否符合要求 */
  public boolean check() {
    String str_oldPass = et_old_pass.getText().toString().trim();
    String str_newPass = et_new_pass.getText().toString().trim();
    String str_confirmPass = et_confirm_pass.getText().toString().trim();

    // 从数据库获取原密码
    UserInfoBean bean =
        DBPerform.queryUserInfoByEmail(EditCountChangePasswd.this, LoginActivity.USER_EMAIL_STR);
    String str_oldPass_db = bean.getUserPass();

    // 输入的原密码与已经在哦数据库存储的密码不匹配
    if (!str_oldPass.equals(str_oldPass_db)) {
      ToastUtils.makeToast(EditCountChangePasswd.this, "请检测您的原密码是否输入正确");
      et_old_pass.requestFocus();
      return false;
    }
    // 输入的新密码与确认密码进行比较
    else if (!str_newPass.equals(str_confirmPass)) {
      ToastUtils.makeToast(EditCountChangePasswd.this, "新密码与确认密码不相同,请重新输入确认密码");
      et_confirm_pass.setText("");
      et_confirm_pass.requestFocus();
      return false;
    }
    // 输入成功
    else {
      return true;
    }
  }
コード例 #9
0
 public void onCheckedChanged(RadioGroup group, int checkedId) {
   switch (checkedId) {
     case R.id.munual_select_interpolation:
       FreqSpinner.setEnabled(false);
       et_bandwidth.setFocusable(true);
       et_bandwidth.setFocusableInTouchMode(true);
       et_bandwidth.requestFocus();
       et_centerfreq.setFocusable(true);
       et_centerfreq.setFocusableInTouchMode(true);
       et_centerfreq.requestFocus();
       Ishand = true;
       Ischoose = false;
       break;
     case R.id.straight_select_interpolation:
       et_bandwidth.setText("");
       et_centerfreq.setText("");
       et_bandwidth.setFocusableInTouchMode(false);
       et_centerfreq.setFocusableInTouchMode(false);
       et_bandwidth.setFocusable(false);
       et_centerfreq.setFocusable(false);
       FreqSpinner.setEnabled(true);
       Ishand = false;
       Ischoose = true;
       break;
     default:
       break;
   }
 }
コード例 #10
0
ファイル: LoginActivity.java プロジェクト: yogesha3/test2
  /**
   * Method to check the validation on the page
   *
   * @return
   */
  private boolean checkValidation() {
    boolean isAllFieldCorrect = true;
    if (strUserName.length() == 0 && strPassword.length() == 0) {
      isAllFieldCorrect = false;
      mEdtUserName.requestFocus();
      Validation.hasText(LoginActivity.this, mEdtUserName, mllUserName);
      Validation.hasText(LoginActivity.this, mEdtPassword, mllPassword);
      ErrorMsgDialog.showErrorAlert(
          LoginActivity.this, "", getString(R.string.wrng_str_empty_requried_field));

    } else if (strUserName.length() == 0) {
      isAllFieldCorrect = false;
      mEdtUserName.requestFocus();
      Validation.hasText(LoginActivity.this, mEdtUserName, mllUserName);
      ErrorMsgDialog.showErrorAlert(
          LoginActivity.this, "", getString(R.string.wrng_str_empty_requried_field));
    } else if (!Validation.isEmailAddress(LoginActivity.this, mEdtUserName, mllUserName, true)) {
      mEdtUserName.requestFocus();
      isAllFieldCorrect = false;
      Validation.isEmailAddress(LoginActivity.this, mEdtUserName, mllUserName, true);
      ErrorMsgDialog.showErrorAlert(
          LoginActivity.this, "", getString(R.string.wrng_str_invalid_email));
    } else if (strPassword.length() == 0) {
      isAllFieldCorrect = false;
      mEdtPassword.requestFocus();
      Validation.hasText(LoginActivity.this, mEdtPassword, mllPassword);
      ErrorMsgDialog.showErrorAlert(
          LoginActivity.this, "", getString(R.string.wrng_str_empty_requried_field));
    } else {
      isAllFieldCorrect = true;
    }
    return isAllFieldCorrect;
  }
コード例 #11
0
  /** 初始化 Views */
  private void initViews() {
    mEtIDNumber = (EditText) findViewById(R.id.id_EtIDNumber);
    mEtPassword = (EditText) findViewById(R.id.id_EtPassword);
    mEtVerifyCode = (EditText) findViewById(R.id.id_EtVerifyCode);
    mImgVerifyCode = (ImageView) findViewById(R.id.id_ImgVerifyCode);
    mBtnLogin = (Button) findViewById(R.id.id_BtnLogin);
    mTvLoginBack = (TextView) findViewById(R.id.id_tvLoginBack);
    mCbRememberPsd = (CheckBox) findViewById(R.id.id_cBRememberPsd);
    mTvRememberPsd = (TextView) findViewById(R.id.id_tvRememberPsd);
    mCbRememberIDNumber = (CheckBox) findViewById(R.id.id_cBRememberIDNumber);
    mTvRememberIDNumber = (TextView) findViewById(R.id.id_tvRememberIDNumber);

    // 读取保存的密码
    SharedPreferences mSharedPreferences = getSharedPreferences("data", Activity.MODE_PRIVATE);
    boolean rememberPsd = mSharedPreferences.getBoolean("rememberPsd", false);
    boolean rememberIDNumber = mSharedPreferences.getBoolean("rememberIDNumber", false);
    if (rememberPsd) {
      String IDNumber = mSharedPreferences.getString("IDNumber", "");
      String password = mSharedPreferences.getString("password", "");
      mEtIDNumber.setText(IDNumber);
      mEtPassword.setText(password);
      // 将焦点置于填写验证码
      mEtVerifyCode.requestFocus();
      // 并将记住账号和记住密码默认打勾
      mCbRememberIDNumber.setChecked(true);
      mCbRememberPsd.setChecked(true);
    } else if (rememberIDNumber) {
      String IDNumber = mSharedPreferences.getString("IDNumber", "");
      mEtIDNumber.setText(IDNumber);
      // 将焦点置于填写验证码
      mEtPassword.requestFocus();
      // 并将记住账号默认打勾
      mCbRememberIDNumber.setChecked(true);
    }
  }
コード例 #12
0
 void loginDropbox() {
   if (dropbox.isAuthenticated()) {
     // If we're already authenticated, we don't need to get
     // the login info
     progress.show();
     dropbox.login(dropboxListener);
   } else {
     String email = dropboxEmail.getText().toString();
     if (email.length() < 5 || email.indexOf("@") < 0 || email.indexOf(".") < 0) {
       shake(dropboxEmail);
       dropboxEmail.requestFocus();
       showToast("Invalid e-mail");
       return;
     }
     String password = dropboxPass.getText().toString();
     if (password.length() < 6) {
       shake(dropboxPass);
       dropboxPass.requestFocus();
       showToast("Password too short");
       return;
     }
     // It's good to do Dropbox API (and any web API) calls
     // in a separate thread, so we don't get a force-close
     // due to the UI thread stalling.
     progress.show();
     dropbox.login(dropboxListener, email, password);
   }
 }
コード例 #13
0
  /**
   * Inicializa las vistas de este Fragment
   *
   * @param layout el layout de este Fragment que contiene las vistas
   */
  private void initViews(View layout) {
    createButton = (Button) layout.findViewById(R.id.create_tokenly_fan_identity);
    mFanExternalUserName = (EditText) layout.findViewById(R.id.external_username);
    mFanExternalPassword = (EditText) layout.findViewById(R.id.tokenly_access_password);
    fanImage = (ImageView) layout.findViewById(R.id.tokenly_fan_image);
    mFanExternalPlatform = (Spinner) layout.findViewById(R.id.external_platform);
    relativeLayout = (RelativeLayout) layout.findViewById(R.id.user_image);
    createButton.setText((!isUpdate) ? "Create" : "Update");
    mFanExternalUserName.requestFocus();
    List<String> arraySpinner = ExternalPlatform.getArrayItems();
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, arraySpinner);
    mFanExternalPlatform.setAdapter(adapter);
    mFanExternalUserName.requestFocus();
    registerForContextMenu(fanImage);
    fanImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            CommonLogger.debug(TAG, "Entrando en fanImage.setOnClickListener");
            getActivity().openContextMenu(fanImage);
          }
        });

    createButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            CommonLogger.debug(TAG, "Entrando en createButton.setOnClickListener");

            int resultKey = createNewIdentity();
            switch (resultKey) {
              case CREATE_IDENTITY_SUCCESS:
                //
                // changeActivity(Activities.CCP_SUB_APP_INTRA_USER_IDENTITY.getCode(),
                // appSession.getAppPublicKey());
                if (!isUpdate) {
                  Toast.makeText(getActivity(), "Identity created", Toast.LENGTH_SHORT).show();
                } else {
                  Toast.makeText(getActivity(), "Changes saved", Toast.LENGTH_SHORT).show();
                }
                break;
              case CREATE_IDENTITY_FAIL_MODULE_EXCEPTION:
                Toast.makeText(getActivity(), "Error al crear la identidad", Toast.LENGTH_LONG)
                    .show();
                break;
              case CREATE_IDENTITY_FAIL_NO_VALID_DATA:
                Toast.makeText(getActivity(), "La data no es valida", Toast.LENGTH_LONG).show();
                break;
              case CREATE_IDENTITY_FAIL_MODULE_IS_NULL:
                Toast.makeText(
                        getActivity(),
                        "No se pudo acceder al module manager, es null",
                        Toast.LENGTH_LONG)
                    .show();
                break;
            }
          }
        });
  }
コード例 #14
0
  /** 注册 */
  public void register() {
    username = userNameEditText.getText().toString().trim();
    nick = userNickEditText.getText().toString().trim();
    pwd = passwordEditText.getText().toString().trim();
    String confirm_pwd = confirmPwdEditText.getText().toString().trim();
    if (TextUtils.isEmpty(username)) {
      Toast.makeText(
              this,
              getResources().getString(R.string.User_name_cannot_be_empty),
              Toast.LENGTH_SHORT)
          .show();
      userNameEditText.requestFocus();
      return;
    } else if (!username.matches("[\\w][\\w\\d_]+")) {
      Toast.makeText(this, getResources().getString(R.string.illegal_user_name), Toast.LENGTH_SHORT)
          .show();
      userNameEditText.requestFocus();
      return;
    } else if (TextUtils.isEmpty(nick)) {
      Toast.makeText(
              this, getResources().getString(R.string.toast_nick_not_isnull), Toast.LENGTH_SHORT)
          .show();
      userNickEditText.requestFocus();
      return;
    } else if (TextUtils.isEmpty(pwd)) {
      Toast.makeText(
              this, getResources().getString(R.string.Password_cannot_be_empty), Toast.LENGTH_SHORT)
          .show();
      passwordEditText.requestFocus();
      return;
    } else if (TextUtils.isEmpty(confirm_pwd)) {
      Toast.makeText(
              this,
              getResources().getString(R.string.Confirm_password_cannot_be_empty),
              Toast.LENGTH_SHORT)
          .show();
      confirmPwdEditText.requestFocus();
      return;
    } else if (!pwd.equals(confirm_pwd)) {
      Toast.makeText(
              this, getResources().getString(R.string.Two_input_password), Toast.LENGTH_SHORT)
          .show();
      return;
    }

    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
      pd = new ProgressDialog(this);
      pd.setMessage(getResources().getString(R.string.Is_the_registered));
      pd.show();

      registerAppSever();
    }
  }
コード例 #15
0
 private boolean isEmptyFields(String user, String pass) {
   if (TextUtils.isEmpty(user)) {
     edtUser.requestFocus(); // seta o foco para o campo usuário
     edtUser.setError(resources.getString(R.string.login_user_required));
     return true;
   } else if (TextUtils.isEmpty(pass)) {
     edtPassword.requestFocus(); // seta o foco para o campo senha
     edtPassword.setError(resources.getString(R.string.login_password_required));
     return true;
   }
   return false;
 }
コード例 #16
0
ファイル: LoginActivity.java プロジェクト: DAleksova666/TP
  public void attemptLogin() {
    mEmailView.setError(null);
    mPasswordView.setError(null);

    mEmail = mEmailView.getText().toString();
    mPassword = mPasswordView.getText().toString();

    boolean cancel = false;
    View focusView = null;

    if (TextUtils.isEmpty(mPassword)) {
      mPasswordView.setError(getString(R.string.error_field_required));
      focusView = mPasswordView;
      cancel = true;
    } else if (mPassword.length() < 4) {
      mPasswordView.setError(getString(R.string.error_invalid_password));
      focusView = mPasswordView;
      cancel = true;
    }

    if (TextUtils.isEmpty(mEmail)) {
      mEmailView.setError(getString(R.string.error_field_required));
      focusView = mEmailView;
      cancel = true;
    } else if (!mEmail.contains("@")) {
      mEmailView.setError(getString(R.string.error_invalid_email));
      focusView = mEmailView;
      cancel = true;
    }

    if (cancel) {
      focusView.requestFocus();
    } else {

      for (String[] name : names2) {
        if (name[2].equals(mEmail)) {
          if (name[3].equals(mPassword)) {
            suc = 1;
            break;
          } else {
            mPasswordView.setError(getString(R.string.error_incorrect_password));
            mPasswordView.requestFocus();
            passfail = 1;
          }
        }
      }
      if (suc != 1 && passfail == 0) {
        mEmailView.setError(getString(R.string.error_incorrect_email));
        mEmailView.requestFocus();
      }
    }
  }
コード例 #17
0
  private boolean hasSizeValid(String user, String pass) {

    if (!(user.length() > 3)) {
      edtUser.requestFocus();
      edtUser.setError(resources.getString(R.string.login_user_size_invalid));
      return false;
    } else if (!(pass.length() > 5)) {
      edtPassword.requestFocus();
      edtPassword.setError(resources.getString(R.string.login_pass_size_invalid));
      return false;
    }
    return true;
  }
コード例 #18
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_edit_note, container, false);

    titleEditText = (EditText) rootView.findViewById(R.id.titleEditText);
    contentEditText = (EditText) rootView.findViewById(R.id.contentEditText);

    if (getArguments() != null) {
      note =
          new Note(
              getArguments().getString(ARG_ID),
              getArguments().getString(ARG_TITLE),
              getArguments().getString(ARG_CONTENT));

      titleEditText.setText(note.getTitle());
      // Place cursor at the end of title
      titleEditText.setSelection(titleEditText.getText().length());
      contentEditText.setText(note.getContent());

      showKeyboard = getArguments().getBoolean(ARG_SHOW_KEYBOARD);
    }

    titleEditText.clearFocus();

    if (showKeyboard) {
      titleEditText.requestFocus();
    }

    getActivity().setTitle(getString(R.string.title_add_note));
    return rootView;
  }
コード例 #19
0
  @SuppressLint("InflateParams")
  private void quickEdit(
      final String previousValue, final OnValueEdited callback, boolean password) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.quickedit, null);
    final EditText editor = (EditText) view.findViewById(R.id.editor);
    OnClickListener mClickListener =
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            String value = editor.getText().toString();
            if (!previousValue.equals(value) && value.trim().length() > 0) {
              callback.onValueEdited(value);
            }
          }
        };
    if (password) {
      editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      editor.setHint(R.string.password);
      builder.setPositiveButton(R.string.accept, mClickListener);
    } else {
      builder.setPositiveButton(R.string.edit, mClickListener);
    }
    editor.requestFocus();
    editor.setText(previousValue);
    builder.setView(view);
    builder.setNegativeButton(R.string.cancel, null);
    builder.create().show();
  }
コード例 #20
0
  private void updateViews() {
    if (!mDebugging) {
      mViewDebug.setVisibility(View.GONE);
      mLvDebug.setVisibility(View.GONE);

      if (mIsLoading && !mSharedPrefs.getBoolean("pref_disable_splash", false)) {
        mIitcWebView.setVisibility(View.GONE);
        mImageLoading.setVisibility(View.VISIBLE);
      } else {
        mIitcWebView.setVisibility(View.VISIBLE);
        mImageLoading.setVisibility(View.GONE);
      }
    } else {
      // if the debug container is invisible (and we are about to show it), select the text box
      final boolean select = mViewDebug.getVisibility() != View.VISIBLE;

      mImageLoading.setVisibility(View.GONE); // never show splash screen while debugging
      mViewDebug.setVisibility(View.VISIBLE);

      if (select) {
        mEditCommand.requestFocus();
        mEditCommand.selectAll();
      }

      if (mShowMapInDebug) {
        mBtnToggleMap.setImageResource(R.drawable.ic_action_view_as_list);
        mIitcWebView.setVisibility(View.VISIBLE);
        mLvDebug.setVisibility(View.GONE);
      } else {
        mBtnToggleMap.setImageResource(R.drawable.ic_action_map);
        mIitcWebView.setVisibility(View.GONE);
        mLvDebug.setVisibility(View.VISIBLE);
      }
    }
  }
コード例 #21
0
  private void initilizeViewVariables() {
    clearDescriptionButton = (Button) findViewById(R.id.descriptionCLRbtn);
    clearTitleButton = (Button) findViewById(R.id.titleCLRbtn);
    notifySwitch = (Switch) findViewById(R.id.switchNotificationLO);
    repeatSpinner = (Spinner) findViewById(R.id.spinnerRepeatingLO);
    timepicker = (TimePicker) findViewById(R.id.timePickerLO);
    datepicker = (DatePicker) findViewById(R.id.datePickerLO);
    timepicker.setIs24HourView(true);
    titleInputext = (EditText) findViewById(R.id.TitleEditTextLO);
    titleInputext.requestFocus();
    descriptionInputText = (EditText) findViewById(R.id.descriptionEditTextLO);

    repeatAdapter =
        new ArrayAdapter<String>(
            this,
            android.R.layout.simple_spinner_item,
            getResources().getStringArray(R.array.repeatArray));
    repeatSpinner.setAdapter(repeatAdapter);

    clearDescriptionButton.setOnClickListener(this);
    clearTitleButton.setOnClickListener(this);
    drawer.setOnOpenListener(this);
    drawer.setOnCloseListener(this);
    notifySwitch.setOnCheckedChangeListener(this);
    initilizeVariables();

    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    if (inputMethodManager != null) {
      inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
  }
コード例 #22
0
ファイル: PromptInput.java プロジェクト: neojski/gecko-dev
    public View getView(final Context context) throws UnsupportedOperationException {
      EditText input = new FloatingHintEditText(context);
      input.setInputType(InputType.TYPE_CLASS_TEXT);
      input.setText(mValue);

      if (!TextUtils.isEmpty(mHint)) {
        input.setHint(mHint);
      }

      if (mAutofocus) {
        input.setOnFocusChangeListener(
            new View.OnFocusChangeListener() {
              @Override
              public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                  ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE))
                      .showSoftInput(v, 0);
                }
              }
            });
        input.requestFocus();
      }

      mView = (View) input;
      return mView;
    }
コード例 #23
0
 protected void initLayout(View view) {
   btnQuery = (Button) view.findViewById(R.id.btn_query);
   edNumber = (EditText) view.findViewById(R.id.ed_tool_query_number_address);
   edNumber.requestFocus();
   tvNumberAddress = (TextView) view.findViewById(R.id.tv_tool_number_address);
   getActivity().getActionBar().setTitle(getString(R.string.tv_query_number_address));
 }
コード例 #24
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    if (getListAdapter() == mHistoryAdapter) {
      String selection = ((TextView) v.findViewById(android.R.id.text1)).getText().toString();
      mSearchText.setText(selection);
      mSearchText.setSelection(selection.length());
      mSearchText.requestFocus();
    } else if (getListAdapter() == mResultAdapter) {
      // add search text to the database (history)
      MediaDatabase db = MediaDatabase.getInstance(this);
      db.addSearchhistoryItem(mSearchText.getText().toString());

      // open media in the player
      Media item = (Media) getListAdapter().getItem(position - 1);
      if (item.getType() == Media.TYPE_VIDEO) {
        VideoPlayerActivity.start(this, item.getLocation());
      } else {
        ArrayList<String> arr = new ArrayList<String>();
        for (int i = 0; i < getListAdapter().getCount(); i++) {
          Media audioItem = (Media) getListAdapter().getItem(i);
          if (audioItem.getType() == Media.TYPE_AUDIO) arr.add(audioItem.getLocation());
        }
        AudioServiceController.getInstance().load(arr, arr.indexOf(item.getLocation()));
        AudioPlayerActivity.start(this);
      }
      super.onListItemClick(l, v, position, id);
    }
  };
コード例 #25
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    // TODO: create layout
    mHistoryAdapter = new SearchHistoryAdapter(this);
    mResultAdapter = new SearchResultAdapter(this);

    mSearchText = (EditText) findViewById(R.id.search_text);
    mSearchText.setOnEditorActionListener(searchTextListener);
    mSearchText.addTextChangedListener(searchTextWatcher);

    final Intent queryIntent = getIntent();
    final String queryAction = queryIntent.getAction();
    if (Intent.ACTION_SEARCH.equals(queryAction)) {
      String query = queryIntent.getStringExtra(SearchManager.QUERY);
      mSearchText.setText(query);
      mSearchText.setSelection(query.length());
    } else {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
      showSearchHistory();
    }

    mSearchText.requestFocus();
  }
コード例 #26
0
 private void sendPrepare() {
   String postT = parentObj.getString("Subject", "");
   String postC = postContent.getText().toString();
   if (postC.length() == 0) {
     postContent.requestFocus();
     UI.toast("内容不能为空");
     return;
   }
   File upload = null;
   /*if (frame.getVisibility() == View.VISIBLE) {
   	Bitmap bitmap = null;
   	try {
   		if (contentUri != null) {
   			bitmap = resizeBitmap(getContentResolver(), contentUri, 400, 300);
   		} else if (outputFileUri != null) {
   			bitmap = resizeBitmap(outputFileUri, 400, 300);
   		}
   	} catch (FileNotFoundException e) {}
   	if (bitmap == null) {
   		UI.toast("图片已经不存在,请重新选择");
   		return;
   	}
   	upload = new File(MainApp.getOutCacheDir(), TEMP_IMAGE);
   	try {
   		FileOutputStream out = new FileOutputStream(upload);
   		bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
   	} catch (Exception e) { e.printStackTrace(); }
   }*/
   sendNow(postT, postC, upload);
 }
コード例 #27
0
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saveInstanceState) {
    View view = inflater.inflate(R.layout.input_note_dialog, container);

    noteText = (EditText) view.findViewById(R.id.note_textView);
    saveButton = (Button) view.findViewById(R.id.saveButton);
    cancelButton = (Button) view.findViewById(R.id.cancelButton);

    note = getArguments().getString("existingNote");
    noteText.setText(note);

    saveButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            buttonPressed = true;
            dismiss();
          }
        });

    cancelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            dismiss();
          }
        });

    // ---show the keyboard automatically
    noteText.requestFocus();
    getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);

    // ---set the title for the dialog
    getDialog().setTitle(DialogboxTitle);

    return view;
  }
コード例 #28
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == INTENT_NEXTWIZARD) {
      if (resultCode == RESULT_OK) {
        boolean isAppExit = data.getBooleanExtra("EXIT", false);
        boolean isUserExist = data.getBooleanExtra("USER_EXIST", false);
        String tempContactInfo = data.getStringExtra("TEMP_CONTACT_INFO");
        if (isAppExit) {
          Intent intent = getIntent();
          intent.putExtra("EXIT", true);
          setResult(RESULT_OK, intent);
          finish();
        } else if (isUserExist) {
          overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
          tempUserInfoList.clear();
          editUserEmailAddress.setText("");
          editUserEmailAddress.requestFocus();
          PMWF_Log.fnlog(PMWF_Log.INFO, "UsersInformation::onActivityResult()", tempContactInfo);
        } else {
          overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
          tempUserInfoList.clear();
          tempContactInfo = data.getStringExtra("TEMP_CONTACT_INFO");
        }
      }
    }
  }
コード例 #29
0
  private void showAddDialog() {
    final View customView =
        LayoutInflater.from(getActivity()).inflate(R.layout.galary_content, null);
    final EditText editText = (EditText) customView.findViewById(R.id.xiu_add_edittext);
    editText.setHint(getString(R.string.input_galary_tip));
    editText.requestFocus();
    BillboardDialogFragment.createBuilder(getActivity())
        .setTitle(getString(R.string.add_galary_message))
        .setCustomView(customView)
        .setPositiveButtonText(android.R.string.ok)
        .setNegativeButtonText(android.R.string.cancel)
        .setPositiveListener(
            new IPositiveButtonDialogListener() {
              @Override
              public void onPositiveButtonClicked(int requestCode) {
                final String inputText = editText.getText().toString();
                if (TextUtils.isEmpty(inputText)) {
                  showMessage(getString(R.string.empty_xiu_galary_message));
                } else if (isDuplicateName(inputText)) {
                  showMessage(getString(R.string.exist_xiu_galary_message));
                } else {
                  final XiuInfo xiuInfo = getXiuInfoByInputText(inputText);
                  mXiuInfos.add(xiuInfo);
                  mAdapter.notifyDataSetChanged();

                  EventBus.getDefault().post(new CoverEvent());
                }
              }
            })
        .setTag(getString(R.string.add_galary_tag))
        .showSinglton();
  }
コード例 #30
0
  /**
   * Finish login
   *
   * @param response response
   */
  private void finishLogin(Response<UserEntity> response) {

    if (response == null || response.body() == null) {

      CustomPreferences.setPreferences(Constants.PREF_USERNAME, "");
      CustomPreferences.setPreferences(Constants.PREF_PASSWORD, "");
      CustomPreferences.setPreferences(Constants.PREF_USER_ID, 0l);
      CustomPreferences.setPreferences(Constants.PREF_ACC_ID, 0l);
      Utilities.showAlertDialog(
          LoginActivity.this,
          getString(R.string.login_fail),
          getString(R.string.try_again),
          getString(R.string.ok),
          "",
          null,
          null,
          false);
      edtPassword.setText("");
      edtPassword.requestFocus();
      return;
    }

    CustomPreferences.setPreferences(Constants.PREF_USER_ID, response.body().getId());
    CustomPreferences.setPreferences(Constants.PREF_ACC_ID, response.body().getAccountId());
    startActivity(new Intent(this, MainActivity.class));
    finish();
  }