Java Code Examples for android.widget.EditText

The following are top voted examples for showing how to use android.widget.EditText. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: coursera-sustainable-apps   File: LoginActivity.java   View source code 7 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    loginButton = (Button) findViewById(R.id.loginButton);
    registerButton = (Button) findViewById(R.id.registerButton);
    forgotPasswordButton = (Button) findViewById(R.id.forgotPassword);

    passwordEditText = (EditText) findViewById(R.id.passwordEditText);
    emailEditText = (EditText) findViewById(R.id.emailEditText);


    // Does having a single click listener really simplify or
    // improve this code's modularity in any helpful way?
    forgotPasswordButton.setOnClickListener(this);
    loginButton.setOnClickListener(this);
    registerButton.setOnClickListener(this);
}
 
Example 2
Project: AppTycoon   File: ChangeProductNameDialog.java   View source code 6 votes vote down vote up
/**
 * @param product Product that's being edited
 * @param context Activity context
 * @param onNameChanged Callback that's called after the name has been changed
 */
public ChangeProductNameDialog(final Product product, Context context, final CustomCallback onNameChanged) {
    super(context,
            R.layout.dialog_change_product_name,
            "Set product name");
    final EditText editTextName = (EditText) findViewById(R.id.editTextName);
    editTextName.setText(product.getName());
    setOkAction(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            product.setName(editTextName.getText().toString());
            onNameChanged.callBack();
            dismiss();
        }
    });
}
 
Example 3
Project: https-github.com-hyb1996-NoRootScriptDroid   File: MyScriptListFragment.java   View source code 6 votes vote down vote up
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
    if (mIsFirstTextChanged) {
        mIsFirstTextChanged = false;
        return;
    }
    EditText editText = dialog.getInputEditText();
    if (editText == null)
        return;
    int errorResId = 0;
    if (input == null || input.length() == 0) {
        errorResId = R.string.text_name_should_not_be_empty;
    } else if (!input.equals(mExcluded)) {
        if (new File(getCurrentDirectory(), mIsDirectory ? input.toString() : input.toString() + ".js").exists()) {
            errorResId = R.string.text_file_exists;
        }
    }
    if (errorResId == 0) {
        editText.setError(null);
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
    } else {
        editText.setError(getString(errorResId));
        dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
    }

}
 
Example 4
Project: weex-uikit   File: AbstractEditComponent.java   View source code 6 votes vote down vote up
private void decideSoftKeyboard() {
  View hostView;
  if ((hostView = getHostView()) != null) {
    final Context context = getContext();
    if (context != null && context instanceof Activity) {
      hostView.postDelayed(new Runnable() {
        @Override
        public void run() {
          View currentFocus = ((Activity) context).getCurrentFocus();
          if (!(currentFocus instanceof EditText)) {
            mInputMethodManager.hideSoftInputFromWindow(getHostView().getWindowToken(), 0);
          }
        }
      }, 16);
    }
  }
}
 
Example 5
Project: odoo-work   File: SelectMembers.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_members);

    textNoRecord = (TextView) findViewById(R.id.textEmpty);
    listView = (ListView) findViewById(R.id.list_team_members);
    listView.setOnItemClickListener(this);
    memberList = new ArrayList<>();

    editAddMembers = (EditText) findViewById(R.id.editAddTeamMember);
    editAddMembers.addTextChangedListener(this);

    findViewById(R.id.image_search).setOnClickListener(this);

    try {
        odoo = Odoo.createWithUser(this, OUser.current(this));
    } catch (OdooVersionException e) {
        e.printStackTrace();
    }
}
 
Example 6
Project: RNLearn_Project1   File: ReactTextInputShadowNode.java   View source code 6 votes vote down vote up
@Override
public void setThemedContext(ThemedReactContext themedContext) {
  super.setThemedContext(themedContext);

  // TODO #7120264: cache this stuff better
  mEditText = new EditText(getThemedContext());
  // This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,
  // setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
  mEditText.setLayoutParams(
      new ViewGroup.LayoutParams(
          ViewGroup.LayoutParams.WRAP_CONTENT,
          ViewGroup.LayoutParams.WRAP_CONTENT));

  setDefaultPadding(Spacing.START, mEditText.getPaddingStart());
  setDefaultPadding(Spacing.TOP, mEditText.getPaddingTop());
  setDefaultPadding(Spacing.END, mEditText.getPaddingEnd());
  setDefaultPadding(Spacing.BOTTOM, mEditText.getPaddingBottom());
  mEditText.setPadding(0, 0, 0, 0);
}
 
Example 7
Project: BrotherWeather   File: BaseActivity.java   View source code 6 votes vote down vote up
@Override public boolean dispatchTouchEvent(MotionEvent ev) {
  if (isAutoHideInputView) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
      View v = getCurrentFocus();
      if (v != null) {
        if ((v instanceof EditText)) {
          if (!AppUtils.isEventInVIew(v, ev)) {
            if (AppUtils.hideInput(this, v) && isClearFocusWhileAutoHideInputView) {
              v.clearFocus();
            }
          }
        }
      }
      return super.dispatchTouchEvent(ev);
    }
    // 必不可少,否则所有的组件都不会有TouchEvent了
    if (getWindow().superDispatchTouchEvent(ev)) {
      return true;
    }
  }

  try {
    return super.dispatchTouchEvent(ev);
  } catch (Exception e) {
    // ignored
  }
  return false;
}
 
Example 8
Project: GitHub   File: MockLocationsActivity.java   View source code 6 votes vote down vote up
private void initViews() {
    latitudeInput = (EditText) findViewById(R.id.latitude_input);
    longitudeInput = (EditText) findViewById(R.id.longitude_input);
    mockLocationView = (TextView) findViewById(R.id.mock_location_view);
    updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
    mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
    setLocationButton = (Button) findViewById(R.id.set_location_button);

    mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setMockMode(isChecked);
            setLocationButton.setEnabled(isChecked);
        }
    });
    setLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMockLocation();
        }
    });
}
 
Example 9
Project: Nird2   File: SetupActivityTest.java   View source code 6 votes vote down vote up
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
	nicknameEntryWrapper = (TextInputLayout) setupActivity
			.findViewById(R.id.nickname_entry_wrapper);
	passwordConfirmationWrapper = (TextInputLayout) setupActivity
			.findViewById(R.id.password_confirm_wrapper);
	nicknameEntry =
			(EditText) setupActivity.findViewById(R.id.nickname_entry);
	passwordEntry =
			(EditText) setupActivity.findViewById(R.id.password_entry);
	passwordConfirmation =
			(EditText) setupActivity.findViewById(R.id.password_confirm);
	strengthMeter =
			(StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
	createAccountButton =
			(Button) setupActivity.findViewById(R.id.create_account);
}
 
Example 10
Project: ChromeLikeTabSwitcher   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public void onShowTab(@NonNull final Context context,
                      @NonNull final TabSwitcher tabSwitcher, @NonNull final View view,
                      @NonNull final Tab tab, final int index, final int viewType,
                      @Nullable final Bundle savedInstanceState) {
    TextView textView = findViewById(android.R.id.title);
    textView.setText(tab.getTitle());
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setVisibility(tabSwitcher.isSwitcherShown() ? View.GONE : View.VISIBLE);

    if (viewType != 0) {
        EditText editText = findViewById(android.R.id.edit);

        if (savedInstanceState == null) {
            editText.setText(null);
        }

        editText.requestFocus();
    }
}
 
Example 11
Project: 2017.1-Trezentos   File: LoginActivity.java   View source code 6 votes vote down vote up
private void loginErrorMessage(String errorMessage, EditText email, EditText password){
    if(errorMessage.equals(getString(R.string.msg_len_email_error_message))){
        email.requestFocus();
        email.setError("Email inválido. Tente novamente");
    }

    if(errorMessage.equals(getString(R.string.msg_special_characters_email_error_message))){
        email.requestFocus();
        email.setError("Email inválido. Tente novamente");
    }

    if(errorMessage.equals(getString(R.string.msg_null_email_error_message))){
        email.requestFocus();
        email.setError(getString(R.string.msg_null_email_error_message));
    }

    if(errorMessage.equals(getString(R.string.msg_len_password_error_message))){
        password.requestFocus();
        password.setError("Senha inválida. Tente Novamente");
    }

    if(errorMessage.equals(getString(R.string.msg_null_password_error_message))){
        password.requestFocus();
        password.setError(getString(R.string.msg_null_password_error_message));
    }
}
 
Example 12
Project: ValueAddSubView   File: FocusManager.java   View source code 6 votes vote down vote up
@Override
public boolean onTouch(View v, MotionEvent event) {
    KeyboardUtils.hideSoftInput(mContext);
    View currentFocus = mContext.getCurrentFocus();
    //处理列表中的控件需要点击两次才生效的问题
    if (currentFocus != v && v.isClickable() && event.getAction() == MotionEvent.ACTION_DOWN) {
        v.requestFocus();
        return false;
    }
    
    if (currentFocus instanceof EditText) {
        mRootView.requestFocus();
    }
    return false;
}
 
Example 13
Project: TimeTrix   File: SectionDetailsActivity.java   View source code 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate (savedInstanceState);
        ActivitySectionDetailsBinding binding = DataBindingUtil.setContentView (this, R.layout.activity_section_details);
        mSectionIndex = getIntent ().getIntExtra (GlobalData.SECTION_INDEX, 1); //TODO do has extra
        Toolbar toolbar = (Toolbar) findViewById (R.id.toolbarSubDetail);
        setSupportActionBar (toolbar);
        android.support.v7.app.ActionBar actionBar = getSupportActionBar ();
        Button updateButton = (Button) findViewById (R.id.update);
        mSectionNameEditText = (EditText) findViewById (R.id.textViewSectionName);
        mSectionDescriptionEditText = (EditText) findViewById (R.id.textViewDescriptionName);
        updateButton.setOnClickListener (this);
//        Toast.makeText (SectionDetailsActivity.this, "file id ="+getIntent ().getLongExtra (GlobalData.SECTION_INDEX,-1), Toast.LENGTH_LONG).show ();
        mSubject = new SectionDetailsBinder (SectionDetailsActivity.this, mSectionIndex + 1);
        mSubject.setInputType ("none");
        binding.setSubject (mSubject);
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled (true);
        }
    }
 
Example 14
Project: AI_Calorie_Counter_Demo   File: reguser.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reguser);
    System.out.println("reached here1232");
    e_name=(EditText) findViewById(R.id.name);
    e_username=(EditText) findViewById(R.id.r_userName);
    e_password=(EditText) findViewById(R.id.password);
    e_lifestyle=(Spinner) findViewById(R.id.lifestyle);
    e_current_weight = (EditText) findViewById(R.id.cweight);
    e_goal_weight = (EditText) findViewById(R.id.gweight);
    e_lifestyle.setOnItemSelectedListener(this);
    spinner = (ProgressBar)findViewById(R.id.progressBar2);
    //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    spinner.setVisibility(View.GONE);
}
 
Example 15
Project: Liz   File: ThemeHelper.java   View source code 6 votes vote down vote up
public static void setCursorColor(EditText editText, int color) {
	try {
		Field fCursorDrawableRes =
				TextView.class.getDeclaredField("mCursorDrawableRes");
		fCursorDrawableRes.setAccessible(true);
		int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
		Field fEditor = TextView.class.getDeclaredField("mEditor");
		fEditor.setAccessible(true);
		Object editor = fEditor.get(editText);
		Class<?> clazz = editor.getClass();
		Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
		fCursorDrawable.setAccessible(true);

		Drawable[] drawables = new Drawable[2];
		drawables[0] = ContextCompat.getDrawable(editText.getContext(), mCursorDrawableRes);
		drawables[1] = ContextCompat.getDrawable(editText.getContext(), mCursorDrawableRes);
		drawables[0].setColorFilter(color, PorterDuff.Mode.SRC_IN);
		drawables[1].setColorFilter(color, PorterDuff.Mode.SRC_IN);
		fCursorDrawable.set(editor, drawables);
	} catch (final Throwable ignored) {  }
}
 
Example 16
Project: FindCurrencyExa   File: MainFragment.java   View source code 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    btn_find = (Button) view.findViewById(R.id.btn_find);
    et_location_name = (EditText) view.findViewById(R.id.et_location_name);
    et_country_code = (EditText) view.findViewById(R.id.et_country_code);
    et_countyISO = (EditText) view.findViewById(R.id.et_countyISO);
    et_currencyCode = (EditText) view.findViewById(R.id.et_currencyCode);
    tv_currencySymbol = (TextView) view.findViewById(R.id.tv_currencySymbol);
    tv_currencyDisplayName = (TextView) view.findViewById(R.id.tv_currencyDisplayName);
    tv_currencyCode = (TextView) view.findViewById(R.id.tv_currencyCode);
    tv_fractionDigits = (TextView) view.findViewById(R.id.tv_fractionDigits);
    tv_numericCode = (TextView) view.findViewById(R.id.tv_numericCode);
    tv_noDataFound = (TextView) view.findViewById(R.id.tv_noDataFound);
    fl_bottomContents = (FrameLayout) view.findViewById(R.id.fl_bottomContents);

    availableCurrenciesSet = Currency.getAvailableCurrencies();
    currencyList = new ArrayList<>(availableCurrenciesSet);
    btn_find.setOnClickListener(this);
}
 
Example 17
Project: AppTycoon   File: EditProductFeatureDialog.java   View source code 6 votes vote down vote up
/**
 * @param product Product that the feature belongs to
 * @param feature Feature that's being edited
 * @param context Activity context
 * @param onFeatureChanged Callback that's called when the feature is changed
 */
public EditProductFeatureDialog(final Product product,
                                final ProductFeature feature,
                                Context context,
                                final CustomCallback onFeatureChanged) {
    super(context,
            R.layout.dialog_edit_product_feature,
            "Edit feature");

    final EditText editTextLevel = (EditText) findViewById(R.id.editTextFeatureLevel);
    String stringCurrentLevel = "" + product.getLevelOfAFeature(feature);
    editTextLevel.setText(stringCurrentLevel);

    TextView textView = (TextView) findViewById(R.id.textViewFeatureName);
    textView.setText(feature.getName());

    setOkAction(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            product.addFeature(feature, Integer.parseInt(editTextLevel.getText().toString()));
            onFeatureChanged.callBack();
            dismiss();
        }
    });
}
 
Example 18
Project: MobileAppForPatient   File: GuiUtils.java   View source code 6 votes vote down vote up
public static void setKeypadVisibility(Context context, EditText inputNote, int visibility) {
    InputMethodManager imm = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);

    switch (visibility) {
        case View.VISIBLE:
            // 開啟鍵盤
            imm.showSoftInput(inputNote, InputMethodManager.SHOW_IMPLICIT);
            break;
        case View.GONE:
        case View.INVISIBLE:
            // 關閉鍵盤
            imm.hideSoftInputFromWindow(inputNote.getWindowToken(), 0);
            break;
    } /* end of switch */
}
 
Example 19
Project: AndroidNetwork   File: LoginNewActivity.java   View source code 6 votes vote down vote up
@Override
protected void initViews(Bundle savedInstanceState) {
	setContentView(R.layout.activity_login);

	etEmail = (EditText)findViewById(R.id.email);
	etEmail.setText(strEmail);
	etPassword = (EditText)findViewById(R.id.password);

	//登录事件
	btnLogin = (Button)findViewById(R.id.sign_in_button);
	btnLogin.setOnClickListener(
			new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					gotoLoginActivity();
				}
			});
}
 
Example 20
Project: GCSApp   File: GroupDetailsActivity.java   View source code 6 votes vote down vote up
private void showAnnouncementDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.group_announcement);
    if (group.getOwner().equals(EMClient.getInstance().getCurrentUser()) ||
            group.getAdminList().contains(EMClient.getInstance().getCurrentUser())) {
        final EditText et = new EditText(GroupDetailsActivity.this);
        et.setText(group.getAnnouncement());
        builder.setView(et);
        builder.setNegativeButton(R.string.cancel, null)
                .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        final String text = et.getText().toString();
                        if (!text.equals(group.getAnnouncement())) {
                            dialog.dismiss();
                            updateAnnouncement(text);
                        }
                    }
                });
    } else {
        builder.setMessage(group.getAnnouncement());
        builder.setPositiveButton(R.string.ok, null);
    }
    builder.show();
}
 
Example 21
Project: OpenHomeAnalysis   File: OhaEnergyUseBillFragment.java   View source code 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_energy_use_bill, container, false);
    this.radioButtonFromDate = (RadioButton) view.findViewById(R.id.radioButtonFromDate);
    this.radioButtonToDate = (RadioButton) view.findViewById(R.id.radioButtonToDate);
    this.editKwhCost = (EditText) view.findViewById(R.id.editKwhCost);
    this.datePicker = (DatePicker) view.findViewById(R.id.datePicker);
    this.toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    this.setTextRadioButtonDate(radioButtonFromDate, this.fromDate);
    this.setTextRadioButtonDate(radioButtonToDate, this.toDate);
    this.setCalendarView();
    this.editKwhCost.setText(OhaHelper.getEditable(this.kwhCost));
    this.radioButtonFromDate.setOnClickListener(this);
    this.radioButtonToDate.setOnClickListener(this);
    this.datePicker.setOnClickListener(this);
    //Remover o date_picker_header do datePicker se o mesmo existir
    View viewDayDatePicker = datePicker.findViewById(Resources.getSystem().getIdentifier("date_picker_header", "id", "android"));
    if (viewDayDatePicker != null) {
        viewDayDatePicker.setVisibility(View.GONE);
    }
    this.toolbar.inflateMenu(R.menu.fragment_energy_use_bill);
    this.toolbar.setOnMenuItemClickListener(this);
    return view;
}
 
Example 22
Project: yyox   File: FeedBackActivity.java   View source code 6 votes vote down vote up
@Override
protected void initWidgets() {
    super.initWidgets();
    mImgContainerLayout = (LinearLayout) findViewById(R.id.kf5_feed_back_image_layout);
    mETContent = (EditText) findViewById(R.id.kf5_feed_back_content_et);
    mETContent.setOnTouchListener(this);
    mETContent.addTextChangedListener(new ETTextWatcher());
    mImgChoiceImg = (ImageView) findViewById(R.id.kf5_feed_back_choice_img);
    mImgChoiceImg.setOnClickListener(this);
    mParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    mParams.bottomMargin = 1;
    mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImg.setOnClickListener(this);
    mTVSubmit = (TextView) findViewById(R.id.kf5_right_text_view);
    mTVSubmit.setOnClickListener(this);
    mTVSubmit.setEnabled(false);
}
 
Example 23
Project: Clases-2017c1   File: HiAppWidgetConfigureActivity.java   View source code 5 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Set the result to CANCELED.  This will cause the widget host to cancel
    // out of the widget placement if the user presses the back button.
    setResult(RESULT_CANCELED);

    setContentView(R.layout.hi_app_widget_configure);
    mAppWidgetText = (EditText) findViewById(R.id.appwidget_text);
    findViewById(R.id.add_button).setOnClickListener(mOnClickListener);

    // Find the widget id from the intent.
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(
                AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    // If this activity was started with an intent without an app widget ID, finish with an error.
    if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
        finish();
        return;
    }

    mAppWidgetText.setText(loadTitlePref(HiAppWidgetConfigureActivity.this, mAppWidgetId));
}
 
Example 24
Project: MusicX-music-player   File: ATEDefaultTags.java   View source code 5 votes vote down vote up
@Nullable
private static HashMap<String, String> get(View forView) {
    if (forView instanceof EditText)
        return getDefaultEditText();
    else if (forView instanceof CompoundButton)
        return getDefaultCompoundButton();
    else if (forView instanceof ProgressBar)
        return getDefaultWidget();
    else if (forView instanceof CheckedTextView)
        return getDefaultCheckedTextView();
    else if (forView instanceof FloatingActionButton)
        return getDefaultFloatingActionButton();
    else if (forView instanceof ScrollView || forView instanceof AbsListView)
        return getDefaultScrollableView();
    else if (ATEUtil.isInClassPath(EdgeGlowTagProcessor.RECYCLERVIEW_CLASS) &&
            RecyclerViewUtil.isRecyclerView(forView)) {
        return getDefaultScrollableView();
    } else if (ATEUtil.isInClassPath(EdgeGlowTagProcessor.NESTEDSCROLLVIEW_CLASS) &&
            NestedScrollViewUtil.isNestedScrollView(forView)) {
        return getDefaultScrollableView();
    } else if (ATEUtil.isInClassPath(EdgeGlowTagProcessor.VIEWPAGER_CLASS) &&
            ViewPagerUtil.isViewPager(forView)) {
        return getDefaultScrollableView();
    } else if (ATEUtil.isInClassPath(TabLayoutTagProcessor.MAIN_CLASS) &&
            TabLayoutUtil.isTabLayout(forView)) {
        return getDefaultTabLayout();
    } else if (forView instanceof TextView) {
        return getDefaultTextView();
    }
    return null;
}
 
Example 25
Project: 2017.2-codigo   File: EditarEstadoActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.alterar_estado);

    Intent i = getIntent();
    codigoEstado = i.getStringExtra(SQLEstadosHelper.STATE_CODE);

    db = SQLEstadosHelper.getInstance(this);

    UF = (EditText) findViewById(R.id.txtUF);
    nomeEstado = (EditText) findViewById(R.id.txtNome);
    editar = (Button) findViewById(R.id.btnInserirEstado);
    new CarregaTask().execute();
}
 
Example 26
Project: FamilyBond   File: LoginActivity.java   View source code 5 votes vote down vote up
void initView() {
    mLoginUsernameEditText = (EditText) findViewById(R.id.login_username_edit_text);
    mLoginPasswordEditText = (EditText) findViewById(R.id.login_password_edit_text);
    mLoginButton = (Button) findViewById(R.id.login_button);
    mForgetPasswordTextView = (TextView) findViewById(R.id.forget_password_text_view);
    mLoginCardView = (CardView) findViewById(R.id.login_card_view);
    mSwitchFab = (FloatingActionButton) findViewById(R.id.switch_fab);
    mLoginInProgressBar = (ProgressBar) findViewById(R.id.login_in_progress_bar);

    mLoginButton.setOnClickListener(this);
    mForgetPasswordTextView.setOnClickListener(this);
    mSwitchFab.setOnClickListener(this);
}
 
Example 27
Project: BaseCore   File: KeyboardUtils.java   View source code 5 votes vote down vote up
/**
 * 动态显示软键盘
 *
 * @param edit 输入框
 */
public static void showSoftInput(EditText edit) {
    edit.setFocusable(true);
    edit.setFocusableInTouchMode(true);
    edit.requestFocus();
    InputMethodManager imm = (InputMethodManager) Utils.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(edit, 0);
}
 
Example 28
Project: BluetoothCtrl   File: MainActivity.java   View source code 5 votes vote down vote up
private void initView() {
    mProgressBar = findViewById(R.id.progressBar);
    mTextViewReceive = (TextView) findViewById(R.id.textViewReceive);
    mEditTextSend = (EditText) findViewById(R.id.etSend);
    mButtonSend = (Button) findViewById(R.id.buttonSend);
    mButtonSend.setOnClickListener(this);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    NavigationView navView = (NavigationView) findViewById(R.id.nav_view);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
    }
    navView.setCheckedItem(R.id.nav_call);
    navView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(MenuItem item) {
            mDrawerLayout.closeDrawers();
            return true;
        }
    });

    FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mBluetoothLeService != null &&
                    mConnectionState.equals(BluetoothLeService.ACTION_GATT_CONNECTED)) {
                mBluetoothLeService.disconnect();
            }
            Intent intent = new Intent(MainActivity.this, BluetoothScanActivity.class);
            startActivityForResult(intent, REQUEST_CONNECT);
        }
    });
}
 
Example 29
Project: do-road   File: LoginActivity.java   View source code 5 votes vote down vote up
private void initViews()
{

    mEmailInput = (EditText) findViewById(R.id.input_email);
    mPasswordInput = (EditText) findViewById(R.id.input_password);
    login = (Button) findViewById(R.id.btn_login);
    link_register = (TextView) findViewById(R.id.link_signup);
    login.setOnClickListener(this);
    link_register.setOnClickListener(this);
}
 
Example 30
Project: Pole-Beacon-Android-SDK   File: QuestionAdapter.java   View source code 5 votes vote down vote up
public TextViewHolder(View view) {
    super(view);

    answer = (EditText) view.findViewById(R.id.answer);
    rootView = (LinearLayout) view.findViewById(R.id.root_view);
    title = (TextView) view.findViewById(R.id.title);
}
 
Example 31
Project: XERUNG   File: SearchGroupMember.java   View source code 5 votes vote down vote up
private void findViewIds(){
	mLayback    = (RelativeLayout)findViewById(R.id.layBack);		
	listview    = (ListView)findViewById(R.id.lvList);		
	relProgress = (RelativeLayout)findViewById(R.id.layProgressresult);		
	layMain     = (LinearLayout)findViewById(R.id.layMain);	
	edtSearch   = (EditText)findViewById(R.id.edtGroupSearch);
	txtType = (TextView)findViewById(R.id.txtTypeSearch);
	txtType.setTypeface(ManagerTypeface.getTypeface(SearchGroupMember.this, R.string.typeface_roboto_regular));
}
 
Example 32
Project: Utils   File: KeyboardUtil.java   View source code 5 votes vote down vote up
/**
 * 切换键盘显示与否状态
 *
 * @param edit 输入框
 */
public static void toggleSoftInput(EditText edit) {
    edit.setFocusable(true);
    edit.setFocusableInTouchMode(true);
    edit.requestFocus();
    InputMethodManager inputManager = (InputMethodManager)
            sContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (inputManager != null) {
        inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
}
 
Example 33
Project: SmingZZick_App   File: AbsControl.java   View source code 5 votes vote down vote up
public AbsControl(TextPreviewView view, ColorPickerView colorPickerView) {
    this.textPreviewView = view;
    this.colorPickerView = colorPickerView;

    ViewGroup pickerLayout =  (ViewGroup) colorPickerView.getChildAt(0);
    int childCount = pickerLayout.getChildCount();
    for (int i = childCount - 1; i >= 0; i--) {
        View child = pickerLayout.getChildAt(i);
        if (child instanceof EditText) {
            ((EditText) child).setTextColor(Color.WHITE);
            break;
        }
    }
}
 
Example 34
Project: sdk-examples-android-java   File: MainActivity.java   View source code 5 votes vote down vote up
private void initCall(Boolean videoCall) {
    final Bundle otherExtras = new Bundle();
    otherExtras.putBoolean(Gruveo.GRV_EXTRA_VIBRATE_IN_CHAT, false);
    otherExtras.putBoolean(Gruveo.GRV_EXTRA_DISABLE_CHAT, false);

    final String code = ((EditText) findViewById(R.id.main_edittext)).getText().toString();
    final String result = new Gruveo.Builder(this)
            .callCode(code)
            .videoCall(videoCall)
            .clientId("demo")
            .requestCode(REQUEST_CALL)
            .otherExtras(otherExtras)
            .eventsListener(eventsListener)
            .build();

    switch (result) {
        case Gruveo.GRV_INIT_MISSING_CALL_CODE: {
            break;
        }
        case Gruveo.GRV_INIT_INVALID_CALL_CODE: {
            break;
        }
        case Gruveo.GRV_INIT_MISSING_CLIENT_ID: {
            break;
        }
        case Gruveo.GRV_INIT_OFFLINE: {
            break;
        }
        default: {
            break;
        }
    }
}
 
Example 35
Project: memento-app   File: PersonActivity.java   View source code 5 votes vote down vote up
private void doneAndSave() {
    TextView textWarning = (TextView)findViewById(R.id.info);
    EditText editTextPersonName = (EditText)findViewById(R.id.edit_person_name);
    String newPersonName = editTextPersonName.getText().toString();
    if (newPersonName.equals("")) {
        textWarning.setText(R.string.person_name_empty_warning_message);
        return;
    }

    StorageHelper.setPersonName(personId, newPersonName, personGroupId, PersonActivity.this);

    finish();
}
 
Example 36
Project: linkedout_procon   File: ArrayQuiz.java   View source code 5 votes vote down vote up
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder = null;
    if(convertView == null){
        holder = new ViewHolder();
        convertView = inflater.inflate(resource, null);
        holder.tvQuiz = (TextView)convertView.findViewById(R.id.tvQuiz);
        holder.tvChoices = (TextView)convertView.findViewById(R.id.tvChoices);
        holder.etAnswer = (EditText)convertView.findViewById(R.id.etAnswer);
        convertView.setTag(holder);
    }
    else{
        holder = (ViewHolder)convertView.getTag();
    }

    //holder for the quiz question
    holder.tvQuiz.setText(quizModelList.get(position).getQuestion());
    //for loop for multiple answer choices string buffer adds one to letter to lidst A,B,C for answers
    StringBuffer stringBuffer = new StringBuffer();
    char letter = 'A';
    for(QuizModel.Choices choices : quizModelList.get(position).getChoiceList()){
        stringBuffer.append( letter + ") "  );
        stringBuffer.append(choices.getAnswerChoice());
        letter++;
        stringBuffer.append("\n");
    }
    holder.tvChoices.setText(stringBuffer);
    //holder.etAnswer.setText("Enter Letter Choice Here");

    return convertView;
}
 
Example 37
Project: keepass2android   File: FragmentFiles.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.afc_fragment_files,
            container, false);

    /*
     * MAP CONTROLS
     */

    mBtnGoHome = rootView.findViewById(R.id.afc_textview_home);
    mViewGoBack = (ImageView) rootView
            .findViewById(R.id.afc_button_go_back);
    mViewGoForward = (ImageView) rootView
            .findViewById(R.id.afc_button_go_forward);
    mViewAddressBar = (ViewGroup) rootView
            .findViewById(R.id.afc_view_locations);
    mViewLocationsContainer = (HorizontalScrollView) rootView
            .findViewById(R.id.afc_view_locations_container);
    mTextFullDirName = (TextView) rootView
            .findViewById(R.id.afc_textview_full_dir_name);
    mViewGroupFiles = rootView.findViewById(R.id.afc_viewgroup_files);
    mViewFilesContainer = (ViewGroup) rootView
            .findViewById(R.id.afc_view_files_container);
    mFooterView = (TextView) rootView
            .findViewById(R.id.afc_view_files_footer_view);
    mViewLoading = rootView.findViewById(R.id.afc_view_loading);
    mTextSaveas = (EditText) rootView
            .findViewById(R.id.afc_textview_saveas_filename);
    mBtnOk = (Button) rootView.findViewById(R.id.afc_button_ok);

    /*
     * INIT CONTROLS
     */

    
    return rootView;
}
 
Example 38
Project: SuspendNotification   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    sharedPreferences = PreferenceManager
            .getDefaultSharedPreferences(this);
    editor = sharedPreferences.edit();
    title = (EditText)findViewById(R.id.title);
    content = (EditText)findViewById(R.id.content);
    manager = NotificationManagerCompat.from(this);
    setIsChecked();
    setIsCheckedBoot();
    setCheckedHideIcon();
    setCheckedHideNew();
    clipBoardMonitor();
    Log.d(TAG, "onCreate: ");
    boolean back = getIntent().getBooleanExtra("moveTaskToBack",false);
    if(back){
        moveTaskToBack(true);
        //Log.i(TAG, "onCreate: veTaskToBack");
    }
    //当前活动被销毁后再重建时保证调用onNewIntent()方法
    onNewIntent(getIntent());
    if (!isCheckedHideNew){
        notifAddNew();
    }
}
 
Example 39
Project: AndroidBackendlessChat   File: ChatSDKEditProfileActivity.java   View source code 5 votes vote down vote up
private void initViews(){
    txtFemale = (TextView) findViewById(R.id.btn_female);
    txtMale = (TextView) findViewById(R.id.btn_male);
    txtDateOfBirth = (TextView) findViewById(R.id.txt_date_of_birth);
    
    etName = (EditText) findViewById(R.id.chat_sdk_et_name);
    etLocation = (EditText) findViewById(R.id.chat_sdk_et_location);
    etStatus = (EditText) findViewById(R.id.chat_sdk_et_status);

    imageCountryFlag = (ImageView) findViewById(R.id.chat_sdk_country_ic);
}
 
Example 40
Project: Open-Weather-API-Wrapper   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Initialize the api
    OpenWeatherApi.initialize(getString(R.string.your_open_weather_api_key), Unit.STANDARD);

    cityTv = (TextView) findViewById(R.id.city_tv);
    tempTv = (TextView) findViewById(R.id.temp_tv);
    tempLowTv = (TextView) findViewById(R.id.temp_low_tv);
    tempHighTv = (TextView) findViewById(R.id.temp_high_tv);
    windSpeedTv = (TextView) findViewById(R.id.wind_speed_tv);
    sunriseTv = (TextView) findViewById(R.id.sunrise_tv);
    sunsetTv = (TextView) findViewById(R.id.sunset_tv);

    final EditText cityEt = (EditText) findViewById(R.id.city_et);

    findViewById(R.id.go_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String s = cityEt.getText().toString().trim();
            if (!s.isEmpty())
                OpenWeatherApi.getCurrentWeather(s, mCurrentWeatherListener);

            OpenWeatherApi.getThreeHoursForecast("Landon,uk", new ForecastListener() {
                @Override
                public void onResponse(WeatherForecast weatherForecasts) {
                    Log.d("Three hour", "Success");
                }

                @Override
                public void onError(String message) {
                    Log.d("Three hour", message);
                }
            });
        }
    });
}