Commit 0edb6310 authored by P P's avatar P P
Browse files

leaderboard patch

parent fc388d51
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class FirebaseActivity extends AppCompatActivity {
//    private static final String SCORE_KEY = "score";

    private Button SaveButton;
    TextView userName, userID,nameScore, chalkScore;
    TextView userName, userID,nameScore, chalkScore,avScore;

    //public Map<String, Object> userScoreMap;
    //public Map<String, Long> big_userScoreMap = new HashMap<>();
@@ -108,6 +108,12 @@ public class FirebaseActivity extends AppCompatActivity {
        chalkScore = (TextView) findViewById(R.id.chalk_score);
        chalkScore.setText(bestChalk/4.0*100+"%");

        avScore = (TextView) findViewById(R.id.av_score);
        Double av = (bestChalk/4.0*100+percent)/2;
        DecimalFormat df = new DecimalFormat("##.##");
        String formattedNum = df.format(av);
        avScore.setText(formattedNum+"%");

        UploadData();
        RetrieveData();

@@ -213,7 +219,8 @@ public class FirebaseActivity extends AppCompatActivity {
                                    big_userScoreMap.scoreboard.put(scoreObj.toString(), score);
                            }
                                 */
                                big_userScoreMap.scoreboard.put(name, scores);
                                String userId = document.getId()+name;
                                big_userScoreMap.scoreboard.put(userId, scores);

                            }

+2 −2
Original line number Diff line number Diff line
@@ -92,12 +92,12 @@ public class LeaderboardActivity extends AppCompatActivity {
            rankView.setFontFeatureSettings("press_start_2p");
            rankView.setText(String.format("%d",ranking));


            String sub_name = username.substring(36);
            TextView nameView = new TextView(this);
            nameView.setTextSize(20);
            nameView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
            nameView.setFontFeatureSettings("press_start_2p");
            nameView.setText(String.format("%s", username));
            nameView.setText(String.format("%s", sub_name));

            TextView scoreView = new TextView(this);
            scoreView.setTextSize(20);
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Update by refreshing..."
        android:text="Scroll down to see the full scoreboard"
        android:layout_marginTop="3dp"
        android:layout_below="@+id/title"
        android:fontFamily="@font/press_start_2p"
+29 −12
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="05dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
@@ -36,7 +36,7 @@
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="05dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
@@ -49,7 +49,7 @@
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
                android:text="Average Name Guessing Accuracy" />
@@ -61,22 +61,25 @@
                android:layout_below="@+id/name_score"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
                android:text="Best Chalk Dodging Score" />

            <TextView
                android:id="@+id/hint_text"
                android:id="@+id/av_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/name_score"
                android:layout_marginStart="10dp"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
                android:text="(press sync data)"
                android:textSize="10dp" />
                android:text="Overall Score" />





@@ -94,7 +97,7 @@
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="0dp"
                android:fontFamily="@font/press_start_2p"
@@ -123,7 +126,7 @@
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="10dp"
                android:fontFamily="@font/press_start_2p"
@@ -138,13 +141,27 @@
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="10dp"
                android:fontFamily="@font/press_start_2p"
                android:text="0"
                android:textAlignment="textEnd"
                android:textColor="@color/white" />
            <TextView
                android:id="@+id/av_score"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="10dp"
                android:fontFamily="@font/press_start_2p"
                android:text="0"
                android:textAlignment="textEnd"
                android:textColor="@color/white" />

        </LinearLayout>
    </LinearLayout>