Beispiel #1
1
  private void initViews() {
    body = (RelativeLayout) findViewById(R.id.body);
    loadingoverlay = (LoadingOverlay) findViewById(R.id.loadingoverlay);

    registerTV = (TextView) findViewById(R.id.registerTV);
    findpwdTV = (TextView) findViewById(R.id.findpwdTV);

    userNameET = (ExEditText) findViewById(R.id.userNameET);
    passwordET = (ExEditText) findViewById(R.id.passwordET);
    loginButton = (Button) findViewById(R.id.loginButton);

    EditText pwdinneret = passwordET.getEditText();
    int pl = pwdinneret.getPaddingLeft();
    pwdinneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    pwdinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    pwdinneret.setPadding(pl, 0, 0, 0); // 如果同时用,setPadding 将不会起作用,用的是
    // drawable里面自带的padding。setPadding要在setBackgroundDrawable之后执行才能生效
    pwdinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});

    EditText usernameinneret = userNameET.getEditText();
    pl = usernameinneret.getPaddingLeft();
    usernameinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    usernameinneret.setPadding(pl, 0, 0, 0);
    usernameinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
  }
Beispiel #2
0
  public void onCreate(Bundle savedInstanceState) {
    try {

      setTheme(General.CurTheme);
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_me);

      call_me = (EditText) findViewById(R.id.call_me);
      my_strength = (EditText) findViewById(R.id.my_strength);
      my_weakness = (EditText) findViewById(R.id.my_weakness);
      words = (EditText) findViewById(R.id.words);
      change = (EditText) findViewById(R.id.change);

      update = (Button) findViewById(R.id.updateme);
      record = (Button) findViewById(R.id.record);
      stopRecord = (Button) findViewById(R.id.stopRecording);
      play = (Button) findViewById(R.id.play);
      stopPlay = (Button) findViewById(R.id.stopPlaying);

      update.setOnClickListener(this);
      record.setOnClickListener(this);
      stopRecord.setOnClickListener(this);
      stopPlay.setOnClickListener(this);
      play.setOnClickListener(this);

      Typeface attribute = Typeface.createFromAsset(getAssets(), "editfont.ttf");
      call_me.setTypeface(attribute);
      my_strength.setTypeface(attribute);
      my_weakness.setTypeface(attribute);
      words.setTypeface(attribute);
      change.setTypeface(attribute);

      InputFilter filter =
          new InputFilter() {
            @Override
            public CharSequence filter(
                CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
              for (int i = start; i < end; i++) {
                if (!Character.isLetterOrDigit(source.charAt(i))
                    && !Character.isSpaceChar(source.charAt(i))) {
                  return " ,";
                }
              }
              return null;
            }
          };

      call_me.setFilters(new InputFilter[] {filter});
      my_strength.setFilters(new InputFilter[] {filter});
      my_weakness.setFilters(new InputFilter[] {filter});
      words.setFilters(new InputFilter[] {filter});
      change.setFilters(new InputFilter[] {filter});
    } catch (Exception ex) {
      Log.i("MeAct Error", ex.toString());
    }
  }
Beispiel #3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    final Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf");
    switch (item.getItemId()) {
      case R.id.btnEdit:
        if (deviceMac.length() > 0) {
          AlertDialog.Builder builder = new AlertDialog.Builder(context);
          builder.setTitle(R.string.editar);

          final EditText input = new EditText(context);

          input.setInputType(InputType.TYPE_CLASS_TEXT);
          input.setTypeface(typeface);
          if (activeWindow != 0) {
            input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(8)});
            input.setHint(R.string.cambiarGrupo);
          } else {
            input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(15)});
            input.setHint(R.string.cambiarGeneral);
          }
          builder.setView(input);

          builder.setPositiveButton(
              "Aceptar",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  String newName = input.getText().toString();
                  if (newName.length() > 0 && !newName.equals("AW Lumina"))
                    updateDataBaseName(newName);
                  else dialog.cancel();
                }
              });
          builder.setNegativeButton(
              "Cancelar",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  dialog.cancel();
                }
              });
          builder.show();
        }
        return true;
      case R.id.action_settings:
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
  private void initUI() {
    mForm = (FrameLayout) findViewById(R.id.tweet_pub_form);
    msgView = (TextView) findViewById(R.id.msg_view);
    mMessage = (LinearLayout) findViewById(R.id.tweet_pub_message);
    mContent = (EditText) findViewById(R.id.tweet_pub_content);
    mClearwords = (LinearLayout) findViewById(R.id.tweet_pub_clearwords);
    mNumberwords = (TextView) findViewById(R.id.tweet_pub_numberwords);

    mClearwords.setOnClickListener(clearwordsClickListener);

    // 编辑器添加文本监听
    mContent.addTextChangedListener(
        new TextWatcher() {
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            // 显示剩余可输入的字数
            mNumberwords.setText((s.length()) + "");
          }

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

          public void afterTextChanged(Editable s) {}
        });
    // 编辑器点击事件
    mContent.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // 显示软键盘
            showIMM();
          }
        });
    // 设置最大输入字数
    InputFilter[] filters = new InputFilter[1];
    filters[0] = new InputFilter.LengthFilter(MAX_TEXT_LENGTH);
    mContent.setFilters(filters);
  }
Beispiel #5
0
  private void requestTransmitterId(final SharedPreferences prefs) {
    final Dialog dialog = new Dialog(BluetoothScan.this);
    dialog.setContentView(R.layout.dialog_single_text_field);
    Button saveButton = (Button) dialog.findViewById(R.id.saveButton);
    Button cancelButton = (Button) dialog.findViewById(R.id.cancelButton);
    dialog.findViewById(R.id.scannerButton).setVisibility(View.GONE);
    final EditText serialNumberView = (EditText) dialog.findViewById(R.id.editTextField);
    serialNumberView.setHint("00000");
    serialNumberView.setFilters(new InputFilter[] {new InputFilter.AllCaps()});
    ((TextView) dialog.findViewById(R.id.instructionsTextField))
        .setText("Enter Your Dexcom Transmitter ID");

    saveButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!TextUtils.isEmpty(serialNumberView.getText())) {
              prefs.edit().putString("dex_txid", serialNumberView.getText().toString()).apply();
            }
            dialog.dismiss();
            returnToHome();
          }
        });
    cancelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
    dialog.show();
  }
Beispiel #6
0
 public void setEditText(Activity activity, ViewGroup rootLayout, EditText editText) {
   mActivity = activity;
   mEditText = editText;
   mEditText.setFilters(new InputFilter[] {getEmoticonInputFilter()});
   rootLayout.setLayoutTransition(mLayoutTransition);
   setupAnimations(mLayoutTransition);
 }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText editText = new EditText(getActivity());
    int maxLength = 128;
    editText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)});
    editText.setHint("user Id");
    builder
        .setTitle("Change User ID")
        .setView(editText)
        .setPositiveButton(
            R.string.ok,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                if (listenerRef != null) {
                  OnUserIdChangedListener listener = listenerRef.get();
                  if (listener != null && editText.getText() != null) {
                    listener.onUserIdChanged(editText.getText().toString());
                  }
                }
                dialog.dismiss();
              }
            })
        .setNegativeButton(
            R.string.cancel,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
              }
            });

    return builder.create();
  }
 @Override
 public void onStart() {
   super
       .onStart(); // super.onStart() is where dialog.show() is actually called on the underlying
                   // dialog, so we have to do it after this point
   final AlertDialog d = (AlertDialog) getDialog();
   if (d != null) {
     TextView spotET = (TextView) getDialog().findViewById(R.id.spot_to_add);
     spotET.setText("Plaça " + mSpot);
     EditText inputCar = (EditText) getDialog().findViewById(R.id.licensePlateEditText);
     inputCar.setFilters(new InputFilter[] {new InputFilter.AllCaps()});
     Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
     positiveButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             // Send the positive button event back to the host activity
             EditText inputCar = (EditText) getDialog().findViewById(R.id.licensePlateEditText);
             String licensePlate = inputCar.getText().toString();
             Log.d("Dialog", "Input: " + licensePlate);
             if (!licensePlate.equals("")) {
               mListener.onDialogPositiveClick(AddCarDialogFragment.this, mSpot, licensePlate);
               d.dismiss();
             } else {
               Toast.makeText(
                       getActivity().getApplicationContext(),
                       "Escriu la matrícula del vehicle",
                       Toast.LENGTH_SHORT)
                   .show();
             }
           }
         });
   }
 }
  public void showServerAddressDialog(View v) {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Connect To Kabouter Server");
    alert.setMessage("Enter Server Address");

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_PHONE);
    InputFilter[] filters = new InputFilter[1];
    filters[0] = new IPAddressInputFilter();
    input.setFilters(filters);

    alert.setView(input);

    alert.setPositiveButton(
        "Ok",
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int whichButton) {
            String value = input.getText().toString();
          }
        });

    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });

    alert.show();
  }
  @SuppressWarnings({"UnusedDeclaration"})
  public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);
    setOrientation(VERTICAL);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.number_picker, this, true);
    mHandler = new Handler();
    InputFilter inputFilter = new NumberPickerInputFilter();
    mNumberInputFilter = new NumberRangeKeyListener();
    mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
    mIncrementButton.setOnClickListener(this);
    mIncrementButton.setOnLongClickListener(this);
    mIncrementButton.setNumberPicker(this);
    mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement);
    mDecrementButton.setOnClickListener(this);
    mDecrementButton.setOnLongClickListener(this);
    mDecrementButton.setNumberPicker(this);

    mText = (EditText) findViewById(R.id.timepicker_input);
    mText.setOnFocusChangeListener(this);
    mText.setFilters(new InputFilter[] {inputFilter});
    mText.setRawInputType(InputType.TYPE_CLASS_NUMBER);

    if (!isEnabled()) {
      setEnabled(false);
    }

    mStart = DEFAULT_MIN;
    mEnd = DEFAULT_MAX;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.propmodder);
    prefSet = getPreferenceScreen();

    mWifiScanPref = (ListPreference) prefSet.findPreference(WIFI_SCAN_PREF);
    mWifiScanPref.setOnPreferenceChangeListener(this);

    mMaxEventsPref = (ListPreference) prefSet.findPreference(MAX_EVENTS_PREF);
    mMaxEventsPref.setOnPreferenceChangeListener(this);

    mRingDelayPref = (ListPreference) prefSet.findPreference(RING_DELAY_PREF);
    mRingDelayPref.setOnPreferenceChangeListener(this);

    mVmHeapsizePref = (ListPreference) prefSet.findPreference(VM_HEAPSIZE_PREF);
    mVmHeapsizePref.setOnPreferenceChangeListener(this);

    mFastUpPref = (ListPreference) prefSet.findPreference(FAST_UP_PREF);
    mFastUpPref.setOnPreferenceChangeListener(this);

    mProxDelayPref = (ListPreference) prefSet.findPreference(PROX_DELAY_PREF);
    mProxDelayPref.setOnPreferenceChangeListener(this);

    mSleepPref = (ListPreference) prefSet.findPreference(SLEEP_PREF);
    mSleepPref.setOnPreferenceChangeListener(this);

    mTcpStackPref = (CheckBoxPreference) prefSet.findPreference(TCP_STACK_PREF);

    mJitPref = (CheckBoxPreference) prefSet.findPreference(JIT_PREF);

    mModVersionPref = (EditTextPreference) prefSet.findPreference(MOD_VERSION_PREF);
    String mod = Helpers.findBuildPropValueOf(MOD_VERSION_PROP);
    if (mModVersionPref != null) {
      EditText modET = mModVersionPref.getEditText();
      ModPrefHolder = mModVersionPref.getEditText().toString();
      if (modET != null) {
        InputFilter lengthFilter = new InputFilter.LengthFilter(32);
        modET.setFilters(new InputFilter[] {lengthFilter});
        modET.setSingleLine(true);
      }
      mModVersionPref.setSummary(
          String.format(getString(R.string.pref_mod_version_alt_summary), mod));
    }
    Log.d(TAG, String.format("ModPrefHoler = '%s' found build number = '%s'", ModPrefHolder, mod));
    mModVersionPref.setOnPreferenceChangeListener(this);

    m3gSpeedPref = (CheckBoxPreference) prefSet.findPreference(THREE_G_PREF);

    mGpuPref = (CheckBoxPreference) prefSet.findPreference(GPU_PREF);

    updateScreen();
  }
  private void initViews() {
    loadingoverlay = (LoadingOverlay) findViewById(R.id.loadingoverlay);
    findpwd_pwd_ET = (ExEditText) findViewById(R.id.findpwd_pwd_ET);
    findpwd_pwd1_ET = (ExEditText) findViewById(R.id.findpwd_pwd1_ET);
    btn_title_left = (Button) findViewById(R.id.btn_title_left);
    tv_top_title = (TextView) findViewById(R.id.tv_top_title);
    btn_title_right = (Button) findViewById(R.id.btn_title_right);

    btn_title_right.setText(R.string.next);
    tv_top_title.setText(R.string.findpwdtitle);

    EditText pwd1inneret = findpwd_pwd1_ET.getEditText();

    pwd1inneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    pwd1inneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});

    EditText pwdinneret = findpwd_pwd_ET.getEditText();
    pwdinneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    pwdinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
  }
  /**
   * Sets up the dialog for taking a photo or browsing the gallery, and also for adding a text
   * comment to the photo. Then calls the either takePhoto() or browseGallery() to actual complete
   * the task of adding a photo to the chapter.
   */
  public void addPhoto() {
    // getting image text / annotation
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    // Set dialog title
    alert.setTitle("Post a photo");
    final EditText text = new EditText(this);
    text.setHint("Enter comment here");

    // setting max length for comment
    InputFilter[] fArray = new InputFilter[1];
    fArray[0] = new InputFilter.LengthFilter(50);
    text.setFilters(fArray);
    alert.setView(text);

    // Options that user may choose to add photo
    final String[] methods = {"Take Photo", "Choose from Gallery"};
    alert.setSingleChoiceItems(
        methods,
        -1,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int item) {
            switch (item) {
              case 0:
                photoComment = text.getText().toString();
                takePhoto(Media.PHOTO);
                break;
              case 1:
                photoComment = text.getText().toString();
                browseGallery(Media.PHOTO);
                break;
            }
            photoDialog.dismiss();
          }
        });
    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            photoDialog.dismiss();
            return;
          }
        });

    photoDialog = alert.create();
    photoDialog.show();
  }
Beispiel #14
0
 public final Dialog c(Bundle paramBundle) {
   Bundle localBundle = this.m;
   Context localContext = ar_();
   un localun = new un(localContext);
   View localView = LayoutInflater.from(localContext).inflate(efj.ZQ, null);
   this.Z = ((EditText) localView.findViewById(aw.eK));
   this.Z.addTextChangedListener(this);
   CharSequence localCharSequence1 = localBundle.getCharSequence("hint_text");
   if (localCharSequence1 != null) {
     this.Z.setHint(localCharSequence1);
   }
   this.aa = localBundle.getInt("max_length", 1000);
   if (this.aa > 0) {
     EditText localEditText = this.Z;
     InputFilter[] arrayOfInputFilter = new InputFilter[1];
     arrayOfInputFilter[0] = new InputFilter.LengthFilter(this.aa);
     localEditText.setFilters(arrayOfInputFilter);
   }
   if (paramBundle != null) {
     this.Z.setText(paramBundle.getCharSequence("text_value"));
   }
   for (; ; ) {
     String str1 = localBundle.getString("error_msg");
     if (str1 != null) {
       this.Z.setError(str1);
     }
     TextView localTextView = (TextView) localView.findViewById(aw.eJ);
     String str2 = localBundle.getString("notice_text");
     if (str2 != null) {
       localTextView.setText(str2);
       localTextView.setVisibility(0);
     }
     localun.a(localView);
     CharSequence localCharSequence2 = localBundle.getCharSequence("dialog_title");
     localun.a.e = localCharSequence2;
     localun.a(fi.b, this);
     localun.b(localBundle.getInt("cancel_resource_id", fi.a), this);
     ((ImageView) localView.findViewById(aw.eH)).setOnClickListener(new luz(this));
     this.Z.post(new lva(this, localBundle));
     return localun.a();
     this.Z.setText(localBundle.getCharSequence("text_value"));
   }
 }
  @Override
  protected void initPageViewListener() {
    mEditView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            L.d(TAG, "onEditorAction %d", actionId);
            return false;
          }
        });

    mEditView.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void afterTextChanged(Editable s) {}
        });

    mFilterEdit.setFilters(
        new InputFilter[] {
          new EmsLenghtFilter(20), new EmojiInputFilter(), new LinebreakInputFilter()
        });

    editSwitch.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              // 恢复编辑
              setEditable(true);
            } else {
              // 禁止编辑
              setEditable(false);
            }
          }
        });
  }
Beispiel #16
0
  /*
   * (non-Javadoc)
   * @see
   * com.medialets.android.analytics.ManagedActivity#onCreate(android.os.Bundle
   * )
   */
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wizard_account_configure);
    nextButton = (Button) findViewById(R.id.next);
    nextButton.setOnClickListener(this);
    accountJID = (EditText) findViewById(R.id.account_username);
    accountPassword = (EditText) findViewById(R.id.account_password);

    final InputFilter[] orgFilters = accountJID.getFilters();
    final InputFilter[] newFilters = new InputFilter[orgFilters.length + 1];
    int i;
    for (i = 0; i < orgFilters.length; i++) {
      newFilters[i] = orgFilters[i];
    }
    newFilters[i] = new LoginFilter.UsernameFilterGeneric();
    accountJID.setFilters(newFilters);
    accountJID.addTextChangedListener(jidTextWatcher);
    accountPassword.addTextChangedListener(passTextWatcher);
  }
  public void setVariables() {

    IDtext = (TextView) findViewById(R.id.empid_text);
    EmailText = (TextView) findViewById(R.id.email_text);
    NameText = (TextView) findViewById(R.id.name_text);
    AccessText = (TextView) findViewById(R.id.access_text);
    AccessConfirmText = (TextView) findViewById(R.id.access_confirm_text);
    GenderText = (TextView) findViewById(R.id.gender_text);

    departmentArray = getResources().getStringArray(R.array.departmentsString);
    employeeIDs = getResources().getStringArray(R.array.empids);

    submit = (Button) findViewById(R.id.submit_button);
    reset = (Button) findViewById(R.id.reset_button);

    eID = (EditText) findViewById(R.id.empid_text_edit);
    eID.setFilters(new InputFilter[] {new InputFilter.AllCaps()});

    eName = (EditText) findViewById(R.id.name_text_edit);
    eEmail = (EditText) findViewById(R.id.email_text_edit);
    eAccess = (EditText) findViewById(R.id.access_text_edit);
    eAccessconfirm = (EditText) findViewById(R.id.access_confirm_text_edit);

    male = (RadioButton) findViewById(R.id.male_button);
    female = (RadioButton) findViewById(R.id.female_button);

    eAccess.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    eAccessconfirm.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    affirm = (CheckBox) findViewById(R.id.AD_check);

    departmentSpinner = (Spinner) findViewById(R.id.spindepartments);
    ArrayAdapter<String> dataAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, departmentArray);
    departmentSpinner.setAdapter(dataAdapter);

    departmentSpinner.setSelection(0);
  }
 private void initValues() {
   loginType = getIntent().getStringExtra("loginType");
   rl_userinfo_modify.setVisibility(View.VISIBLE);
   userinfo_sex.setVisibility(View.GONE);
   iv_next.setVisibility(View.GONE);
   handler = new MyHandler(this);
   userinfo_title.setText("你的昵称");
   KeyBoardUtils.openKeybord(userinfo_modify, this);
   userinfo_modify.setInputType(android.text.InputType.TYPE_CLASS_TEXT);
   userinfo_modify.setFilters(new InputFilter[] {new InputFilter.LengthFilter(16)});
   userinfo_sex.check(R.id.rb_userinfo_man);
   sex = "男";
   if (!"phoneNumber".equals(loginType)) {
     count = 2;
     rl_userinfo_modify.setVisibility(View.GONE);
     userinfo_sex.setVisibility(View.VISIBLE);
     tv_nickname_modified.setText(
         (String) UserInfoUtils.getUserInfo(this, Constants.NICKNAME, ""));
     tv_nickname_modified.setVisibility(View.VISIBLE);
     userinfo_title.setText("男生or女生?");
     iv_next.setVisibility(View.VISIBLE);
   }
 }
  /**
   * Helper method to add the field alias and the fields value into columns of a view using standard
   * id names. If the field has a length set, then this is used to constrain the EditText's
   * allowable characters. No validation is applied here, it is assumed that the container has this
   * set already (in XML).
   */
  View createAttributeRow(View container, Field field, Object value) {

    TextView fieldAlias = (TextView) container.findViewById(R.id.field_alias_txt);
    EditText fieldValue = (EditText) container.findViewById(R.id.field_value_txt);
    fieldAlias.setText(field.getAlias());

    // set the length of the text field and its value
    if (field.getLength() > 0) {
      InputFilter.LengthFilter filter = new InputFilter.LengthFilter(field.getLength());
      fieldValue.setFilters(new InputFilter[] {filter});
    }

    Log.d(AttributeEditorActivity.TAG, "value is null? =" + (value == null));
    Log.d(AttributeEditorActivity.TAG, "value=" + value);

    if (value != null) {
      fieldValue.setText(value.toString(), BufferType.EDITABLE);
    } else {
      fieldValue.setText("", BufferType.EDITABLE);
    }

    return fieldValue;
  }
Beispiel #20
0
  @Override
  protected void initData() {
    comment.setFilters(
        new InputFilter[] {new InputFilter.LengthFilter(UnoConfig.MAX_TEXT_LENGTH_REPAIRE)});
    mTvClear.setText(UnoConfig.MAX_TEXT_LENGTH_REPAIRE + "");

    photoOperate = new PhotoUtils(fatherActivity);
    imageWidthPx = SystemUtils.dpToPx(100);
    mSize = new ImageSize(imageWidthPx, imageWidthPx);

    gridView.setAdapter(adapter);
    adapter.notifyDataSetChanged();

    RepaireDraft draft =
        (RepaireDraft) UnoApplication.getCacheManager().getAsObject(Constants.KEY_DRAFT_REPAIRE);
    if (draft != null && !draft.isEmpty()) {
      comment.setText(draft.input);
      mData = draft.getPhotos();
      adapter.notifyDataSetChanged();
      if (!StringUtils.isEmpty(draft.input)) {
        mTvClear.setText((UnoConfig.MAX_TEXT_LENGTH_REPAIRE - draft.input.length()) + "");
      }
    }
  }
  private void setupScreenComponents() {

    try {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.bw_create_transaction_dialog);

      dialogTitleLayout = (LinearLayout) findViewById(R.id.bnk_ctd_title_layout);
      dialogTitle = (FermatTextView) findViewById(R.id.bnk_ctd_title);
      amountText = (EditText) findViewById(R.id.bnk_ctd_amount);
      memoText = (AutoCompleteTextView) findViewById(R.id.bnk_ctd_memo);
      applyBtn = (Button) findViewById(R.id.bnk_ctd_apply_transaction_btn);
      cancelBtn = (Button) findViewById(R.id.bnk_ctd_cancel_transaction_btn);

      dialogTitleLayout.setBackgroundColor(getTransactionTitleColor());
      dialogTitle.setText(getTransactionTitleText());
      amountText.setFilters(new InputFilter[] {new NumberInputFilter(9, 2)});

      cancelBtn.setOnClickListener(this);
      applyBtn.setOnClickListener(this);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 protected final void DV()
 {
   t.d("!32@/B4Tb64lLpKNhhU94SG29vC9zoVXGkMM", "init getintent mobile:" + aMQ);
   izI = ((MMFormInputView)findViewById(a.i.bind_mcontact_verify_num));
   izI.setImeOption(5);
   izI.setInputType(3);
   iyu = izI.getContentEditText();
   izJ = ((TextView)findViewById(a.i.mobileverify_resend_bt));
   izK = ((TextView)findViewById(a.i.mobileverify_counting_tv));
   izg = ((TextView)findViewById(a.i.bind_mcontact_verify_hint));
   izg.setText(aMQ);
   aMQ = am.xx(aMQ);
   izJ.setText(getString(a.n.mobileverify_resend));
   izL = ((TextView)findViewById(a.i.bind_mcontact_verify_tip));
   gmh = ((Button)findViewById(a.i.next_btn));
   izM = ((ScrollView)findViewById(a.i.scroll));
   grS = getResources().getStringArray(a.c.sms_content);
   Object localObject = getString(a.n.regbymobile_reg_input_verify_tip);
   izL.setText(Html.fromHtml((String)localObject));
   localObject = new di(this);
   izK.setVisibility(0);
   izK.setText(getResources().getQuantityString(a.l.mobileverify_send_code_tip, iwr, new Object[] { Integer.valueOf(iwr) }));
   aMp();
   izR = false;
   iyu.setFilters(new InputFilter[] { localObject });
   iyu.addTextChangedListener(new MMEditText.c(iyu, null, 12));
   gmh.setOnClickListener(new dj(this));
   gmh.setEnabled(false);
   iyu.setTextSize(15.0F);
   iyu.addTextChangedListener(new dk(this));
   izJ.setOnClickListener(new dl(this));
   izJ.setEnabled(false);
   a(new do(this));
   iyu.setOnEditorActionListener(new dp(this));
   iyu.setOnKeyListener(new dq(this));
 }
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
      switch (requestCode) {
        case DAY_PICK:
          selectedDays = data.getIntegerArrayListExtra("selectedDays");
          dayStrings.clear();
          days[0] = days[1] = days[2] = days[3] = days[4] = 0;
          for (int n : selectedDays) {
            days[n] = 1;
            switch (n) {
              case Loc8Preference.MONDAY:
                dayStrings.add("Monday");
                break;
              case Loc8Preference.TUESDAY:
                dayStrings.add("Tuesday");
                break;
              case Loc8Preference.WEDNESDAY:
                dayStrings.add("Wednesday");
                break;
              case Loc8Preference.THURSDAY:
                dayStrings.add("Thursday");
                break;
              case Loc8Preference.FRIDAY:
                dayStrings.add("Friday");
                break;
              case Loc8Preference.SATURDAY:
                dayStrings.add("Saturday");
                break;
              case Loc8Preference.SUNDAY:
                dayStrings.add("Sunday");
                break;
            }
          }
          if (dayStrings.size() > 5) {
            tSelectDaysOfWeekHeader.setText(
                dayStrings.get(0).toString()
                    + ", "
                    + dayStrings.get(1).toString()
                    + ", "
                    + dayStrings.get(2).toString()
                    + " and "
                    + String.valueOf(dayStrings.size() - 3)
                    + " other(s)");
          } else if (dayStrings.size() == 0) {
            tSelectDaysOfWeekHeader.setText("");
            selectedDays = null;
          } else {
            tSelectDaysOfWeekHeader.setText(
                dayStrings.toString().replace("[", "").replace("]", ""));
          }
          break;

        case LOCATION_PICK:

          // clear arraylist to prevent previous selections to be added
          locs.clear();

          int count_l = 0;
          int loc;

          String found = "";

          ArrayList<Integer> selection = data.getIntegerArrayListExtra("selectedLoc");

          Cursor locsCursor = mDbHelper.getAllLocations("");

          ArrayList<String> locArrayList = new ArrayList<String>();

          for (locsCursor.moveToFirst(); !locsCursor.isAfterLast(); locsCursor.moveToNext()) {
            locArrayList.add(locsCursor.getString(1));
          }

          for (int n : selection) {
            for (locsCursor.moveToFirst(); !locsCursor.isAfterLast(); locsCursor.moveToNext()) {
              if (n == locsCursor.getInt(0)) {

                Log.d("locationSelect", "Found : " + selection);
                loc = n;
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.setTitle("Set radius (meters) for ");
                alert.setMessage(
                    locsCursor.getString(locsCursor.getColumnIndex(mDbHelper.KEY_LOCATIONNAME)));

                final double tempLat =
                    locsCursor.getDouble(locsCursor.getColumnIndex(mDbHelper.KEY_LATITUDE));
                final double tempLon =
                    locsCursor.getDouble(locsCursor.getColumnIndex(mDbHelper.KEY_LONGITUDE));
                final String tempName =
                    locsCursor.getString(locsCursor.getColumnIndex(mDbHelper.KEY_LOCATIONNAME));

                // Set an EditText view to get user input
                final EditText input = new EditText(this);
                int maxLength = 6;
                InputFilter[] filter = new InputFilter[1];
                filter[0] = new InputFilter.LengthFilter(maxLength);
                input.setFilters(filter);
                alert.setView(input);

                alert.setPositiveButton(
                    "Set",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
                        String value = input.getText().toString();
                        float radius;
                        if ((value != null) && (value.trim().length() == 0)) {
                          radius = Loc8Task.RADIUS_DEFAULT;
                        } else {
                          radius = Float.parseFloat(value);
                        }

                        Loc8Location d =
                            new Loc8Location(
                                new GeoPoint(
                                    (int) ((tempLat) * 1000000), (int) ((tempLon) * 1000000)),
                                radius,
                                tempName);

                        locs.add(d);
                      }
                    });
                // if back button pressed then default radius is used
                alert.setOnCancelListener(
                    new OnCancelListener() {
                      @Override
                      public void onCancel(DialogInterface di) {
                        Loc8Location d =
                            new Loc8Location(
                                new GeoPoint(
                                    (int) ((tempLat) * 1000000), (int) ((tempLon) * 1000000)),
                                Loc8Task.RADIUS_DEFAULT,
                                tempName);
                        locs.add(d);
                      }
                    });
                alert.show();

                count_l++;
                found = locsCursor.getString(1);
              }
            }
          }

          if (count_l == 1) {
            tSelectLocationHeaderPref.setText(found);

          } else if (count_l > 1) {
            tSelectLocationHeaderPref.setText(count_l + " locations selected");
          } else {
            tSelectLocationHeaderPref.setText("");
            Log.d("locationSelectPreference", "Nothing found");
          }
          break;
        case PREF_PICK:
          // This thing is super hacky now that I've removed a bunch of stuff.
          //
          prefsArrayList = data.getIntegerArrayListExtra("prefs");
          ArrayList<String> blockNames = data.getStringArrayListExtra("blockNames");
          for (String n : blockNames) {
            /*if(n.equals("All callers")) {
            	blockList.add(Loc8ContactList.ALL);
            	break;
            }*/
            blockList.add(Loc8ContactList.getContactFromName(n));
          }
          prefs = prefsArrayList.toArray(new Integer[prefsArrayList.size()]);
          int prefsCount = 0;
          int prefIndex = -1;
          for (int i = 0; i < prefsArrayList.size(); i++) {
            if (prefsArrayList.get(i) == 1) {
              prefsCount++;
              prefIndex = i;
            }
          }
          if (prefsCount == 1) {
            switch (prefIndex) {
              case Loc8Preference.SILENT:
                tSetPreferencesHeader.setText("Set phone to silent");
                break;
              case Loc8Preference.ALARM:
                tSetPreferencesHeader.setText("Turn off alarms");
                break;
              case Loc8Preference.VIBRATE:
                tSetPreferencesHeader.setText("Set ringtone to vibrate");
                break;
              case Loc8Preference.NORMAL:
                tSetPreferencesHeader.setText("Normal ringtone");
                break;
            }
          } else if (prefsCount == 0) {
            prefsArrayList = null;
            tSetPreferencesHeader.setText("");
          } else {
            tSetPreferencesHeader.setText(String.valueOf(prefsCount) + " preferences selected");
          }
          break;
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit_slide_activity);

    mSlideView = (BasicSlideEditorView) findViewById(R.id.slide_editor_view);
    mSlideView.setOnTextChangedListener(mOnTextChangedListener);

    mPreSlide = (ImageButton) findViewById(R.id.pre_slide_button);
    mPreSlide.setOnClickListener(mOnNavigateBackward);

    mNextSlide = (ImageButton) findViewById(R.id.next_slide_button);
    mNextSlide.setOnClickListener(mOnNavigateForward);

    mPreview = (Button) findViewById(R.id.preview_button);
    mPreview.setOnClickListener(mOnPreview);

    mReplaceImage = (Button) findViewById(R.id.replace_image_button);
    mReplaceImage.setOnClickListener(mOnReplaceImage);

    mRemoveSlide = (Button) findViewById(R.id.remove_slide_button);
    mRemoveSlide.setOnClickListener(mOnRemoveSlide);

    mTextEditor = (EditText) findViewById(R.id.text_message);
    mTextEditor.setFilters(new InputFilter[] {new LengthFilter(MmsConfig.getMaxTextLimit())});

    mDone = (Button) findViewById(R.id.done_button);
    mDone.setOnClickListener(mDoneClickListener);

    initActivityState(savedInstanceState, getIntent());

    try {
      mSlideshowModel = SlideshowModel.createFromMessageUri(this, mUri);
      // Confirm that we have at least 1 slide to display
      if (mSlideshowModel.size() == 0) {
        Log.e(TAG, "Loaded slideshow is empty; can't edit nothingness, exiting.");
        finish();
        return;
      }
      // Register an observer to watch whether the data model is changed.
      mSlideshowModel.registerModelChangedObserver(mModelChangedObserver);
      mSlideshowEditor = new SlideshowEditor(this, mSlideshowModel);
      mPresenter =
          (SlideshowPresenter)
              PresenterFactory.getPresenter(
                  "SlideshowPresenter", this, mSlideView, mSlideshowModel);

      // Sanitize mPosition
      if (mPosition >= mSlideshowModel.size()) {
        mPosition = Math.max(0, mSlideshowModel.size() - 1);
      } else if (mPosition < 0) {
        mPosition = 0;
      }

      showCurrentSlide();
    } catch (MmsException e) {
      Log.e(TAG, "Create SlideshowModel failed!", e);
      finish();
      return;
    }
  }
 public final void d(LinkedList paramLinkedList1, LinkedList paramLinkedList2) {
   boolean bool;
   if (paramLinkedList1.size() > 0) {
     bool = true;
     Assert.assertTrue(bool);
     if (paramLinkedList2.size() <= 0) {
       break label304;
     }
     bool = true;
     label25:
     Assert.assertTrue(bool);
     onStart();
     gTe = paramLinkedList1;
     eAn = paramLinkedList2;
     eBy = View.inflate(context, a.k.sendrequest_dialog, null);
     if (gRT != null) {
       break label310;
     }
     bool = true;
     label69:
     if (gRT != null) {
       break label316;
     }
   }
   label304:
   label310:
   label316:
   for (int i = 0; ; i = gRT.length()) {
     t.i(
         "!44@/B4Tb64lLpLVd6spdHyDjUdOUXrNyAnPpMhB/tzZ/pc=",
         "verifyTip is null: %b, length : %d, value : [%s]",
         new Object[] {Boolean.valueOf(bool), Integer.valueOf(i), gRT});
     if (!com.tencent.mm.sdk.platformtools.bn.iW(gRT)) {
       ((TextView) eBy.findViewById(a.i.sendrequest_tip)).setText(gRT);
     }
     euS = ((EditText) eBy.findViewById(a.i.sendrequest_content));
     eBA = ((TextView) eBy.findViewById(a.i.wordcount));
     eBA.setVisibility(0);
     euS.setText(null);
     eBA.setText("50");
     euS.setFilters(ad.hfa);
     euS.addTextChangedListener(new ak(this));
     paramLinkedList1 = new al(this);
     paramLinkedList2 = new an(this);
     arb =
         h.a(
             context,
             context.getString(a.n.sendrequest_title),
             eBy,
             paramLinkedList1,
             paramLinkedList2);
     if (arb == null) {
       onStop();
     }
     euS.post(new ao(this));
     return;
     bool = false;
     break;
     bool = false;
     break label25;
     bool = false;
     break label69;
   }
 }
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      int id = getArguments().getInt("id");
      switch (id) {
        case DLG_AUTO_SMS_MESSAGE:
          final String defaultText = getResources().getString(R.string.quiet_hours_auto_sms_null);
          final String autoText = getOwner().mPrefs.getString(KEY_AUTO_SMS_MESSAGE, defaultText);

          final EditText input = new EditText(getActivity());
          InputFilter[] filter = new InputFilter[1];
          // No multi/split messages for ease of compatibility
          filter[0] = new InputFilter.LengthFilter(160);
          input.append(autoText);
          input.setFilters(filter);

          return new AlertDialog.Builder(getActivity())
              .setTitle(R.string.quiet_hours_auto_string_title)
              .setMessage(R.string.quiet_hours_auto_string_explain)
              .setView(input)
              .setNegativeButton(R.string.cancel, null)
              .setPositiveButton(
                  R.string.dlg_ok,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      String value = input.getText().toString();
                      if (TextUtils.isEmpty(value)) {
                        value = defaultText;
                      }
                      SharedPreferences.Editor editor = getOwner().mPrefs.edit();
                      editor.putString(KEY_AUTO_SMS_MESSAGE, value).apply();
                    }
                  })
              .create();
        case DLG_SMS_BYPASS_CODE:
          final String defaultCode = getResources().getString(R.string.quiet_hours_sms_code_null);
          final String code = getOwner().mPrefs.getString(KEY_SMS_BYPASS_CODE, defaultCode);

          final EditText inputCode = new EditText(getActivity());
          InputFilter[] filterCode = new InputFilter[1];
          filterCode[0] = new InputFilter.LengthFilter(20);
          inputCode.append(code);
          inputCode.setFilters(filterCode);

          return new AlertDialog.Builder(getActivity())
              .setTitle(R.string.quiet_hours_sms_code_title)
              .setMessage(R.string.quiet_hours_sms_code_explain)
              .setView(inputCode)
              .setNegativeButton(R.string.cancel, null)
              .setPositiveButton(
                  R.string.dlg_ok,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      String value = inputCode.getText().toString();
                      if (TextUtils.isEmpty(value)) {
                        value = defaultCode;
                      }
                      SharedPreferences.Editor editor = getOwner().mPrefs.edit();
                      editor.putString(KEY_SMS_BYPASS_CODE, value).apply();
                    }
                  })
              .create();
      }
      throw new IllegalArgumentException("unknown id " + id);
    }
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    EzServe ezServe = (EzServe) getApplication();
    FoodItem realItem = ezServe.getItem(identifier);

    if (!((EzServe) getApplication()).getItem(identifier).getDescription().contains("/")) {

      super.onListItemClick(l, v, position, id);
      String selectedOption = getListView().getItemAtPosition(position).toString();

      Table table = ezServe.getTable(this.tableNum);
      Seat seat = table.getSeats().get(this.seatNum);
      if (StringUtils.equals(selectedOption, listItems[0])) {
        FoodItem itemToDelete = null;
        for (FoodItem item : seat.getAllItems()) {
          if (identifier == item.identifier) {
            itemToDelete = item;
          }
        }
        if (itemToDelete != null) {
          if (itemToDelete.type == FOOD_ITEM_TYPE.BEVERAGE) {
            seat.getBeverages().remove(itemToDelete);
          }
          if (itemToDelete.type == FOOD_ITEM_TYPE.SALAD) {
            seat.getSalads().remove(itemToDelete);
          }
          if (itemToDelete.type == FOOD_ITEM_TYPE.ENTREE) {
            seat.getEntrees().remove(itemToDelete);
          }
          if (itemToDelete.type == FOOD_ITEM_TYPE.DESSERT) {
            seat.getDesserts().remove(itemToDelete);
          }
          if (itemToDelete.type == FOOD_ITEM_TYPE.KID) {
            seat.getKidsmeals().remove(itemToDelete);
          }
          if (itemToDelete.type == FOOD_ITEM_TYPE.APPETIZER) {
            seat.getAppetizers().remove(itemToDelete);
          }
        }

        Intent intent = new Intent(this, SeatListActivity.class);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("tableNumber", this.tableNum);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, listItems[1])) {
        Intent intent = new Intent(this, SplitItemActivity.class);
        intent.putExtra("tableNumber", this.tableNum);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("foodItem", this.identifier);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, listItems[3])) {
        Intent intent = new Intent(this, RemoveActivity.class);
        intent.putExtra("tableNumber", this.tableNum);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("foodItem", this.identifier);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, listItems[2])) {
        Intent intent = new Intent(this, AddActivity.class);
        intent.putExtra("tableNumber", this.tableNum);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("foodItem", this.identifier);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, listItems[4])) {
        /*
         * Intent intent = new Intent(this, MsgActivity.class);
         * intent.putExtra("tableNumber", this.tableNum);
         * intent.putExtra("seatNumber", this.seatNum);
         * intent.putExtra("foodItem", this.selectedItem);
         * startActivity(intent);
         */
        AlertDialog.Builder alert = new AlertDialog.Builder(this);

        alert.setTitle("Attach Message");

        // Set an EditText view to get user input
        final EditText input = new EditText(this);
        input.setText(ezServe.getItem(identifier).customMsg);
        InputFilter[] filters = new InputFilter[1];
        filters[0] = new InputFilter.LengthFilter(200);
        input.setFilters(filters);
        alert.setView(input);

        alert.setPositiveButton(
            "Ok",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                Editable value = input.getText();
                EzServe ezServe = (EzServe) getApplication();
                ezServe.getItem(identifier).customMsg = value.toString();
              }
            });

        alert.setNegativeButton(
            "Cancel",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                // Canceled.
              }
            });

        alert.show();
      }
    } else {

      super.onListItemClick(l, v, position, id);
      String selectedOption = getListView().getItemAtPosition(position).toString();
      Table table = ezServe.getTable(this.tableNum);
      Seat seat = table.getSeats().get(this.seatNum);
      if (StringUtils.equals(selectedOption, splitItems[0])) {
        for (Seat seatssas : ezServe.getTable(this.tableNum).getSeats()) {
          FoodItem itemToDelete = null;
          for (FoodItem item : seatssas.getAllItems()) {
            if (item.getDescription().equals(realItem.getDescription())) {
              itemToDelete = item;
            }
            if (itemToDelete != null) {
              if (itemToDelete.type == FOOD_ITEM_TYPE.BEVERAGE) {
                seatssas.getBeverages().remove(itemToDelete);
              }
              if (itemToDelete.type == FOOD_ITEM_TYPE.SALAD) {
                seatssas.getSalads().remove(itemToDelete);
              }
              if (itemToDelete.type == FOOD_ITEM_TYPE.ENTREE) {
                seatssas.getEntrees().remove(itemToDelete);
              }
              if (itemToDelete.type == FOOD_ITEM_TYPE.DESSERT) {
                seatssas.getDesserts().remove(itemToDelete);
              }
              if (itemToDelete.type == FOOD_ITEM_TYPE.KID) {
                seatssas.getKidsmeals().remove(itemToDelete);
              }
              if (itemToDelete.type == FOOD_ITEM_TYPE.APPETIZER) {
                seatssas.getAppetizers().remove(itemToDelete);
              }
              itemToDelete = null;
            }
          }
        }

        Intent intent = new Intent(this, SeatListActivity.class);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("tableNumber", this.tableNum);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, splitItems[2])) {
        Intent intent = new Intent(this, RemoveActivity.class);
        intent.putExtra("tableNumber", this.tableNum);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("foodItem", this.identifier);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, splitItems[1])) {
        Intent intent = new Intent(this, AddActivity.class);
        intent.putExtra("tableNumber", this.tableNum);
        intent.putExtra("seatNumber", this.seatNum);
        intent.putExtra("foodItem", this.identifier);
        startActivity(intent);
      }
      if (StringUtils.equals(selectedOption, splitItems[3])) {
        /*
         * Intent intent = new Intent(this, MsgActivity.class);
         * intent.putExtra("tableNumber", this.tableNum);
         * intent.putExtra("seatNumber", this.seatNum);
         * intent.putExtra("foodItem", this.selectedItem);
         * startActivity(intent);
         */
        AlertDialog.Builder alert = new AlertDialog.Builder(this);

        alert.setTitle("Attach Message");

        // Set an EditText view to get user input
        final EditText input = new EditText(this);
        input.setText(ezServe.getItem(identifier).customMsg);
        InputFilter[] filters = new InputFilter[1];
        filters[0] = new InputFilter.LengthFilter(200);
        input.setFilters(filters);
        alert.setView(input);

        alert.setPositiveButton(
            "Ok",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                Editable value = input.getText();
                EzServe ezServe = (EzServe) getApplication();
                ezServe.getItem(identifier).customMsg = value.toString();
              }
            });

        alert.setNegativeButton(
            "Cancel",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                // Canceled.
              }
            });

        alert.show();
      }
    }
  }
Beispiel #28
0
    @Override
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
      final Intent it = getIntent();

      String prefKey = preference.getKey();

      if ("level_filter".equals(prefKey)) // $NON-NLS-1$
      {
        OnClickListener listener =
            new OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                if (dmesgMode) {
                  it.putExtra(PREF_KEY_DLOG_LEVL, which);
                } else {
                  it.putExtra(PREF_KEY_CLOG_LEVL, which + 2);
                }

                dialog.dismiss();

                refreshLevelFilter();
              }
            };

        if (dmesgMode) {
          new AlertDialog.Builder(this)
              .setTitle(R.string.log_level)
              .setNeutralButton(R.string.close, null)
              .setSingleChoiceItems(
                  new CharSequence[] {
                    Html.fromHtml(
                        "<font color=\"#ff00ff\">● </font>" //$NON-NLS-1$
                            + getString(R.string.emmergency)),
                    Html.fromHtml(
                        "<font color=\"#F183BD\">● </font>" //$NON-NLS-1$
                            + getString(R.string.alert)),
                    Html.fromHtml(
                        "<font color=\"#8737CE\">● </font>" //$NON-NLS-1$
                            + getString(R.string.critical)),
                    Html.fromHtml(
                        "<font color=\"#ff0000\">● </font>" //$NON-NLS-1$
                            + getString(R.string.error)),
                    Html.fromHtml(
                        "<font color=\"#ffff00\">● </font>" //$NON-NLS-1$
                            + getString(R.string.warning)),
                    Html.fromHtml(
                        "<font color=\"#00ffff\">● </font>" //$NON-NLS-1$
                            + getString(R.string.notice)),
                    Html.fromHtml(
                        "<font color=\"#00ff00\">● </font>" //$NON-NLS-1$
                            + getString(R.string.info)),
                    Html.fromHtml(
                        "<font color=\"#888888\">● </font>" //$NON-NLS-1$
                            + getString(R.string.debug)),
                  },
                  it.getIntExtra(PREF_KEY_DLOG_LEVL, DM_LVL_DEBUG),
                  listener)
              .create()
              .show();
        } else {
          new AlertDialog.Builder(this)
              .setTitle(R.string.log_level)
              .setNeutralButton(R.string.close, null)
              .setSingleChoiceItems(
                  new CharSequence[] {
                    Html.fromHtml(
                        "<font color=\"#888888\">● </font>" //$NON-NLS-1$
                            + getString(R.string.verbose)),
                    Html.fromHtml(
                        "<font color=\"#00ffff\">● </font>" //$NON-NLS-1$
                            + getString(R.string.debug)),
                    Html.fromHtml(
                        "<font color=\"#00ff00\">● </font>" //$NON-NLS-1$
                            + getString(R.string.info)),
                    Html.fromHtml(
                        "<font color=\"#ffff00\">● </font>" //$NON-NLS-1$
                            + getString(R.string.warning)),
                    Html.fromHtml(
                        "<font color=\"#ff0000\">● </font>" //$NON-NLS-1$
                            + getString(R.string.error)),
                    Html.fromHtml(
                        "<font color=\"#ff00ff\">● </font>" //$NON-NLS-1$
                            + getString(R.string.asser_t)),
                  },
                  it.getIntExtra(PREF_KEY_CLOG_LEVL, Log.VERBOSE) - 2,
                  listener)
              .create()
              .show();
        }

        return true;
      } else if (PREF_KEY_RING_BUFFER.equals(prefKey)) {
        OnClickListener listener =
            new OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                it.putExtra(PREF_KEY_RING_BUFFER, which);

                dialog.dismiss();

                refreshRingBuffer();
              }
            };

        new AlertDialog.Builder(this)
            .setTitle(R.string.ring_buffer)
            .setNeutralButton(R.string.close, null)
            .setSingleChoiceItems(
                new CharSequence[] {
                  getString(R.string.main), getString(R.string.radio), getString(R.string.events),
                },
                it.getIntExtra(PREF_KEY_RING_BUFFER, RING_BUFFER_MAIN),
                listener)
            .create()
            .show();

        return true;
      } else if (PREF_KEY_TAG_FILTER.equals(prefKey)) {
        final EditText txt = new EditText(this);
        txt.setText(it.getStringExtra(PREF_KEY_TAG_FILTER));

        OnClickListener listener =
            new OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                String filter = txt.getText().toString();

                if (filter != null) {
                  filter = filter.trim();

                  if (filter.length() == 0) {
                    filter = null;
                  }
                }

                it.putExtra(PREF_KEY_TAG_FILTER, filter);

                dialog.dismiss();

                refreshTagFilter();
              }
            };

        new AlertDialog.Builder(this)
            .setTitle(R.string.tag_filter)
            .setPositiveButton(android.R.string.ok, listener)
            .setNegativeButton(android.R.string.cancel, null)
            .setView(txt)
            .create()
            .show();

        return true;
      } else if (PREF_KEY_PID_FILTER.equals(prefKey)) {
        final EditText txt = new EditText(this);
        txt.setFilters(new InputFilter[] {DigitsKeyListener.getInstance(false, false)});

        int pid = it.getIntExtra(PREF_KEY_PID_FILTER, 0);
        if (pid != 0) {
          txt.setText(String.valueOf(pid));
        }

        OnClickListener listener =
            new OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                String filter = txt.getText().toString();

                if (filter != null) {
                  filter = filter.trim();

                  if (filter.length() == 0) {
                    filter = null;
                  }
                }

                int pid = 0;

                if (filter != null) {
                  try {
                    pid = Integer.parseInt(filter);
                  } catch (Exception e) {
                    Log.e(LogSettings.class.getName(), e.getLocalizedMessage(), e);
                  }
                }

                it.putExtra(PREF_KEY_PID_FILTER, pid);

                dialog.dismiss();

                refreshPidFilter();
              }
            };

        new AlertDialog.Builder(this)
            .setTitle(R.string.pid_filter)
            .setPositiveButton(android.R.string.ok, listener)
            .setNegativeButton(android.R.string.cancel, null)
            .setView(txt)
            .create()
            .show();

        return true;
      }
      return false;
    }
  @Override
  public void setValues(
      DataKind kind,
      ValuesDelta entry,
      RawContactDelta state,
      boolean readOnly,
      ViewIdGenerator vig) {
    super.setValues(kind, entry, state, readOnly, vig);
    // Remove edit texts that we currently have
    if (mFieldEditTexts != null) {
      for (EditText fieldEditText : mFieldEditTexts) {
        mFields.removeView(fieldEditText);
      }
    }
    boolean hidePossible = false;

    int fieldCount = kind.fieldList.size();
    mFieldEditTexts = new EditText[fieldCount];
    for (int index = 0; index < fieldCount; index++) {
      final EditField field = kind.fieldList.get(index);
      final EditText fieldView = new EditText(mContext);
      fieldView.setLayoutParams(
          new LinearLayout.LayoutParams(
              LayoutParams.MATCH_PARENT,
              field.isMultiLine() ? LayoutParams.WRAP_CONTENT : mMinFieldHeight));
      // Set either a minimum line requirement or a minimum height (because {@link TextView}
      // only takes one or the other at a single time).
      if (field.minLines != 0) {
        fieldView.setMinLines(field.minLines);
      } else {
        fieldView.setMinHeight(mMinFieldHeight);
      }
      fieldView.setTextAppearance(getContext(), android.R.style.TextAppearance_Medium);
      fieldView.setGravity(Gravity.TOP);
      mFieldEditTexts[index] = fieldView;
      fieldView.setId(vig.getId(state, kind, entry, index));

      if (field.titleRes > 0) {
        fieldView.setHint(field.titleRes);
      }
      /** M:AAS @ { update fieldView's hint text */
      if (Phone.CONTENT_ITEM_TYPE.equals(kind.mimeType)) {
        int type = SimUtils.isAdditionalNumber(entry) ? 1 : 0;
        ExtensionManager.getInstance()
            .getContactDetailExtension()
            .updateView(
                fieldView,
                type,
                ContactDetailExtension.VIEW_UPDATE_HINT,
                ExtensionManager.COMMD_FOR_AAS);
      }
      /** M: @ } */

      /** M: New Feature xxx @{ */
      /* original code int inputType = field.inputType; */
      final int inputType = field.inputType;
      /** @} */
      fieldView.setInputType(inputType);
      if (inputType == InputType.TYPE_CLASS_PHONE) {
        /** M: New Feature xxx @{ */
        /*
         * original code
         * PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher
         * (mContext, fieldView);
         */
        // add by mediatek
        ExtensionManager.getInstance()
            .getContactDetailExtension()
            .setViewKeyListener(fieldView, ContactPluginDefault.COMMD_FOR_OP01);
        PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(mContext, fieldView, null);
        /** @} */
      }

      // Show the "next" button in IME to navigate between text fields
      // TODO: Still need to properly navigate to/from sections without text fields,
      // See Bug: 5713510
      fieldView.setImeOptions(EditorInfo.IME_ACTION_NEXT);

      // Read current value from state
      final String column = field.column;
      final String value = entry.getAsString(column);

      /*
       * Bug Fix by Mediatek Begin.
       *   Original Android's code:
       *     xxx
       *   CR ID: ALPS00244669
       *   Descriptions:
       */
      Log.i(TAG, "setValues setFilter");
      fieldView.setFilters(new InputFilter[] {new InputFilter.LengthFilter(FIELD_VIEW_MAX)});
      /*
       * Bug Fix by Mediatek End.
       */

      fieldView.setText(value);

      // Show the delete button if we have a non-null value
      setDeleteButtonVisible(value != null);

      // Prepare listener for writing changes
      fieldView.addTextChangedListener(
          new TextWatcher() {
            /** M: New Feature xxx @{ */
            int location = 0;

            /** @} */
            @Override
            public void afterTextChanged(Editable s) {
              // Trigger event for newly changed value
              /** M: New Feature Easy Porting @{ */
              /* original code onFieldChanged(column, s.toString()); */
              String phoneText = s.toString();
              phoneText =
                  ExtensionManager.getInstance()
                      .getContactDetailExtension()
                      .TextChanged(
                          inputType, s, phoneText, location, ContactPluginDefault.COMMD_FOR_OP01);
              onFieldChanged(column, phoneText);
              /** @} */
            }

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

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {}
          });

      fieldView.setEnabled(isEnabled() && !readOnly);

      if (field.shortForm) {
        hidePossible = true;
        mHasShortAndLongForms = true;
        fieldView.setVisibility(mHideOptional ? View.VISIBLE : View.GONE);
      } else if (field.longForm) {
        hidePossible = true;
        mHasShortAndLongForms = true;
        fieldView.setVisibility(mHideOptional ? View.GONE : View.VISIBLE);
      } else {
        // Hide field when empty and optional value
        final boolean couldHide = (!ContactsUtils.isGraphic(value) && field.optional);
        final boolean willHide = (mHideOptional && couldHide);
        fieldView.setVisibility(willHide ? View.GONE : View.VISIBLE);
        hidePossible = hidePossible || couldHide;
      }

      mFields.addView(fieldView);
    }

    // When hiding fields, place expandable
    setupExpansionView(hidePossible, mHideOptional);
    mExpansionView.setEnabled(!readOnly && isEnabled());
  }
Beispiel #30
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.addpeer);

    Log.i("Shapes", "AddPeer onCreate...");

    et_addr = (EditText) findViewById(R.id.peerAddress);
    et_idx = (EditText) findViewById(R.id.peerIndex);

    // construct an InputFilter for IPv4 addresses
    InputFilter[] filters = new InputFilter[1];
    filters[0] =
        new InputFilter() {
          @Override
          public CharSequence filter(
              CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
            if (end > start) {
              String destTxt = dest.toString();
              String resultingTxt =
                  destTxt.substring(0, dstart)
                      + source.subSequence(start, end)
                      + destTxt.substring(dend);
              if (!resultingTxt.matches(
                  "^\\d{1,3}(\\.(\\d{1,3}(\\.(\\d{1,3}(\\.(\\d{1,3})?)?)?)?)?)?")) {
                return "";
              } else {
                String[] splits = resultingTxt.split("\\.");
                for (int i = 0; i < splits.length; i++) {
                  if (Integer.valueOf(splits[i]) > 255) {
                    return "";
                  }
                }
              }
            }
            return null;
          }
        };
    et_addr.setFilters(filters);

    // add callbacks to buttons...
    ((Button) findViewById(R.id.addPeerButton))
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {

                // read results... if valid, construct 'return' data
                String addr = et_addr.getText().toString();
                if (addr.length() > 0) {
                  Intent result = new Intent();
                  result.putExtra("addr", addr);
                  result.putExtra("idx_start", et_idx.getText().toString());
                  result.putExtra("idx_end", et_idx.getText().toString());
                  setResult(RESULT_OK, result);
                } else {
                  setResult(RESULT_CANCELED);
                }
                finish();
              }
            });
  }