Beispiel #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    presenter = new LoginPresenter(this, new LoginService(this));

    // register buttonn
    Login_OnClickButtonListener();
    ClearDB_OnClickButtonListener();
    RegistrationLink_OnClickListener();

    // text handles
    header = (TextView) findViewById(R.id.textView_header);
    username = (EditText) findViewById(R.id.editText_username);
    password = (EditText) findViewById(R.id.editText_password);

    Typeface type = Typeface.createFromAsset(getAssets(), "fonts/Sansation-LightItalic.ttf");
    Typeface glyphicons = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf");

    // initialize values
    header.setTypeface(type);

    username.setText("");
    username.setTypeface(glyphicons);
    username.setHint("  \uf007    Username");

    password.setText("");
    password.setTypeface(glyphicons);
    password.setHint("  \uf023    Password");
  }
 /** Fills the data with preset stuff/hints */
 public void fillDataEmpty() {
   RadioButton male = (RadioButton) findViewById(R.id.gender_male);
   RadioButton female = (RadioButton) findViewById(R.id.gender_female);
   RadioButton pounds = (RadioButton) findViewById(R.id.weight_lbs);
   RadioButton kgs = (RadioButton) findViewById(R.id.weight_kgs);
   male.setChecked(true);
   female.setChecked(false);
   pounds.setChecked(true);
   kgs.setChecked(false);
   EditText weight = (EditText) findViewById(R.id.weight_view);
   EditText deadlift_view = (EditText) findViewById(R.id.deadlift_view);
   EditText squat_view = (EditText) findViewById(R.id.squat_view);
   EditText bench_view = (EditText) findViewById(R.id.bench_view);
   weight.getText().clear();
   deadlift_view.getText().clear();
   squat_view.getText().clear();
   bench_view.getText().clear();
   weight.setHint("Weight");
   deadlift_view.setHint("Deadlift Max");
   squat_view.setHint("Squat Max");
   bench_view.setHint("Bench Max");
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(weight.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(deadlift_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(squat_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(bench_view.getWindowToken(), 0);
   TextView output = (TextView) findViewById(R.id.output_view);
   output.setText(" ");
   output.setOnClickListener(null);
   setButtonsOnClick(male, female, pounds, kgs, weight, deadlift_view, squat_view, bench_view);
 }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sale_tab);

    myDb = new InventoryDatabase(this);
    myDb.getWritableDatabase();
    SaleRecordDateDatabase DbSr = new SaleRecordDateDatabase(this);
    DbSr.getWritableDatabase();
    sCT = new StoreController(myDb, DbSr);
    productList = sCT.getProductList();
    basket = sCT.newBasket();

    initWidget();

    editText.setHint("search");
    cash.setHint("input cash");

    // adapter of list item.
    saleAdapter = new SaleItemAdapter();

    list_sale_item.setAdapter(saleAdapter);

    addButton();

    addFindByPartial();
  }
Beispiel #4
0
 /** Sets the ssh password/passphrase hint appropriately. */
 private void setSshPasswordHint(boolean isPassphrase) {
   if (isPassphrase) {
     sshPassword.setHint(R.string.ssh_passphrase_hint);
   } else {
     sshPassword.setHint(R.string.password_hint_ssh);
   }
 }
 /** Updates hint displaying chat target. */
 public void updateChatTargetText() {
   if (chatTarget == null) {
     chatTextEdit.setHint(R.string.messageToChannel);
   } else {
     chatTextEdit.setHint(getString(R.string.messageToUser, chatTarget.name));
   }
 }
  private void setupEditText() {
    etSummary.setHint(getResources().getString(R.string.booking_summary));
    etSummary.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

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

          @Override
          public void afterTextChanged(Editable s) {
            summaryText = s.toString();
          }
        });

    etDetails.setHint(getResources().getString(R.string.event_details));
    etDetails.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

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

          @Override
          public void afterTextChanged(Editable s) {
            detailsText = s.toString();
          }
        });
  }
  public void changeusername() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("Edit Name");
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(1);
    LinearLayout.LayoutParams layoutParams =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 0, 10, 0);
    final EditText fname = new EditText(this);
    final EditText sname = new EditText(this);
    fname.setHint("first");
    sname.setHint("last");
    fname.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    sname.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    linearLayout.addView(fname, layoutParams);
    linearLayout.addView(sname, layoutParams);
    alert.setView(linearLayout);

    alert.setPositiveButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {}
        });

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

    alert.show();
  }
  /** 添加好友 */
  private void addSubscriber() {
    // 设计添加好友界面
    final EditText name_input = new EditText(SingleChatListActivity.this);
    name_input.setLayoutParams(
        new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    name_input.setHint("输入好友账号");
    final EditText nickname = new EditText(SingleChatListActivity.this);
    nickname.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    nickname.setHint("输入昵称");
    LinearLayout layout = new LinearLayout(SingleChatListActivity.this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    layout.addView(name_input);
    layout.addView(nickname);
    // 显示添加好友界面
    new AlertDialog.Builder(SingleChatListActivity.this)
        .setTitle("添加好友")
        .setView(layout)
        .setPositiveButton(
            "确定",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                String userName = name_input.getText().toString();
                if ("".equals(userName)) {
                  Toast.makeText(SingleChatListActivity.this, "请输入好友账号", Toast.LENGTH_SHORT).show();
                  userName = null;
                } else {
                  // Toast.makeText(SingleChatListActivity.this,String.valueOf(IsUserOnLine(userName)), Toast.LENGTH_SHORT).show();
                  if (isMyFriend(userName)) {
                    Toast.makeText(
                            SingleChatListActivity.this, userName + "已是你的好友", Toast.LENGTH_SHORT)
                        .show();
                  } else {
                    //								if (IsUserOnLine(userName) == 0) {
                    //									Toast.makeText(SingleChatListActivity.this,
                    //											"不存在此用户", Toast.LENGTH_SHORT)
                    //											.show();
                    //								} else if (IsUserOnLine(userName) != -1) {
                    //									try {
                    //										createSubscriber(userName, nickname
                    //												.getText().toString(), null);
                    //									} catch (XMPPException e) {
                    //										e.getStackTrace();
                    //									}
                    //								}
                    // 插件失效
                    try {
                      createSubscriber(userName, nickname.getText().toString(), null);
                    } catch (XMPPException e) {
                      e.getStackTrace();
                    }
                  }
                }
              }
            })
        .setNegativeButton("取消", null)
        .show();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.facebook_login_ui);

    // start login sub activity
    loghelper = FacebookLoginHelper.instance(this);
    handler = new LoginHandler();

    facebook_info_span = (View) this.findViewById(R.id.facebook_info_span);
    facebook_info = (TextView) this.findViewById(R.id.facebook_info);
    facebook_info_span.setVisibility(View.VISIBLE);
    orm = SocialORM.instance(this);
    boolean forinvalidsession = getIntent().getBooleanExtra("forinvalidsession", false);
    if (forinvalidsession) {
      Log.d(TAG, "for invalid session issue=" + this);
      loghelper.clearSesion();
      AccountListener.AccountManager.logout();
    }

    // for UI
    email = (EditText) this.findViewById(R.id.facebook_login_email);
    email.setHint(R.string.facebook_email_address);
    pwd = (EditText) this.findViewById(R.id.facebook_login_pwd);
    pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
    pwd.setHint(R.string.facebook_password);

    login = (Button) this.findViewById(R.id.facebook_login_ok_button);
    sign_up = (Button) this.findViewById(R.id.facebook_login_sign_up_button);

    Paint p = login.getPaint();
    float width1 = p.measureText(login.getText().toString());
    p = null;

    p = sign_up.getPaint();
    float width2 = p.measureText(sign_up.getText().toString());
    int width = Math.round(Math.max(width1, width1));

    width = width + 40;
    login.getLayoutParams().width = width;
    sign_up.getLayoutParams().width = width;
    p = null;

    login.setText(R.string.facebook_login_ok);
    sign_up.setText(R.string.facebook_login_sign_up);
    checkbox_sync_phonebook = (CheckBox) this.findViewById(R.id.checkbox_sync_phonebook);
    checkbox_sync_phonebook.setChecked(orm.isEnableSyncPhonebook());
    checkbox_sync_phonebook.setOnCheckedChangeListener(checkedListener);

    login.setOnClickListener(loginClick);
    sign_up.setOnClickListener(signupClick);

    SocialORM.Account ac = orm.getFacebookAccount();
    email.setText(ac.email);
    pwd.setText(ac.password);

    setTitle(R.string.menu_title_login);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case MENU_UNDO:
        // DeckTask.launchDeckTask(DeckTask.TASK_TYPE_UNDO, mUndoRedoHandler, new
        // DeckTask.TaskData(0, mDeck, 0,
        // true));
        return true;

      case MENU_ADD_NOTE:
        Intent intent = new Intent(CardBrowser.this, CardEditor.class);
        intent.putExtra(CardEditor.EXTRA_CALLER, CardEditor.CALLER_CARDBROWSER_ADD);
        startActivityForResult(intent, ADD_NOTE);
        if (UIUtils.getApiLevel() > 4) {
          ActivityTransitionAnimation.slide(CardBrowser.this, ActivityTransitionAnimation.LEFT);
        }
        return true;

      case MENU_SHOW_MARKED:
        mShowOnlyMarSus = true;
        mSearchEditText.setHint(R.string.card_browser_show_marked);
        mCards.clear();
        for (int i = 0; i < mAllCards.size(); i++) {
          int flags = Integer.parseInt(mAllCards.get(i).get("flags"));
          if (flags == 2 || flags == 3) {
            mCards.add(mAllCards.get(i));
          }
        }
        updateList();
        return true;

      case MENU_SELECT_SUSPENDED:
        mShowOnlyMarSus = true;
        mSearchEditText.setHint(R.string.card_browser_show_suspended);
        mCards.clear();
        for (int i = 0; i < mAllCards.size(); i++) {
          int flags = Integer.parseInt(mAllCards.get(i).get("flags"));
          if (flags == 1 || flags == 3) {
            mCards.add(mAllCards.get(i));
          }
        }
        updateList();
        return true;

      case MENU_SELECT_TAG:
        showDialog(DIALOG_TAGS);
        return true;

      case MENU_CHANGE_ORDER:
        showDialog(DIALOG_ORDER);
        return true;

      case MENU_FIELD:
        showDialog(DIALOG_FIELD);
        return true;
    }

    return false;
  }
 @Override
 public void onFocusChange(View v, boolean hasFocus) {
   EditText input = (EditText) v.findViewById(R.id.group_select_list_section_input);
   if (hasFocus) {
     input.setHint("");
   } else {
     input.setHint(GroupListActivity.this.getResources().getText(R.string.search));
   }
 }
  private void setCode(String code) {
    if (code == null) return;

    EditText nameView = (EditText) findViewById(R.id.cart_grocery_edit_name);
    String oldHint = (String) nameView.getHint();
    nameView.setHint("Searching for item " + code + " in the database...");

    QueryUPCDatabase q = new QueryUPCDatabase(this, nameView);
    q.execute(getString(R.string.upcdatabase_key), code);

    nameView.setHint(oldHint);
  }
Beispiel #13
0
  public void initValues() {

    acc_id = account.getAcc_id();
    editTextName.setHint(account.getUser_name());
    editTextPW.setHint(account.getAcc_password());

    //        if(account.getProfile_image_path() != ""){
    //            ImageLoader.getInstance().displayImage(account.getProfile_image_path(),
    // mImageProfile, options);}

    calendar = Calendar.getInstance();
  }
  /**
   * Constructor for add dialog.
   *
   * @param context
   * @param positive
   * @param type AddType.ITEM or AddType.LIST
   */
  protected AddDialog(
      @NonNull Context context, AddType type, DialogInterface.OnClickListener positive) {
    super(context);
    // mList = list;
    // mPosition = position;
    mContext = context;
    // mAdapter = adapter;

    mPositiveListener = positive;
    if (type == AddType.ITEM || type == AddType.LIST) {
      mType = type;
    } else {
      mType = null;
    }

    // Build the dialog and set up the button click handlers
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);

    final EditText titleBox = new EditText(mContext);
    titleBox.setHint("Name");
    titleBox.setId(R.id.add_dialog_title_edit);
    layout.addView(titleBox);

    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    String message = "";
    String title = "Add new ";
    switch (mType) {
      case ITEM:
        title += "To-Do Item";
        message = "Please add a Name and Description to the new message";
        final EditText descriptionBox = new EditText(mContext);
        descriptionBox.setHint("Description");
        descriptionBox.setId(R.id.add_dialog_description_edit);
        layout.addView(descriptionBox);
        break;
      case LIST:
        title += "To-Do List";
        message = "Please specify a Name for your new To-Do List";
        break;
      default:
        break;
    }
    builder.setView(layout);
    builder
        .setMessage(message)
        .setTitle(title)
        .setPositiveButton("Add", mPositiveListener)
        .setNegativeButton("Cancel", null);
    builder.create();
    builder.show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pole_prostokata);

    guzik = (Button) findViewById(R.id.button2);
    bok1 = (EditText) findViewById(R.id.editText2);
    bok2 = (EditText) findViewById(R.id.editText3);
    wynik = (TextView) findViewById(R.id.textView12);

    bok1.setHint("Długość pierwszego boku");
    bok2.setHint("Długość drugiego boku");
  }
Beispiel #16
0
  /** 检查标签Hint */
  private void checkEditHint() {

    if (mInputTags.isEmpty()) {
      mTags.setHint(mTagsHint);
    } else {
      mTags.setHint("");
      if (mInputTags.size() < 3) {
        mTags.setImeActionLabel(mInputActionAdd, EditorInfo.IME_ACTION_DONE);
      } else {
        mTags.setImeActionLabel(mInputActionFinish, EditorInfo.IME_ACTION_DONE);
      }
    }
  }
Beispiel #17
0
  @Override
  public void onClick(View view) {
    // SplashMessage(name,"Registration Failed",android.R.drawable.ic_dialog_alert);

    if (AllIDS.USER_key == null) {
      Intent in = new Intent(this, Users.class);
      startActivity(in);
      return;
    }

    if (size == 1) postData(null, null, "" + id);
    else {
      LinearLayout v = new LinearLayout(this);
      v.setOrientation(LinearLayout.VERTICAL);
      final EditText team_name = new EditText(this);
      team_name.setHint("Team Name");
      v.addView(team_name);
      final EditText[] team_members = new EditText[size - 1];
      for (int i = 0; i < size - 1; i++) {
        EditText et = new EditText(this);
        et.setHint("Member " + (i + 2) + " ID");
        team_members[i] = et;
        v.addView(et);
      }
      AlertDialog.Builder ad = new AlertDialog.Builder(this);
      ad.setTitle("Group Registration");
      ad.setView(v);
      ad.setIcon(android.R.drawable.ic_dialog_info);
      ad.setPositiveButton(
          "Register",
          new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              JSONObject obj = new JSONObject();
              JSONArray array = new JSONArray();
              for (int i2 = 0; i2 < size - 1; i2++) {
                String id = team_members[i2].getText().toString().toUpperCase();
                if (!id.trim().isEmpty()) array.put(id);
              }
              // obj.put("IDs", array);
              ArrayList<Pair<String, String>> param = new ArrayList<Pair<String, String>>();
              param.add(new Pair<String, String>(obj.toString(), ""));
              String url = "group/" + id;
              postData(array, team_name.getText().toString(), url);
            }
          });
      ad.setNegativeButton("Cancel", null);
      ad.show();
    }
  }
Beispiel #18
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    final Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Black.ttf");
    switch (item.getItemId()) {
      case R.id.btnEdit:
        if (deviceMac.length() > 0) {
          AlertDialog.Builder builder = new AlertDialog.Builder(context);
          builder.setTitle(R.string.editar);

          final EditText input = new EditText(context);

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

          builder.setPositiveButton(
              "Aceptar",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  String newName = input.getText().toString();
                  if (newName.length() > 0 && !newName.equals("AW Lumina"))
                    updateDataBaseName(newName);
                  else dialog.cancel();
                }
              });
          builder.setNegativeButton(
              "Cancelar",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  dialog.cancel();
                }
              });
          builder.show();
        }
        return true;
      case R.id.action_settings:
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
Beispiel #19
0
  void changePassword() {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);

    final EditText editText_old = new EditText(this);
    final EditText editText_new1 = new EditText(this);
    final EditText editText_new2 = new EditText(this);
    alertDialog.setTitle("Enter New Password");
    alertDialog.setView(ll);
    editText_old.setHint("< Old Password >");
    editText_old.setSingleLine();
    editText_new1.setHint("< New Password >");
    editText_new2.setHint("< Confirm Password >");
    editText_new1.setSingleLine();
    editText_new2.setSingleLine();
    editText_old.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    editText_new1.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    editText_new2.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    ll.addView(editText_old);
    ll.addView(editText_new1);
    ll.addView(editText_new2);

    alertDialog.setNegativeButton("No Change", null);
    final Activity activity = this;
    alertDialog.setPositiveButton(
        "Change",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            if (!editText_new1.getText().toString().equals(editText_new2.getText().toString()))
              Toast.makeText(activity, "Password Didn't Match Try Again!", Toast.LENGTH_SHORT)
                  .show();
            else
              AppToServer.changeMyDetails(
                  activity,
                  null,
                  editText_old.getText().toString(),
                  editText_new1.getText().toString(),
                  new Callable<Void>() {
                    @Override
                    public Void call() throws Exception {
                      Toast.makeText(activity, "Password Changed", Toast.LENGTH_SHORT).show();
                      return null;
                    }
                  });
          }
        });
    alertDialog.show();
  }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
      Log.i(AnkiDroidApp.TAG, "CardBrowser - onBackPressed()");
      if (mSearchEditText.getText().length() == 0
          && !mShowOnlyMarSus
          && mSelectedTags.size() == 0) {
        // if (mPrefCacheCardBrowser) {
        // sCachedDeckPath = mDeck.getDeckPath();
        // sAllCardsCache = new ArrayList<HashMap<String, String>>();
        // sAllCardsCache.addAll(mAllCards);
        // }
        closeCardBrowser();
      } else {
        mSearchEditText.setText("");
        mSearchEditText.setHint(R.string.downloaddeck_search);
        mSelectedTags.clear();
        mCards.clear();
        mCards.addAll(mAllCards);
        updateList();
      }
      return true;
    }

    return super.onKeyDown(keyCode, event);
  }
  @SuppressLint("InflateParams")
  private void quickEdit(
      final String previousValue, final OnValueEdited callback, boolean password) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.quickedit, null);
    final EditText editor = (EditText) view.findViewById(R.id.editor);
    OnClickListener mClickListener =
        new OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            String value = editor.getText().toString();
            if (!previousValue.equals(value) && value.trim().length() > 0) {
              callback.onValueEdited(value);
            }
          }
        };
    if (password) {
      editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      editor.setHint(R.string.password);
      builder.setPositiveButton(R.string.accept, mClickListener);
    } else {
      builder.setPositiveButton(R.string.edit, mClickListener);
    }
    editor.requestFocus();
    editor.setText(previousValue);
    builder.setView(view);
    builder.setNegativeButton(R.string.cancel, null);
    builder.create().show();
  }
  public void showEditDialog(
      Context context, String hintText, String OKText, final DialogCallBack callBack) {
    final EditText et_search;
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_view, null);
    dialog.setView(layout);
    et_search = (EditText) layout.findViewById(R.id.searchC);
    et_search.setHint(hintText);
    dialog.setPositiveButton(
        OKText,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            String s = et_search.getText().toString().trim();
            callBack.exectEditEvent(s);
          }
        });

    dialog.setNegativeButton(
        R.string.cancel,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        });
    dialog.show();
  }
  private View createAlarmTitleStep() {
    // This step view is generated programmatically
    titleEditText = new EditText(this);
    titleEditText.setHint("Alarm title (mandatory)");
    titleEditText.setSingleLine(true);
    titleEditText.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

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

          @Override
          public void afterTextChanged(Editable s) {}
        });
    titleEditText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (checkTitleStep(v.getText().toString())) {
              verticalStepperForm.goToNextStep();
            }
            return false;
          }
        });
    return titleEditText;
  }
Beispiel #24
0
 public static void showInputDialog(
     Activity context, int title, int hint, String prefillInput, final InputCallback callback) {
   @SuppressLint("InflateParams")
   final View view = context.getLayoutInflater().inflate(R.layout.dialog_input, null);
   MaterialDialog.Builder dialog =
       new MaterialDialog.Builder(context)
           .title(title)
           .positiveText(android.R.string.ok)
           .negativeText(android.R.string.cancel)
           .callback(
               new MaterialDialog.ButtonCallback() {
                 @Override
                 public void onPositive(MaterialDialog dialog) {
                   if (callback != null) {
                     EditText input = (EditText) view.findViewById(R.id.input);
                     callback.onInput(input.getText().toString().trim());
                   }
                 }
               })
           .customView(view, true);
   final EditText input = (EditText) view.findViewById(R.id.input);
   if (hint != 0) input.setHint(hint);
   if (prefillInput != null) input.append(prefillInput);
   MaterialDialog alert = dialog.build();
   alert.setOnDismissListener(
       new DialogInterface.OnDismissListener() {
         @Override
         public void onDismiss(DialogInterface dialog) {
           if (callback instanceof InputCancelCallback)
             ((InputCancelCallback) callback).onCancel();
         }
       });
   alert.show();
 }
Beispiel #25
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.login_number:
       iv_code.setVisibility(View.GONE);
       iv_password.setImageResource(R.drawable.icon_pwd);
       login_number.setBackgroundResource(R.drawable.background_view_green_left);
       login_Code.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.white));
       login_Code.setTextColor(getResources().getColor(R.color.black));
       type = "number";
       break;
     case R.id.login_Code:
       iv_code.setVisibility(View.VISIBLE);
       iv_password.setImageResource(R.drawable.icon_code);
       login_Code.setBackgroundResource(R.drawable.background_view_green_right);
       login_number.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.black));
       login_Code.setTextColor(getResources().getColor(R.color.white));
       passwordEditText.setHint("验证码为4位数字");
       type = "code";
       break;
     case R.id.iv_code:
       currentUsername = usernameEditText.getText().toString().trim();
       Log.e("username", currentUsername);
       if (!currentUsername.equals("") && currentUsername != null) {
         registercode(currentUsername);
       } else {
         Toast.makeText(context, "请输入手机号码", Toast.LENGTH_SHORT).show();
       }
       break;
   }
 }
  public void photoNameInputAlert() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(getString(R.string.app_name));

    answerText = new EditText(this);
    answerText.setHint("Answer Here");
    answerText.setTextSize(20);
    answerText.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    answerText.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    alert.setView(answerText);

    alert.setPositiveButton(
        "Okay",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            checkAnswer(answerText.getText().toString());
          }
        });
    alert.setNegativeButton(
        "Cancel",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
          }
        });
    alert.setNeutralButton(
        "Say It!",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            startVoiceRecognitionActivity();
          }
        });
    alert.show();
  }
  @Override
  public void onViewCreated(View root, Bundle savedInstanceState) {
    super.onViewCreated(root, savedInstanceState);

    serverFields = root.findViewById(R.id.mpp_xmpp_server_fields);
    serverEditText = (EditText) root.findViewById(R.id.mpp_xmpp_server_edittext);
    loginEditText = (EditText) root.findViewById(R.id.mpp_xmpp_login_edittext);
    passwordEditText = (EditText) root.findViewById(R.id.mpp_xmpp_password_edittext);

    if (!isNewAccount()) {
      final XmppAccount realm = getEditedAccount();
      final XmppAccountConfiguration configuration = realm.getConfiguration();

      setupServerInput(root);
      serverEditText.setText(configuration.getServer());

      loginEditText.setText(configuration.getLogin());
      loginEditText.setEnabled(false);

      passwordEditText.setText(configuration.getPassword());
    } else {
      setupServerInput(root);
    }

    final int loginHintResId = getLoginHintResId();
    if (loginHintResId != NO_ID) {
      loginEditText.setHint(loginHintResId);
    }
  }
 private void setTexts() {
   mAnchorLikely.setText(mSettings.getAnchorLikely());
   mAnchorNotLikely.setText(mSettings.getAnchorNotLikely());
   mBtnSubmit.setText(mSettings.getBtnSubmit());
   mBtnDismiss.setText(mSettings.getBtnDismiss());
   mEtFeedback.setHint(mSettings.getFollowupPlaceholder(mRatingBar.getSelectedScore()));
 }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
      Log.i(AnkiDroidApp.TAG, "CardBrowser - onBackPressed()");
      if (mSearchEditText.getText().length() == 0
          && !mShowOnlyMarSus
          && mSelectedTags.size() == 0) {
        setResult(RESULT_OK);
        finish();
        if (Integer.valueOf(android.os.Build.VERSION.SDK) > 4) {
          ActivityTransitionAnimation.slide(CardBrowser.this, ActivityTransitionAnimation.RIGHT);
        }
      } else {
        mSearchEditText.setText("");
        mSearchEditText.setHint(R.string.downloaddeck_search);
        mSelectedTags.clear();
        mCards.clear();
        mCards.addAll(mAllCards);
        updateList();
      }
      return true;
    }

    return super.onKeyDown(keyCode, event);
  }
Beispiel #30
0
 void changeNickName() {
   AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
   final EditText editText = new EditText(this);
   alertDialog.setTitle("Nickname");
   alertDialog.setView(editText);
   editText.setText(AppToServer.getNickName());
   editText.setHint("< nickname >");
   editText.setSingleLine();
   alertDialog.setNegativeButton("No Change", null);
   final Activity activity = this;
   alertDialog.setPositiveButton(
       "Change",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           AppToServer.changeMyDetails(
               activity,
               editText.getText().toString(),
               null,
               null,
               new Callable<Void>() {
                 @Override
                 public Void call() throws Exception {
                   setOfflineData();
                   return null;
                 }
               });
         }
       });
   alertDialog.show();
 }