Java 类android.widget.RatingBar.OnRatingBarChangeListener 实例源码

项目:B4A_ViewsEx    文件:RatingBarWrapper.java   
@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);
            }
        });
    }
}
项目:wordwise    文件:WordEvaluation.java   
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();
                }
            });
}
项目:wordwise    文件:TranslationEvaluation.java   
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);
}
项目:UMBCHiTeaApp    文件:MainActivity.java   
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);
        }
    });
}
项目:UMBCHiTeaApp    文件:MainActivity.java   
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);
        }
    });
}
项目:UMBCHiTeaApp    文件:MainActivity.java   
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);
        }
    });
}
项目:FastValueHolder    文件:RatingBarItem.java   
@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;
}
项目:FastValueHolder    文件:RatingBarItem.java   
@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;
}
项目:CXJPadProject    文件:DCRCActivity.java   
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);
        }
    });
}
项目:AndroidViewHelper    文件:RatingBarWrapper.java   
/**
* @see RatingBar#setOnRatingBarChangeListener(OnRatingBarChangeListener)
*/
 public W setOnRatingBarChangeListener(OnRatingBarChangeListener listener) {
     mView.setOnRatingBarChangeListener(listener);
     return (W) this;
 }
项目:quiz-me    文件:RateCardActivity.java   
@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
    }

}
项目:AllGrade    文件:GradeActivity.java   
/**
 * 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;
    }
}
项目:Mimix-Client    文件:RatingActivity.java   
@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");

        }
    });



}