Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
3.4 kB
2
Indexable
Never
@Override
                    public void onMenuSelected(int index) {
                        int score = 0;
                        String curUser = FirebaseAuth.getInstance().getUid();
                        switch (index){
                            case 0:
                                Toast.makeText(MainScreen.this, "Happy", Toast.LENGTH_SHORT).show();
                                constraintLayout.setBackgroundColor(Color.parseColor("#98FB98"));

                                score = 50;
                                new DaysHelper(curUser).addMoodScore(score, new DaysHelper._addMoodScore() {
                                    @Override
                                    public void moodScoreAdded() {

                                    }
                                });
                                break;
                            case 1:
                                Toast.makeText(MainScreen.this, "Angry", Toast.LENGTH_SHORT).show();
                                constraintLayout.setBackgroundColor(Color.parseColor("#ffcccb"));
                                score = 25;
                                new DaysHelper(curUser).addMoodScore(score, new DaysHelper._addMoodScore() {
                                    @Override
                                    public void moodScoreAdded() {

                                    }
                                });
                                break;
                            case 2:
                                Toast.makeText(MainScreen.this, "Anxious", Toast.LENGTH_SHORT).show();
                                constraintLayout.setBackgroundColor(Color.parseColor("#fac4a2"));
                                score = 30;
                                new DaysHelper(curUser).addMoodScore(score, new DaysHelper._addMoodScore() {
                                    @Override
                                    public void moodScoreAdded() {

                                    }
                                });
                                break;
                            case 3:
                                Toast.makeText(MainScreen.this, "Ok", Toast.LENGTH_SHORT).show();
                                constraintLayout.setBackgroundColor(Color.parseColor("#d3cde6"));
                                score = 25;
                                new DaysHelper(curUser).addMoodScore(score, new DaysHelper._addMoodScore() {
                                    @Override
                                    public void moodScoreAdded() {

                                    }
                                });
                                break;
                            case 4:
                                Toast.makeText(MainScreen.this, "Sad", Toast.LENGTH_SHORT).show();
                                score = 25;
                                new DaysHelper(curUser).addMoodScore(score, new DaysHelper._addMoodScore() {
                                    @Override
                                    public void moodScoreAdded() {

                                    }
                                });
                                constraintLayout.setBackgroundColor(Color.parseColor("#afeeee"));
                                break;
                        }
                    }
                });
    }