コード例 #1
0
  /** {@inheritDoc} */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    long requestId = getIntent().getLongExtra(REQUEST_ID_EXTRA, -1);
    if (requestId == -1) throw new IllegalArgumentException();

    this.authWindow = AuthWindowServiceImpl.getAuthWindow(requestId);

    // Content view
    setContentView(R.layout.auth_window);
    View content = findViewById(android.R.id.content);

    // Server name
    String server = authWindow.getServer();

    // Title
    String title = authWindow.getWindowTitle();
    if (title == null) {
      title = getString(R.string.service_gui_AUTHENTICATION_WINDOW_TITLE, server);
    }
    setTitle(title);

    // Message
    String text = authWindow.getWindowText();
    if (text == null) {
      text = getString(R.string.service_gui_AUTHENTICATION_REQUESTED_SERVER, server);
    }
    ViewUtil.setTextViewValue(content, R.id.text, text);

    // Username filed and label
    if (authWindow.getUsernameLabel() != null)
      ViewUtil.setTextViewValue(content, R.id.username_label, authWindow.getUsernameLabel());

    ViewUtil.ensureEnabled(content, R.id.username, authWindow.isUserNameEditable());

    // Password filed and label
    if (authWindow.getPasswordLabel() != null)
      ViewUtil.setTextViewValue(content, R.id.password_label, authWindow.getPasswordLabel());

    ViewUtil.setCompoundChecked(content, R.id.store_password, authWindow.isRememberPassword());
    ViewUtil.ensureVisible(content, R.id.store_password, authWindow.isAllowSavePassword());
  }
コード例 #2
0
 /**
  * Updates select group spinner status based on add to contact list checkbox state.
  *
  * @param isChecked <tt>true</tt> if "add to contacts" checkbox is checked.
  */
 private void updateAddToContactsStatus(boolean isChecked) {
   ViewUtil.ensureEnabled(getContentView(), R.id.selectGroupSpinner, isChecked);
 }