コード例 #1
0
ファイル: LoginFragment.java プロジェクト: lzdragonix/amb
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   txtUser.setOnEditorActionListener(this);
   txtPwd.setOnEditorActionListener(this);
   presenter.initView();
 }
コード例 #2
0
  /** Sets up the contents of the home screen. */
  private void setScreenContent() {
    setContentView(R.layout.empire_setup);

    View rootView = findViewById(android.R.id.content);
    ActivityBackgroundGenerator.setBackground(rootView);

    final TextView empireName = (TextView) findViewById(R.id.empire_setup_name);
    final Button doneButton = (Button) findViewById(R.id.empire_setup_done);

    empireName.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            saveEmpire();
            return true;
          }
        });

    doneButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            saveEmpire();
          }
        });
  }
コード例 #3
0
ファイル: LoginActivity.java プロジェクト: tootwo2/Order-1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
    // 去除title
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    //            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // 去掉Activity上面的状态栏
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    // WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_login);

    app = (OrderApplication) getApplication();
    btnLoginIn = (Button) findViewById(R.id.btnLoginIn);
    txtUserid = (TextView) findViewById(R.id.useridEdittext);
    txtPassword = (TextView) findViewById(R.id.passwordEdittext);
    btnLoginIn.setOnClickListener(this);
    txtUserid.setOnEditorActionListener(this);
    txtPassword.setOnEditorActionListener(this);
  }
コード例 #4
0
  @Override
  protected void onFinishInflate() {
    mLockPatternUtils = new LockPatternUtils(mContext);

    mPasswordEntry = (TextView) findViewById(getPasswordTextViewId());
    mPasswordEntry.setOnEditorActionListener(this);
    mPasswordEntry.addTextChangedListener(this);

    // Set selected property on so the view can send accessibility events.
    mPasswordEntry.setSelected(true);

    // Poke the wakelock any time the text is selected or modified
    mPasswordEntry.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            mCallback.userActivity(0); // TODO: customize timeout for text?
          }
        });

    mQuickUnlock =
        (Settings.System.getInt(
                mContext.getContentResolver(), Settings.System.LOCKSCREEN_QUICK_UNLOCK_CONTROL, 0)
            == 1);

    mPasswordEntry.addTextChangedListener(
        new TextWatcher() {
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          public void afterTextChanged(Editable s) {
            if (mCallback != null) {
              mCallback.userActivity(0);
            }
            if (mQuickUnlock) {
              String entry = mPasswordEntry.getText().toString();
              if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT
                  && mLockPatternUtils.checkPassword(entry)) {
                mCallback.reportSuccessfulUnlockAttempt();
                mCallback.dismiss(true);
              }
            }
          }
        });
    mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
    mEcaView = findViewById(R.id.keyguard_selector_fade_container);
    View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
    if (bouncerFrameView != null) {
      mBouncerFrame =
          KeyguardSecurityViewHelper.colorizeFrame(mContext, bouncerFrameView.getBackground());
    }
  }
コード例 #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_word);
    /* get a reference to the activities ActionBar, disable the home icon and title and set the title*/
    getSupportActionBar().setDisplayShowHomeEnabled(false);
    getSupportActionBar().setTitle("Add Word");

    application = (ToponimoApplication) this.getApplication();
    Intent sender = getIntent();
    this.currentPlaceIndex = application.getCurrentPlaceIndex();
    upid = new String(application.getPlaceResults(currentPlaceIndex).getId());
    placeName = new String(application.getPlaceResults(currentPlaceIndex).getName());
    // placeNameFromCaller = new
    // String(application.getPlaceResults().get(position).getResults().get(position).getName().toString());

    Log.i("ID", upid);
    Log.i("Name", placeName);

    imm =
        (InputMethodManager)
            AddWordLocalActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
      // imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }

    final TextView addWordText = (TextView) findViewById(R.id.add_word_add_edit_text);
    addWordText.setOnEditorActionListener(
        new OnEditorActionListener() {

          public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
            if (arg1 == EditorInfo.IME_ACTION_GO) {
              return true;
            } else {
              return false;
            }
          }
        });

    final Button addWordButton = (Button) findViewById(R.id.add_word_add_button);
    addWordButton.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View v) {
            addWord(addWordText);
          }
        });
  }
コード例 #6
0
ファイル: JniInterface.java プロジェクト: Nalic/chromium
  /** Prompts the user to enter a PIN. */
  @CalledByNative
  private static void displayAuthenticationPrompt(boolean pairingSupported) {
    AlertDialog.Builder pinPrompt = new AlertDialog.Builder(sContext);
    pinPrompt.setTitle(sContext.getString(R.string.pin_entry_title));
    pinPrompt.setMessage(sContext.getString(R.string.pin_entry_message));
    pinPrompt.setIcon(android.R.drawable.ic_lock_lock);

    final View pinEntry = sContext.getLayoutInflater().inflate(R.layout.pin_dialog, null);
    pinPrompt.setView(pinEntry);

    final TextView pinTextView = (TextView) pinEntry.findViewById(R.id.pin_dialog_text);
    final CheckBox pinCheckBox = (CheckBox) pinEntry.findViewById(R.id.pin_dialog_check);

    if (!pairingSupported) {
      pinCheckBox.setChecked(false);
      pinCheckBox.setVisibility(View.GONE);
    }

    pinPrompt.setPositiveButton(
        R.string.pin_entry_connect,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            Log.i("jniiface", "User provided a PIN code");
            nativeAuthenticationResponse(
                String.valueOf(pinTextView.getText()), pinCheckBox.isChecked());
          }
        });

    pinPrompt.setNegativeButton(
        R.string.pin_entry_cancel,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            Log.i("jniiface", "User canceled pin entry prompt");
            Toast.makeText(
                    sContext, sContext.getString(R.string.msg_pin_canceled), Toast.LENGTH_LONG)
                .show();
            disconnectFromHost();
          }
        });

    final AlertDialog pinDialog = pinPrompt.create();

    pinTextView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // The user pressed enter on the keypad (equivalent to the connect button).
            pinDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
            pinDialog.dismiss();
            return true;
          }
        });

    pinDialog.setOnCancelListener(
        new DialogInterface.OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            // The user backed out of the dialog (equivalent to the cancel button).
            pinDialog.getButton(AlertDialog.BUTTON_NEGATIVE).performClick();
          }
        });

    pinDialog.show();
  }