private void InitState() {
    // title
    String sSubTitle = utils.GetResStr(R.string.titleDefaultAppointment);

    // date values
    dateStart = Calendar.getInstance();
    dateEndOn = Calendar.getInstance();

    dataRow.SetDuration(prefs.iMinutesDuration);

    // INSERT MODE
    if (GetStartMode() == StartMode.NEW) {
      sSubTitle = utils.GetResStr(R.string.titleNewAppointment);
      btnDelete.setVisibility(View.INVISIBLE);

      // initialize data
      SetStartDateByAgendaView(dateStart);
      updateStartDateTimeForNewAppointment(dateStart);
      SetStartTimeForDayAgendaView(dateStart);

      chkAllDay.setChecked(false);
      chkAlarm.setChecked(true);

      // repeat data
      iRepeatType = 0; // none
      iRepeatEvery = 1;
      dateEndOn.setTimeInMillis(0); // no end date
    }

    // EDIT MODE
    if (GetStartMode() == StartMode.EDIT) {
      sSubTitle = utils.GetResStr(R.string.titleEditAppointment);

      dateStart.setTimeInMillis(dataRow.GetStartDate().getTimeInMillis());

      btnDelete.setVisibility(View.VISIBLE);
      edSubject.setText(dataRow.GetSubject());
      chkAllDay.setChecked(dataRow.GetAllDay());
      chkAlarm.setChecked(dataRow.GetAlarm());

      // repeat data
      iRepeatType = dataRow.GetRepeat().GetRepeatTypeAsInt();
      iRepeatEvery = dataRow.GetRepeat().GetEvery();
      dateEndOn.setTimeInMillis(dataRow.GetRepeat().GetEndOnDate().getTimeInMillis());
    }

    restoreStateFromFreezeIfRequired();

    SetActivityTitle(sSubTitle);
    UpdateStartDateTimeView();

    UpdateRepeatInfo();

    // set focus to subject
    edSubject.requestFocus();
    if (GetStartMode() == StartMode.EDIT) edSubject.setSelection(edSubject.length());
  }
 @Override
 protected void restoreStateFromFreeze() {
   edSubject.setText(freeze.getString("subject"));
   chkAlarm.setChecked(freeze.getBoolean("alarm"));
   dateStart.setTimeInMillis(freeze.getLong("dateStart"));
   chkAllDay.setChecked(freeze.getBoolean("allday"));
   iRepeatType = freeze.getInt("repeatType");
   iRepeatEvery = freeze.getInt("repeatEvery");
   dateEndOn.setTimeInMillis(freeze.getLong("dateEndOn"));
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Bundle extras = CommonActivity.getIntentExtras(data);
    if (extras != null) {

      // check for repeat update
      if (ActivityAppointmentRepeat.GetActivityResult(requestCode, resultCode, extras)) {
        iRepeatType = ActivityAppointmentRepeat.getExtraRepeatType(extras);
        iRepeatEvery = ActivityAppointmentRepeat.getExtraRepeatEvery(extras);
        dateEndOn.setTimeInMillis(ActivityAppointmentRepeat.getExtraRepeatEndOnDate(extras));
        UpdateRepeatInfo();
        return;
      }

      // check for date widget edit request code
      if (requestCode == DateWidget.SELECT_DATE_REQUEST) {
        final long lDate =
            DateWidget.GetSelectedDateOnActivityResult(requestCode, resultCode, extras, dateStart);
        if (lDate != -1) {
          UpdateStartDateTimeView();
          return;
        }
      }

      // check for time widget edit request code
      if ((requestCode == TimeWidget.SELECT_TIME_REQUEST) && (resultCode == RESULT_OK)) {
        final int iHour =
            TimeWidget.GetSelectedTimeHourOnActivityResult(requestCode, resultCode, extras);
        final int iMinute =
            TimeWidget.GetSelectedTimeMinuteOnActivityResult(requestCode, resultCode, extras);
        dateStart.set(Calendar.HOUR_OF_DAY, iHour);
        dateStart.set(Calendar.MINUTE, iMinute);
        chkAllDay.setChecked(false);
        UpdateStartDateTimeView();
        return;
      }

      // get KeyboardWidget result
      if ((requestCode == KeyboardWidget.EDIT_TEXT_REQUEST) && (resultCode == RESULT_OK)) {
        String sText = KeyboardWidget.GetTextOnActivityResult(requestCode, resultCode, extras);
        edSubject.setText(sText);
        return;
      }
    }
  }
Example #4
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.settings);
   this.setTitle(R.string.setting);
   sp = PreferenceManager.getDefaultSharedPreferences(this);
   edit = sp.edit();
   Button widgettheme = (Button) findViewById(R.id.widgettheme);
   Button settime = (Button) findViewById(R.id.settime);
   Button save = (Button) findViewById(R.id.set_save);
   nc = (CheckBox) findViewById(R.id.nightcheck);
   rs = (CheckBox) findViewById(R.id.ringswitch);
   widgettheme.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           AlertDialog.Builder ad =
               new AlertDialog.Builder(Settings.this)
                   .setTitle("选择颜色?")
                   .setItems(
                       color,
                       new DialogInterface.OnClickListener() {
                         @Override
                         public void onClick(DialogInterface p1, int p2) {
                           edit.putInt("widgetTextColor", colori[p2]);
                           edit.commit();
                         }
                       });
           ad.show();
         }
       });
   settime.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           Intent set = new Intent(Settings.this, Settime.class);
           startActivity(set);
           return;
         }
       });
   save.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View Button) {
           save();
           return;
         }
       });
   nc.setChecked(sp.getBoolean("nightmode", false));
   if (sp.getBoolean("timewrong", false) == true) {
     rs.setChecked(false);
     rs.setClickable(false);
   }
 }
 @Override
 void updateCheckboxState(CheckBox checkBox, boolean graphObjectSelected) {
   checkBox.setChecked(graphObjectSelected);
   int visible =
       (graphObjectSelected || selectionStrategy.shouldShowCheckBoxIfUnselected())
           ? View.VISIBLE
           : View.GONE;
   checkBox.setVisibility(visible);
 }
    @Override
    public View getView(int position, View convertView, final ViewGroup parent) {
      final Item item = getItem(position);

      final View view;
      if (convertView != null && item.getClass().equals(convertView.getTag())) {
        view = convertView;
      } else {
        view =
            getLayoutInflater()
                .inflate(
                    item instanceof SectionItem
                        ? R.layout.catalog_manager_section_head
                        : R.layout.catalog_manager_item,
                    null);
        view.setTag(item.getClass());
      }

      if (item instanceof SectionItem) {
        ((TextView) view.findViewById(R.id.catalog_manager_section_head_title))
            .setText(((SectionItem) item).Title);
      } else /* if (item instanceof CatalogItem) */ {
        final CatalogItem catalogItem = (CatalogItem) item;

        if (myCoverManager == null) {
          view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          final int coverHeight = view.getMeasuredHeight();
          myCoverManager =
              new CoverManager(CatalogManagerActivity.this, coverHeight * 15 / 22, coverHeight);
          view.requestLayout();
        }

        final INetworkLink link = catalogItem.Tree.getLink();
        ((TextView) view.findViewById(R.id.catalog_manager_item_title)).setText(link.getTitle());
        ((TextView) view.findViewById(R.id.catalog_manager_item_subtitle))
            .setText(link.getSummary());

        final ImageView coverView = (ImageView) view.findViewById(R.id.catalog_manager_item_icon);
        if (!myCoverManager.trySetCoverImage(coverView, catalogItem.Tree)) {
          coverView.setImageResource(R.drawable.ic_list_library_books);
        }

        final CheckBox checkBox = (CheckBox) view.findViewById(R.id.catalog_manager_item_checkbox);
        checkBox.setChecked(catalogItem.IsChecked);
        checkBox.setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                catalogItem.IsChecked = checkBox.isChecked();
                setResultIds(catalogItem, 0);
              }
            });
      }
      return view;
    }
Example #7
0
 private TableRow buildAmenityTableRow(Context ctx, Amenity amenity) {
   TextView textView = new TextView(ctx);
   String amName = amenity.name();
   int id = getResources().getIdentifier(ctx.getPackageName() + ":string/" + amName, null, null);
   String value = ctx.getString(id);
   textView.setText(value);
   textView.setGravity(Gravity.RIGHT);
   CheckBox checkBox = new CheckBox(ctx);
   checkBox.setChecked(false);
   checkBox.setOnCheckedChangeListener(new AmenityOnCheckChangeListener(this.amenities, amenity));
   TableRow tableRow = new TableRow(ctx);
   TableRow.LayoutParams layoutParams = new TableRow.LayoutParams();
   layoutParams.setMargins(0, 0, 10, 0);
   tableRow.addView(textView, layoutParams);
   tableRow.addView(checkBox);
   return tableRow;
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final boolean customTitle = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    final Intent i = new Intent(this, BuganizerCreateParseUserActivity.class);

    setContentView(R.layout.bug_edit);

    if (customTitle) {
      getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_layout);
    }

    TextView tt = (TextView) findViewById(R.id.logout);
    tt.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Log.d("BuganizerParseEdit", "logout clicked ");
            ParseUser.logOut();
            startActivity(i);
          }
        });

    arrayPeople = new ArrayList<String>();

    mLinLayout = (LinearLayout) findViewById(R.id.EditVertLayout);

    Button bsave = (Button) findViewById(R.id.BugSave);
    Button bAddComment = (Button) findViewById(R.id.AddComment);
    Button bAddFriend = (Button) findViewById(R.id.AddUser);

    Log.d("BuganizerParseEdit", "hare krsna showing bug details ");

    Bundle extras = getIntent().getExtras();

    if (extras != null) {

      objectid = extras.getString(BuganizerParseConstants.objectid);
      Log.d("BuganizerParseEdit", "object id is  " + objectid);

      ParseQuery query = new ParseQuery("BugObject");
      try {
        pObject = query.get(objectid);
      } catch (ParseException e1) {
        e1.printStackTrace();
      }

      mAssTo = (TextView) findViewById(R.id.EditBugAssignedTo);
      mDetails = (TextView) findViewById(R.id.EditBugDetails);
      mTitle = (TextView) findViewById(R.id.EditBugTitle);
      mCreatedTS = (TextView) findViewById(R.id.EditBugCreatedTS);
      mPriority = (TextView) findViewById(R.id.EditBugPriority);
      mLayout = (LinearLayout) findViewById(R.id.EditVertLayout);

      String title = pObject.getString(BuganizerParseConstants.title);
      String body = pObject.getString(BuganizerParseConstants.body);
      String assto = pObject.getString(BuganizerParseConstants.assignedto);
      Date ts2 = pObject.getCreatedAt();
      int pri = pObject.getInt(BuganizerParseConstants.priority);

      acl = pObject.getACL();

      SimpleDateFormat dateFormatISO8601 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

      String ts = dateFormatISO8601.format(ts2);

      if (title != null) {
        mTitle.setText(title);
      }
      if (body != null) {
        mDetails.setText(body);
      }
      if (assto != null) {
        mAssTo.setText(assto);
      }
      if (ts != null) {
        mCreatedTS.setText(ts);
      }
      if (pri != 0) {
        mPriority.setText(Integer.toString(pri));
      } else {
        mPriority.setText("undefined");
      }

      if (acl != null) {
        Log.d("BuganizerParseEdit", "The bug has an ACL!");
        if (acl.getWriteAccess(ParseUser.getCurrentUser()) == true) {
          CheckBox chk = new CheckBox(this);
          chk.setChecked(true);
          chk.setText("Mark as private");
          mLayout.addView(chk, 5);
        }
      }
    }

    GetCommentsForBug();

    // fetch the comments first in the background
    ParseQuery query = new ParseQuery("CommentObject");
    query.whereEqualTo("bug", pObject);
    query.findInBackground(
        new FindCallback() {

          @Override
          public void done(List<ParseObject> objects, ParseException arg1) {

            // TODO Auto-generated method stub
            for (ParseObject ob : objects) {
              Log.d(
                  "BuganizerParseEdit",
                  "comments are : "
                      + ob.getString(BuganizerParseConstants.comments)
                      + " created at TS: "
                      + ob.getCreatedAt());
              AddCommentView(ob.getString(BuganizerParseConstants.comments), "", "", false);
            }
          }
        });

    bAddComment.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {

            Log.d("BuganizerParseEdit", "Adding a new comment... ");
            final EditText bdetails = (EditText) findViewById(R.id.BugCommentAdd);
            String cmnt = bdetails.getText().toString();

            arrayPeople.add(cmnt);
            bdetails.setText("");
            AddCommentView(cmnt, "", "", false);
          }
        });

    bAddFriend.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {

            Log.d("BuganizerParseEdit", "Adding a user to bug... ");
            Intent i2 = new Intent(BuganizerParseEdit.this, BuganizerListFriendsActivity.class);
            BuganizerParseEdit.this.startActivityForResult(i2, ACTIVITY_FRIEND_LIST_SHOW);
          }
        });

    bsave.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {

            Intent mIntent = new Intent();
            Bundle bundle = new Bundle();

            for (String s : arrayPeople) Log.d("BuganizerParseEdit", "Comment: " + s);

            bundle.putString(BuganizerParseConstants.objectid, objectid);
            bundle.putStringArrayList(BuganizerParseConstants.comments, arrayPeople);

            mIntent.putExtras(bundle);
            setResult(RESULT_OK, mIntent);
            finish();
          }
        });
  }
  private Grid addWalrusEntry(int row, WalrusInfoWeb walrusInfo) {
    final ArrayList<String> properties = walrusInfo.getProperties();
    int numProperties = properties.size() / 4;
    Grid g = new Grid(1 + numProperties, 2);
    g.setStyleName("euca-table");
    g.setCellPadding(4);

    int i = 0; // row 1
    g.setWidget(i, 0, new Label("Walrus host:"));
    g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel p = new HorizontalPanel();
    p.setSpacing(0);
    g.setWidget(i, 1, p);
    final TextBox walrusHost_box = new TextBox();
    walrusHost_box.addChangeListener(new ChangeCallback(this, row));
    walrusHost_box.setVisibleLength(35);
    walrusHost_box.setText(walrusInfo.getHost());
    p.add(walrusHost_box);
    p.add(new EucaButton("Deregister", new DeleteCallback(this, row)));

    for (int propIdx = 0; propIdx < numProperties; ++propIdx) {
      i++; // next row
      if ("KEYVALUE".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new TextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("KEYVALUEHIDDEN".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new PasswordTextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("BOOLEAN".equals(properties.get(4 * propIdx))) {
        final int index = propIdx;
        final CheckBox propCheckbox = new CheckBox();
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        g.setWidget(i, 0, propCheckbox);
        if (Boolean.parseBoolean(properties.get(4 * index + 2))) {
          propCheckbox.setChecked(true);
        } else {
          propCheckbox.setChecked(false);
        }
        propCheckbox.addClickListener(
            new ClickListener() {
              public void onClick(Widget sender) {
                if (((CheckBox) sender).isChecked()) {
                  properties.set(4 * index + 2, String.valueOf(true));
                } else {
                  properties.set(4 * index + 2, String.valueOf(false));
                }
              }
            });
        g.setWidget(i, 1, new Label(properties.get(propIdx * 4 + 1)));
      }
    }
    return g;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.account_setup_incoming);

    mUsernameView = (EditText) findViewById(R.id.account_username);
    mPasswordView = (EditText) findViewById(R.id.account_password);
    mClientCertificateSpinner =
        (ClientCertificateSpinner) findViewById(R.id.account_client_certificate_spinner);
    mClientCertificateLabelView = (TextView) findViewById(R.id.account_client_certificate_label);
    mPasswordLabelView = (TextView) findViewById(R.id.account_password_label);
    TextView serverLabelView = (TextView) findViewById(R.id.account_server_label);
    mServerView = (EditText) findViewById(R.id.account_server);
    mPortView = (EditText) findViewById(R.id.account_port);
    mSecurityTypeView = (Spinner) findViewById(R.id.account_security_type);
    mAuthTypeView = (Spinner) findViewById(R.id.account_auth_type);
    mImapAutoDetectNamespaceView = (CheckBox) findViewById(R.id.imap_autodetect_namespace);
    mImapPathPrefixView = (EditText) findViewById(R.id.imap_path_prefix);
    mWebdavPathPrefixView = (EditText) findViewById(R.id.webdav_path_prefix);
    mWebdavAuthPathView = (EditText) findViewById(R.id.webdav_auth_path);
    mWebdavMailboxPathView = (EditText) findViewById(R.id.webdav_mailbox_path);
    mNextButton = (Button) findViewById(R.id.next);
    mCompressionMobile = (CheckBox) findViewById(R.id.compression_mobile);
    mCompressionWifi = (CheckBox) findViewById(R.id.compression_wifi);
    mCompressionOther = (CheckBox) findViewById(R.id.compression_other);
    // mSubscribedFoldersOnly = (CheckBox)findViewById(R.id.subscribed_folders_only);
    mRequiresCellular = (CheckBox) findViewById(R.id.account_requires_cellular);
    mAccountName = (EditText) findViewById(R.id.account_name);

    mNextButton.setOnClickListener(this);

    mImapAutoDetectNamespaceView.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mImapPathPrefixView.setEnabled(!isChecked);
            if (isChecked && mImapPathPrefixView.hasFocus()) {
              mImapPathPrefixView.focusSearch(View.FOCUS_UP).requestFocus();
            } else if (!isChecked) {
              mImapPathPrefixView.requestFocus();
            }
          }
        });

    mAuthTypeAdapter = AuthTypeAdapter.get(this);
    mAuthTypeView.setAdapter(mAuthTypeAdapter);

    /*
     * Only allow digits in the port field.
     */
    mPortView.setKeyListener(DigitsKeyListener.getInstance("0123456789"));

    String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
    mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
    // mMakeDefault = getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false);

    /*
     * If we're being reloaded we override the original account with the one
     * we saved
     */
    if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
      accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
      mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
    }

    boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction());

    try {
      ServerSettings settings = RemoteStore.decodeStoreUri(mAccount.getStoreUri());

      if (savedInstanceState == null) {
        // The first item is selected if settings.authenticationType is null or is not in
        // mAuthTypeAdapter
        mCurrentAuthTypeViewPosition =
            mAuthTypeAdapter.getAuthPosition(settings.authenticationType);
      } else {
        mCurrentAuthTypeViewPosition = savedInstanceState.getInt(STATE_AUTH_TYPE_POSITION);
      }
      mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
      updateViewFromAuthType();

      if (settings.username != null) {
        mUsernameView.setText(settings.username);
      }

      if (settings.password != null) {
        mPasswordView.setText(settings.password);
      }

      if (settings.clientCertificateAlias != null) {
        mClientCertificateSpinner.setAlias(settings.clientCertificateAlias);
      }

      mStoreType = settings.type;
      if (Type.POP3 == settings.type) {
        serverLabelView.setText(R.string.account_setup_incoming_pop_server_label);
        findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
        findViewById(R.id.webdav_advanced_header).setVisibility(View.GONE);
        findViewById(R.id.webdav_mailbox_alias_section).setVisibility(View.GONE);
        findViewById(R.id.webdav_owa_path_section).setVisibility(View.GONE);
        findViewById(R.id.webdav_auth_path_section).setVisibility(View.GONE);
        findViewById(R.id.compression_section).setVisibility(View.GONE);
        findViewById(R.id.compression_label).setVisibility(View.GONE);
        // mSubscribedFoldersOnly.setVisibility(View.GONE);
      } else if (Type.IMAP == settings.type) {
        serverLabelView.setText(R.string.account_setup_incoming_imap_server_label);

        ImapStoreSettings imapSettings = (ImapStoreSettings) settings;

        mImapAutoDetectNamespaceView.setChecked(imapSettings.autoDetectNamespace);
        if (imapSettings.pathPrefix != null) {
          mImapPathPrefixView.setText(imapSettings.pathPrefix);
        }

        findViewById(R.id.webdav_advanced_header).setVisibility(View.GONE);
        findViewById(R.id.webdav_mailbox_alias_section).setVisibility(View.GONE);
        findViewById(R.id.webdav_owa_path_section).setVisibility(View.GONE);
        findViewById(R.id.webdav_auth_path_section).setVisibility(View.GONE);

        /*if (!editSettings) {
            findViewById(R.id.imap_folder_setup_section).setVisibility(View.GONE);
        }*/
      } else if (Type.WebDAV == settings.type) {
        serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label);
        mConnectionSecurityChoices =
            new ConnectionSecurity[] {ConnectionSecurity.NONE, ConnectionSecurity.SSL_TLS_REQUIRED};

        // Hide the unnecessary fields
        findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
        findViewById(R.id.account_auth_type_label).setVisibility(View.GONE);
        findViewById(R.id.account_auth_type).setVisibility(View.GONE);
        findViewById(R.id.compression_section).setVisibility(View.GONE);
        findViewById(R.id.compression_label).setVisibility(View.GONE);
        // mSubscribedFoldersOnly.setVisibility(View.GONE);

        WebDavStoreSettings webDavSettings = (WebDavStoreSettings) settings;

        if (webDavSettings.path != null) {
          mWebdavPathPrefixView.setText(webDavSettings.path);
        }

        if (webDavSettings.authPath != null) {
          mWebdavAuthPathView.setText(webDavSettings.authPath);
        }

        if (webDavSettings.mailboxPath != null) {
          mWebdavMailboxPathView.setText(webDavSettings.mailboxPath);
        }
      } else {
        throw new Exception("Unknown account type: " + mAccount.getStoreUri());
      }

      if (!editSettings) {
        mAccount.setDeletePolicy(AccountCreator.getDefaultDeletePolicy(settings.type));
      }

      // Note that mConnectionSecurityChoices is configured above based on server type
      ConnectionSecurityAdapter securityTypesAdapter =
          ConnectionSecurityAdapter.get(this, mConnectionSecurityChoices);
      mSecurityTypeView.setAdapter(securityTypesAdapter);

      // Select currently configured security type
      if (savedInstanceState == null) {
        mCurrentSecurityTypeViewPosition =
            securityTypesAdapter.getConnectionSecurityPosition(settings.connectionSecurity);
      } else {

        /*
         * Restore the spinner state now, before calling
         * setOnItemSelectedListener(), thus avoiding a call to
         * onItemSelected(). Then, when the system restores the state
         * (again) in onRestoreInstanceState(), The system will see that
         * the new state is the same as the current state (set here), so
         * once again onItemSelected() will not be called.
         */
        mCurrentSecurityTypeViewPosition = savedInstanceState.getInt(STATE_SECURITY_TYPE_POSITION);
      }
      mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);

      updateAuthPlainTextFromSecurityType(settings.connectionSecurity);

      mCompressionMobile.setChecked(mAccount.useCompression(NetworkType.MOBILE));
      mCompressionWifi.setChecked(mAccount.useCompression(NetworkType.WIFI));
      mCompressionOther.setChecked(mAccount.useCompression(NetworkType.OTHER));

      if (settings.host != null) {
        mServerView.setText(settings.host);
      }

      if (settings.port != -1) {
        mPortView.setText(Integer.toString(settings.port));
      } else {
        updatePortFromSecurityType();
      }
      mCurrentPortViewSetting = mPortView.getText().toString();

      // mSubscribedFoldersOnly.setChecked(mAccount.subscribedFoldersOnly());
    } catch (Exception e) {
      failure(e);
    }
    // show & populate setup fields
    if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) {
      findViewById(R.id.account_name_label).setVisibility(View.VISIBLE);
      mAccountName.setVisibility(View.VISIBLE);
      String desc = mAccount.getDescription();
      mAccountName.setText((desc != null ? desc : ""));
      findViewById(R.id.account_requires_cellular_label).setVisibility(View.VISIBLE);
      mRequiresCellular.setVisibility(View.VISIBLE);
      mRequiresCellular.setChecked(true);
    }
  }
 private void setIsDone() {
   CheckBox isDone = getIsDoneComponent();
   isDone.setChecked(task.getBoolean(TaskAdapter.IS_DONE, false));
 }
Example #12
0
 public void setCheckBoxChecked(boolean isChecked) {
   mCheckBox.setChecked(isChecked);
 }
  public void showOrder(Order order) {
    currentOrder = order;
    valueList = currentOrder.getOrderValues();
    editFields = new ArrayList<EditText>();

    if (mainLayout != null) {

      Button saveButton = (Button) getActivity().findViewById(R.id.saveButton);
      saveButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              saveOrder(currentOrder);
              fragmentListener.saveOrderButtonClicked();
            }
          });

      CheckBox execStateCheckBox = (CheckBox) getActivity().findViewById(R.id.execStateCheckBox);
      execStateCheckBox.setChecked(currentOrder.getExecState());
      execStateCheckBox.setOnCheckedChangeListener(
          new CheckBox.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              currentOrder.setExecState(isChecked);
              valueList.put("execState", isChecked);
            }
          });

      EditText clientNameEdit = (EditText) mainLayout.findViewById(R.id.clientNameEdit);
      clientNameEdit.setOnKeyListener(onTextChanged);
      clientNameEdit.setOnFocusChangeListener(onFocusLost);
      clientNameEdit.setText(currentOrder.getClientName());
      clientNameEdit.setTag("clientName");
      editFields.add(clientNameEdit);

      EditText clientPhoneEdit = (EditText) mainLayout.findViewById(R.id.clientPhoneEdit);
      clientPhoneEdit.setOnKeyListener(onTextChanged);
      clientPhoneEdit.setOnFocusChangeListener(onFocusLost);
      clientPhoneEdit.setText(currentOrder.getClientPhone());
      clientPhoneEdit.setTag("clientPhone");
      editFields.add(clientPhoneEdit);

      EditText carMakerEdit = (EditText) mainLayout.findViewById(R.id.carMakerEdit);
      carMakerEdit.setOnKeyListener(onTextChanged);
      carMakerEdit.setOnFocusChangeListener(onFocusLost);
      carMakerEdit.setText(currentOrder.getCarMaker());
      carMakerEdit.setTag("carMaker");
      editFields.add(carMakerEdit);

      EditText colorCodeEdit = (EditText) mainLayout.findViewById(R.id.colorCodeEdit);
      colorCodeEdit.setOnKeyListener(onTextChanged);
      colorCodeEdit.setOnFocusChangeListener(onFocusLost);
      colorCodeEdit.setText(currentOrder.getColorCode());
      colorCodeEdit.setTag("colorCode");
      editFields.add(colorCodeEdit);

      EditText volumeBaseEdit = (EditText) mainLayout.findViewById(R.id.volumeBaseEdit);
      volumeBaseEdit.setOnKeyListener(onTextChanged);
      volumeBaseEdit.setOnFocusChangeListener(onFocusLost);
      volumeBaseEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeBaseEdit.setText(currentOrder.getVolumeBase().toString());
      volumeBaseEdit.setTag("volumeBase");
      editFields.add(volumeBaseEdit);

      EditText volumeAdditionEdit = (EditText) mainLayout.findViewById(R.id.volumeAdditionEdit);
      volumeAdditionEdit.setOnKeyListener(onTextChanged);
      volumeAdditionEdit.setOnFocusChangeListener(onFocusLost);
      volumeAdditionEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeAdditionEdit.setText(currentOrder.getVolumeAddition().toString());
      volumeAdditionEdit.setTag("volumeAddition");
      editFields.add(volumeAdditionEdit);

      EditText orderDateEdit = (EditText) mainLayout.findViewById(R.id.orderDateEdit);
      orderDateEdit.setOnKeyListener(onTextChanged);
      orderDateEdit.setOnFocusChangeListener(onFocusLost);
      orderDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      orderDateEdit.setText(currentOrder.getOrderDate().toString());
      orderDateEdit.setTag("orderDate");
      editFields.add(orderDateEdit);

      EditText execDateEdit = (EditText) mainLayout.findViewById(R.id.execDateEdit);
      execDateEdit.setOnKeyListener(onTextChanged);
      execDateEdit.setOnFocusChangeListener(onFocusLost);
      execDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      execDateEdit.setText(currentOrder.getExecDate().toString());
      execDateEdit.setTag("execDate");
      editFields.add(execDateEdit);

      NumberKeyListener realKeyListener =
          new NumberKeyListener() {
            @Override
            protected char[] getAcceptedChars() {
              return new char[] {'.', ',', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
            }

            @Override
            public int getInputType() {
              return TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL;
            }
          };
      volumeBaseEdit.setKeyListener(realKeyListener);
      volumeAdditionEdit.setKeyListener(realKeyListener);
    }
  }