android.widget.TextView#getId ( )源码实例Demo

下面列出了android.widget.TextView#getId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: octoandroid   文件: TempControlsFragment.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
        switch (v.getId()) {
            case R.id.target_temp_tool0_input:
                setTargetTempTool0();
                break;
            case R.id.offset_temp_tool0_input:
                setOffsetTempTool0();
                break;
            case R.id.target_temp_tool1_input:
                setTargetTempTool1();
                break;
            case R.id.offset_temp_tool1_input:
                setOffsetTempTool1();
                break;
            case R.id.target_temp_bed_input:
                setTargetTempBed();
                break;
            case R.id.offset_temp_bed_input:
                setOffsetTempBed();
                break;
        }
    }
    return false;
}
 
@Override
public void onClick(View v) {
  if (v.getId() == R.id.next) {
    mListener.onOptionSelected();
    return;
  }
  for (TextView t : options) {
    if (t.getId() == v.getId()) {
      AppSettings settings = AppSettings.getInstance(getActivity());
      settings.setCalcMethodFor(mParam1, Integer.valueOf((String) t.getTag()));
      t.setSelected(true);
      mListener.onOptionSelected();
    } else {
      t.setSelected(false);
    }
  }
}
 
@Override
public void onClick(View v) {
  if (v.getId() == R.id.next) {
    mListener.onOptionSelected();

  } else if (v.getId() == R.id.prev) {
    getActivity().onBackPressed();

  } else {
    for (int i=0; i < views.length; i++) {
      TextView tv = views[i];
      if (tv.getId() == v.getId()) {
        tv.setSelected(true);
        AppSettings.getInstance(getActivity()).setHighLatitudeAdjustmentMethodFor(mParam1, i);
      } else {
        tv.setSelected(false);
      }
    }
    mListener.onOptionSelected();
  }

}
 
源代码4 项目: BonjourBrowser   文件: RegisterServiceActivity.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (getView() == null || actionId != EditorInfo.IME_ACTION_DONE) {
        return false;
    }
    switch (v.getId()) {
        case R.id.service_name:
            regTypeEditText.requestFocus();
            return true;
        case R.id.reg_type:
            portEditText.requestFocus();
            return true;
        case R.id.port:
            InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
            return true;
    }
    return false;
}
 
源代码5 项目: adapter-kit   文件: InstantAdapterCore.java
private void updateTextView(final Holder holder, final Object returnValue) {
    InstantText instantText = (InstantText) holder.meta.annotation;
    TextView textView = (TextView) holder.view;
    int viewId = textView.getId();

    String text = null;
    if (returnValue != null) {
        text = applyDatePattern(viewId, instantText, returnValue);
        text = applyFormatString(viewId, instantText, text, returnValue);
        if (text == null) {
            text = returnValue.toString();
        }
    }

    textView.setText(instantText.isHtml() ? Html.fromHtml(text) : text);
}
 
源代码6 项目: EosCommander   文件: PushFragment.java
@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;
}
 
源代码7 项目: android-proguards   文件: PlayerActivity.java
@OnClick({R.id.shot_count, R.id.followers_count, R.id.likes_count})
void playerActionClick(TextView view) {
    ((AnimatedVectorDrawable) view.getCompoundDrawables()[1]).start();
    switch (view.getId()) {
        case R.id.followers_count:
            PlayerSheet.start(PlayerActivity.this, player);
            break;
    }
}
 
private void clipboard(TextView tv) {
    // which view are we copying to the clipboard?
    int which;

    switch (tv.getId()) {
        case txt_request_url: // the url field
            which = code_snippet;
            break;

        case txt_response_body: // the response body
            which = raw_object;
            break;

        default:
            which = UNSET; // don't assign a prefix
    }

    // if we know which view we're copying, prefix it with useful info
    String what = which == UNSET ? "" : getString(which) + " ";

    // concat the clipboard data to this String
    what += getString(clippy);

    // inform the user that data was added to the clipboard
    Toast.makeText(
            getActivity(),
            what,
            Toast.LENGTH_SHORT
    ).show();

    // depending on our API, do it one way or another...
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // old way
        ClipboardManager clipboardManager = (ClipboardManager)
                getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
        clipboardManager.setText(tv.getText());
    } else {
        clipboard11(tv);
    }
}
 
private void clipboard(TextView tv) {
    int which;
    switch (tv.getId()) {
        case txt_request_url:
            which = req_url;
            break;
        case txt_response_headers:
            which = response_headers;
            break;
        case txt_response_body:
            which = response_body;
            break;
        default:
            which = UNSET;
    }
    String what = which == UNSET ? "" : getString(which) + " ";
    what += getString(clippy);
    Toast.makeText(getActivity(), what, Toast.LENGTH_SHORT).show();
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // old way
        ClipboardManager clipboardManager = (ClipboardManager)
                getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
        clipboardManager.setText(tv.getText());
    } else {
        clipboard11(tv);
    }
}
 
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) {
    // Only handle "Done" action triggered by the user tapping "Enter" on the keyboard.
    if (actionId != EditorInfo.IME_ACTION_DONE) {
        return false;
    }

    int textViewId = textView.getId();
    if (textViewId == R.id.fps_edittext) {
        setFrameRate(textView);
    } else if (textViewId == R.id.step_edittext) {
        setStepSize(textView);
    }
    return false;
}
 
源代码11 项目: ShakeDetector   文件: MainActivity.java
private void updateSeekBarLabel(TextView view, String textToAppend) {
    String label = "";
    if (view.getId() == R.id.sensibility_label) {
        label = getString(R.string.label_sensibility, textToAppend);
    }
    if (view.getId() == R.id.shake_number_label) {
        label = getString(R.string.label_shake_number, textToAppend);
    }
    view.setText(label);
}
 
源代码12 项目: screenplay   文件: NavigationMenuView.java
private void setSelected(int id) {
    selected = id;
    for (int i = 0; i < getChildCount(); i++) {
        TextView child = (TextView) getChildAt(i);
        if (id == child.getId()) {
            child.setSelected(true);
        } else {
            child.setSelected(false);
        }
    }
}
 
源代码13 项目: Botifier   文件: Botification.java
private static ArrayList<String> extractTextFromNotification(Service service, RemoteViews view) {
  	LayoutInflater inflater = (LayoutInflater) service.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   ArrayList<String> result = new ArrayList<String>();
   if (view == null) {
   	Log.d(TAG, "View is empty");
   	return null;
   }
try {
	int layoutid = view.getLayoutId();
	ViewGroup localView = (ViewGroup) inflater.inflate(layoutid, null);
    view.reapply(service.getApplicationContext(), localView);
    ArrayList<View> outViews = new ArrayList<View>();
    extractViewType(outViews, TextView.class, localView);
    for (View  ttv: outViews) {
    	TextView tv = (TextView) ttv;
    	String txt = tv.getText().toString();
    	if (!TextUtils.isEmpty(txt) && tv.getId() != TIMESTAMPID) {
    		result.add(txt);
    	}
	}
} catch (Exception e) {
	Log.d(TAG, "FAILED to load notification " + e.toString());
	Log.wtf(TAG, e);
	return null;
	//notification might have dissapeared by now
}
Log.d(TAG, "Return result" + result);
   return result;
  }
 
源代码14 项目: SublimePicker   文件: SublimeRecurrencePicker.java
void updateFlowLayout(RecurrenceOption recurrenceOption) {
    // Currently selected recurrence option
    int viewIdToSelect;

    switch (recurrenceOption) {
        case DOES_NOT_REPEAT:
            viewIdToSelect = R.id.tvDoesNotRepeat;
            break;
        case DAILY:
            viewIdToSelect = R.id.tvDaily;
            break;
        case WEEKLY:
            viewIdToSelect = R.id.tvWeekly;
            break;
        case MONTHLY:
            viewIdToSelect = R.id.tvMonthly;
            break;
        case YEARLY:
            viewIdToSelect = R.id.tvYearly;
            break;
        case CUSTOM:
            viewIdToSelect = R.id.tvChosenCustomOption;
            break;
        default:
            viewIdToSelect = R.id.tvDoesNotRepeat;
    }

    for (TextView tv : mRepeatOptionTextViews) {
        tv.setOnClickListener(this);

        // If we have a non-empty recurrence rule,
        // display it for easy re-selection
        if (tv.getId() == R.id.tvChosenCustomOption) {
            if (!TextUtils.isEmpty(mRecurrenceRule)) {
                EventRecurrence eventRecurrence = new EventRecurrence();
                eventRecurrence.parse(mRecurrenceRule);
                Time startDate = new Time(TimeZone.getDefault().getID());
                startDate.set(mCurrentlyChosenTime);
                eventRecurrence.setStartDate(startDate);

                tv.setVisibility(View.VISIBLE);

                tv.setText(EventRecurrenceFormatter.getRepeatString(
                        getContext(), getContext().getResources(),
                        eventRecurrence, true));
            } else { // hide this TextView since 'mRecurrenceRule' is not available
                tv.setVisibility(View.GONE);
                continue;
            }
        }

        // Selected option
        if (tv.getId() == viewIdToSelect) {
            // Set checkmark drawable & drawable-padding
            tv.setCompoundDrawablesWithIntrinsicBounds(null, null,
                    mCheckmarkDrawable, null);
            tv.setCompoundDrawablePadding(mSelectedOptionDrawablePadding);
            tv.setTextColor(mSelectedStateTextColor);

            continue;
        }

        // Unselected options
        tv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
        tv.setTextColor(mUnselectedStateTextColor);
    }
}
 
private void clipboard(TextView tv) {
    // which view are we copying to the clipboard?
    int which;

    switch (tv.getId()) {
        case txt_request_url: // the url field
            which = req_url;
            break;

        case txt_response_headers: // the display headers
            which = response_headers;
            break;

        case txt_response_body: // the response body
            which = response_body;
            break;

        default:
            which = UNSET; // don't assign a prefix
    }

    // if we know which view we're copying, prefix it with useful info
    String what = which == UNSET ? "" : getString(which) + " ";

    // concat the clipboard data to this String
    what += getString(clippy);

    // inform the user that data was added to the clipboard
    Toast.makeText(
            getActivity(),
            what,
            Toast.LENGTH_SHORT
    ).show();

    // depending on our API, do it one way or another...
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        // old way
        ClipboardManager clipboardManager = (ClipboardManager)
                getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
        clipboardManager.setText(tv.getText());
    } else {
        clipboard11(tv);
    }
}
 
源代码16 项目: FixMath   文件: PlayActivity.java
public void CalcClick(View view){
    clicked = true;
    isKeyboradOpen = true;
    ClickOn = view.getId();
    //FIELD TO CLOSE KEYBORAD
    CloseKeyboardNextTo();

    //FIGURE ANIMATION


    animClickFigures(view.getTag().toString());



    //      KEYBOARD
    RelativeLayout keyobard1 = (RelativeLayout)findViewById(R.id.keyboard);
    View key = findViewById(R.id.keyboard);
    setClickableRecursive(key, true);

    //Keyboard animation
    SameLineKeyAnim(view);

    RelativeLayout.LayoutParams keyboardParams = (RelativeLayout.LayoutParams)keyobard1.getLayoutParams();

    //RESET KEYBOARD
    keyboardParams.addRule(RelativeLayout.BELOW);
    keyboardParams.addRule(RelativeLayout.ABOVE);
    keyobard1.setLayoutParams(keyboardParams);



    SetVisibleKeyboard();

    //COLOR KEYBOARD
    SetKeyboardView(view);

    int ID, on;

    outerloop:
    for (int i = 1; i <= 5; i++){
        for (int z = 0; z <= 4; z++) {
            String TextViewId = "var" + i + "x" + z;
            ID = getResources().getIdentifier(TextViewId, "id", getPackageName());
            TextView xt = (TextView) findViewById(ID);
            on = xt.getId();

            if (ClickOn == on){

                TextViewX = i;
                TextViewY = z;
                break outerloop;
            }
        }
    }


}
 
源代码17 项目: FixMath   文件: TimeAttackActivity.java
public void FigureClick(View view) {
    isClicked = true;
    clickedFigureID = view.getId();



    //FIGURE ANIMATION
    YoYo.with(Techniques.RubberBand)
            .duration(500)
            .playOn(findViewById(clickedFigureID));

    //KEYBOARD
    RelativeLayout keyboardView = (RelativeLayout) findViewById(R.id.t_keyboard);
    View keyboardViewID = findViewById(R.id.t_keyboard);
    setClickableRecursive(keyboardViewID, true);

    RelativeLayout.LayoutParams keyboardParams = (RelativeLayout.LayoutParams) keyboardView.getLayoutParams();

    //RESET KEYBOARD
    keyboardParams.addRule(RelativeLayout.BELOW);
    keyboardParams.addRule(RelativeLayout.ABOVE);
    keyboardView.setLayoutParams(keyboardParams);


    setVisibleKeyboard();

    //COLOR KEYBOARD
    setKeyboardView(view);


    int ID, on;
    for (int i = 0; i <= 4; i++) {
        String TextViewId = "t_var" + i;
        ID = getResources().getIdentifier(TextViewId, "id", getPackageName());
        TextView xt = (TextView) findViewById(ID);
        on = xt.getId();
        if (clickedFigureID == on) {

            TextViewIndex = i;

        }
    }


}
 
 方法所在类
 同类方法