Java Code Examples for android.widget.TextView.getId()

The following are Jave code examples for showing how to use getId() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Android-2017   File: NotesAdapter.java   View Source Code Vote up 6 votes
/**
 * Se de formatear el contenido de las distintas views de la lista. Modificaremos el texto de la fecha,
 * para que se vea con un formato más legible y el contendio de la nota para mostrar un preview.
 * @param v vista
 * @param text texto a modificar.
 */
@Override
public void setViewText(TextView v, String text) {
    switch (v.getId())
    {
        case R.id.liNoteDate :
            text = AppConstants.getStringDate(new Date(Long.parseLong(text)));
            break;
        case R.id.liNoteContent :
            if (text.length() > 100) {
                text = text.substring(0, 99);
                text = text + " ... ";
            }
    }
    super.setViewText(v, text);
}
 
Example 2
Project: Android-2017   File: NotesAdapter.java   View Source Code Vote up 6 votes
/**
 * Se de formatear el contenido de las distintas views de la lista. Modificaremos el texto de la fecha,
 * para que se vea con un formato más legible y el contendio de la nota para mostrar un preview.
 * @param v vista
 * @param text texto a modificar.
 */
@Override
public void setViewText(TextView v, String text) {
    switch (v.getId())
    {
        case R.id.liNoteDate :
            text = AppConstants.getStringDate(new Date(Long.parseLong(text)));
            break;
        case R.id.liNoteContent :
            if (text.length() > 100) {
                text = text.substring(0, 99);
                text = text + " ... ";
            }
    }
    super.setViewText(v, text);
}
 
Example 3
Project: Hotspot-master-devp   File: UnderlinePageIndicator.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
	for (int i = 0; i < mTabViews.size(); i++) {
		TextView textView =  mTabViews.get(i);
           boolean isClickMe = textView.getId() == v.getId() ||
                   (mTabViews2 != null && mTabViews2.get(i).getId() == v.getId());
		if(isClickMe){
			textView.setTextColor(mSelectedTabColor);
			setCurrentItem(i);
		}else{
			textView.setTextColor(mTabViewDefaultColor);
		}
	}
}
 
Example 4
Project: BittrexApi   File: AuthenticationActivity.java   View Source Code Vote up 6 votes
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
    final int id = textView.getId();
    switch (id) {
        case R.id.key_edittext:
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                _secretEditText.requestFocus();
            }

            return true;
        case R.id.secret_edittext:
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                updateAuthenticationSettings();
            }

            return true;
    }

    return false;
}
 
Example 5
Project: CXJPadProject   File: addSkuFragment.java   View Source Code Vote up 6 votes
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEARCH) {
        switch (v.getId()) {
            case R.id.etSkuNo:
                // 当按了搜索之后关闭软键盘
                ((InputMethodManager) etSkuNo.getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
                        .hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
                getSkuNoListByNo(etSkuNo.getText().toString());
                break;
            case R.id.etSkuName:
                ((InputMethodManager) etSkuName.getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
                        .hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
                getSkuNoListByName(etSkuName.getText().toString());
                break;
        }


        return true;
    }
    return false;
}
 
Example 6
Project: Veggietizer   File: HistoryCursorAdapter.java   View Source Code Vote up 6 votes
@Override
public void setViewText(TextView textView, String text) {
    //Set font
    Typeface font = FontManager.getInstance().getFont(FontManager.Font.ROBOTO_LIGHT);
    textView.setTypeface(font);

    int id = textView.getId();

    if (id == R.id.textView_history_date) {
        setDateView(textView, text);
    } else if (id == R.id.textView_history_meat) {
        setMeatView(textView, text);
    } else if (id == R.id.textView_history_amount) {
        setAmountView(textView, text);
    }
}
 
Example 7
Project: hypertrack-live-android   File: Profile.java   View Source Code Vote up 5 votes
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (v.getId() == nameView.getId() && actionId == EditorInfo.IME_ACTION_NEXT) {
        phoneNumberView.requestFocus();
        return true;
    }

    return false;
}
 
Example 8
Project: Android-2017   File: CallLogAdapter.java   View Source Code Vote up 5 votes
@Override
public void setViewText(TextView view, String text) {
    // para la duración, realizaremos un formateo
    if (view.getId() == R.id.liCallDuration) {
        long longVal = Long.parseLong(text);
        text = AppUtils.secondsToHoutMinSecond(longVal);
    }
    super.setViewText(view, text);

}
 
Example 9
Project: EosCommander   File: PushFragment.java   View Source Code Vote up 5 votes
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
    if (EditorInfo.IME_ACTION_SEND == actionId) {
        onPushAction();
        return true;
    }
    else
    if ( (EditorInfo.IME_ACTION_SEARCH == actionId ) && ( textView.getId() == R.id.et_contract_account) ){
        onContractEntered( mEtContract.getText().toString());
    }

    return false;
}
 
Example 10
Project: threed   File: MainActivity.java   View Source Code Vote up 5 votes
@Override
public void onEllipsizeChange(TextView view, boolean ellipsized) {
    switch (view.getId()) {
        case R.id.text1:
            view.setBackgroundColor(getResources().getColor(R.color.white));
            break;
        case R.id.text2:
            if (!ellipsized) {
                Toast.makeText(this, "ellipsized=false", Toast.LENGTH_LONG).show();
            }
            break;
    }
}