@Override
  protected void initViews(Bundle savedInstanceState) {
    setContentView(R.layout.activity_add_memo);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      setTranslucentStatus(true);
    }
    mTintManager = new SystemBarTintManager(this);
    mTintManager.setStatusBarTintEnabled(true);
    mTintManager.setNavigationBarTintEnabled(true);
    mTintManager.setStatusBarTintResource(R.color.colorPrimary);

    selectDate = (EditText) findViewById(R.id.add_memo_date_picker_edit_text);
    selectDate.setInputType(InputType.TYPE_NULL);
    selectTime = (EditText) findViewById(R.id.add_memo_time_picker_edit_text);
    selectTime.setInputType(InputType.TYPE_NULL);
    memoEditText = (EditText) findViewById(R.id.add_memo_memo_edit_text);
    addButton = (Button) findViewById(R.id.add_memo_ok_button);
    refreshButton = (Button) findViewById(R.id.add_memo_refresh_button);
    listView = (ListView) findViewById(R.id.add_memo_list_view);
    repeat = (Spinner) findViewById(R.id.add_memo_repeat_spinner);

    selectDate.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            showSelectDateDialog(event);
            return false;
          }
        });

    selectTime.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            showSelectTimeDialog(event);
            return false;
          }
        });

    addButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            save();
          }
        });

    refreshButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            refresh();
          }
        });
  }
 private void setListenerOrAdapter() {
   imageButtonPrevious.setOnClickListener(new ImageButtonPreviousClick());
   listViewFriends.setOnItemClickListener(new ListViewFriendsItemClick());
   editTextSearchFriends.setOnTouchListener(new EditTextSearchFriendsTouch());
   editTextSearchFriends.addTextChangedListener(new EditTextSearchFriendsTextChanged());
   buttonDone.setOnClickListener(new ButtonDoneClick());
 }
  private void initStatus() {
    final EditText statusEdit = (EditText) findViewById(R.id.StatusEditText);
    statusEdit.setInputType(InputType.TYPE_NULL);

    statusEdit.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            statusEdit.setInputType(InputType.TYPE_CLASS_TEXT);
            statusEdit.onTouchEvent(event);
            return true;
          }
        });

    findViewById(R.id.StatusSubmitButton)
        .setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                String statusText =
                    ((EditText) findViewById(R.id.StatusEditText)).getText().toString();
                new AsyncTask<String, Object, Boolean>() {

                  String m_status = "";

                  @Override
                  protected void onPostExecute(Boolean result) {
                    EditText et = ((EditText) findViewById(R.id.StatusEditText));
                    Toast.makeText(
                            et.getContext(),
                            "\"" + et.getText().toString() + "\" Shared!",
                            Toast.LENGTH_SHORT)
                        .show();
                    et.setText(result ? m_status : "");
                  }

                  @Override
                  protected Boolean doInBackground(String... params) {
                    try {
                      m_status = params[0];
                      ServiceHelper.getService().sendStatus(m_status);
                      return true;
                    } catch (RemoteException e) {
                      e.printStackTrace();
                      AppHelper.showFatalError(
                          HomeGridActivity.this, "Error while launching the application");
                    }
                    return false;
                  }
                }.execute(new String[] {statusText});
              }
            });
  }
Example #4
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    context = getContext();

    View view = inflater.inflate(R.layout.xxxhdpi, container, false);
    Button button = (Button) view.findViewById(R.id.button);
    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            editText.setText("");
            editText2.setText("");
          }
        });
    this.editText2 = (EditText) view.findViewById(R.id.editText2);
    this.editText = (EditText) view.findViewById(R.id.editText);
    editText.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            a = true;
            b = false;
            c = false;
            return false;
          }
        });
    editText2.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            a = false;
            b = true;
            c = false;
            return false;
          }
        });
    editText();
    return view;
  }
  private void setTextView() {
    if (mUser == null) {
      return;
    }

    tvChangeProfile = (TextView) this.findViewById(R.id.tv_change_profile);
    String text = "修改" + mUser.getName() + "的资料";
    tvChangeProfile.setText(text);
    et_phone = (EditText) findViewById(R.id.et_profile_telephone);
    et_phone.setText(mUser.getPhone());
    et_phone.setOnTouchListener(onEditTextTouchListener);
    et_email = (EditText) findViewById(R.id.et_profile_email);
    et_email.setText(mUser.getEmail());
    et_email.setOnTouchListener(onEditTextTouchListener);
    et_qq = (EditText) findViewById(R.id.et_profile_qq);
    et_qq.setText(mUser.getQQ());
    et_qq.setOnTouchListener(onEditTextTouchListener);
    et_weibo = (EditText) findViewById(R.id.et_profile_sina_weibo);
    et_weibo.setText(mUser.getSinaWeibo());
    et_weibo.setOnTouchListener(onEditTextTouchListener);
  }
  private void HRM_SetEdtTouchListener() {
    edtAgeInput.setOnTouchListener(edtAgeOnTouchListener);

    Calendar AgeInitCalendar = Calendar.getInstance();
    datePickerDialogAge =
        new DatePickerDialog(
            this,
            dateSetListenerAge,
            AgeInitCalendar.get(Calendar.YEAR),
            AgeInitCalendar.get(Calendar.MONTH),
            AgeInitCalendar.get(Calendar.DATE));
  }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.date_livrare_retur_marfa, container, false);

    spinnerDataRetur = (Spinner) v.findViewById(R.id.spinnerDataRetur);
    populateSpinnerDataRetur();
    setListenerSpinnerData();

    spinnerTransport = (Spinner) v.findViewById(R.id.spinnerTranspRetur);
    populateSpinnerTransport();
    setListenerSpinnerTransport();

    spinnerMotivRetur = (Spinner) v.findViewById(R.id.spinnerMotivRetur);
    populateSpinnerMotivRetur();
    setListenerSpinnerRetur();

    spinnerAdresaRetur = (Spinner) v.findViewById(R.id.spinnerAdresaRetur);
    setSpinnerAdresaListener();
    layoutAdresaNoua = (LinearLayout) v.findViewById(R.id.layoutAdresa);
    layoutAdresaNoua.setVisibility(View.GONE);

    spinnerJudet = (Spinner) v.findViewById(R.id.spinnerJudet);
    setSpinnerJudetListener();
    textOras = (EditText) v.findViewById(R.id.textOras);
    setTextOrasListener();
    textStrada = (EditText) v.findViewById(R.id.textStrada);
    setTextStradaListener();

    textPersoana = (EditText) v.findViewById(R.id.textPersoana);
    textPersoana.setOnTouchListener(this);
    setTextPersoanaListener();
    lpw = new ListPopupWindow(getActivity());
    lpw.setOnItemClickListener(this);

    textTelefon = (EditText) v.findViewById(R.id.textTelefon);
    setTextTelefonListener();

    textObservatii = (EditText) v.findViewById(R.id.textObservatii);
    setTextObservatiiListener();

    btnPozitieAdresa = (Button) v.findViewById(R.id.btnPozitieAdresa);
    setListnerBtnPozitieAdresa();

    return v;
  }
  /**
   * Handles views for the add dialog box
   *
   * @param dialogViews
   */
  public AddMapView(android.view.View dialogViews) {
    mapModel = new ListMapModel();
    mMapName = (EditText) dialogViews.findViewById(R.id.map_name);
    mMapDescription = (EditText) dialogViews.findViewById(R.id.map_description);
    mMapUrl = (EditText) dialogViews.findViewById(R.id.map_url);
    mContext = dialogViews.getContext();
    mMapUrl.setOnTouchListener(
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent event) {

            if (TextUtils.isEmpty(getMapUrl())) {
              setMapUrl("http://");
            }

            return false;
          }
        });
  }
  public void setDefaultSnoozeSpinner() {
    editSnooze.setText(String.valueOf(defaultSnooze));
    editSnooze.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View mView, MotionEvent mMotionEvent) {
            if (mMotionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              final Dialog d = new Dialog(mContext);
              d.setTitle("Default Snooze");
              d.setContentView(R.layout.snooze_picker);
              Button b1 = (Button) d.findViewById(R.id.button1);
              Button b2 = (Button) d.findViewById(R.id.button2);

              final NumberPicker snoozeValue = (NumberPicker) d.findViewById(R.id.numberPicker1);

              SnoozeActivity.SetSnoozePickerValues(snoozeValue, above, defaultSnooze);
              b1.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      defaultSnooze = SnoozeActivity.getTimeFromSnoozeValue(snoozeValue.getValue());
                      editSnooze.setText(String.valueOf(defaultSnooze));

                      d.dismiss();
                    }
                  });
              b2.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      d.dismiss();
                    }
                  });
              d.show();
            }
            return false;
          }
        });
  }
Example #10
0
  private void iniEditext() {
    mClearDrawable = editText.getCompoundDrawables()[2];
    if (mClearDrawable == null) {
      mClearDrawable = getResources().getDrawable(R.drawable.ceshi33);
    }
    mClearDrawable.setBounds(
        0, 0, mClearDrawable.getIntrinsicWidth(), mClearDrawable.getIntrinsicHeight());
    setClearIconVisible(false);
    editText.setOnFocusChangeListener(this);
    editText.setOnTouchListener(this);

    editText.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            setClearIconVisible(arg0.length() > 0);
            if (list == null) {
              list = CityLocationFragment.list;
              filterData(arg0.toString());
            } else {
              filterData(arg0.toString());
            }
          }

          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            // TODO Auto-generated method stub

          }

          @Override
          public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub

          }
        });
  }
  private void bindFields() {
    editTextName = (EditText) findViewById(R.id.insertName);
    editTextName.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.ic_edittext_client, 0);
    editTextName.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            final int DRAWABLE_LEFT = 0;
            final int DRAWABLE_TOP = 1;
            final int DRAWABLE_RIGHT = 2;
            final int DRAWABLE_BOTTOM = 3;

            if (event.getAction() == MotionEvent.ACTION_UP) {
              if (event.getRawX()
                  >= (editTextName.getRight()
                      - editTextName.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                // TODO: Explanation 2:
                final Intent goToSOContacts =
                    new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
                // goToSOContacts.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); //
                // Show user only contacts w/ phone numbers
                startActivityForResult(goToSOContacts, 999);
              }
            }
            return false;
          }
        });
    editTextIdade = (EditText) findViewById(R.id.insertIdade);
    editTextTelefone = (EditText) findViewById(R.id.insertTelefone);
    editTextEmail = (EditText) findViewById(R.id.insertEnderedo);
    editTextCep = (EditText) findViewById(R.id.editTextCep);
    editTextTipoLogradouro = (EditText) findViewById(R.id.editTextTipoLogradouro);
    editTextLogradouro = (EditText) findViewById(R.id.editTextLogradouro);
    editTextBairro = (EditText) findViewById(R.id.editTextBairro);
    editTextCidade = (EditText) findViewById(R.id.editTextCidade);
    editTextEstado = (EditText) findViewById(R.id.editTextEstado);
    bindButtonFindCep();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.editdatescreen);

    initWidget();

    toIntent = getIntent().getStringExtra("to");

    mResult.setHint("Result");
    if (toIntent.equals("mEndDate")) {
      mEnterButton1.setHint("Enter Start Date");
      mEnterButton2.setHint("Enter Number of Working Days");
      mEnterButton2.setInputType(InputType.TYPE_CLASS_NUMBER);
      tv1.setText("Start Date");
      tv2.setText("Number of Working Days");
      tv4.setText(R.string.DaysStartDateBtn);
      var = 1;

    } else if (toIntent.equals("mBetweenDate")) {
      mEnterButton1.setHint("Enter Start Date");
      mEnterButton2.setHint("Enter End Date");
      mEnterButton2.setInputType(InputType.TYPE_CLASS_DATETIME);
      tv1.setText("Start Date");
      tv2.setText("End Date");
      tv4.setText(R.string.DaysBtTwoDatesBtn);
      var = 2;

    } else if (toIntent.equals("mStartingDate")) {
      mEnterButton1.setHint("Enter End Date");
      mEnterButton2.setHint("Enter Number of Working Days");
      mEnterButton2.setInputType(InputType.TYPE_CLASS_NUMBER);
      tv1.setText("End Date");
      tv2.setText("Number of Working Days");
      tv4.setText(R.string.StartWithEndDateBtn);
      var = 3;
    }

    mEnterButton1.setInputType(InputType.TYPE_CLASS_DATETIME);

    mEnterButton1.setOnTouchListener(
        new OnTouchListener() {
          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            showDialog(DATE_PICKER_ID_0);
            return false;
          }
        });

    mEnterButton2.setOnTouchListener(
        new OnTouchListener() {
          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            if (var == 2) {
              showDialog(DATE_PICKER_ID_1);
              bool = true;
            }
            return false;
          }
        });

    mEnterButton2.setOnEditorActionListener(
        new OnEditorActionListener() {
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

            if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
                || (actionId == EditorInfo.IME_ACTION_DONE)) {

              if (!mEnterButton1.getText().toString().trim().equals("")
                  && !mEnterButton2.getText().toString().trim().equals("")) {
                if (var == 1) {

                  countEndDate();

                } else if (var == 3) {

                  countStartDate();
                }
              }
            }
            return false;
          }
        });

    mBackBtn.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub

            onBackPressed();
          }
        });
  }
Example #13
0
  private void onClik() {
    back.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    spinnerMoney.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            int position = spinnerMoney.getSelectedItemPosition();
            if (position == 0) {
              oneAmt = "1";
            } else if (position == 1) {
              oneAmt = "2";
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    spinnerDeduct.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            int position = spinnerDeduct.getSelectedItemPosition();
            PublicMethod.myOutput("*********position " + position);
            if (position == 0) {
              pushmoney = "0";
            } else if (position == 1) {
              pushmoney = "1";
            } else if (position == 2) {
              pushmoney = "2";
            } else if (position == 3) {
              pushmoney = "3";
            } else if (position == 4) {
              pushmoney = "4";
            } else if (position == 5) {
              pushmoney = "5";
            } else if (position == 6) {
              pushmoney = "6";
            } else if (position == 7) {
              pushmoney = "7";
            } else if (position == 8) {
              pushmoney = "8";
            } else if (position == 9) {
              pushmoney = "9";
            } else if (position == 10) {
              pushmoney = "10";
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    spinnerType.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            int position = spinnerType.getSelectedItemPosition();
            PublicMethod.myOutput("*********position " + position);
            if (position == 0) {
              open_flag = "0";
            } else if (position == 1) {
              open_flag = "2"; // 认购后公开
            } else if (position == 2) {
              open_flag = "1";
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });
    buttonMoney.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = intent = new Intent(JoinBuyChange.this, RuyicaiAndroid.class);
            Bundle mBundle = new Bundle();
            mBundle.putInt("index", 2); // 充值界面
            mBundle.putBoolean("flag", true);
            intent.putExtras(mBundle);
            startActivity(intent);
          }
        });
    buttonSubmit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            buyamt_by_user = editBuy.getText().toString();
            baodiamt = editLeast.getText().toString();
            name = editName.getText().toString();
            allAmt = editMoney.getText().toString();
            int all = 0;
            int buy = 0;
            int bao = 0;
            if (!allAmt.equals("")) {
              all = Integer.parseInt(allAmt) / Integer.parseInt(oneAmt);
            }
            if (!buyamt_by_user.equals("")) {
              buy = Integer.parseInt(buyamt_by_user);
            }
            if (!baodiamt.equals("")) {
              bao = Integer.parseInt(baodiamt);
            }
            allNum = Integer.toString(all); // all必须是整数
            if (!editTell.getText().toString().equals("")) {
              descible = editTell.getText().toString();
            }
            if (all < (buy + bao)) {

              Toast.makeText(JoinBuyChange.this, "发起合买失败,认购份数和保底份数之和不能大于总份数!", Toast.LENGTH_SHORT)
                  .show();
            } else if (buyamt_by_user.equals("") | baodiamt.equals("")) {

              Toast.makeText(JoinBuyChange.this, "认购份数或保底份数不能为空!", Toast.LENGTH_SHORT).show();
            } else if (Integer.parseInt(buyamt_by_user) < 1) {
              Toast.makeText(JoinBuyChange.this, "至少认购一份,不能为零!", Toast.LENGTH_SHORT).show();
            } else {
              submit(); // 提交
            }
          }
        });
    editLeast.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            editLeast.setText("");
            return false;
          }
        });
    editBuy.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            editBuy.setText("");
            return false;
          }
        });
  }
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootview = inflater.inflate(R.layout.activity_modif_profil, container, false);

    btn_modif_profil = (Button) rootview.findViewById(R.id.modif_info_profil);
    Typeface font =
        Typeface.createFromAsset(
            getActivity().getAssets(), "font-awesome-4.3.0/fonts/fontawesome-webfont.ttf");
    btn_modif_profil.append("    MODIFIER");
    btn_modif_profil.setTypeface(font);

    /** Recuperer les valeurs des composants dans des variables */
    pseudo = (TextView) rootview.findViewById(R.id.txt_modif_pseudo_userProfil);
    mail = (TextView) rootview.findViewById(R.id.txt_modif_courriel_userProfil);
    ancienMdp = (EditText) rootview.findViewById(R.id.txt_ancien_mdp);
    mdp = (EditText) rootview.findViewById(R.id.txtMdp_modif);
    confmdp = (EditText) rootview.findViewById(R.id.txtConfMdp_modif);
    dateNais = (EditText) rootview.findViewById(R.id.txt_modif_date_naiss_userProfil);
    nom = (EditText) rootview.findViewById(R.id.txt__modif_nom_userProfil);
    prenom = (EditText) rootview.findViewById(R.id.txt_modif_prenom_userProfil);

    radioM = (RadioButton) rootview.findViewById(R.id.radioM_modif);
    radioF = (RadioButton) rootview.findViewById(R.id.radioF_modif);

    // compteCree = (TextView) rootview.findViewById(R.id.compteCree);
    ((RadioButton) rootview.findViewById(R.id.radioF_modif))
        .setOnTouchListener(radioButtonListener);
    ((RadioButton) rootview.findViewById(R.id.radioM_modif))
        .setOnTouchListener(radioButtonListener);
    /** Obtenir l'heure courante du calendrier */
    final Calendar c = Calendar.getInstance();
    year = c.get(Calendar.YEAR);
    month = c.get(Calendar.MONTH);
    day = c.get(Calendar.DAY_OF_MONTH);

    /** gestion affichage calendrier */
    final EditText txtCalendar =
        (EditText) rootview.findViewById(R.id.txt_modif_date_naiss_userProfil);
    txtCalendar.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            datePickerDialog.show();
            return false;
          }
        });
    btn_modif_profil.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // Perform action on click
            modifierUtilisateur(v);
          }
        });
    // Initialisation des champs

    ParseUser us = ParseUser.getCurrentUser();
    pseudo.setText(us.getString("username"));
    mail.setText(us.getString("email"));
    SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy");
    dateNais.setText(sdf.format(us.getDate("birthday")));
    nom.setText(us.getString("lastname"));
    prenom.setText(us.getString("firstname"));

    String gender = us.getString("gender");
    if (gender.equals("M")) {

      radioM.setChecked(true);
    } else {
      radioF.setChecked(true);
    }

    /** Controle sur l'ancien mdp saisie */
    //     strAncienMdp = ancienMdp.getText().toString();

    /** Controle sur la confirmation de Mdp */
    final EditText password1 = (EditText) rootview.findViewById(R.id.txtMdp_modif);
    final EditText password2 = (EditText) rootview.findViewById(R.id.txtConfMdp_modif);

    strMdp = password1.getText().toString();

    /** vérification du mot de passe et de la confirmation de mot de passe */
    password2.addTextChangedListener(
        new TextWatcher() {
          public void afterTextChanged(Editable s) {
            String strPass1 = password1.getText().toString();
            String strPass2 = password2.getText().toString();
            if (!strPass1.equals(strPass2)) {

              password2.setError("Confirmation invalide");
            } else {
              password2.setError(null);
            }
          }

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

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

    password1.addTextChangedListener(
        new TextWatcher() {
          public void afterTextChanged(Editable s) {
            String strPass1 = password1.getText().toString();
            String strPass2 = password2.getText().toString();
            if (!strPass1.equals(strPass2) && strPass2.length() > 0) {
              password2.setError("Confirmation invalide");
            } else {
              password2.setError(null);
            }
          }

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

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

    /** Controle sur la taille du Mdp */
    password1.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {

          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus && password1.getText().length() < 5 && password1.getText().length() > 0) {
              // code to execute when EditText loses focus
              password1.setError("mot de passe trop court: minimum 5 caractères");
            } else if (password1.getText().length() >= 5) {
              password1.setError(null);
            }
          }
        });

    /** Controle sur l'age de l'utilisateur min 18 ans */
    dateNais.addTextChangedListener(
        new TextWatcher() {
          public void afterTextChanged(Editable s) {
            int age = getYears(dateNais.getText().toString());
            if (age < 18) {
              dateNais.setError("Age min 18 ans");
            } else {
              dateNais.setError(null);
            }
          }

          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            dateNais.setError(null);
          }

          public void onTextChanged(CharSequence s, int start, int before, int count) {
            dateNais.setError(null);
          }
        });

    datePickerDialog = new DatePickerDialog(getActivity(), pickerListener, year, month, day);
    return rootview;
  }
Example #15
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);

    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_hmac_srl);
    llRoot = (LinearLayout) view.findViewById(R.id.fragment_hmac_ll_root);

    etInput = (EditText) view.findViewById(R.id.fragment_hmac_et_input);
    etPassword = (EditText) view.findViewById(R.id.fragment_hmac_et_password);

    etHmacMd5 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_md5);
    etHmacSha1 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha1);
    etHmacSha224 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha224);
    etHmacSha256 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha256);
    etHmacSha384 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha384);
    etHmacSha512 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha512);

    etHmacMd5.setInputType(InputType.TYPE_NULL);
    etHmacSha1.setInputType(InputType.TYPE_NULL);
    etHmacSha224.setInputType(InputType.TYPE_NULL);
    etHmacSha256.setInputType(InputType.TYPE_NULL);
    etHmacSha384.setInputType(InputType.TYPE_NULL);
    etHmacSha512.setInputType(InputType.TYPE_NULL);

    MyEditTextOnTouchListener editTextOnTouchListener = new MyEditTextOnTouchListener();

    etHmacMd5.setOnTouchListener(editTextOnTouchListener);
    etHmacSha1.setOnTouchListener(editTextOnTouchListener);
    etHmacSha224.setOnTouchListener(editTextOnTouchListener);
    etHmacSha256.setOnTouchListener(editTextOnTouchListener);
    etHmacSha384.setOnTouchListener(editTextOnTouchListener);
    etHmacSha512.setOnTouchListener(editTextOnTouchListener);
    llRoot.setOnTouchListener(editTextOnTouchListener);

    CommonTextWatcher textWatcher = new CommonTextWatcher();

    etInput.addTextChangedListener(textWatcher);
    etPassword.addTextChangedListener(textWatcher);

    swipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            if (!(TextUtils.isEmpty(etInput.getText())
                && TextUtils.isEmpty(etPassword.getText()))) {
              etInput.setText("");
              etPassword.setText("");
              etHmacMd5.setText("");
              etHmacSha1.setText("");
              etHmacSha224.setText("");
              etHmacSha256.setText("");
              etHmacSha384.setText("");
              etHmacSha512.setText("");
            }
            if (getActivity() != null) {
              getActivity().getCurrentFocus().clearFocus();
              swipeRefreshLayout.setRefreshing(false);
            }
          }
        });
  }
Example #16
0
  /** 初始化组件 */
  public void init() {
    isDialog = false;
    Button imgRetrun = (Button) findViewById(R.id.layout_gift_img_return);
    imgRetrun.setBackgroundResource(R.drawable.returnselecter);
    // ImageView的返回事件
    imgRetrun.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    editLanguage = (EditText) findViewById(R.id.gift_edit_language);
    editLanguage.setText(languageStr);
    editPhone = (EditText) findViewById(R.id.gift_edit_phone);
    ok = (Button) findViewById(R.id.gift_img_ok);
    ok.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            addPerson();
            if (checkedPersons.size() != 0) {
              beginTouZhu();
            } else {
              Toast.makeText(
                      GiftActivity.this, R.string.ruyichuanqing_atleastone, Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });
    cancel = (Button) findViewById(R.id.gift_img_cancel);
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    language = (ImageButton) findViewById(R.id.gift_img_language);
    language.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            if (Constants.avdiceStr == null) {
              giftMsgNet();
            } else {
              adviceDialog();
            }
          }
        });
    phone = (ImageButton) findViewById(R.id.gift_img_phone);
    phone.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            editPhone.setText("");
            checkedPersons.clear();
            LinkDialog();
          }
        });
    zhuma = (TextView) findViewById(R.id.gift_text_zhuma);
    zhushu = (TextView) findViewById(R.id.gift_text_zhushu);
    editLanguage.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
            // TODO Auto-generated method stub
            editLanguage.setFocusable(true);
            return false;
          }
        });
    editPhone.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
            // TODO Auto-generated method stub
            editPhone.setFocusable(true);
            return false;
          }
        });
  }
Example #17
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    termOut = (EditText) findViewById(R.id.termOutput);
    termOut.setFocusable(false);
    termOut.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            termOut.setFocusable(true);
            prompt_box.setFocusable(false);
            termOut.requestFocus();
            return true;
          }
        });

    // termOut.setOnClickListener(termOut_onClicklsn);

    prompt_box = (EditText) findViewById(R.id.Input);
    prompt_box.setSelection(prompt_box.getText().length());
    prompt_box.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            termOut.setFocusable(false);
            prompt_box.setFocusableInTouchMode(true);
            prompt_box.setFocusable(true);
            prompt_box.requestFocus();
            // prompt_box.setSelection(prompt_box.getText().length());
            if (prompt_box.getSelectionStart() <= 2) prompt_box.setSelection(2);
            return true;
          }
        });

    prompt_box.setOnKeyListener(
        new OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_DEL) {
              if (prompt_box.getText().length() <= 2 || prompt_box.getSelectionStart() <= 2)
                return true;
            }

            if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
              if (prompt_box.getSelectionStart() <= 2) return true;
            }
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
              if (event.getAction() == KeyEvent.ACTION_DOWN) {
                enter_pressed();
                return true;
              } else {
                return false;
              }
            }
            return false;
          }
        });

    enter_button = (Button) findViewById(R.id.enter);
    enter_button.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            enter_pressed();
          }
        });

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs.registerOnSharedPreferenceChangeListener(this);
    mSettings = new FsSetting(mPrefs);
    // mSettings.readPrefs(mPrefs);
    startTest(mSettings);
  }
Example #18
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_create_account, null);
    ed_mail = (EditText) view.findViewById(R.id.editText_cre_mail);
    ed_pass = (EditText) view.findViewById(R.id.editText_cre_pass);
    ed_repass = (EditText) view.findViewById(R.id.editText_cre_repass);
    button_create = (Button) view.findViewById(R.id.but_cre_creaccount);

    button_create.setEnabled(false);
    ed_mail.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            if (ed_mail.getText().toString().equals("") == false
                && ed_pass.getText().toString().equals("") == false
                && ed_repass.getText().toString().equals("") == false) {
              button_create.setEnabled(true);
              button_create.setBackgroundResource(R.drawable.demo2);
            } else {
              button_create.setEnabled(false);
              button_create.setBackgroundResource(R.drawable.demo);
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

          }

          @Override
          public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

          }
        });
    ed_pass.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            if (ed_mail.getText().toString().equals("") == false
                && ed_pass.getText().toString().equals("") == false
                && ed_repass.getText().toString().equals("") == false) {
              button_create.setEnabled(true);
              button_create.setBackgroundResource(R.drawable.demo2);
            } else {
              button_create.setEnabled(false);
              button_create.setBackgroundResource(R.drawable.demo);
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

          }

          @Override
          public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

          }
        });

    ed_repass.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            if (ed_mail.getText().toString().equals("") == false
                && ed_pass.getText().toString().equals("") == false
                && ed_repass.getText().toString().equals("") == false) {
              button_create.setEnabled(true);
              button_create.setBackgroundResource(R.drawable.demo2);
            } else {
              button_create.setEnabled(false);
              button_create.setBackgroundResource(R.drawable.demo);
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

          }

          @Override
          public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

          }
        });
    ed_pass.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            ed_pass.setText("");
            return false;
          }
        });
    ed_repass.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            ed_repass.setText("");
            return false;
          }
        });
    button_create.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            mail = ed_mail.getText().toString();
            pass = ed_pass.getText().toString();
            String repass = ed_repass.getText().toString();
            netWork.setMail(mail);
            netWork.setPass(pass);
            if (!isValidEmail(mail)) {
              AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
              builder.setTitle("Fail");
              builder.setMessage("Mail incorrect @@");
              builder.setNegativeButton(
                  "OK",
                  new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      // TODO Auto-generated method stub
                      dialog.dismiss();
                    }
                  });
              AlertDialog dialog = builder.create();
              dialog.show();
              dialog.setCancelable(false);
            } else if (netWork.checkInternetConnect(getActivity())) {
              check = 0;
              if (pass.equals(repass) == true) {
                NetWorkAsyncTask nw =
                    (NetWorkAsyncTask)
                        new NetWorkAsyncTask()
                            .execute("http://thachpn.name.vn/account/create_account.php");
              } else {
                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setTitle("Error");
                builder.setMessage("Có nhập lại mật khẩu mà cũng sai @@");
                builder.setNegativeButton(
                    "Retry",
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                      }
                    });
                AlertDialog dialog = builder.create();
                dialog.show();
              }
            } else {
              AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
              builder.setTitle("Internet");
              builder.setMessage("Có đéo mạng đâu @@");
              builder.setNegativeButton(
                  "Retry",
                  new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      button_create.callOnClick();
                    }
                  });
              builder.setNeutralButton(
                  "Exit",
                  new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      getActivity().finish();
                    }
                  });
              AlertDialog dialog = builder.create();
              dialog.show();
              dialog.setCancelable(false);
            }
          }
        });
    return view;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View view = inflater.inflate(R.layout.fragment_businessland, container, false);
    context = this.getActivity(); // 获取activity的context
    // 定时器返回广告页面
    //		timer.schedule(new TimerTask() {
    //	        @Override
    //	        public void run() {
    //        		  if(pwdcount > 0)
    //	              {
    //        			  pwdcount=0;
    //	              }
    //	        }
    //	    }, 1000, 10000);       // timeTask
    // =======
    // 操作模块
    // =======
    txtadsTip = (EditText) view.findViewById(R.id.txtadsTip);
    txtadsTip.setFocusable(false); // 不让该edittext获得焦点
    txtadsTip.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            // 关闭软键盘,这样当点击该edittext的时候,不会弹出系统自带的输入法
            txtadsTip.setInputType(InputType.TYPE_NULL);
            return false;
          }
        });
    btnads1 = (ImageButton) view.findViewById(R.id.btnads1);
    btnads1.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("1");
            } else {
              chuhuo("1", 1);
            }
          }
        });
    btnads2 = (ImageButton) view.findViewById(R.id.btnads2);
    btnads2.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("2");
            } else {
              chuhuo("2", 1);
            }
          }
        });
    btnads3 = (ImageButton) view.findViewById(R.id.btnads3);
    btnads3.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("3");
            } else {
              chuhuo("3", 1);
            }
          }
        });
    btnads4 = (ImageButton) view.findViewById(R.id.btnads4);
    btnads4.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("4");
            } else {
              chuhuo("4", 1);
            }
          }
        });
    btnads5 = (ImageButton) view.findViewById(R.id.btnads5);
    btnads5.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("5");
            } else {
              chuhuo("5", 1);
            }
          }
        });
    btnads6 = (ImageButton) view.findViewById(R.id.btnads6);
    btnads6.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("6");
            } else {
              chuhuo("6", 1);
            }
          }
        });
    btnads7 = (ImageButton) view.findViewById(R.id.btnads7);
    btnads7.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("7");
            } else {
              chuhuo("7", 1);
            }
          }
        });
    btnads8 = (ImageButton) view.findViewById(R.id.btnads8);
    btnads8.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("8");
            } else {
              chuhuo("8", 1);
            }
          }
        });
    btnads9 = (ImageButton) view.findViewById(R.id.btnads9);
    btnads9.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("9");
            } else {
              chuhuo("9", 1);
            }
          }
        });
    btnads0 = (ImageButton) view.findViewById(R.id.btnads0);
    btnads0.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (pwdMode) {
              IsAdminSet("0");
            } else {
              chuhuo("0", 1);
            }
          }
        });
    btnadscancel = (ImageButton) view.findViewById(R.id.btnadscancel);
    btnadscancel.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            chuhuo("0", 0);
          }
        });
    btnadsenter = (ImageButton) view.findViewById(R.id.btnadsenter);
    btnadsenter.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            if (count == 0) {
              pwdMode = !pwdMode;
              pwdcount = 0;
            }
          }
        });
    btnadsclass = (ImageButton) view.findViewById(R.id.btnadsclass);
    btnadsclass.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            vmc_classDAO classdao = new vmc_classDAO(context); // 创建InaccountDAO对象
            long count = classdao.getCount();
            ToolClass.Log(ToolClass.INFO, "EV_JNI", "APP<<商品类型数量=" + count, "log.txt");
            if (count > 0) {
              // intent = new Intent(context, BusgoodsClass.class);// 使用Accountflag窗口初始化Intent
              // startActivityForResult(intent,REQUEST_CODE);// 打开Accountflag
              listterner.gotoBusiness(1, null);
            } else {
              //		    		intent = new Intent(context, Busgoods.class);// 使用Accountflag窗口初始化Intent
              //                	intent.putExtra("proclassID", "");
              //                	startActivityForResult(intent,REQUEST_CODE);// 打开Accountflag
              listterner.gotoBusiness(2, null);
            }
          }
        });
    return view;
  }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   initialize();
   url.setOnTouchListener((view, event) -> setHttpProtocol());
 }
Example #21
0
  /** 初始化组件 */
  public void init() {
    isDialog = false;
    if (betAndGift.isZhui()) {
      initZhuiJia();
    }
    zhushu = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_zhushu);
    jine = (TextView) findViewById(R.id.alert_dialog_touzhu_text_one);
    caizhong = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_caizhong);
    caizhong.setText(PublicMethod.toLotno(betAndGift.getLotno()));
    issueText = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_qihao);
    textZhuma = (TextView) findViewById(R.id.alert_dialog_touzhu_text_zhuma);
    textTitle = (TextView) findViewById(R.id.alert_dialog_touzhu_text_zhuma_title);
    issueText.setText("第" + PublicMethod.toIssue(betAndGift.getLotno()) + "期");
    getTouzhuAlert();
    if (type.equals("zc")) {
      textTitle.setText("注码:共有1笔投注");
      textZhuma.setText(betAndGift.getBet_code());
    } else {
      initImageView();
      ZixuanActivity.addView
          .getCodeList()
          .get(ZixuanActivity.addView.getSize() - 1)
          .setTextCodeColor(textZhuma);
      textTitle.setText("注码:" + "共有" + ZixuanActivity.addView.getSize() + "笔投注");
      codeInfo = (Button) findViewById(R.id.alert_dialog_touzhu_btn_look_code);
      isCodeText(codeInfo);
      codeInfo.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              ZixuanActivity.addView.createCodeInfoDialog(GiftActivity.this);
              ZixuanActivity.addView.showDialog();
            }
          });
    }
    Button cancel = (Button) findViewById(R.id.alert_dialog_touzhu_button_cancel);
    Button ok = (Button) findViewById(R.id.alert_dialog_touzhu_button_ok);
    editLanguage = (EditText) findViewById(R.id.gift_edit_language);
    editLanguage.setText(languageStr);
    editPhone = (EditText) findViewById(R.id.gift_edit_phone);
    ok = (Button) findViewById(R.id.alert_dialog_touzhu_button_ok);
    ok.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            addPerson();
            if (checkedPersons.size() != 0) {
              beginTouZhu();
            } else {
              Toast.makeText(
                      GiftActivity.this, R.string.ruyichuanqing_atleastone, Toast.LENGTH_SHORT)
                  .show();
            }
          }
        });
    cancel = (Button) findViewById(R.id.alert_dialog_touzhu_button_cancel);
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    language = (ImageButton) findViewById(R.id.gift_img_language);
    language.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            if (Constants.avdiceStr == null) {
              giftMsgNet();
            } else {
              adviceDialog();
            }
          }
        });
    phone = (ImageButton) findViewById(R.id.gift_img_phone);
    phone.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            editPhone.setText("");
            checkedPersons.clear();
            LinkDialog();
          }
        });
    //		zhuma = (TextView) findViewById(R.id.gift_text_zhuma);
    //		zhushu = (TextView) findViewById(R.id.gift_text_zhushu);
    editLanguage.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
            // TODO Auto-generated method stub
            editLanguage.setFocusable(true);
            return false;
          }
        });
    editPhone.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View arg0, MotionEvent arg1) {
            // TODO Auto-generated method stub
            editPhone.setFocusable(true);
            return false;
          }
        });
  }
Example #22
0
  @Override
  protected void setListener() {
    contactRL.setOnClickListener(this);
    rlOrderTime.setOnClickListener(this);
    caseinfoRl.setOnClickListener(this);
    taskinfoRl.setOnClickListener(this);
    rlBaoDan.setOnClickListener(this);
    rlHistory.setOnClickListener(this);
    messagesQuery.setOnClickListener(this);
    edOrderTime.setOnTouchListener(this);
    edOrderTime.addTextChangedListener(this);
    messagesEditxiepei.setOnClickListener(this);
    drawerUtils.setAcceptOnClick(
        new IBtnAccept() {
          @Override
          public void onClick() {
            /** 接受任务,接受任务时间插入查勘详细表 */
            promptManager.showDialog(
                context,
                "是否接受此任务?",
                R.string.yes,
                R.string.no,
                new ShowDialogPositiveButton() {
                  @Override
                  public void setPositiveButton() {
                    // 确定
                    if (!SystemConfig.isUserExperience) {
                      // 判断是否有联系过客户
                      boolean isContact = UtilIsNotNull.isNotNullContact(DataConfig.tblTaskQuery);
                      if (isContact) {
                        arrivedService(registNo);
                      } else {
                        Toast.showToast(context, "请先与客户取得联系!");
                      }
                    }
                  }

                  @Override
                  public void setNegativeButton() {
                    // 取消
                  }
                });
          }
        });
    drawerUtils.setGaiPaiOnClick(
        new IBtnGaiPai() {
          @Override
          public void onClick() {
            promptManager.showSingnRadio(
                context,
                new ShowDialogGaiPai() {
                  @Override
                  public void setPositiveButton(String reason) {
                    final String str = reason;
                    if (!TextUtils.isEmpty(str)) {
                      List<CertainLossTask> clts = CertainLossTaskAccess.getByRegistNo(registNo);
                      if (clts != null && clts.size() >= 1) {
                        promptManager.showDialog(
                            context,
                            "是否关联定损任务",
                            R.string.yes,
                            R.string.no,
                            new ShowDialogPositiveButton() {
                              @Override
                              public void setPositiveButton() {
                                if (!SystemConfig.isUserExperience) {
                                  // for update by haoyun
                                  // 20130401
                                  // begin
                                  if (SystemConfig.loginResponse.getDutyFlag().equals("on")) {
                                    sendForService("1", str);
                                  } else {
                                    handler.sendEmptyMessage(ConstantValue.PROGRESS_CLOSE);
                                    Message message = Message.obtain();
                                    message.obj = "下班状态不可以改派任务!";
                                    message.what = ConstantValue.ERROE;
                                    handler.sendMessage(message);
                                  }
                                }
                              }

                              @Override
                              public void setNegativeButton() {
                                if (!SystemConfig.isUserExperience) {
                                  if (SystemConfig.loginResponse.getDutyFlag().equals("on")) {
                                    sendForService("0", str);
                                  } else {
                                    handler.sendEmptyMessage(ConstantValue.PROGRESS_CLOSE);
                                    Message message = Message.obtain();
                                    message.obj = "下班状态不可以改派任务!";
                                    message.what = ConstantValue.ERROE;
                                    handler.sendMessage(message);
                                  }
                                }
                              }
                            });
                      } else {
                        sendForService("0", reason);
                      }
                    } else {
                      Toast.showToast(context, "请输入改派原因");
                    }
                  }

                  @Override
                  public void setNegativeButton() {}
                });
          }
        });
  }
  private Dialog createNewRssFeed() {

    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.dialogrss);
    dialog.setTitle("Add new Feed");
    final EditText name = (EditText) dialog.findViewById(R.id.dialogRss_name);
    final EditText url = (EditText) dialog.findViewById(R.id.dialogRss_url);
    Button cancelButton = (Button) dialog.findViewById(R.id.dialogRss_cancel_button);
    Button okButton = (Button) dialog.findViewById(R.id.dialogRss_submit_button);

    url.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (url.getText().toString().equalsIgnoreCase("")) {
              url.setText("http://");
            }
            return false;
          }
        });

    name.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (url.getText().toString().equalsIgnoreCase("http://")) {
              url.setText("");
            }
            return false;
          }
        });

    cancelButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            dialog.hide();
            name.setText("");
            url.setText("");
          }
        });

    okButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            feedName = name.getText().toString();
            urlName = url.getText().toString();
            Boolean verif = true;

            for (RSSFeed rssfeed : rssfeedNames) {

              if (rssfeed.getName().contentEquals(feedName)) {
                verif = false;
              }
            }
            if (verif) {
              ContentValues values = new ContentValues();
              values.put("name", feedName);
              values.put("link", urlName);
              sqlDb.insert("FEEDS", null, values);
              dialog.hide();
              name.setText("");
              url.setText("");
              onCreate(null);
              isVerif = "Feed Add";
              verif();
            } else {
              isVerif = "sorry but the name already exist";
              verif();
            }
          }
        });

    return dialog;
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    editText.setHint(getArguments().getString("hint"));
    isCompanyCircle = getArguments().getBoolean("isCompanyCircle");
    mImm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    getView()
        .findViewById(R.id.ly_other)
        .setOnTouchListener(
            new View.OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                  //                    finish();
                  KeyboardUtil.hideSoftInput(getActivity());
                  if (mComLis != null) {
                    mComLis.onHideCommunityCommentary();
                  }
                  getFragmentManager()
                      .beginTransaction()
                      .remove(CommunityCommentaryFragment.this)
                      .commit();
                  return true;
                }
                return false;
              }
            });
    mRootContainer.setOnInputViewListener(this);

    editText.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
              if (mIsExprShow) {
                mIsExprShow = false;
                mIsSoftKeyboardShow = true;
                mExpressionWidgt.setVisibility(View.GONE);
                mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions);
              }
            }
            return false;
          }
        });
    mSoftKeyboardHeight = PreferencesManager.getSoftKeyboardHeight(getActivity());
    if (mSoftKeyboardHeight > 0) {
      resizeExprArea(Constants.screenWidth);
    } else {
      mSoftKeyboardHeight = Constants.screenHeight / 3;
    }

    /** 测量软键盘所占区域高度 */
    mRootContainer
        .getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                Rect r = new Rect();
                if (mRootContainer != null) {
                  mRootContainer.getWindowVisibleDisplayFrame(r);
                  int screenHeight = mRootContainer.getHeight();
                  final int screenWidth = mRootContainer.getWidth();
                  if (mOriginalHeight == 0) {
                    mOriginalHeight = screenHeight;
                  } else {
                    if (screenHeight != mOriginalHeight && !isExprAreaResized) {
                      mSoftKeyboardHeight = Math.abs(screenHeight - mOriginalHeight);
                      PreferencesManager.saveSoftKeyboardHeight(getActivity(), mSoftKeyboardHeight);
                      isExprAreaResized = true;
                      mUiHandler.post(
                          new Runnable() {
                            @Override
                            public void run() {
                              resizeExprArea(screenWidth);
                            }
                          });
                    }
                  }
                }
              }
            });
    mExpressionWidgt.setmOnExprItemClickListener(this);
    resizeExprArea(Constants.screenWidth);
    KeyboardUtil.showSoftInput(editText);
  }
  /**
   *
   *
   * <pre>方法  </pre>
   */
  private void initView() {
    edt_keyword = (EditText) findViewById(R.id.edt_keyword);
    btn_keyword_submit = (Button) findViewById(R.id.btn_keyword_submit);
    rgroup_keyword = (RadioGroup) findViewById(R.id.rgroup_keyword);
    rbtn_keyword_full = (RadioButton) findViewById(R.id.rbtn_keyword_full);
    rbtn_keyword_position_name = (RadioButton) findViewById(R.id.rbtn_keyword_position_name);
    rbtn_keyword_enterprise_name = (RadioButton) findViewById(R.id.rbtn_keyword_enterprise_name);
    lv_keyword_history = (ListView) findViewById(R.id.lv_keyword_history);
    linear_clear_history = (LinearLayout) findViewById(R.id.linear_clear_history);
    linear_clear_history.setVisibility(View.GONE);
    initRadioStates();
    rgroup_keyword.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            initRadioButtonStatus();
            switch (checkedId) {
              case R.id.rbtn_keyword_full:
                rbtn_keyword_full.setTextColor(Color.WHITE);
                scope = 1;
                break;
              case R.id.rbtn_keyword_position_name:
                rbtn_keyword_position_name.setTextColor(Color.WHITE);
                scope = 2;
                break;
              case R.id.rbtn_keyword_enterprise_name:
                rbtn_keyword_enterprise_name.setTextColor(Color.WHITE);
                scope = 3;
                break;
            }
            String txt = edt_keyword.getText().toString().trim();
            int nn = (txt == null ? 0 : txt.length());
            if (adapter != null && nn > 0) {
              adapter.clear();
              loadDatas(nn);
            }
          }
        });
    edt_keyword.addTextChangedListener(watcher);
    linear_clear_history.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            historyHandler.deleteAllKeywords();
            adapter.clear();
            linear_clear_history.setVisibility(View.GONE);
          }
        });
    btn_keyword_submit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            kw = edt_keyword.getText().toString().trim();
            if (mFunction == FunctionEnum.FINISH) {
              boolean flag = historyHandler.isKeywordExist(kw);
              String datetime = DateTimeUtils.getLongDateTime(true);
              if (flag) {
                historyHandler.updateKeywordCount(kw, datetime);
              } else {
                historyHandler.insertKeyword("", "", kw, datetime);
              }
              startIntent();
              finish();
            } else {
              finish();
            }
          }
        });
    lv_keyword_history.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            String txt = adapter.getContext(position);
            if (txt != null) {
              isitem = true;
              edt_keyword.removeTextChangedListener(watcher);
              edt_keyword.setText(txt);
              int n = txt.length();
              edt_keyword.setSelection(n);
              switchFunction();
            }
          }
        });
    edt_keyword.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            edt_keyword.addTextChangedListener(watcher);
            return false;
          }
        });
    isitem = false;
  }
Example #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    user = (EditText) findViewById(R.id.reg_usrname);
    passwd = (EditText) findViewById(R.id.reg_passwd);

    // 检查更新
    //		if (DB.getVersion(this) == null || DB.getVersion(this) == "")
    DB.setVersion(this, "02.03.1505");

    check_update();

    //		if (DB.getSessionid(this) != null && DB.getSessionid(this) != ""){
    //			Intent intent = new Intent(LoginActivity.this, MainActivity.class);
    //			startActivity(intent);
    //			finish();
    //		}

    //		final CustomProgressDialog progressDialog = CustomProgressDialog.show(this, "加载中");

    //		user.setText("13941707965");
    //		passwd.setText("123456");
    //		user.setText("18796239663");
    //		passwd.setText("654321");
    //		user.setText("15026827729");
    //		passwd.setText("123456");

    if (DB.getUsername(this) != null && !DB.getUsername(this).equals("")) {
      user.setText(DB.getUsername(this));
      passwd.requestFocus();
    }

    passwd.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            View view1 = (View) findViewById(R.id.login_error);
            view1.setVisibility(View.GONE);
            return false;
          }
        });

    //		passwd.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    //
    //			@Override
    //			public boolean onEditorAction(TextView v, int actionId,  KeyEvent event)  {
    //			if (actionId==EditorInfo.IME_ACTION_SEND ||(event!=null&&event.getKeyCode()==
    // KeyEvent.KEYCODE_ENTER))
    //			{
    //			//do something;
    //			return true;
    //			}
    //			return false;
    //			}

    tv_forget_pwd = (TextView) findViewById(R.id.tv_forget_pwd);
    tv_forget_pwd.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
            startActivity(intent);
            overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
          }
        });

    login = (ImageView) findViewById(R.id.reg_login);
    login.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (b) {
              AlertDialog alert = new AlertDialog.Builder(LoginActivity.this).create();
              alert.setTitle("注意");
              alert.setMessage("发现新版本,该版本已过期,需要升级,点击下载安装");
              alert.setButton(
                  DialogInterface.BUTTON_POSITIVE,
                  "确认",
                  new Dialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      // DONOTING
                      Uri uri = Uri.parse(Version_netItem.getUrl());
                      Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                      startActivity(intent);
                    }
                  });
              alert.setButton(
                  DialogInterface.BUTTON_NEGATIVE,
                  "取消",
                  new Dialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                      // do nothing
                    }
                  });
              alert.show();
            } else {
              login();
            }
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.activity_diem_pho_bien, container, false);

    setHasOptionsMenu(true);

    pDialog = new ProgressDialog(getActivity());
    pDialog.setMessage("Vui lòng đợi...");
    pDialog.setCancelable(false);

    MySharePreferences.preferences = getActivity().getSharedPreferences(PREFS_NAME, 0);
    MySharePreferences.editor = MySharePreferences.preferences.edit();

    // MySharePreferences.getDiemPhoBienData(getActivity()
    // .getApplicationContext());
    // new LoadDataFromDatabase().execute();
    d.clear();
    // Restore preferences
    for (int i = 0; i < MySharePreferences.diemPhoBienList.size(); i++) {
      int isFavorite = MySharePreferences.preferences.getInt("diem_pho_bien_" + i, 0);
      if (isFavorite == 1) {
        MySharePreferences.diemPhoBienList.get(i).setFavorite(true);
      } else MySharePreferences.diemPhoBienList.get(i).setFavorite(false);
      d.add(MySharePreferences.diemPhoBienList.get(i));
    }

    listView = (ListView) rootView.findViewById(R.id.list_result_diem_pho_bien);

    /*
     * if (isSearch) { // ((TextView) //
     * rootView.findViewById(R.id.title_bus_list)).setText("Kết quả tìm //
     * kiếm"); ((ActionBarActivity)
     * getActivity()).getSupportActionBar().setTitle( "Kết quả tìm kiếm");
     * if (MySharePreferences.busSearchList.isEmpty()) {
     * alert.showAlertDialog(getActivity(), "Kết quả",
     * "Không tìm thấy tuyến xe nào!", false); } else adapter = new
     * BusListAdapter(getActivity(), MySharePreferences.busSearchList, true,
     * mTracker); } else { ((ActionBarActivity)
     * getActivity()).getSupportActionBar().setTitle( "Danh sách xe bus");
     * adapter = new BusListAdapter(getActivity(),
     * MySharePreferences.busList, false, mTracker); }
     */
    adapter = new DiemPhoBienListAdapter(getActivity(), d, false, MainActivity.mTracker);
    listView.setAdapter(adapter);

    listView.setOnItemClickListener(new ListViewListenner());

    textSearch = (EditText) rootView.findViewById(R.id.search_text_diem_diem_pho_bien);

    textSearch.addTextChangedListener(
        new TextWatcher() {

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            String input = textSearch.getText().toString().toLowerCase();
            d.clear();
            for (int i = 0; i < MySharePreferences.diemPhoBienList.size(); i++) {
              if (MySharePreferences.diemPhoBienList
                  .get(i)
                  .getName()
                  .toLowerCase()
                  .contains(input)) {
                d.add(MySharePreferences.diemPhoBienList.get(i));
                continue;
              }
              if (MySharePreferences.diemPhoBienList
                  .get(i)
                  .getName_ko_dau()
                  .contains(HandleString.removeAccent(input))) {
                d.add(MySharePreferences.diemPhoBienList.get(i));
                continue;
              }
            }

            adapter.notifyDataSetChanged();
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

          }

          @Override
          public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

          }
        });

    textSearch.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            isKeyboardOpen = true;
            return false;
          }
        });

    // textSearch.setThreshold(1);
    // // Each row in the list stores country name, currency and flag
    // List<HashMap<String, String>> aList = new ArrayList<HashMap<String,
    // String>>();
    //
    // for (int i = 0; i < MySharePreferences.diemPhoBienList.size(); i++) {
    // HashMap<String, String> hm = new HashMap<String, String>();
    // hm.put("image", Integer.toString(R.drawable.icn_menu_bus));
    // hm.put("decription", MySharePreferences.diemPhoBienList.get(i)
    // .getName());
    // hm.put("name", MySharePreferences.diemPhoBienList.get(i).getTinh());
    // aList.add(hm);
    // }
    //
    // // Keys used in Hashmap
    // String[] from = { "image", "name", "description" };
    //
    // // Ids of views in listview_layout
    // int[] to = { R.id.autocomplete_diem_pho_bien_image,
    // R.id.autocomplete_diem_pho_bien_phone,
    // R.id.autocomplete_diem_pho_bien_description };
    //
    // // Instantiating an adapter to store each items
    // // R.layout.listview_layout defines the layout of each item
    // SimpleAdapter adapter2 = new SimpleAdapter(getActivity()
    // .getBaseContext(), aList, R.layout.autocomplete_diem_pho_bien,
    // from, to);
    // textSearch.setAdapter(adapter2);
    //
    // // Adding textchange listener
    // textSearch.addTextChangedListener(new TextWatcher() {
    //
    // @Override
    // public void onTextChanged(CharSequence s, int start, int before,
    // int count) {
    // }
    //
    // @Override
    // public void beforeTextChanged(CharSequence s, int start, int count,
    // int after) {
    // // TODO Auto-generated method stub
    // }
    //
    // @Override
    // public void afterTextChanged(Editable s) {
    // // TODO Auto-generated method stub
    // }
    // });
    //
    // // Setting an item click listener for the AutoCompleteTextView
    // // dropdown
    // // list
    // textSearch.setOnItemClickListener(new OnItemClickListener() {
    // @Override
    // public void onItemClick(AdapterView<?> arg0, View arg1, int index,
    // long id) {
    // HashMap<String, String> hm = (HashMap<String, String>) arg0
    // .getAdapter().getItem(index);
    //
    // InputMethodManager imm = (InputMethodManager) getActivity()
    // .getSystemService(Context.INPUT_METHOD_SERVICE);
    // imm.hideSoftInputFromWindow(textSearch.getWindowToken(), 0);
    // }
    // });
    isFirstView = true;
    return rootView;
  }
Example #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.log);
    // 设置横屏还是竖屏的布局策略
    this.setRequestedOrientation(ToolClass.getOrientation());
    df = new SimpleDateFormat("yyyy"); // 设置日期格式
    date = df.format(new Date());
    mYear = Integer.parseInt(date);
    eYear = Integer.parseInt(date);
    df = new SimpleDateFormat("MM"); // 设置日期格式
    date = df.format(new Date());
    mMon = Integer.parseInt(date);
    eMon = Integer.parseInt(date);
    df = new SimpleDateFormat("dd"); // 设置日期格式
    date = df.format(new Date());
    mDay = Integer.parseInt(date);
    eDay = Integer.parseInt(date);
    // ToolClass.Log(ToolClass.INFO,"EV_JNI","APP<<现在时刻是"+y+"-"+m+"-"+d);
    lvlog = (ListView) findViewById(R.id.lvlog);
    edtloggridstart = (EditText) findViewById(R.id.edtloggridstart); // 获取时间文本框
    edtloggridstart.setFocusable(false); // 不让该edittext获得焦点
    edtloggridstart.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            // 关闭软键盘,这样当点击该edittext的时候,不会弹出系统自带的输入法
            edtloggridstart.setInputType(InputType.TYPE_NULL);
            return false;
          }
        });
    edtloggridstart.setOnClickListener(
        new OnClickListener() { // 为时间文本框设置单击监听事件
          @Override
          public void onClick(View arg0) {
            datetype = DATE_DIALOG_IDSTART;
            showDialog(DATE_DIALOG_IDSTART); // 显示日期选择对话框
          }
        });
    edtloggridend = (EditText) findViewById(R.id.edtloggridend); // 获取时间文本框
    edtloggridend.setFocusable(false); // 不让该edittext获得焦点
    edtloggridend.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            // 关闭软键盘,这样当点击该edittext的时候,不会弹出系统自带的输入法
            edtloggridend.setInputType(InputType.TYPE_NULL);
            return false;
          }
        });
    edtloggridend.setOnClickListener(
        new OnClickListener() { // 为时间文本框设置单击监听事件
          @Override
          public void onClick(View arg0) {
            datetype = DATE_DIALOG_IDEND;
            showDialog(DATE_DIALOG_IDEND); // 显示日期选择对话框
          }
        });
    // 查询
    btnloggridquery = (Button) findViewById(R.id.btnloggridquery);
    btnloggridquery.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            loggrid();
          }
        });
    // 删除查询
    btnloggriddel = (Button) findViewById(R.id.btnloggriddel);
    btnloggriddel.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            delloggrid();
          }
        });
    // 退出
    btnloggridexit = (Button) findViewById(R.id.btnloggridexit);
    btnloggridexit.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
    // 动态设置控件高度
    //
    DisplayMetrics dm = new DisplayMetrics();
    // 取得窗口属性
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    // 窗口的宽度
    int screenWidth = dm.widthPixels;
    // 窗口高度
    int screenHeight = dm.heightPixels;
    ToolClass.Log(
        ToolClass.INFO, "EV_JNI", "APP<<屏幕" + screenWidth + "],[" + screenHeight + "]", "log.txt");
    // 横屏
    if (ToolClass.getOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
      LinearLayout.LayoutParams linearParams =
          (LinearLayout.LayoutParams) lvlog.getLayoutParams(); // 取控件mGrid当前的布局参数
      linearParams.height = screenHeight - 252; // 当控件的高强制设成75象素
      lvlog.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件mGrid2
    }
    // 竖屏
    else {
      LinearLayout.LayoutParams linearParams =
          (LinearLayout.LayoutParams) lvlog.getLayoutParams(); // 取控件mGrid当前的布局参数
      linearParams.height = screenHeight - 700; // 当控件的高强制设成75象素
      lvlog.setLayoutParams(linearParams); // 使设置好的布局参数应用到控件mGrid2
    }
  }