Project

General

Profile

« Previous | Next » 

Revision 79e752b3

Added by Leszek Koltunski over 4 years ago

Solving time - display it more accurately.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
150 150
    final View view = inflater.inflate(R.layout.dialog_new_record, null);
151 151
    TextView text = view.findViewById(R.id.new_record_time);
152 152
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
153
    text.setText(getString(R.string.ti_placeholder, (time/100)/10.0f));
153
    text.setText(getString(R.string.ti_placeholder, (time/10)/100.0f));
154 154
    builder.setView(view);
155 155

  
156 156
    TextView submit = view.findViewById(R.id.new_record_submit);
src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
19 19

  
20 20
package org.distorted.dialogs;
21 21

  
22
import android.annotation.SuppressLint;
22 23
import android.content.Context;
23 24
import android.content.res.Resources;
24 25
import androidx.fragment.app.FragmentActivity;
......
74 75

  
75 76
///////////////////////////////////////////////////////////////////////////////////////////////////
76 77

  
78
  @SuppressLint("DefaultLocale")
77 79
  LinearLayout createSection(FragmentActivity act, int tab, int level, final String[] country, final String[] name, final float[] time)
78 80
    {
79 81
    LinearLayout levelLayout = (LinearLayout)inflate(act, R.layout.dialog_scores_scramble_title, null);
......
92 94

  
93 95
    boolean inserted = false;
94 96
    long myRecordInMillis = scores.getRecord(object, sizeIndex, level);
95
    float myRecordInSeconds = (myRecordInMillis/100)/10.0f;
97
    float myRecordInSeconds = (myRecordInMillis/10)/100.0f;
96 98
    boolean mySubmitted = scores.isSubmitted(object, sizeIndex, level);
97 99
    String myName = scores.getName();
98 100
    if( myName.length()==0 ) myName = act.getString(R.string.you);
99 101
    int myCountryID = res.getIdentifier( scores.getCountry(), "drawable", packageName);
100
    String myRecord = ( myRecordInMillis<RubikScores.NO_RECORD ) ? Float.toString(myRecordInSeconds) : "??";
102
    String myRecord = ( myRecordInMillis<RubikScores.NO_RECORD ) ? String.format("%.2f", myRecordInSeconds) : "??";
101 103
    String theirTime;
102 104
    int theirCountryID;
103 105

  
......
123 125
          {
124 126
          if( equals ) inserted=true;
125 127
          theirCountryID = res.getIdentifier( country[j], "drawable", packageName);
126
          theirTime = Float.toString(time[j]);
128
          theirTime = String.format("%.2f", time[j]);
127 129
          View row = createRow(act, theirCountryID, name[j], theirTime, height, equals ? red:white);
128 130
          levelLayout.addView(row);
129 131
          }
src/main/java/org/distorted/dialogs/RubikDialogSolved.java
89 89
    final View view = inflater.inflate(R.layout.dialog_solved, null);
90 90
    TextView text = view.findViewById(R.id.solved_time);
91 91
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
92
    text.setText(getString(R.string.ti_placeholder, (time/100)/10.0f));
92
    text.setText(getString(R.string.ti_placeholder, (time/10)/100.0f));
93 93
    builder.setView(view);
94 94

  
95 95
    Dialog dialog = builder.create();
src/main/java/org/distorted/scores/RubikScoresDownloader.java
202 202

  
203 203
          mCountry[object][level][p] = country;
204 204
          mName   [object][level][p] = name;
205
          mTime   [object][level][p] = ((float)(time/100))/10.0f;
205
          mTime   [object][level][p] = ((float)(time/10))/100.0f;
206 206
          }
207 207
        }
208 208
      }
src/main/res/values-de/strings.xml
55 55
    <string name="lv_placeholder">Level %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f Sekunden</string>
58
    <string name="ti_placeholder">%1$.2f Sekunden</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-es/strings.xml
55 55
    <string name="lv_placeholder">Nivel %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f segundos</string>
58
    <string name="ti_placeholder">%1$.2f segundos</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-fr/strings.xml
55 55
    <string name="lv_placeholder">Niveau %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f secondes</string>
58
    <string name="ti_placeholder">%1$.2f secondes</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-it/strings.xml
55 55
    <string name="lv_placeholder">Livello %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f secondi</string>
58
    <string name="ti_placeholder">%1$.2f secondi</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-ja/strings.xml
55 55
    <string name="lv_placeholder">レベル %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f 秒</string>
58
    <string name="ti_placeholder">%1$.2f 秒</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-ko/strings.xml
55 55
    <string name="lv_placeholder">레벨 %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f 초</string>
58
    <string name="ti_placeholder">%1$.2f 초</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-pl/strings.xml
54 54
    <string name="lv_placeholder">Poziom %1$d</string>
55 55
    <string name="tm_placeholder">%1$02d:%2$02d</string>
56 56
    <string name="ap_placeholder">%1$s %2$s</string>
57
    <string name="ti_placeholder">%1$.1f sekund</string>
57
    <string name="ti_placeholder">%1$.2f sekund</string>
58 58
    <string name="mo_placeholder">%1$d/%2$d</string>
59 59
</resources>
src/main/res/values-ru/strings.xml
55 55
    <string name="lv_placeholder">Уровень %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f сек.</string>
58
    <string name="ti_placeholder">%1$.2f сек.</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-zh-rCN/strings.xml
55 55
    <string name="lv_placeholder">级别 %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f 秒</string>
58
    <string name="ti_placeholder">%1$.2f 秒</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values-zh-rTW/strings.xml
55 55
    <string name="lv_placeholder">级别 %1$d</string>
56 56
    <string name="tm_placeholder">%1$02d:%2$02d</string>
57 57
    <string name="ap_placeholder">%1$s %2$s</string>
58
    <string name="ti_placeholder">%1$.1f 秒</string>
58
    <string name="ti_placeholder">%1$.2f 秒</string>
59 59
    <string name="mo_placeholder">%1$d/%2$d</string>
60 60
</resources>
src/main/res/values/strings.xml
56 56
    <string name="lv_placeholder">Level %1$d</string>
57 57
    <string name="tm_placeholder">%1$02d:%2$02d</string>
58 58
    <string name="ap_placeholder">%1$s %2$s</string>
59
    <string name="ti_placeholder">%1$.1f seconds</string>
59
    <string name="ti_placeholder">%1$.2f seconds</string>
60 60
    <string name="mo_placeholder">%1$d/%2$d</string>
61 61
    <string name="sq_placeholder" translatable="false">%1$2d.</string>
62 62
</resources>

Also available in: Unified diff