Exemplo n.º 1
27
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.fragment_loginregister, container, false);
    ButterKnife.bind(this, v);

    password.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
              logIn();
            }
            return false;
          }
        });

    register_email.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView arg0, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
              signUp();
            }
            return false;
          }
        });

    return v;
  }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);
    LueApp = (LuelinksViewer) getApplicationContext();
    LueApp
        .clearCookies(); // If this activity is launched, something happened with the session. Clear
                         // the cookies

    username = (EditText) findViewById(R.id.login_username);
    username.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // handles editor button clicks
            if (actionId == EditorInfo.IME_ACTION_NEXT
                || event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
              password.requestFocus();
              return true;
            }
            return false;
          }
        });
    password = (EditText) findViewById(R.id.login_password);
    password.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // handles editor button clicks
            if (actionId == EditorInfo.IME_ACTION_GO
                || event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
              login(findViewById(R.id.login_btn));
              return true;
            }
            return false;
          }
        });

    // cbSave = (CheckBox) findViewById(R.id.save_info);

    username.setText(LueApp.getSavedUsername());
    password.setText(LueApp.getSavedPassword());

    /*if (!username.getText().toString().contains("")){
    	cbSave.setChecked(false);
    }*/

    final Button loginbtn = (Button) findViewById(R.id.login_btn);
    loginbtn.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            try {
              login(findViewById(R.id.login_btn));
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
  }
  private void initializePassphrase() {
    createPassphraseView.setVisibility(View.VISIBLE);
    enterPassphraseView.setVisibility(View.GONE);

    newPassphraseEditText.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE) {
              if (!isPasswordValid()) {
                showValidationError();
              } else {
                twoViewSlider.showConfirmationField();
              }
            }
            return false;
          }
        });

    confirmNewPassphraseEditText.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE) {
              if (!newEqualsConfirmation()) {
                showInequalityError();
                twoViewSlider.showNewPasswordField();
              }
            }
            return false;
          }
        });

    Button createPassphraseButton = (Button) findViewById(R.id.btnCreate);
    createPassphraseButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!isPasswordValid()) {
              showValidationError();
              twoViewSlider.showNewPasswordField();
            } else if (isConfirmationFieldEmpty()) {
              twoViewSlider.showConfirmationField();
            } else if (!newEqualsConfirmation()) {
              showInequalityError();
              twoViewSlider.showNewPasswordField();
            } else {
              try {
                cacheWordHandler.setPassphrase(
                    newPassphraseEditText.getText().toString().toCharArray());
              } catch (GeneralSecurityException e) {
                Log.e(TAG, "Cacheword pass initialization failed: " + e.getMessage());
              }
            }
          }
        });
  }
Exemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mTracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
    // Load an ad into the AdMob banner view.
    AdView adView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
    adView.loadAd(adRequest);

    // Toasts the test ad message on the screen. Remove this after defining your own ad unit ID.
    Toast.makeText(this, TOAST_TEXT, Toast.LENGTH_LONG).show();
    mText = (EditText) findViewById(R.id.partno);
    mStart = findViewById(R.id.imageView1);

    mText.setOnEditorActionListener(ActionListener.newInstance(this));
    mStart.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!TextUtils.isEmpty(mText.getText())) {
              String s = mText.getText().toString();
              Intent i = new Intent(getBaseContext(), Game.class);
              i.putExtra("number", s);
              startActivity(i);
              finish();
            } else {
              Toast.makeText(MainActivity.this, TOAST_TEXT, Toast.LENGTH_LONG).show();
            }
          }
        });
  }
Exemplo n.º 5
0
    protected void addUiListeners() {
        editText.setOnEditorActionListener(new OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    addNote();
                    return true;
                }
                return false;
            }
        });

        final View button = findViewById(R.id.buttonAdd);
        button.setEnabled(false);
        editText.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                boolean enable = s.length() != 0;
                button.setEnabled(enable);
            }

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

            @Override
            public void afterTextChanged(Editable s) {
            }
        });
    }
Exemplo n.º 6
0
 public GoToPageDialog(
     final Context context, final DocumentView documentView, final DecodeService decodeService) {
   super(context);
   this.documentView = documentView;
   this.decodeService = decodeService;
   setTitle("Go to page");
   setContentView(R.layout.gotopage);
   final Button button = (Button) findViewById(R.id.goToButton);
   button.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View view) {
           goToPageAndDismiss();
         }
       });
   final EditText editText = (EditText) findViewById(R.id.pageNumberTextEdit);
   editText.setOnEditorActionListener(
       new TextView.OnEditorActionListener() {
         public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
           if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE) {
             goToPageAndDismiss();
             return true;
           }
           return false;
         }
       });
 }
Exemplo n.º 7
0
  public void createAlertDialog() {
    final EditText edtUsername = new EditText(getSherlockActivity());
    edtUsername.setSingleLine();
    edtUsername.setImeOptions(EditorInfo.IME_ACTION_DONE);

    final AlertDialog alert =
        new AlertDialog.Builder(getSherlockActivity())
            .setTitle("Coderwall")
            .setMessage("Please enter " + (username == null ? "your" : "a") + " username")
            .setView(edtUsername)
            .setPositiveButton(
                "Ok",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int whichButton) {
                    createTask(edtUsername.getText().toString().trim(), true).execute();
                  }
                })
            .show();

    edtUsername.setOnEditorActionListener(
        new OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            alert.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
            return false;
          }
        });
  }
Exemplo n.º 8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_generate_pass);

    Intent intent = getIntent();
    url = intent.getStringExtra(ViewPasswordsActivity.EXTRA_URL);

    mURLView = (EditText) findViewById(R.id.url);
    mScrollView = (ScrollView) findViewById(R.id.generate_pass_form);
    mPasswordView = (EditText) findViewById(R.id.masterpass);
    mPasswordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.generatePass || id == EditorInfo.IME_NULL) {
              generatePass();
              return true;
            }
            return false;
          }
        });

    Button mGeneratePasswordButton = (Button) findViewById(R.id.generatePasswordButton);
    mGeneratePasswordButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            generatePass();
          }
        });
    if (url != null) mURLView.setText(url);
  }
  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;
  }
  /** Loads the layout and its widgets */
  private void setView() {
    Button fbBtn = (Button) findViewById(R.id.simpleauth_fb_btn);
    Button twBtn = (Button) findViewById(R.id.simpleauth_tw_btn);
    mEmailInput = (EditText) findViewById(R.id.simpleauth_email_input);
    mPasswordInput = (EditText) findViewById(R.id.simpleauth_password_input);
    mPasswordInput.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_GO && validEmailPasswordInput()) {
              String email = mEmailInput.getText().toString().trim();
              String password = mPasswordInput.getText().toString().trim();
              performEmailAndPasswordLogin(email, password);
            }
            return false;
          }
        });
    Button loginBtn = (Button) findViewById(R.id.simpleauth_login_btn);
    fbBtn.setOnClickListener(this);
    twBtn.setOnClickListener(this);
    loginBtn.setOnClickListener(this);

    View socialHolder = findViewById(R.id.simpleauth_social);
    View emailpasswordHolder = findViewById(R.id.simpleauth_email_password);
    socialHolder.setVisibility(
        mAuthMode == AuthMode.SOCIAL || mAuthMode == AuthMode.BOTH ? View.VISIBLE : View.GONE);
    emailpasswordHolder.setVisibility(
        mAuthMode == AuthMode.EMAIL || mAuthMode == AuthMode.BOTH ? View.VISIBLE : View.GONE);

    // Only create adapter if that mode is going to be used
    if (mAuthMode == AuthMode.EMAIL || mAuthMode == AuthMode.BOTH) {
      initNetworking();
    }
  }
Exemplo n.º 11
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   txtUser.setOnEditorActionListener(this);
   txtPwd.setOnEditorActionListener(this);
   presenter.initView();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initializeDeviceList(this);
    setContentView(R.layout.custom_ip_list);

    list = (ListView) findViewById(android.R.id.list);
    list.setOnItemClickListener(onClickListener);

    list.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, ipAddressList));

    findViewById(android.R.id.button1)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                addNewDevice();
              }
            });

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

            mTab.loadUrlWithSanitization(mUrlTextView.getText().toString());
            mUrlTextView.clearFocus();
            setKeyboardVisibilityForUrl(false);
            mTab.getContentView().requestFocus();
            return true;
          }
        });
    mUrlTextView.setOnFocusChangeListener(
        new OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            setKeyboardVisibilityForUrl(hasFocus);
            mNextButton.setVisibility(hasFocus ? GONE : VISIBLE);
            mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE);
            if (!hasFocus) {
              mUrlTextView.setText(mTab.getContentView().getUrl());
            }
          }
        });
  }
Exemplo n.º 14
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (DEBUG_LIFECYCLE) logger.debug("onCreateView()");
    View v = inflater.inflate(R.layout.chatview_main, container, false);

    uiLines = (ListView) v.findViewById(R.id.chatview_lines);
    uiInput = (EditText) v.findViewById(R.id.chatview_input);
    uiSend = (ImageButton) v.findViewById(R.id.chatview_send);
    uiTab = (ImageButton) v.findViewById(R.id.chatview_tab);

    uiSend.setOnClickListener(this);
    uiTab.setOnClickListener(this);
    uiInput.setOnKeyListener(this); // listen for hardware keyboard
    uiInput.addTextChangedListener(
        this); // listen for software keyboard through watching input box text
    uiInput.setOnEditorActionListener(
        this); // listen for software keyboard's “send” click. see onEditorAction()

    uiLines.setFocusable(false);
    uiLines.setFocusableInTouchMode(false);

    CopyPaste cp = new CopyPaste(activity, uiInput);
    uiInput.setOnLongClickListener(cp);
    uiLines.setOnItemLongClickListener(cp);

    uiMore = (ViewGroup) inflater.inflate(R.layout.more_button, null);
    uiMoreButton = (Button) uiMore.findViewById(R.id.button_more);
    uiMoreButton.setOnClickListener(this);
    uiLines.addHeaderView(uiMore);
    status = Buffer.LINES.CAN_FETCH_MORE;

    online = true;
    return v;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UIHelper.SetTheme(this, R.layout.activity_display_light_novel_content);
    UIHelper.SetActionBarDisplayHomeAsUp(this, true);

    try {
      PageModel tempPage = new PageModel();
      tempPage.setPage(getIntent().getStringExtra(Constants.EXTRA_PAGE));
      pageModel = dao.getPageModel(tempPage, null);
    } catch (Exception e) {
      Log.e(
          TAG,
          "Failed to get the PageModel for content: "
              + getIntent().getStringExtra(Constants.EXTRA_PAGE),
          e);
    }

    // compatibility search box
    final EditText searchText = (EditText) findViewById(R.id.searchText);
    searchText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            search(searchText.getText().toString());
            return false;
          }
        });

    webView = (WebView) findViewById(R.id.webView1);
    Log.d(TAG, "OnCreate Completed: " + pageModel.getPage());

    restored = false;
  }
Exemplo n.º 16
0
 private void setEventListener() {
   btn_header.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           GlobalController.pop();
         }
       });
   btn_qrcode.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           doScanQRCode();
         }
       });
   btn_valid.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           doValidation();
         }
       });
   txt_code.setOnEditorActionListener(
       new TextView.OnEditorActionListener() {
         @Override
         public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
           if (actionId == EditorInfo.IME_ACTION_GO) {
             doValidation();
             return true;
           }
           return false;
         }
       });
 }
Exemplo n.º 17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    /**
     * @note : Le titre de l'activité de lancement donné dans l'AndroidManifest.xml est repris comme
     *     nom du lanceur de l'application par Android. Pour ce premier écran, on va donc utiliser
     *     la méthode setTitle afin de définir le titre de l'activité (s'il est différent du titre
     *     de l'application).
     */
    setTitle(R.string.login_activity_title);
    /**
     * @note La liste des utilisateurs est affichées dans un Spinner, pour en savoir plus lisez
     *     http://d.android.com/guide/topics/ui/controls/spinner.html
     */
    userSpinner = (Spinner) findViewById(R.id.login_username);

    // Obtention de la liste des utilisateurs.
    ArrayList<User> users = User.getClients();
    // Création d'un ArrayAdapter en utilisant la liste des utilisateurs et un layout pour le
    // spinner existant dans Android.
    ArrayAdapter<User> adapter =
        new ArrayAdapter<User>(this, android.R.layout.simple_spinner_dropdown_item, users);
    // On lie l'adapter au spinner.
    userSpinner.setAdapter(adapter);
    // On indique qu'il faut appeler onEditorAction de cette classe lorsqu'une action (valider ici)
    // est faite depuis le clavier lorsqu'on est en train de remplir le mot de passe.
    EditText passwordEditText = (EditText) findViewById(R.id.login_password);
    passwordEditText.setOnEditorActionListener(this);
  }
Exemplo n.º 18
0
  private void setupChat() {
    Log.d(TAG, "setupChat()");

    // Initialize the array adapter for the conversation thread
    mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message);
    mConversationView = (ListView) findViewById(R.id.in);
    mConversationView.setAdapter(mConversationArrayAdapter);

    // Initialize the compose field with a listener for the return key
    mOutEditText = (EditText) findViewById(R.id.edit_text_out);
    mOutEditText.setOnEditorActionListener(mWriteListener);

    // Initialize the send button with a listener that for click events
    mSendButton = (Button) findViewById(R.id.button_send);
    mSendButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            // Send a message using content of the edit text widget
            TextView view = (TextView) findViewById(R.id.edit_text_out);
            String message = view.getText().toString();
            sendMessage(message);
          }
        });

    // Initialize the BluetoothChatService to perform bluetooth connections
    mChatService = new BluetoothThread1(this, mHandler);

    // Initialize the buffer for outgoing messages
    mOutStringBuffer = new StringBuffer("");
  }
Exemplo n.º 19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    // TODO: create layout
    mHistoryAdapter = new SearchHistoryAdapter(this);
    mResultAdapter = new SearchResultAdapter(this);

    mSearchText = (EditText) findViewById(R.id.search_text);
    mSearchText.setOnEditorActionListener(searchTextListener);
    mSearchText.addTextChangedListener(searchTextWatcher);

    final Intent queryIntent = getIntent();
    final String queryAction = queryIntent.getAction();
    if (Intent.ACTION_SEARCH.equals(queryAction)) {
      String query = queryIntent.getStringExtra(SearchManager.QUERY);
      mSearchText.setText(query);
      mSearchText.setSelection(query.length());
    } else {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(mSearchText, InputMethodManager.RESULT_SHOWN);
      showSearchHistory();
    }

    mSearchText.requestFocus();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
      actionBar.setDisplayHomeAsUpEnabled(true);
    }

    usernameEditText = (EditText) findViewById(R.id.username_edit_text);
    passwordEditText = (EditText) findViewById(R.id.password_edit_text);
    passwordEditText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == R.id.edittext_action_login
                || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) {
              login();
              return true;
            }
            return false;
          }
        });

    // Set up the submit button click handler
    Button actionButton = (Button) findViewById(R.id.action_button);
    actionButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            login();
          }
        });
  }
Exemplo n.º 21
0
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mUsernameView = (AutoCompleteTextView) findViewById(R.id.email);
    populateAutoComplete();

    mPasswordView = (EditText) findViewById(R.id.password);
    mPasswordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
              attemptLogin();
              return true;
            }
            return false;
          }
        });

    Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
    mEmailSignInButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            attemptLogin();
          }
        });

    mLoginFormView = findViewById(R.id.login_form);
    mProgressView = findViewById(R.id.login_progress);

    api = RxUtils.createApi(RtApi.class, Config.BASE_URL);
  }
  private void init(AttributeSet attrs) {
    inflate(getContext(), R.layout.searchbar, this);

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

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

    array.recycle();

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

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

    setupIcons();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (fragmentView == null) {
      fragmentView = inflater.inflate(R.layout.chat_profile_change_name_layout, container, false);

      TLRPC.Chat currentChat = MessagesController.Instance.chats.get(chat_id);

      firstNameField = (EditText) fragmentView.findViewById(R.id.first_name_field);
      firstNameField.setOnEditorActionListener(
          new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
              if (i == EditorInfo.IME_ACTION_DONE) {
                doneButton.performClick();
                return true;
              }
              return false;
            }
          });
      firstNameField.setText(currentChat.title);
      firstNameField.setSelection(firstNameField.length());

      TextView headerLabel = (TextView) fragmentView.findViewById(R.id.settings_section_text);
      headerLabel.setText(getStringEntry(R.string.EnterGroupNameTitle));
    } else {
      ViewGroup parent = (ViewGroup) fragmentView.getParent();
      if (parent != null) {
        parent.removeView(fragmentView);
      }
    }
    return fragmentView;
  }
Exemplo n.º 24
0
 @Override
 @NonNull
 protected LinearLayout makeCenterView() {
   LinearLayout rootLayout = new LinearLayout(activity);
   rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   rootLayout.setOrientation(LinearLayout.VERTICAL);
   blackColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   blackColorView.setId(BLACK_ID);
   blackColorView.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   blackColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_bottom));
   blackColorView.setLockPointerInBounds(false);
   blackColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(blackColorView);
   multiColorView = new ColorPanelView(activity);
   //noinspection ResourceType
   multiColorView.setId(MULTI_ID);
   multiColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
   multiColorView.setPointerDrawable(
       CompatUtils.getDrawable(activity, R.drawable.color_picker_cursor_top));
   multiColorView.setLockPointerInBounds(true);
   multiColorView.setOnColorChangedListener(
       new ColorPanelView.OnColorChangedListener() {
         @Override
         public void onColorChanged(ColorPanelView view, int color) {
           updateCurrentColor(color);
         }
       });
   rootLayout.addView(multiColorView);
   LinearLayout previewLayout = new LinearLayout(activity);
   previewLayout.setOrientation(LinearLayout.HORIZONTAL);
   previewLayout.setGravity(Gravity.CENTER);
   previewLayout.setLayoutParams(
       new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
   hexValView = new EditText(activity);
   hexValView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
   hexValView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
   hexValView.setImeOptions(EditorInfo.IME_ACTION_DONE);
   hexValView.setGravity(Gravity.CENTER);
   hexValView.setBackgroundColor(initColor);
   hexValView.setTextColor(Color.BLACK);
   hexValView.setShadowLayer(3, 0, 2, Color.WHITE); // 设置阴影,以便背景色为黑色系列时仍然看得见
   hexValView.setMinEms(6);
   hexValView.setMaxEms(8);
   hexValView.setPadding(0, 0, 0, 0);
   hexValView.setSingleLine(true);
   hexValView.setOnEditorActionListener(this);
   hexValDefaultColor = hexValView.getTextColors();
   previewLayout.addView(hexValView);
   rootLayout.addView(previewLayout);
   return rootLayout;
 }
Exemplo n.º 25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    // Set up the login form.
    mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
    populateAutoComplete();

    mPasswordView = (EditText) findViewById(R.id.password);
    mPasswordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
              attemptLogin();
              return true;
            }
            return false;
          }
        });

    Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
    mEmailSignInButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            attemptLogin();
          }
        });

    mLoginFormView = findViewById(R.id.login_form);
    mProgressView = findViewById(R.id.login_progress);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.group_score);

    EditText groups = (EditText) findViewById(R.id.editText1);

    mIntent = getIntent(); // gets the previously created intent
    groups.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {

              EditText groups = (EditText) findViewById(R.id.editText1);

              mIntent.putExtra("num_groups", groups.getText().toString());
              setResult(RaceActivity.RESULT_OK, mIntent);
              finish();
              return true;
            }
            return false;
          }
        });
  }
Exemplo n.º 27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    btnLogin = (Button) findViewById(R.id.btnLogin);
    txtUsername = (EditText) findViewById(R.id.txtUsername);

    intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
    intentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);

    manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
    channel = manager.initialize(this, getMainLooper(), null);

    txtUsername.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            login();
            return true;
          }
        });

    // Restore preferences
    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    String username = settings.getString("username", "");
    txtUsername.setText(username);
    btnLogin.setOnClickListener(this);
  }
Exemplo n.º 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    // Set up the login form.
    serverView = (AutoCompleteTextView) findViewById(R.id.server);
    macmContextView = (AutoCompleteTextView) findViewById(R.id.macm_context);
    macmTenantView = (AutoCompleteTextView) findViewById(R.id.macm_tenant);
    macmLibView = (AutoCompleteTextView) findViewById(R.id.macm_lib);
    userView = (AutoCompleteTextView) findViewById(R.id.user);
    passwordView = (EditText) findViewById(R.id.password);
    passwordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            return true;
          }
        });

    Button mSignInButton = (Button) findViewById(R.id.email_sign_in_button);
    mSignInButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            attemptLogin();
          }
        });
    loginFormView = findViewById(R.id.login_form);
    progressView = findViewById(R.id.login_progress);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_login);

    // Set up the login form.
    mUsernameView = (EditText) findViewById(R.id.username);

    mPasswordView = (EditText) findViewById(R.id.password);
    mPasswordView.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
              attemptLogin();
              return true;
            }
            return false;
          }
        });

    mLoginFormView = findViewById(R.id.login_form);
    mLoginStatusView = findViewById(R.id.login_status);
    mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);

    findViewById(R.id.sign_in_button)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                attemptLogin();
              }
            });
  }
Exemplo n.º 30
0
  private void init() {
    setId(R.id.pathview);
    setLayoutParams(toolbarLayoutParams());
    from(getContext()).inflate(R.layout.widget_pathview, this, true);

    mPathContainer = (PathHorizontalScrollView) findViewById(R.id.pathview_path_container);
    mButtonRight = findViewById(R.id.pathview_button_right);
    View buttonManualLeft = findViewById(R.id.pathview_manual_button_left);
    View buttonManualRight = findViewById(R.id.pathview_manual_button_right);
    mManualText = (EditText) findViewById(R.id.pathview_manual_text);

    mButtonRight.setOnClickListener(mSwitchToManualOnClickListener);
    buttonManualLeft.setOnClickListener(mCloseManualInputClickListener);
    buttonManualRight.setOnClickListener(mApplyManualInputClickListener);
    mManualText.setOnEditorActionListener(mOnEditorActionListener);
    mManualText.setCustomSelectionActionModeCallback(mEditorActionModeCallback);

    // XML doesn't always work
    mManualText.setInputType(TYPE_TEXT_VARIATION_URI | TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    scheduleSetRightEdgeRangeListener();

    // Setup CheatSheets
    setup(mButtonRight);
    setup(buttonManualRight);
    setup(buttonManualLeft);
  }