@TargetApi(11)
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_pens_calc, parent, false);
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
    }

    pOkladZvan = (EditText) v.findViewById(R.id.edPOklad_zvan);
    pOkladDolg = (EditText) v.findViewById(R.id.edPOklad_dolg);
    pProcentNadbv = (EditText) v.findViewById(R.id.edPProcent_nadb);
    pKalendVisl = (EditText) v.findViewById(R.id.edKalendVisl);

    if (pens.getpOkladZvani() != 0) pOkladZvan.setText(String.valueOf((int) pens.getpOkladZvani()));
    if (pens.getpOkladDolg() != 0) pOkladDolg.setText(String.valueOf((int) pens.getpOkladDolg()));
    if (pens.getVislLetPoln() != 0)
      pProcentNadbv.setText(String.valueOf((int) pens.getVislLetPoln()));
    if (pens.getpKlandVisl() != 0) pKalendVisl.setText(String.valueOf((int) pens.getpKlandVisl()));

    pOkladZvan.addTextChangedListener(new GenericTextWatcher(pOkladZvan));
    pOkladDolg.addTextChangedListener(new GenericTextWatcher(pOkladDolg));
    pProcentNadbv.addTextChangedListener(new GenericTextWatcher(pProcentNadbv));
    pKalendVisl.addTextChangedListener(new GenericTextWatcher(pKalendVisl));
    pKalendVisl.setOnFocusChangeListener(new GenFocus());
    return v;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_fine, container, false);
    desc = (EditText) view.findViewById(R.id.desc);
    desc.setOnFocusChangeListener(
        new OnFocusChangeListener() {

          @Override
          public void onFocusChange(View arg0, boolean arg1) {
            if (!arg1) {
              if (desc.getText().length() < 1) {
                desc.setText("Description cannot be empty");
              }
            }
          }
        });
    cost = (EditText) view.findViewById(R.id.cost);
    cost.setOnFocusChangeListener(
        new OnFocusChangeListener() {

          @Override
          public void onFocusChange(View arg0, boolean arg1) {
            if (!arg1) {
              if (isNumber(cost.getText().toString())) {
              } else {
                cost.setError("Invalid cost");
              }
            }
          }
        });
    type = (Spinner) view.findViewById(R.id.type);
    button1 = (Button) view.findViewById(R.id.button1);
    button1.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            if (desc.getText().toString().length() > 1 & isNumber(cost.getText().toString())) {
              ViewFinePricing ab = new ViewFinePricing();
              List<NameValuePair> params = new LinkedList<NameValuePair>();
              params.add(new BasicNameValuePair("opt", "insert"));
              params.add(new BasicNameValuePair("t", "fine"));
              params.add(new BasicNameValuePair("cost", cost.getText().toString()));
              params.add(new BasicNameValuePair("desc", desc.getText().toString()));
              params.add(new BasicNameValuePair("type", type.getSelectedItem().toString()));
              new InsertForm(getActivity(), params).execute("http://10.0.2.2:8080/B2B/pricing.jsp");
              cost.setText("");
              desc.setText("");
              fragmentTransaction = fm.beginTransaction();
              fragmentTransaction.replace(R.id.myfragment, ab);
              fragmentTransaction.commit();
            } else {
              Toast.makeText(getActivity(), "All fields are mandatory", Toast.LENGTH_SHORT).show();
            }
          }
        });
    return view;
  }
  private void createValidationsOnLostFocus() {
    // validate on lost focus
    mTxtAccountName.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View view, boolean b) {
            if (!b)
              if (mPresenter.validateAccountName(mTxtAccountName.getText().toString(), true))
                mTxtAccountName.setError(null);
          }
        });

    mTxtDueDate.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View view, boolean b) {
            if (!b) {
              if (mPresenter.validateDueDate(mTxtDueDate.getText().toString(), true))
                mTxtDueDate.setError(null);
            } else {
              fromDatePickerDialog.show();
            }
          }
        });

    mTxtBarCode.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View view, boolean b) {
            if (!b)
              if (mPresenter.validateBarCode(mTxtBarCode.getText().toString(), true))
                mTxtBarCode.setError(null);
          }
        });
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.world_info);
    gameModeText = (TextView) findViewById(R.id.world_info_gamemode);
    gameModeChangeButton = (Button) findViewById(R.id.world_info_gamemode_change);
    gameModeChangeButton.setOnClickListener(this);
    worldTimeText = (EditText) findViewById(R.id.world_info_time_text);
    worldTimeText.setOnFocusChangeListener(this);
    spawnToPlayerButton = (Button) findViewById(R.id.world_info_spawn_to_player_button);
    spawnToPlayerButton.setOnClickListener(this);
    warpToSpawnButton = (Button) findViewById(R.id.world_info_warp_to_spawn_button);
    warpToSpawnButton.setOnClickListener(this);
    timeToMorningButton = (Button) findViewById(R.id.world_info_time_to_morning);
    timeToMorningButton.setOnClickListener(this);
    timeToNightButton = (Button) findViewById(R.id.world_info_time_to_night);
    timeToNightButton.setOnClickListener(this);
    playerXText = (TextView) findViewById(R.id.world_info_player_x);
    playerYText = (TextView) findViewById(R.id.world_info_player_y);
    playerZText = (TextView) findViewById(R.id.world_info_player_z);
    healthText = (EditText) findViewById(R.id.world_info_health);
    fullHealthButton = (Button) findViewById(R.id.world_info_full_health);
    infiniteHealthButton = (Button) findViewById(R.id.world_info_infinite_health);
    healthText.setOnFocusChangeListener(this);
    fullHealthButton.setOnClickListener(this);
    infiniteHealthButton.setOnClickListener(this);
    sidewaysOnButton = (Button) findViewById(R.id.world_info_sideways_on);
    sidewaysOffButton = (Button) findViewById(R.id.world_info_sideways_off);
    sidewaysOnButton.setOnClickListener(this);
    sidewaysOffButton.setOnClickListener(this);
    worldNameText = (TextView) findViewById(R.id.world_info_name);
    worldNameText.setOnFocusChangeListener(this);
    worldFolderNameText = (TextView) findViewById(R.id.world_info_folder_name);
    worldFolderNameText.setOnFocusChangeListener(this);
    movePlayerButton = (Button) findViewById(R.id.world_info_move_player);
    movePlayerButton.setOnClickListener(this);

    flyingBox = (CheckBox) findViewById(R.id.world_info_flying);
    flyingBox.setOnClickListener(this);
    invulnerableBox = (CheckBox) findViewById(R.id.world_info_invulnerable);
    invulnerableBox.setOnClickListener(this);
    instaBuildBox = (CheckBox) findViewById(R.id.world_info_insta_build);
    instaBuildBox.setOnClickListener(this);
    mayFlyBox = (CheckBox) findViewById(R.id.world_info_may_fly);
    mayFlyBox.setOnClickListener(this);

    dayCycleStopTimeText = (TextView) findViewById(R.id.world_info_day_cycle_stop_time_text);
    dayCycleStopTimeText.setOnFocusChangeListener(this);

    spawnMobsBox = (CheckBox) findViewById(R.id.world_info_spawn_mobs);
    spawnMobsBox.setOnClickListener(this);

    // if (EditorActivity.level != null) {
    //	onLevelDataLoad();
    // } else {

    // }

  }
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
   LayoutInflater inflater = getActivity().getLayoutInflater();
   View view = inflater.inflate(R.layout.dialog_add_availability, null);
   mStartDaySpinner = (Spinner) view.findViewById(R.id.start_day_of_week_spinner);
   ArrayAdapter<CharSequence> startAdapter =
       ArrayAdapter.createFromResource(
           getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item);
   startAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   mStartDaySpinner.setAdapter(startAdapter);
   mEndDaySpinner = (Spinner) view.findViewById(R.id.end_day_of_week_spinner);
   ArrayAdapter<CharSequence> endAdapter =
       ArrayAdapter.createFromResource(
           getActivity(), R.array.days_of_week, android.R.layout.simple_spinner_item);
   endAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   mEndDaySpinner.setAdapter(endAdapter);
   mStartTimeEdit = (EditText) view.findViewById(R.id.edit_start_time);
   mStartTimeEdit.setInputType(InputType.TYPE_NULL);
   mStartTimeEdit.setOnFocusChangeListener(mTimeFocusListener);
   mStartTimeEdit.setOnClickListener(mTimeClickListener);
   mEndTimeEdit = (EditText) view.findViewById(R.id.edit_end_time);
   mEndTimeEdit.setInputType(InputType.TYPE_NULL);
   mEndTimeEdit.setOnFocusChangeListener(mTimeFocusListener);
   mEndTimeEdit.setOnClickListener(mTimeClickListener);
   builder.setView(view);
   builder.setPositiveButton(
       R.string.dialog_add,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           if (mStartHour == null || mEndHour == null) {
             Toast.makeText(getActivity(), "Times not set!", Toast.LENGTH_SHORT).show();
             return;
           }
           Availability avail = new Availability();
           avail.startHour = mStartHour;
           avail.startMinute = mStartMinute;
           avail.endHour = mEndHour;
           avail.endMinute = mEndMinute;
           avail.startDay = mStartDaySpinner.getSelectedItemPosition();
           avail.endDay = mEndDaySpinner.getSelectedItemPosition();
           if (mListener != null) {
             mListener.onAvailabilityAdded(avail);
           }
         }
       });
   builder.setNegativeButton(
       R.string.dialog_cancel,
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           AddAvailabilityDialog.this.getDialog().cancel();
         }
       });
   builder.setTitle(R.string.add_availability);
   return builder.create();
 }
 private void setupEditTextFocusChangeListener() {
   EditBoxFocusChangeListener textFocusChangeListener = new EditBoxFocusChangeListener();
   EditText text = (EditText) findViewById(R.id.pingTargetText);
   text.setOnFocusChangeListener(textFocusChangeListener);
   text = (EditText) findViewById(R.id.tracerouteTargetText);
   text.setOnFocusChangeListener(textFocusChangeListener);
   text = (EditText) findViewById(R.id.httpUrlText);
   text.setOnFocusChangeListener(textFocusChangeListener);
   text = (EditText) findViewById(R.id.dnsLookupText);
   text.setOnFocusChangeListener(textFocusChangeListener);
   text = (EditText) findViewById(R.id.UDPBurstLookupText);
   text.setOnFocusChangeListener(textFocusChangeListener);
 }
  @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);
    setContentView(R.layout.main);

    this.findAllViewsById();

    moviesSearchRadioButton.setOnClickListener(radioButtonListener);
    peopleSearchRadioButton.setOnClickListener(radioButtonListener);

    searchButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String query = searchEditText.getText().toString();
            if (moviesSearchRadioButton.isChecked()) {
              longToast(moviesSearchRadioButton.getText() + " " + query);
            } else if (peopleSearchRadioButton.isChecked()) {
              longToast(peopleSearchRadioButton.getText() + " " + query);
            }
          }
        });

    searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener(getString(R.string.search)));

    int id = searchRadioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) findViewById(id);
    searchTypeTextView.setText(radioButton.getText());
  }
Example #9
0
  private void setDateField() {
    Calendar now = Calendar.getInstance();
    final DatePickerDialog dpd =
        DatePickerDialog.newInstance(
            new DatePickerDialog.OnDateSetListener() {
              @Override
              public void onDateSet(
                  DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
                Calendar newDate = Calendar.getInstance();
                newDate.set(year, monthOfYear, dayOfMonth);
                mFechaAnterior.setText(mDateFormatter.format(newDate.getTime()));
              }
            },
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH),
            now.get(Calendar.DAY_OF_MONTH));

    mFechaAnterior.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) dpd.show(getFragmentManager(), "DatePickerDialog");
          }
        });

    dpd.setOnDismissListener(
        new DialogInterface.OnDismissListener() {
          @Override
          public void onDismiss(DialogInterface dialog) {
            mUltimoPago.requestFocus();
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    searchEditText = (EditText) findViewById(R.id.etSearch);
    moviesSearchRadioButton = (RadioButton) findViewById(R.id.rMovie);
    peopleSearchRadioButton = (RadioButton) findViewById(R.id.rPeople);
    searchRadioGroup = (RadioGroup) findViewById(R.id.rgSelector);
    searchButton = (Button) findViewById(R.id.bSearch);
    searchTypeTextView = (TextView) findViewById(R.id.search_type_text_view);

    moviesSearchRadioButton.setOnClickListener(radioButtonListener);
    peopleSearchRadioButton.setOnClickListener(radioButtonListener);

    searchButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String query = searchEditText.getText().toString();
            if (moviesSearchRadioButton.isChecked()) {
              longToast(moviesSearchRadioButton.getText() + " " + query);
            } else if (peopleSearchRadioButton.isChecked()) {
              longToast(peopleSearchRadioButton.getText() + " " + query);
            }
          }
        });

    searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener("Search"));

    int id = searchRadioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) findViewById(id);
    searchTypeTextView.setText(radioButton.getText());
  }
Example #11
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    view = inflater.inflate(R.layout.formulario4, container, false);
    editTextCodigoApuntador = (EditText) view.findViewById(R.id.editTextCodigoApuntador);
    listaCodigoVagones = (Spinner) view.findViewById(R.id.listaCodigoVagones);
    txtDescCodigoApuntador = (EditText) view.findViewById(R.id.txtDescCodigoApuntador);
    layout = (RelativeLayout) view.findViewById(R.id.formulario4);
    editTextCodigoApuntador.setOnFocusChangeListener(
        (new MyOnFocusListenerFactory(
                txtDescCodigoApuntador,
                ourInstance.context.getEntityManager(),
                Empleados.class,
                Empleados.NOMBRE,
                Empleados.ID_EMPLEADO))
            .setTitle("Empleado"));

    try {
      listaCodigoVagones.setAdapter(findCodigosVehiculos(Vehiculos.class, "C"));
    } catch (Exception ex) {
      Log.e("Error", "Al cargar las listas en el formulario principal.", ex);
      Toast.makeText(this.context, "Error al cargar la lista en pantalla.", Toast.LENGTH_SHORT)
          .show();
    }

    return view;
  }
Example #12
0
    public View getView(final Context context) throws UnsupportedOperationException {
      EditText input = new FloatingHintEditText(context);
      input.setInputType(InputType.TYPE_CLASS_TEXT);
      input.setText(mValue);

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

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

      mView = (View) input;
      return mView;
    }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_ui);

    // --the two buttons are wired to the same event handler--
    Button btn1 = (Button) findViewById(R.id.btn1);
    btn1.setOnClickListener(btnListener);

    Button btn2 = (Button) findViewById(R.id.btn2);
    btn2.setOnClickListener(btnListener);

    // --create an anonymous inner class to act as an onfocus listener--
    EditText txt1 = (EditText) findViewById(R.id.txt1);
    txt1.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            Toast.makeText(
                    getBaseContext(),
                    ((EditText) v).getId() + " has focus - " + hasFocus,
                    Toast.LENGTH_LONG)
                .show();
          }
        });
  }
  @Override
  public void onStart() {
    super.onStart();

    AlertDialog dialog = (AlertDialog) getDialog();

    dialog
        .getButton(AlertDialog.BUTTON_NEGATIVE)
        .setTextColor(ColorScheme.getPrimaryText(getActivity()));

    positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
    positiveButton.setTextColor(ColorScheme.getAccent());
    positiveButton.setEnabled(false);

    editFileName.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {

          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            fromUser = hasFocus;
          }
        });

    editScriptName.addTextChangedListener(scriptNameTextWatcher);
    editFileName.addTextChangedListener(fileNameTextWatcher);

    KeyboardUtils.showKeyboard(editScriptName, true);
  }
  private void initializeUrlField() {
    mUrlTextView = (EditText) findViewById(R.id.url);
    mUrlTextView.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if ((actionId != EditorInfo.IME_ACTION_GO)
                && (event == null
                    || event.getKeyCode() != KeyEvent.KEYCODE_ENTER
                    || event.getKeyCode() != KeyEvent.ACTION_DOWN)) {
              return false;
            }

            mTab.loadUrlWithSanitization(mUrlTextView.getText().toString());
            mUrlTextView.clearFocus();
            setKeyboardVisibilityForUrl(false);
            mTab.getContentView().requestFocus();
            return true;
          }
        });
    mUrlTextView.setOnFocusChangeListener(
        new OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            setKeyboardVisibilityForUrl(hasFocus);
            mNextButton.setVisibility(hasFocus ? GONE : VISIBLE);
            mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE);
            if (!hasFocus) {
              mUrlTextView.setText(mTab.getContentView().getUrl());
            }
          }
        });
  }
  void requestFocusAndShowInputMode(final EditText tv) {

    // Bring up the softkeyboard so the user can immediately enter msg. This
    // call won't do anything on devices with a hard keyboard.

    tv.setOnFocusChangeListener(
        new OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, final boolean hasFocus) {
            // TODO Auto-generated method stub
            if (hasFocus) {
              Handler handler = new Handler();
              handler.postDelayed(
                  new Runnable() {
                    public void run() {
                      InputMethodManager imm =
                          (InputMethodManager)
                              tv.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                      if (hasFocus) {
                        imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
                      } else {
                        imm.hideSoftInputFromWindow(tv.getWindowToken(), 0);
                      }
                    }
                  },
                  300);
            }
          }
        });
  }
  private void init(AttributeSet attrs) {
    inflate(getContext(), R.layout.searchbar, this);

    TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.MaterialSearchBar);
    iconRightResId = array.getResourceId(R.styleable.MaterialSearchBar_iconRight, -1);
    iconLefttResId = array.getResourceId(R.styleable.MaterialSearchBar_iconLeft, -1);
    hint = array.getString(R.styleable.MaterialSearchBar_hint);
    maxSuggestionCount = array.getInt(R.styleable.MaterialSearchBar_maxSuggestionsCount, 3);
    speechMode = array.getBoolean(R.styleable.MaterialSearchBar_speechMode, false);

    destiny = getResources().getDisplayMetrics().density;
    adapter = new SuggestionsAdapter(LayoutInflater.from(getContext()));
    adapter.setOnClickListener(this);
    adapter.maxSuggestionsCount = maxSuggestionCount;
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.mt_recycler);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

    array.recycle();

    searchIcon = (ImageView) findViewById(R.id.mt_search);
    arrowIcon = (ImageView) findViewById(R.id.mt_arrow);
    searchEdit = (EditText) findViewById(R.id.mt_editText);
    inputContainer = (LinearLayout) findViewById(R.id.inputContainer);
    findViewById(R.id.mt_clear).setOnClickListener(this);

    arrowIcon.setOnClickListener(this);
    searchEdit.setOnFocusChangeListener(this);
    setOnClickListener(this);
    searchEdit.setOnEditorActionListener(this);
    if (speechMode) searchIcon.setOnClickListener(this);

    setupIcons();
  }
Example #18
0
 public TextBoxBase(ComponentContainer container, EditText textview, int resourceId) {
   super(container, resourceId);
   view = textview;
   // Listen to focus changes
   view.setOnFocusChangeListener(this);
   defaultTextBoxDrawable = view.getBackground();
   fontTypeface = Component.TYPEFACE_DEFAULT;
 }
Example #19
0
  public void onStart() {
    super.onStart();
    EditText editText6 = (EditText) getView().findViewById(R.id.editText6);
    editText6.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
              DateDialog dialog = new DateDialog(v);
              FragmentTransaction ft = getFragmentManager().beginTransaction();
              dialog.show(ft, "DatePicker");
            }
          }
        });
    editText6.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            DateDialog dialog = new DateDialog(v);
            FragmentTransaction ft = getFragmentManager().beginTransaction();
            dialog.show(ft, "DatePicker");
          }
        });

    EditText editText7 = (EditText) getView().findViewById(R.id.editText7);
    editText7.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
              TimeDialog dialog = new TimeDialog(v);
              FragmentTransaction ft = getFragmentManager().beginTransaction();
              dialog.show(ft, "TimePicker");
            }
          }
        });
    editText7.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            TimeDialog dialog = new TimeDialog(v);
            FragmentTransaction ft = getFragmentManager().beginTransaction();
            dialog.show(ft, "TimePicker");
          }
        });
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    getPrefs();
    savePrefs();
    pwdText = (EditText) findViewById(R.id.passwordText1);
    enableCheckBox = (CheckBox) findViewById(R.id.enableCheckBox);
    timeOutText = (EditText) findViewById(R.id.timeOutText);
    useGPSCheckBox = (CheckBox) findViewById(R.id.useGPSCheckBox);
    setFormValues();

    // Enable the testButton
    Button testButton = (Button) findViewById(R.id.testButton);
    testButton.setOnClickListener(this);

    // Save the data when the enter or TAB key is pressed
    pwdText.setOnKeyListener(
        new View.OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && ((keyCode == KeyEvent.KEYCODE_ENTER) || (keyCode == KeyEvent.KEYCODE_TAB))) {
              msgBox("Saving Data");
              getFormValues();
              savePrefs();
              return true;
            }
            return false;
          }
        });

    pwdText.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          public void onFocusChange(View v, boolean hasFocus) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });

    enableCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton v, boolean b) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });

    useGPSCheckBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton v, boolean b) {
            msgBox("Saving Data");
            getFormValues();
            savePrefs();
          }
        });
  }
  /**
   * Register {@link EditText} for using this custom keyboard.
   *
   * @param editText The EditText to register to the custom keyboard.
   */
  public void registerEditText(EditText editText) {

    editText.setOnFocusChangeListener(onFocusChangeListener);

    editText.setOnClickListener(onClickListener);

    // editText.setInputType(editText.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    CompatMisc.getInstance().setInputTypeNoKeyboard(editText);
  }
Example #22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    ButterKnife.bind(this);

    tvTitle.setText("登陆");
    ivLogo.setVisibility(View.GONE);
    sharedPreferences = getSharedPreferences("user_sp", Context.MODE_PRIVATE);

    etPassword.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
              // 22 33 娘
              ivBili22.setBackground(getResources().getDrawable(biliHide[0], null));
              ivBili33.setBackground(getResources().getDrawable(biliHide[1], null));

              // 用户名部分UI
              ivUsername.setBackground(getResources().getDrawable(usernameDrawable[1], null));
              viewUsername.setBackgroundColor(getResources().getColor(lineColorDark));

              // 密码部分UI
              ivPassword.setBackground(getResources().getDrawable(passwordDrawable[0], null));
              viewPassword.setBackgroundColor(getResources().getColor(lineColorPink));
            } else {
              // 22 33 娘
              ivBili22.setBackground(getResources().getDrawable(biliNormal[0], null));
              ivBili33.setBackground(getResources().getDrawable(biliNormal[1], null));

              // 用户名部分UI
              ivUsername.setBackground(getResources().getDrawable(usernameDrawable[0], null));
              viewUsername.setBackgroundColor(getResources().getColor(lineColorPink));

              // 密码部分UI
              ivPassword.setBackground(getResources().getDrawable(passwordDrawable[1], null));
              viewPassword.setBackgroundColor(getResources().getColor(lineColorDark));
            }
          }
        });

    if (Utils.checkNetConnection(getApplicationContext())) {
      Snackbar.make(clContainer, "少年呦 你联网了嘛?", Snackbar.LENGTH_LONG).show();
    }

    if (getIntent().getBooleanExtra("register", false)) {
      etUsername.setText(getIntent().getStringExtra("username"));
      Snackbar.make(clContainer, "注册成功 和我们签订契约吧", Snackbar.LENGTH_LONG).show();
    }

    // 初始化Volley
    HttpTools.init(getApplicationContext());
    httpTools = new HttpTools(getApplicationContext());
  }
  /**
   * Inicializa las vistas de este Fragment
   *
   * @param layout el layout de este Fragment que contiene las vistas
   */
  private void initViews(View layout) {
    actualizable = true;

    mCustomerImage = (ImageView) layout.findViewById(R.id.crypto_customer_image);

    mCustomerName = (EditText) layout.findViewById(R.id.crypto_customer_name);
    mCustomerName.requestFocus();
    mCustomerName.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            getActivity()
                .getWindow()
                .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            if (actualizable) {
              if (!mCustomerName.getText().toString().trim().equals("")) {
                if (cryptoCustomerBitmap != null) {
                  /*
                  new AlertDialog.Builder(v.getContext())
                      .setTitle("Create Identity?")
                      .setMessage("You want to create identity?")
                      .setNegativeButton(android.R.string.no, null)
                      .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface arg0, int arg1) {
                              createNewIdentityInBackDevice("onFocus");
                          }
                      }).create().show();
                   */
                }
              }
            }
          }
        });

    ImageView camara = (ImageView) layout.findViewById(R.id.camara);
    camara.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            dispatchTakePictureIntent();
          }
        });
    ImageView galeria = (ImageView) layout.findViewById(R.id.galeria);
    galeria.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            loadImageFromGallery();
          }
        });

    ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE))
        .toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);

    configureToolbar();
  }
  private void setupWeddingView(View rootView) {
    mWeddingDateEditText = (EditText) rootView.findViewById(R.id.ua_et_wedinfo_date);
    mWeddingLocationEditText = (EditText) rootView.findViewById(R.id.ua_et_wedinfo_wedloc);
    mWeddingbudgetEditText = (EditText) rootView.findViewById(R.id.ua_et_wedinfo_budget);
    hideSoftInput(mWeddingDateEditText);

    mWeddingDateEditText.setOnFocusChangeListener(mOnFocusChangeListener);
    setLocEditAction(
        mWeddingLocationEditText, getActivity().getResources().getString(R.string.ua_wedloctitle));
  }
  private TextView initStatusBar(long providerId, boolean showEdit) {

    EditText statusEdit = (EditText) findViewById(R.id.statusEdit);
    statusEdit.setVisibility(View.GONE);
    TextView statusView = (TextView) findViewById(R.id.statusView);
    statusView.setVisibility(View.GONE);

    if (showEdit) {

      statusEdit.setVisibility(View.VISIBLE);
      statusEdit.setOnKeyListener(
          new OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
              if (KeyEvent.ACTION_DOWN == event.getAction()) {
                switch (keyCode) {
                  case KeyEvent.KEYCODE_DPAD_CENTER:
                  case KeyEvent.KEYCODE_ENTER:
                    updateStatusText();
                    return true;
                }
              }
              return false;
            }
          });

      statusEdit.setOnFocusChangeListener(
          new View.OnFocusChangeListener() {
            public void onFocusChange(View v, boolean hasFocus) {
              if (!hasFocus) {
                updateStatusText();
              }
            }
          });

      return statusEdit;
    } else {
      if (mPresence != null) {
        statusView.setText(mPresence.getStatusText());
      }

      statusView.setVisibility(View.VISIBLE);

      statusView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              mStatusBar = initStatusBar(mProviderId, true);
            }
          });

      return statusView;
    }
  }
  /**
   * The system calls this to get the DialogFragment's layout, regardless of whether it's being
   * displayed as a dialog or an embedded fragment.
   */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d("mine", "onCreateView");

    // Inflate the layout to use as dialog or embedded fragment
    View v = inflater.inflate(R.layout.exercise_creation, container, false);

    getDialog().setTitle("Create New Exercise");

    //
    btnOk = (Button) v.findViewById(R.id.newExerciseOK);
    btnOk.setOnClickListener(this);

    btnCancel = (Button) v.findViewById(R.id.newExerciseCancel);
    btnCancel.setOnClickListener(this);

    etName = (EditText) v.findViewById(R.id.newExerciseName);
    etName.setOnFocusChangeListener(myhandler1);

    // Show soft keyboard automatically
    // etName.requestFocus();
    // getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    // etName.setOnEditorActionListener(this); implements OnEditorActionListener

    // Get ListView object from xml
    mTypeListView = (ListView) v.findViewById(R.id.newExerciseType);
    mTypeListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    // Defined Array values to show in ListView
    // "None",
    // "--------",
    // TODO: add these to ?sql?, allow user to define them?
    String[] values =
        new String[] {"Chest", "Tricep", "Bicep", "Back", "Shoulder", "Legs", "Other"};
    mTypeArrayList = new ArrayList<String>(Arrays.asList(values));

    // Define a new Adapter
    // First parameter - Context
    // Second parameter - Layout for the row
    // Third parameter - ID of the TextView to which the data is written
    // Forth - the Array of data

    mTypeArrayAdapter =
        new ArrayAdapter<String>(
            this.getActivity(),
            android.R.layout.select_dialog_singlechoice,
            android.R.id.text1,
            mTypeArrayList);

    // Assign adapter to ListView
    mTypeListView.setAdapter(mTypeArrayAdapter);
    return v;
  }
  void initView() {

    mHostnameField = (EditText) findViewById(R.id.hostname);
    mHostnameField.setOnFocusChangeListener(mOnFocusChangeHandler);

    mPortField = (EditText) findViewById(R.id.port);
    mPortField.setOnClickListener(mOKHandler);
    mPortField.setOnFocusChangeListener(mOnFocusChangeHandler);

    mProxyWifiOnly = (CheckBox) findViewById(R.id.wifi_only);

    mOKButton = (Button) findViewById(R.id.action);
    mOKButton.setOnClickListener(mOKHandler);

    Button b = (Button) findViewById(R.id.clear);
    b.setOnClickListener(mClearHandler);

    b = (Button) findViewById(R.id.defaultView);
    b.setOnClickListener(mDefaultHandler);
  }
  protected void addListeners() {
    TextChangedListener textChangedListener = new TextChangedListener();
    EditorActionListener editorActionListener = new EditorActionListener();
    FocusChangeListener focusChangeListener = new FocusChangeListener();

    emailEdit.addTextChangedListener(textChangedListener);
    emailEdit.setOnEditorActionListener(editorActionListener);
    emailEdit.setOnFocusChangeListener(focusChangeListener);
    passwordEdit.addTextChangedListener(textChangedListener);
    passwordEdit.setOnEditorActionListener(editorActionListener);
    passwordEdit.setOnFocusChangeListener(focusChangeListener);
  }
Example #29
0
  // @Override
  public void onCreate(Bundle bundle) {
    Log.i(I, "start Settings");
    super.onCreate(bundle);
    Bundle userdatabundle = getIntent().getExtras();
    chooser = userdatabundle.getInt("chooser");

    // VERY IMPORTANT: checks the settings and if the skeleton is not
    // available let it create by ConfigurationSkeletonMaker
    new AccountSettingsChecker();

    switch (chooser) {
      case 1:
        setContentView(R.layout.settings_incoming);
        incoming_button = (Button) findViewById(R.id.settings_incoming_button_save);
        incoming_button.setOnClickListener(this);
        initFields();
        initIncoming();
        break;
      case 2:
        setContentView(R.layout.settings_outgoing);
        outgoing_button = (Button) findViewById(R.id.settings_outgoing_button_save);
        outgoing_button.setOnClickListener(this);
        initFields();
        initOutgoing();
        break;
      case 3:
        setContentView(R.layout.settings_ftp);
        ftp_button = (Button) findViewById(R.id.settings_ftp_button_save);
        httpUrl = (EditText) findViewById(R.id.settings_ftp_httpurl);
        ftp_button.setOnClickListener(this);
        initFields();
        initftp();
        // continuously update edit-url-field
        host.setOnFocusChangeListener(
            new View.OnFocusChangeListener() {
              @Override
              public void onFocusChange(View arg0, boolean arg1) {
                updateHttpUrlField();
              }
            });
        break;
    }

    // Bundle userdatabundle = getIntent().getExtras();
    // user_data = userdatabundle;

    // Button outgoing_button = (Button)
    // findViewById(R.id.settings_outgoing_button_save);
    // outgoing_button.setOnClickListener(this);
    // Button ftp_button = (Button)
    // findViewById(R.id.settings_ftp_button_save);
    // ftp_button.setOnClickListener(this);
  }
 private void ajouterFocusChangedListener() {
   editRechercher.setOnFocusChangeListener(
       new OnFocusChangeListener() {
         public void onFocusChange(View v, boolean hasFocus) {
           if (!hasFocus) {
             InputMethodManager imm =
                 (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
             imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
           }
         }
       });
 }