android.widget.EditText Java Examples

The following examples show how to use android.widget.EditText. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlacePickerFragment.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@Override
void setupViews(ViewGroup view) {
    if (showSearchBox) {
        ListView listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);

        View searchHeaderView = getActivity().getLayoutInflater().inflate(
                R.layout.com_facebook_picker_search_box, listView, false);

        listView.addHeaderView(searchHeaderView, null, false);

        searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);

        searchBox.addTextChangedListener(new SearchTextWatcher());
        if (!TextUtils.isEmpty(searchText)) {
            searchBox.setText(searchText);
        }
    }
}
 
Example #2
Source File: SpotifyActuator.java    From puck-central-android with Apache License 2.0 6 votes vote down vote up
@Override
public AlertDialog getActuatorDialog(Activity activity, final Action action, final Rule rule,
                                     final ActuatorDialogFinishListener listener) {
    LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View view = layoutInflater.inflate(R.layout.dialog_actuator_single_textinput, null);
    final EditText editText1 = (EditText) view.findViewById(R.id.etDialogActuatorEditText1);
    editText1.setHint(SPOTIFY_URI);

    AlertDialog.Builder builder = new AlertDialog.Builder(activity)
            .setView(view)
            .setTitle(describeActuator())
            .setPositiveButton(activity.getString(R.string.accept), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String arguments = Action.jsonStringBuilder(SPOTIFY_URI,
                            editText1.getText().toString());

                    action.setArguments(arguments);
                    rule.addAction(action);
                    listener.onActuatorDialogFinish(action, rule);
                }
            })
            .setNegativeButton(activity.getString(R.string.reject), null);
    return builder.create();
}
 
Example #3
Source File: LoginActivity.java    From xmpp with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化控件
 */
private void initialView() {
    DialogView.Initial(LoginActivity.this, "正在登录......");
    tv_phone_regster = (TextView) findViewById(R.id.login_textview_phone_regster);
    tv_password = (TextView) findViewById(R.id.login_textview_forget_password);
    et_user = (EditText) findViewById(R.id.login_editText_user);
    et_password = (EditText) findViewById(R.id.login_editText_password);
    tv_login = (TextView) findViewById(R.id.login_textview_enter);
    rb_qq = (RadioButton) findViewById(R.id.login_imageView_qqlogin);
    rb_weibo = (RadioButton) findViewById(R.id.login_imageView_weibologin);

    tv_phone_regster.setOnClickListener(this);
    tv_password.setOnClickListener(this);
    tv_login.setOnClickListener(this);
    rb_qq.setOnClickListener(this);
    rb_weibo.setOnClickListener(this);


}
 
Example #4
Source File: PlanListActivityTest.java    From friendly-plans with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void whenSearchPlanIsRemovedExpectItToBeRemoved() {
    final int testedPlanPosition = 5;

    onView(withId(R.id.menu_search))
            .perform(click());
    onView(withId(R.id.menu_search)).perform(typeText(expectedName + testedPlanPosition));
    closeSoftKeyboard();

    onView(withId(R.id.rv_plan_list))
            .perform(RecyclerViewActions
                    .actionOnItemAtPosition(0,
                            new ViewClicker(R.id.id_remove_plan)));
    onView(withText(R.string.plan_removal_confirmation_positive_button)).perform(click());

    onView(withRecyclerView(R.id.rv_plan_list)
            .atPosition(0))
            .check(doesNotExist());
    onView(isAssignableFrom(EditText.class)).perform(clearText());

    onView(withId(R.id.rv_plan_list)).perform(scrollToPosition(testedPlanPosition));
    onView(withRecyclerView(R.id.rv_plan_list)
            .atPosition(testedPlanPosition))
            .check(matches(hasDescendant(withText(expectedName
                    + (testedPlanPosition + 1)))));
}
 
Example #5
Source File: KeyBoardUtils.java    From DevUtils with Apache License 2.0 6 votes vote down vote up
/**
 * 打开软键盘
 * @param editText    {@link EditText}
 * @param handler     {@link Handler}
 * @param delayMillis 延迟时间 ( 毫秒 )
 * @return {@code true} success, {@code false} fail
 */
public static boolean openKeyboard(final EditText editText, final Handler handler, final long delayMillis) {
    if (editText != null && handler != null) {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                try {
                    editText.requestFocus();
                    editText.setSelection(editText.getText().toString().length());
                } catch (Exception e) {
                }
                openKeyboard(editText);
            }
        }, delayMillis);
        return true;
    }
    return false;
}
 
Example #6
Source File: CustomWebView.java    From Lucid-Browser with Apache License 2.0 6 votes vote down vote up
public void setUrlBarText(String url){
	if (url!=null){
		CustomWebView WV = activityRef.get().webLayout.findViewById(R.id.browser_page);
		if (WV!=null && this!=null && WV.equals(this)){
			if ((activityRef.get().findViewById(R.id.browser_searchbar))!=null && !activityRef.get().findViewById(R.id.browser_searchbar).isFocused()){
				if (url.startsWith("file:///android_asset/")) {
					((EditText) activityRef.get().findViewById(R.id.browser_searchbar)).setText("");
					((EditText) activityRef.get().findViewById(R.id.browser_searchbar)).setHint(R.string.urlbardefault);
				}else{
					((EditText) activityRef.get().findViewById(R.id.browser_searchbar))
							.setText(url
									.replace("http://", "")
									.replace("https://", ""));
				}
			}
		}
	}
}
 
Example #7
Source File: AuthorisedArea_1.java    From owasp-workshop-android-pentest with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_authorised_area_1, container, false);

    ClickMe = (Button) rootView.findViewById(R.id.button);
    ClickMe.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
        mEdit = (EditText) getView().findViewById(R.id.editText_password);
        if(auth(sha1Hash(mEdit.getText().toString()))) {
            FragmentManager fm = getFragmentManager();
            AuthorisedArea_2 f = new AuthorisedArea_2();
            fm.beginTransaction().replace(R.id.main_content,f).commit();
        }
        }
    });
    return rootView;
}
 
Example #8
Source File: CommentListActivity.java    From stynico with MIT License 6 votes vote down vote up
@Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
   {
       // TODO: Implement this method
       View view=inflater.inflate(R.layout.activity_comment_, null);

	weibo.setObjectId(nico.SPUtils.get(getActivity(), "mes", "") + "");
	adapter = new MyAdapter(getActivity());
	et_content = (EditText) view.findViewById(R.id.et_content);
	btn_publish = (TextView) view.findViewById(R.id.btn_publish);
	listView = (ListView) view.findViewById(R.id.listview);
	listView.setAdapter(adapter);

	btn_publish.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v)
			{
				// TODO Auto-generated method stub
				publishComment(et_content.getText().toString());
			}
		});
	findComments();
       return view;
}
 
Example #9
Source File: BaseDialog.java    From TestChat with Apache License 2.0 6 votes vote down vote up
/**
 * 设置编辑列表VIEW
 *
 * @param names 编辑view 的name
 * @return this
 */
public BaseDialog setEditViewsName(List<String> names) {
        if (middleLayout.getChildCount() > 0) {
                middleLayout.removeAllViews();
        }
        for (String name :
                names) {
                TextView textView = new TextView(getContext());
                textView.setText(name);
                EditText editText = new EditText(getContext());
                editText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
                editText.setHint("请输入" + name);
                editText.setPadding(10, 0, 0, 0);
                editText.setHintTextColor(Color.BLUE);
                LinearLayout child = new LinearLayout(getContext());
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                child.setOrientation(LinearLayout.HORIZONTAL);
                child.setGravity(Gravity.CENTER_VERTICAL);
                child.setLayoutParams(params);
                child.addView(textView);
                child.addView(editText);
                middleLayout.addView(child);
        }
        return this;
}
 
Example #10
Source File: NavigationViewItemSelectedListenerTest.java    From openwebnet-android with MIT License 6 votes vote down vote up
@Test
public void onNavigationItemSelected_shouldSelectAdd_clickValid() {
    String NEW_ENVIRONMENT = "newEnvironment";
    int NEW_ENVIRONMENT_ID = 108;
    when(environmentService.add(NEW_ENVIRONMENT)).thenReturn(Observable.just(NEW_ENVIRONMENT_ID));

    setupActivity();
    clickMenuItem(R.id.nav_add);

    ShadowAlertDialogSupport shadowAlertDialog = ShadowAlertDialogSupport.getShadowAlertDialog();
    View inflatedView = shadowAlertDialog.getInflatedView();

    EditText name = inflatedView.findViewById(R.id.editTextDialogEnvironmentName);
    name.setText(NEW_ENVIRONMENT);
    when(utilityService.isBlankText(name)).thenReturn(false);
    when(utilityService.sanitizedText(name)).thenReturn(NEW_ENVIRONMENT);
    shadowAlertDialog.performButtonClick(AlertDialog.BUTTON_POSITIVE);
    verify(environmentService).add(NEW_ENVIRONMENT);
}
 
Example #11
Source File: DailyToDoListCreateActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void initView() {
    actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
    setNewActionBar(actionBar);
    setActionBarTitle(!isUpdate? R.string.atom_ui_todolist_title_create :R.string.atom_ui_todolist_title_update);
    setActionBarRightText(R.string.atom_ui_common_save);
    setActionBarRightTextClick(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            editTodoList();
        }
    });

    todolist_title = (EditText) findViewById(R.id.todolist_title);
    todolist_content = (EditText) findViewById(R.id.todolist_content);
    if (dailyMindMain != null) {
        todolist_title.setText(dailyMindMain.title);
        todolist_content.setText(dailyMindMain.content);
    }
}
 
Example #12
Source File: XKeyboardUtils.java    From XFrame with Apache License 2.0 6 votes vote down vote up
/**
 * 处理点击非 EditText 区域时,自动关闭键盘
 *
 * @param isAutoCloseKeyboard 是否自动关闭键盘
 * @param currentFocusView    当前获取焦点的控件
 * @param motionEvent         触摸事件
 * @param dialogOrActivity    Dialog 或 Activity
 */
public static void handleAutoCloseKeyboard(boolean isAutoCloseKeyboard, View currentFocusView, MotionEvent motionEvent, Object dialogOrActivity) {
    if (isAutoCloseKeyboard && motionEvent.getAction() == MotionEvent.ACTION_DOWN && currentFocusView != null && (currentFocusView instanceof EditText) && dialogOrActivity != null) {
        int[] leftTop = {0, 0};
        currentFocusView.getLocationInWindow(leftTop);
        int left = leftTop[0];
        int top = leftTop[1];
        int bottom = top + currentFocusView.getHeight();
        int right = left + currentFocusView.getWidth();
        if (!(motionEvent.getX() > left && motionEvent.getX() < right && motionEvent.getY() > top && motionEvent.getY() < bottom)) {
            if (dialogOrActivity instanceof Dialog) {
                XKeyboardUtils.closeKeyboard((Dialog) dialogOrActivity);
            } else if (dialogOrActivity instanceof Activity) {
                XKeyboardUtils.closeKeyboard((Activity) dialogOrActivity);
            }
        }
    }
}
 
Example #13
Source File: Location_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
private void initView(){
	rgLocationMode = (RadioGroup) findViewById(R.id.rg_locationMode);
	
	etInterval = (EditText) findViewById(R.id.et_interval);
	etHttpTimeout = (EditText) findViewById(R.id.et_httpTimeout);
	
	cbOnceLocation = (CheckBox)findViewById(R.id.cb_onceLocation);
	cbGpsFirst = (CheckBox) findViewById(R.id.cb_gpsFirst);
	cbAddress = (CheckBox) findViewById(R.id.cb_needAddress);
	cbCacheAble = (CheckBox) findViewById(R.id.cb_cacheAble);
	cbOnceLastest = (CheckBox) findViewById(R.id.cb_onceLastest);
	cbSensorAble = (CheckBox)findViewById(R.id.cb_sensorAble);

	tvResult = (TextView) findViewById(R.id.tv_result);
	btLocation = (Button) findViewById(R.id.bt_location);
	
	rgLocationMode.setOnCheckedChangeListener(this);
	btLocation.setOnClickListener(this);
}
 
Example #14
Source File: ReflectionExtractor.java    From AndroidRipper with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Detect Name of the Widget
 * 
 * @param v
 *            Widget
 * @return
 */
protected String detectName(View v) {
	String name = "";
	if (v instanceof TextView) {
		TextView t = (TextView) v;
		name = (t.getText() != null) ? t.getText().toString() : "";
		if (v instanceof EditText) {
			CharSequence hint = ((EditText) v).getHint();
			name = (hint == null) ? "" : hint.toString();
		}
	} else if (v instanceof RadioGroup) {
		RadioGroup g = (RadioGroup) v;
		int max = g.getChildCount();
		String text = "";
		for (int i = 0; i < max; i++) {
			View c = g.getChildAt(i);
			text = detectName(c);
			if (!text.equals("")) {
				name = text;
				break;
			}
		}
	}
	return name;
}
 
Example #15
Source File: Monitor.java    From BehaviorCollect with GNU General Public License v3.0 6 votes vote down vote up
@Override
		public void onButtonTouch(MotionEvent event, View view){

			try {
				if (event.getAction() == MotionEvent.ACTION_UP ){
					String viewName = "";
					String viewType = "";
					String idName = ViewUtils.getSimpleResourceName(view.getContext(), view.getId());
					//获取文本值
					viewName =getButtonName(view );
					//动态生成view  比如listView
					if (view.hasOnClickListeners() && TextUtils.isEmpty(idName)){
						idName = viewName;
					}
					viewType = (view instanceof EditText) ? "text": "button";

//					onClickButton(idName,viewName,viewType);
					onClickButton(idName,viewName,viewType);
				}
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
		}
 
Example #16
Source File: BlackListActivity.java    From NotificationPeekPort with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.black_list_layout);

    mSearchEditText = (EditText) findViewById(R.id.search_edit_text);
    mSearchEditText.setOnFocusChangeListener(this);

    mSystemAppCheckBox = (CheckBox) findViewById(R.id.show_system_app_check);
    mSystemAppCheckBox.setChecked(AppList.shouldExcludeSystemApps(this));
    mSystemAppCheckBox.setOnCheckedChangeListener(this);

    initActionBar();
    initFragments();

}
 
Example #17
Source File: CustomMatchers.java    From android-test-demo with MIT License 6 votes vote down vote up
public static Matcher<View> withError(final String expected) {
    return new TypeSafeMatcher<View>() {

        @Override
        public boolean matchesSafely(View view) {
            if (!(view instanceof EditText)) {
                return false;
            }
            EditText editText = (EditText) view;
            return editText.getError().toString().equals(expected);
        }

        @Override
        public void describeTo(Description description) {

        }
    };
}
 
Example #18
Source File: AddAccountActivity.java    From Shaarlier with GNU General Public License v3.0 5 votes vote down vote up
/**
* Fill the fields with the selected account when editing a new account
*/
private void fillFields() {
    // Get the user inputs :
    ((EditText) findViewById(R.id.urlShaarliView)).setText(account.getUrlShaarli());
    ((EditText) findViewById(R.id.usernameView)).setText(account.getUsername());
    ((EditText) findViewById(R.id.passwordView)).setText(account.getPassword());
    ((EditText) findViewById(R.id.shortNameView)).setText(account.getShortName());
    ((EditText) findViewById(R.id.restapiView)).setText(account.getRestAPIKey());

    ((Switch) findViewById(R.id.passwordAuthCheckbox)).setChecked(
            !(account.getRestAPIKey().length() > 0)
    );
    togglePasswordAuth(findViewById(R.id.passwordAuthCheckbox));

    if (!"".equals(account.getBasicAuthUsername())) {
        ((EditText) findViewById(R.id.basicUsernameView)).setText(account.getBasicAuthUsername());
        ((EditText) findViewById(R.id.basicPasswordView)).setText(account.getBasicAuthPassword());
        ((Switch) findViewById(R.id.basicAuthSwitch)).setChecked(true);
        enableBasicAuth(findViewById(R.id.basicAuthSwitch));
    }

    // default account?
    SharedPreferences prefs = getSharedPreferences(getString(R.string.params), MODE_PRIVATE);
    this.isDefaultAccount = (prefs.getLong(getString(R.string.p_default_account), -1) == account.getId());
    ((CheckBox) findViewById(R.id.defaultAccountCheck)).setChecked(this.isDefaultAccount);

    findViewById(R.id.deleteAccountButton).setVisibility(View.VISIBLE);
}
 
Example #19
Source File: LiveVideoPlayerActivity.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
  shouldAutoPlay = true;
  clearResumePosition();
  mediaDataSourceFactory = buildDataSourceFactory(true);
  rtmpDataSourceFactory = new RtmpDataSource.RtmpDataSourceFactory();
  mainHandler = new Handler();
  if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
    CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
  }

  setContentView(R.layout.activity_live_video_player);
  View rootView = findViewById(R.id.root);
  rootView.setOnClickListener(this);
  debugRootView = (LinearLayout) findViewById(R.id.controls_root);
  debugTextView = (TextView) findViewById(R.id.debug_text_view);
  retryButton = (Button) findViewById(R.id.retry_button);
  retryButton.setOnClickListener(this);

  videoNameEditText = (EditText) findViewById(R.id.video_name_edit_text);
  videoStartControlLayout = findViewById(R.id.video_start_control_layout);

  simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.player_view);
  simpleExoPlayerView.setControllerVisibilityListener(this);
  simpleExoPlayerView.requestFocus();

}
 
Example #20
Source File: MainActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @return the operand value which was entered in an {@link EditText} as a double
 */
private Double getOperand(EditText operandEditText) {
    String operandText = getOperandText(operandEditText);
    if (! operandText.equals("")){
        return Double.valueOf(operandText);
    }
    else{
        Log.e(TAG, "Empty string");
        mResultTextView.setText(R.string.blank);
        return 0.0;
    }
}
 
Example #21
Source File: RealTimeUpdateSearchBox.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
private void init(AttributeSet attrs, int defStyle) {
    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.lingju, defStyle, 0);
    LayoutInflater.from(getContext()).inflate(R.layout.search_online_box, this);
    mLlRoot = findViewById(R.id.ll_root);
    edit = (EditText) findViewById(R.id.sob_search_edit);
    stateBt = (ImageButton) findViewById(R.id.sob_state_bt);
    animate = AnimationUtils.loadAnimation(getContext(), R.anim.start_up_loading);
    animate.setInterpolator(new LinearInterpolator());
    drawable = (LevelListDrawable) stateBt.getDrawable();
    edit.addTextChangedListener(searhWatcher);
    edit.setOnEditorActionListener(editorActionListener);
    edit.setOnClickListener(editorClickListener);
    stateBt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (stateBt.getVisibility() == View.VISIBLE && drawable.getLevel() == 1) {
                edit.setText("");
                stateBt.setVisibility(View.INVISIBLE);
            }
        }
    });
    edit.setHint(a.getString(R.styleable.lingju_hint));
    // edit.setHintTextColor(getResources().getColor(R.color.navi_search_box_color));
    edit.setHintTextColor(a.getColor(R.styleable.lingju_hintColor, getResources().getColor(R.color.navi_search_box_color)));
    edit.setTextColor(a.getColor(R.styleable.lingju_textColor, getResources().getColor(R.color.ksw_md_solid_disable)));
    mLlRoot.setBackgroundColor(a.getColor(R.styleable.lingju_search_background, getResources().getColor(R.color.green_style)));
    //edit.setTextSize(a.getFloat(com.android.internal.R.styleable.TextView_textSize,12));

    a.recycle();
}
 
Example #22
Source File: SizeChooser.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public boolean validateValue(Context context, EditText editValue, float min, float max, boolean grabFocus)
{
    if (editValue == null)
        return true;

    boolean isValid = true;
    editValue.setError(null);

    try {
        int textSize = Integer.parseInt(editValue.getText().toString());
        if (textSize < min)
        {
            isValid = false;       // too small
            editValue.setError(context.getString(R.string.edittheme_error_textsize_min, min+""));
            if (grabFocus)
                editValue.requestFocus();
        }

        if (textSize > max)
        {
            isValid = false;       // too large
            editValue.setError(context.getString(R.string.edittheme_error_textsize_max, max+""));
            if (grabFocus)
                editValue.requestFocus();
        }

    } catch (NumberFormatException e) {
        isValid = false;          // NaN (too small)
        editValue.setError(context.getString(R.string.edittheme_error_textsize_min, min+""));
        if (grabFocus)
            editValue.requestFocus();
    }
    return isValid;
}
 
Example #23
Source File: AnswerRequestActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void bindViews() {
    rl_header = (RelativeLayout) findViewById(R.id.rl_header);
    user_gravatar = (com.facebook.drawee.view.SimpleDraweeView) findViewById(R.id.user_gravatar);
    sign = (TextView) findViewById(R.id.sign);
    radio_allow = (RadioButton) findViewById(R.id.radio_allow);
    radio_deny = (RadioButton) findViewById(R.id.radio_deny);
    edit_deny_reason = (EditText) findViewById(R.id.edit_deny_reason);
    operation_btn = (TextView) findViewById(R.id.operation_btn);
}
 
Example #24
Source File: FeedSourcesActivity.java    From AnotherRSS with The Unlicense 5 votes vote down vote up
private void loadUrls() {
    _linearLayout = (LinearLayout) findViewById(R.id.feedsourceList);
    _linearLayout.removeAllViews();
    String urls[] = _pref.getString("rss_url", AnotherRSS.urls).split(" ");
    _active = PreferencesActivity.loadArray("rss_url_act", AnotherRSS.getContextOfApplication());
    _urlCheck = new ArrayList<>();
    _urlEdit  = new ArrayList<>();

    for (int i=0; i < urls.length + 5; i++) {
        _urlCheck.add(i, new CheckBox(this));
        _urlEdit.add(i, new EditText(this));
        if (i < urls.length) {
            _urlCheck.get(i).setChecked(_active[i]);
            _urlEdit.get(i).setText(urls[i]);
        }

        if (i >= _active.length) {
            _active = Arrays.copyOf(_active, _active.length +1);
            _active[i] = false;
        }
        LinearLayout dummy = new LinearLayout(AnotherRSS.getContextOfApplication());
        dummy.setOrientation(LinearLayout.HORIZONTAL);
        dummy.addView(_urlCheck.get(i), 0);
        dummy.addView(_urlEdit.get(i), 1);
        _urlEdit.get(i).setMinWidth(AnotherRSS.Config.DEFAULT_MAX_IMG_WIDTH);
        _linearLayout.addView(dummy, i);
    }
}
 
Example #25
Source File: FragmentModifyDescription.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void findAndBindViews(View contentView) {
    setDefaultImageLeftVisible(true, R.attr.img_nav_back);
    setRightVisible(true, R.string.v_commit);
    setTitleText(R.string.v_user_edit_description);

    user_desc = new SpTool(getActivity(), SpTool.SP_USER).getString("description", "");

    et_description = (EditText) contentView.findViewById(R.id.et_description);
    et_description.setText(user_desc);

    contentView.findViewById(R.id.iv_send).setOnClickListener(this);
}
 
Example #26
Source File: DetailFragment.java    From masterdetail-j2objc-swift with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_detail, container,
            false);

    final EditText title = (EditText) rootView.findViewById(
            R.id.masterdetail_detail_title);
    final EditText words = (EditText) rootView.findViewById(
            R.id.masterdetail_detail_words);

    viewModel.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
        if (DetailViewModel.TITLE.equals(event.getPropertyName())) {
            title.setText((String) event.getNewValue());
        }
        else if (DetailViewModel.WORDS.equals(event.getPropertyName())) {
            words.setText((String) event.getNewValue());
        }
        }
    });

    viewModel.init(getArguments().getInt(ARG_ITEM_ID));

    return rootView;
}
 
Example #27
Source File: SamplePugNotification.java    From Pugnotification with Apache License 2.0 5 votes vote down vote up
private void loadInfoComponents() {
    this.mEdtTitle = (EditText) findViewById(R.id.edt_title);
    this.mEdtMessage = (EditText) findViewById(R.id.edt_message);
    this.mEdtBigText = (EditText) findViewById(R.id.edt_bigtext);
    this.mEdtUrl = (EditText) findViewById(R.id.edt_url);
    this.mBtnNotifySimple = (Button) findViewById(R.id.btn_notify_simple);
    this.mBtnNotifyCustom = (Button) findViewById(R.id.btn_notify_custom);
    this.mSpnType = (Spinner) findViewById(R.id.spn_notification_type);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.pugnotification_notification_types, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mSpnType.setAdapter(adapter);

    this.mContentBigText = (RelativeLayout) findViewById(R.id.content_bigtext);
}
 
Example #28
Source File: BaseConverterFragment.java    From text_converter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
    if (parent.isFocused()) {
        for (Map.Entry<Base, EditText> entry : mEditTextBase.entrySet()) {
            Base newBase = entry.getKey();
            if (!newBase.equals(base)) {
                EditText editText = entry.getValue();
                editText.setText(convert(base, newBase, s.toString()));
            }
        }
    }
}
 
Example #29
Source File: HomePageFragment.java    From CoolWeather with Apache License 2.0 5 votes vote down vote up
private void initview() {
	currentcity = (TextView) homeContent.findViewById(R.id.currentcity);
	pm25 = (TextView) homeContent.findViewById(R.id.pm25);
	temp = (TextView) homeContent.findViewById(R.id.temp);
	searchWeatherBtn= (Button) homeContent.findViewById(R.id.btn_search);
	
	pollution = (TextView) homeContent.findViewById(R.id.pollution_level);
	inputcity = (EditText) homeContent.findViewById(R.id.inputcity);
	weatherInfolist = (ListView) homeContent
			.findViewById(R.id.weather_infor_list);
	
}
 
Example #30
Source File: UserInfoEditActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
private void init() {
	// TODO Auto-generated method stub
	iv_avatar = (ImageView) findViewById(R.id.iv_avatar);
	et_username = (EditText) findViewById(R.id.et_uername);
	et_introduction = (EditText) findViewById(R.id.et_introduction);
	lv_birthday = (LinearLayout) findViewById(R.id.lv_birthday);
	lv_business = (LinearLayout) findViewById(R.id.lv_business);
	tv_sex_f = (TextView) findViewById(R.id.tv_sex_f);
	tv_sex_m = (TextView) findViewById(R.id.tv_sex_m);
	tv_sex_f_background = (TextView) findViewById(R.id.tv_sex_f_background);
	tv_sex_m_background = (TextView) findViewById(R.id.tv_sex_m_background);
	tv_birthday_info = (TextView) findViewById(R.id.tv_birthday_info);
	tv_business_info = (TextView) findViewById(R.id.tv_business_info);
	iv_avatar.setOnClickListener(this);
	et_username.setOnClickListener(this);
	et_introduction.setOnClickListener(this);
	lv_birthday.setOnClickListener(this);
	lv_business.setOnClickListener(this);
	tv_sex_f_background.setOnClickListener(this);
	tv_sex_m_background.setOnClickListener(this);
	tv_sex_m.setOnClickListener(this);
	tv_sex_f.setOnClickListener(this);
	tv_birthday_info.setOnClickListener(this);
	tv_business_info.setOnClickListener(this);

	// �����ж�
	NetworkState networkState = new NetworkState();
	if (networkState.isNetworkConnected(UserInfoEditActivity.this)) {
		getUserProfile();
	} else {
		Toast.makeText(this, "û�����磬�����Ӻ������", Toast.LENGTH_SHORT).show();
	}

}