@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_forget_password);
    iv_logo = (ImageView) this.findViewById(R.id.iv_logo);
    img_background = (ImageView) this.findViewById(R.id.img_background);
    resizeLogo();
    fontManager = FontManager.getInstance(getAssets());
    ed_email = (EditText) this.findViewById(R.id.ed_email);
    ed_email
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_new_password = (EditText) this.findViewById(R.id.ed_new_password);
    ed_new_password
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_repassword = (EditText) this.findViewById(R.id.ed_repassword);
    ed_repassword
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);

    ed_email.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_new_password.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_repassword.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));

    btn_update_password = (Button) this.findViewById(R.id.btn_update_password);
    btn_update_password = (Button) this.findViewById(R.id.btn_update_password);
    btn_update_password.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String email = ed_email.getText().toString().trim();
            String password = ed_new_password.getText().toString();
            String repassword = ed_repassword.getText().toString();
            if (verifyInputs(email, password, repassword)) {
              v.startAnimation(animFade);
              update_password(email, password);
            }
          }
        });
    btn_update_password.setTypeface(fontManager.getFont(FontManager.ROBOTO_MEDIUM));
    iv_back = (ImageView) this.findViewById(R.id.iv_back);
    iv_back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });
    ll_parent = (CoordinatorLayout) this.findViewById(R.id.ll_parent);
    ll_parent.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
          }
        });
    mValidator = Validator.getInstance();
    animFade = AnimationUtils.loadAnimation(ForgetPassword.this, R.anim.fade);
  }
Пример #2
0
  private View getCustomView() {
    mFontManager = FontManager.getInstance(getActivity().getAssets());

    LayoutInflater inflater =
        (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.fragment_contactus, null, false);
    ll_parent = (LinearLayout) view.findViewById(R.id.ll_parent);
    ll_parent.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
          }
        });
    user_id =
        getActivity()
            .getSharedPreferences(
                GNLConstants.SharedPreference.SHARED_PREF_NAME, Context.MODE_PRIVATE)
            .getLong(GNLConstants.SharedPreference.ID_KEY, -1);
    ed_message = (EditText) view.findViewById(R.id.ed_message);
    ed_message.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));
    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInputFromInputMethod(ed_message.getWindowToken(), 0);

    tv_send = (TextView) view.findViewById(R.id.tv_send);
    if (type == 1) tv_send.setText("SUGGEST");
    else tv_send.setText("SEND");
    tv_send.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    tv_send.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // send message to server then
            hideSoftKeyboard();
            //
            // dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
            String message = ed_message.getText().toString().trim();
            if (!TextUtils.isEmpty(message)) {
              message = Validator.getInstance().getSafeText(message);
              if (!TextUtils.isEmpty(message)) {
                //                        final LoadingDialog loadingDialog = new LoadingDialog();
                //                        Bundle args = new Bundle();
                //                        args.putString(LoadingDialog.DIALOG_TEXT_KEY,
                // getString(R.string.sending));
                //                        loadingDialog.setArguments(args);
                //                        loadingDialog.setCancelable(false);
                //                        loadingDialog.show(getFragmentManager(), "sending");
                final AlertDialog loadingDialog =
                    new SpotsDialog(
                        getActivity(),
                        getString(R.string.sending_message),
                        R.style.SpotsDialogCustom);
                loadingDialog.setCancelable(false);
                loadingDialog.show();
                WebServiceFunctions.sendMessage(
                    getActivity(),
                    user_id,
                    message,
                    type,
                    new OnSendMessageListener() {

                      @Override
                      public void onSuccess() {
                        loadingDialog.dismiss();
                        ed_message.setText("");
                        Toast.makeText(
                                getActivity().getApplicationContext(),
                                getString(R.string.message_sent),
                                Toast.LENGTH_LONG)
                            .show();
                        dialog.dismiss();
                      }

                      @Override
                      public void onFail(String error) {
                        loadingDialog.dismiss();
                        Toast.makeText(
                                getActivity().getApplicationContext(), error, Toast.LENGTH_LONG)
                            .show();
                      }
                    });
              } else {
                ed_message.setError(getString(R.string.BR_GNL_007));
              }
            }
          }
        });
    tv_cancel = (TextView) view.findViewById(R.id.tv_cancel);
    tv_cancel.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    tv_cancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
            dialog.dismiss();
          }
        });
    tv_contact = (TextView) view.findViewById(R.id.tv_contact);
    tv_contact.setText(title);
    tv_contact.setTypeface(mFontManager.getFont(FontManager.ROBOTO_LIGHT));

    return view;
  }
Пример #3
0
  private void initializeFields() {
    fontManager = FontManager.getInstance(getAssets());
    pref =
        getSharedPreferences(GNLConstants.SharedPreference.SHARED_PREF_NAME, Context.MODE_PRIVATE);
    prefEditor = pref.edit();
    iv_logo = (ImageView) this.findViewById(R.id.iv_logo);
    img_background = (ImageView) this.findViewById(R.id.img_background);
    ed_fname = (EditText) this.findViewById(R.id.ed_fname);
    ed_fname
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_lname = (EditText) this.findViewById(R.id.ed_lname);
    ed_lname
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_email = (EditText) this.findViewById(R.id.ed_email);
    ed_email
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_password = (EditText) this.findViewById(R.id.ed_password);
    ed_password
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);
    ed_repassword = (EditText) this.findViewById(R.id.ed_repassword);
    ed_repassword
        .getBackground()
        .setColorFilter(getResources().getColor(R.color.ed_underline), PorterDuff.Mode.SRC_ATOP);

    ed_fname.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_lname.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_email.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_password.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));
    ed_repassword.setTypeface(fontManager.getFont(FontManager.ROBOTO_LIGHT));

    btn_signup = (Button) this.findViewById(R.id.btn_signup);
    btn_signup.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            fname = ed_fname.getText().toString().trim();
            lname = ed_lname.getText().toString().trim();
            email = ed_email.getText().toString().trim();
            password = ed_password.getText().toString();
            repassword = ed_repassword.getText().toString();
            if (verifyInputs(fname, lname, email, password, repassword)) {
              v.startAnimation(animFade);
              register(fname, lname, email, password);
            }
          }
        });
    btn_signup.setTypeface(fontManager.getFont(FontManager.ROBOTO_MEDIUM));
    iv_back = (ImageView) this.findViewById(R.id.iv_back);
    iv_back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });
    ll_parent = (CoordinatorLayout) this.findViewById(R.id.ll_parent);
    ll_parent.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            hideSoftKeyboard();
          }
        });
    mValidator = Validator.getInstance();
    animFade = AnimationUtils.loadAnimation(Register.this, R.anim.fade);
  }