本文整理汇总了Java中android.widget.RatingBar.OnRatingBarChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java OnRatingBarChangeListener类的具体用法?Java OnRatingBarChangeListener怎么用?Java OnRatingBarChangeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnRatingBarChangeListener类属于android.widget.RatingBar包,在下文中一共展示了OnRatingBarChangeListener类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _initialize
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
@Hide
@Override
public void _initialize(final BA ba, Object activityClass, String EventName) {
final RatingBar rb = new RatingBar(ba.context);
final String eventName = EventName.toLowerCase(BA.cul);
setObject(rb);
innerInitialize(ba, eventName, true);
if (ba.subExists(eventName + "_valuechanged")) {
getObject().setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
ba.raiseEventFromUI(rb, eventName + "_valuechanged", rating, fromUser);
}
});
}
}
示例2: enableRatingBar
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
private void enableRatingBar() {
wordDifficultyRating.setEnabled(true);
wordDifficultyRating
.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar,
float rating, boolean fromUser) {
difficultyRated = false;
if (rating > 0.0f) {
difficultyRated = true;
}
checkSubmitCondition();
}
});
}
示例3: onGameInit
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
public void onGameInit() {
submitRating = (Button) findViewById(R.id.submitRatingButton);
continueButton = (Button) findViewById(R.id.continueButton);
wordInEnglish = (TextView) findViewById(R.id.wordInEnglish);
translationLanguageTitle = (TextView) findViewById(R.id.translationTitle);
translationToRate = (TextView) findViewById(R.id.translationToRate);
translationRatingBar = (RatingBar) findViewById(R.id.translationRatingBar);
languageOfTranslation = chooseRandomProficientLanguage();
this.setChangeableTextViews();
translationRatingBar
.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar,
float rating, boolean fromUser) {
translationRated = false;
if (rating > 0.0f) {
translationRated = true;
}
checkSubmitCondition();
}
});
submitRating.setVisibility(View.VISIBLE);
continueButton.setVisibility(View.INVISIBLE);
}
示例4: addListenerOnFoodQualityRatingBar
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
private void addListenerOnFoodQualityRatingBar() {
//if rating is changed,
//store the current rating value in the result (float) automatically
foodQualityRatingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
setFoodQualityRating((double) rating);
}
});
}
示例5: addListenerOnValueForMoneyRatingBar
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
private void addListenerOnValueForMoneyRatingBar() {
//if rating is changed,
//store the current rating value in the result (float) automatically
valueForMoneyRatingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
setValueForMoneyRating((double) rating);
}
});
}
示例6: addListenerOnFoodPresentationRatingBar
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
private void addListenerOnFoodPresentationRatingBar() {
//if rating is changed,
//store the current rating value in the result (float) automatically
foodPresentationRatingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
setFoodPresentationRating((double) rating);
}
});
}
示例7: convert
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
@Override
public boolean convert(ItemBuilder builder, final ViewGroup parent, Float data) {
builder.setRating(R.id.rating_bar, data).setStepSize(R.id.rating_bar, 0.5f);
builder.setOnRatingBarChangeListener(R.id.rating_bar, new OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
Toast.makeText(parent.getContext(), "Rating is " + rating, Toast.LENGTH_SHORT).show();
}
});
return true;
}
示例8: initListener
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
private void initListener() {
sobot_out_side_id.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
KeyboardUtil.hideKeyboard(sobot_out_side_id);
}
});
sobot_ratingBar
.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar arg0, float arg1,
boolean arg2) {
score = sobot_ratingBar.getRating();
if (0 < score && score < 5) {
hideLayout.setVisibility(View.VISIBLE);
sobot_button_style.setVisibility(View.GONE);
} else {
hideLayout.setVisibility(View.GONE);
comment("1", score + "", "", "", 0);
}
}
});
btnCancle.setOnClickListener(this);
btnSubmit.setOnClickListener(this);
sobot_btn_no_robot.setOnClickListener(this);
sobot_btn_ok_robot.setOnClickListener(this);
sobot_close_now.setOnClickListener(this);
gv_demo.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
TextView text = (TextView) view.findViewById(getResId("sobot_every_case"));
Boolean isChecked = (Boolean) text.getTag();
if (!isChecked) {
text.setTextColor(getResources().getColor(ResourceUtils.getIdByName(getApplicationContext(),
"color","sobot_color_evaluate_text_pressed")));
text.setBackgroundResource(getResDrawableId("sobot_login_edit_pressed"));
listChecked.add(text.getText().toString());
} else {
text.setTextColor(getResources().getColor(ResourceUtils.getIdByName(getApplicationContext(),
"color","sobot_color_evaluate_text_normal")));
text.setBackgroundResource(getResDrawableId("sobot_login_edit_nomal"));
listChecked.remove(text.getText().toString());
}
text.setTag(!isChecked);
}
});
}
示例9: setOnRatingBarChangeListener
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
/**
* @see RatingBar#setOnRatingBarChangeListener(OnRatingBarChangeListener)
*/
public W setOnRatingBarChangeListener(OnRatingBarChangeListener listener) {
mView.setOnRatingBarChangeListener(listener);
return (W) this;
}
示例10: onCreate
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db = new CardDatabase(this);
setContentView(R.layout.rate_card_view);
Intent intent = getIntent();
Long cardId = intent.getExtras().getLong(CARD_RATING_INTENT_ID_KEY);
card = db.getCard(cardId);
FrameLayout cardFrame = (FrameLayout) findViewById(R.id.CardFrame);
TextView cardTitle = (TextView) findViewById(R.id.RateCardTitle);
RatingBar rateCard = (RatingBar) findViewById(R.id.RateCardRatingBar);
rateCard.setRating(1f);
rating = 1;
Button doneBtn = (Button) findViewById(R.id.DoneRatingButton);
textSideViewer = new TextView(this);
imgSideViewer = new ImageView(this);
final RateCardActivity self = this;
if (card != null) {
cardTitle.setText(card.getTitle());
if (card.getSide2Type() == Card.TEXT_TYPE) {
textSideViewer.setText(card.getSide2Text());
cardFrame.addView(textSideViewer);
} else {
imgSideViewer.setImageURI(card.getSide2URI());
cardFrame.addView(imgSideViewer);
}
OnRatingBarChangeListener ratingListener = new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar arg0, float ratingFloat,
boolean arg2) {
rating = Math.round(ratingFloat);
L.d("onRatingChanged", "Rating is now %d from float: %f", rating, ratingFloat);
}
};
OnClickListener doneListener = new OnClickListener() {
public void onClick(View v) {
card.incrementCount();
SM2.scoreCardAndCalculateInterval(card, rating);
L.d("onClick doneListener", "Cards ef after: %f", card.getEFactor());
card.setLastTime(new Date().getTime());
db.upsertCard(card);
self.setResult(QuizActivity.CARD_RATING_RESULT);
self.finish();
}
};
doneBtn.setOnClickListener(doneListener);
rateCard.setOnRatingBarChangeListener(ratingListener);
} else {
// Show an error message
}
}
示例11: onCreate
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
/**
* This method is called when the {@link Activity} is started. It is responsible for the
* initialization of the fields. It also sets an {@link OnRatingBarChangeListener} for the
* {@link RatingBar} and the <code>spinnerLongClick</code> on the field <code>spinner_markComment</code>.
*
* The method also shows the information {@link Toast} for the user.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_grade);
prefs = getSharedPreferences(C.prefs.FILE_NAME, MODE_PRIVATE);
textView_studentName = (TextView) findViewById(R.id.textView_studentName);
spinner_markType = (Spinner) findViewById(R.id.spinner_markType);
ratingBar_markRating = (RatingBar) findViewById(R.id.ratingBar_markRating);
spinner_markComment = (Spinner) findViewById(R.id.spinner_markComment);
textView_bottomInfo = (TextView) findViewById(R.id.textView_bottomInfo);
ratingBar_markRating.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
/**
* This method makes sure that the RatingBar never has a rating lower than 1 and bigger than 5.
*/
@Override
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
if(rating<1)
{
ratingBar.setRating(1);
}else if(rating>5)
{
ratingBar.setRating(5);
}
}
});
spinner_markComment.setOnLongClickListener(spinnerLongClick);
textView_studentName.setText(getIntent().getExtras().getString(
C.intent.bundle.STUDENTNAME));
activeClass = prefs.getString(C.prefs.ACTIVE_CLASS, getString(R.string.nodata)).toUpperCase();
activeSubject = prefs.getString(C.prefs.ACTIVE_SUBJECT, getString(R.string.nodata)).toUpperCase();
textView_bottomInfo.setText(activeSubject+"/"+activeClass);
if(SHOW_COMMENT_SPINNER_INFO)
{
Toast.makeText(getApplicationContext(), R.string.toast_addCommentInfo, Toast.LENGTH_SHORT).show();
SHOW_COMMENT_SPINNER_INFO = false;
}
}
示例12: onCreate
import android.widget.RatingBar.OnRatingBarChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating);
utilhelper = new Util_Database(this);
UserID = utilhelper.getUSER_ID();
Intent intent = getIntent();
PID = intent.getStringExtra(Post_Fragment.PostID);
rating_btn = (Button) findViewById(R.id.rating_btn);
rate_progressBar = (ProgressBar) findViewById(R.id.rate_progressBar);
rate_progressBar.setVisibility(View.GONE);
RateCount=(TextView)findViewById(R.id.rate_count);
RateBar=(RatingBar)findViewById(R.id.main_ratingbar);
RateBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener()
{
/*public void OnRatingBarChanged(RatingBar ratingBar, float rating, boolean fromUser){
RateCount.setText(String.valueOf(rating)+"/5.0");
}*/
@Override
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
RateCount.setText(String.valueOf(rating)+"/5.0");
}
});
}