Project

General

Profile

« Previous | Next » 

Revision a7327225

Added by Leszek Koltunski about 1 year ago

Slightely improve the scores dialog.

View differences:

src/main/java/org/distorted/main/RubikActivity.java
18 18
import android.content.pm.PackageManager;
19 19
import android.os.Build;
20 20
import android.os.Bundle;
21
import android.os.LocaleList;
22 21
import android.preference.PreferenceManager;
23 22

  
24 23
import android.util.DisplayMetrics;
......
46 45
import org.distorted.objectlib.main.TwistyObject;
47 46

  
48 47
import org.distorted.dialogs.RubikDialogError;
49
import org.distorted.dialogs.RubikDialogPrivacy;
50 48
import org.distorted.external.RubikScores;
51 49
import org.distorted.external.RubikNetwork;
52 50
import org.distorted.objects.RubikObject;
......
65 63
public class RubikActivity extends AppCompatActivity
66 64
{
67 65
    public static final boolean SHOW_DOWNLOADED_DEBUG = false;
68
    public static final boolean SHOW_IAP_DEBUG        = true;
66
    public static final boolean SHOW_IAP_DEBUG        = false;
69 67
    public static final boolean USE_IAP               = false;
70 68

  
71 69
    public static final float PADDING             = 0.010f;
......
81 79
    public static final float POPUP_PADDING       = 0.028f;
82 80
    public static final float POPUP_MARGIN        = 0.016f;
83 81
    public static final float POPUP_BOTTOM        = 0.090f;
84
    public static final float BUTT_PAD            = 0.020f;
85 82
    public static final float RATIO_BAR           = 0.100f;
86 83

  
87 84
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
......
99 96
    private boolean mJustStarted;
100 97
    private FirebaseAnalytics mFirebaseAnalytics;
101 98
    private static int mScreenWidth, mScreenHeight;
102
    private boolean mPolicyAccepted, mIsChinese;
99
    private boolean mPolicyAccepted;
103 100
    private int mCurrentApiVersion;
104
    private int mHeightUpperBar, mHeightLowerBar;
101
    private int mHeightUpperBar;
105 102
    private int mOldVersion1, mOldVersion2, mOldVersion3;
106 103
    private String mOldVersion, mCurrVersion;
107 104
    private int mSolverIndex;
......
113 110
      {
114 111
      super.onCreate(savedState);
115 112
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
116

  
117 113
      setTheme(R.style.MaterialThemeNoActionBar);
118 114
      setContentView(R.layout.main);
115
      hideNavigationBar();
119 116

  
120 117
      mJustStarted = true;
121 118
      mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
122
      mIsChinese = localeIsChinese();
123 119

  
124 120
      DisplayMetrics displaymetrics = new DisplayMetrics();
125 121
      getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics);
126 122
      mScreenWidth =displaymetrics.widthPixels;
127 123
      mScreenHeight=displaymetrics.heightPixels;
128 124

  
129
      hideNavigationBar();
125

  
130 126
      cutoutHack();
131 127
      computeBarHeights();
132 128

  
......
151 147
    private void computeBarHeights()
152 148
      {
153 149
      int barHeight = (int)(mScreenHeight*RATIO_BAR);
154
      mHeightLowerBar = barHeight;
155 150
      mHeightUpperBar = barHeight;
156 151

  
157 152
      LinearLayout layoutTop = findViewById(R.id.upperBar);
......
161 156
      paramsTop.height = mHeightUpperBar;
162 157
      layoutTop.setLayoutParams(paramsTop);
163 158
      ViewGroup.LayoutParams paramsBot = layoutBot.getLayoutParams();
164
      paramsBot.height = mHeightLowerBar;
159
      paramsBot.height = barHeight;
165 160
      layoutBot.setLayoutParams(paramsBot);
166 161
      }
167 162

  
......
290 285
        }
291 286
      }
292 287

  
293
///////////////////////////////////////////////////////////////////////////////////////////////////
294

  
295
    private void privacyPolicy()
296
      {
297
      RubikDialogPrivacy priDiag = new RubikDialogPrivacy();
298
      priDiag.show(getSupportFragmentManager(), null);
299
      }
300

  
301 288
///////////////////////////////////////////////////////////////////////////////////////////////////
302 289

  
303 290
    private void displayNovelties()
......
516 503
      return mHeightUpperBar;
517 504
      }
518 505

  
519
///////////////////////////////////////////////////////////////////////////////////////////////////
520

  
521
    public int getHeightLowerBar()
522
      {
523
      return mHeightLowerBar;
524
      }
525

  
526 506
///////////////////////////////////////////////////////////////////////////////////////////////////
527 507

  
528 508
    public TwistyObject getObject()
......
632 612
      finish();
633 613
      }
634 614

  
635
///////////////////////////////////////////////////////////////////////////////////////////////////
636

  
637
    public static boolean localeIsChinese()
638
      {
639
      String language;
640

  
641
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
642
        {
643
        language= LocaleList.getDefault().get(0).getLanguage();
644
        }
645
      else
646
        {
647
        language= Locale.getDefault().getLanguage();
648
        }
649

  
650
      return language.equals("zh");
651
      }
652

  
653 615
///////////////////////////////////////////////////////////////////////////////////////////////////
654 616

  
655 617
    public boolean isVertical()
src/main/res/layout/dialog_scores_scramble_row.xml
4 4
    android:layout_height="wrap_content"
5 5
    android:paddingBottom="2dp"
6 6
    android:paddingTop="2dp"
7
    android:orientation="horizontal" >
7
    android:orientation="horizontal"
8
    android:weightSum="1.0">
8 9

  
9 10
    <ImageView
10 11
        android:id="@+id/scoresScrambleRowCountry"
11
        android:layout_width="match_parent"
12
        android:layout_width="0dp"
12 13
        android:layout_height="match_parent"
13 14
        android:paddingBottom="3dp"
14 15
        android:paddingTop="3dp"
15
        android:layout_weight="1.5"
16
        android:layout_weight="0.17"
16 17
        android:gravity="start"
17 18
        android:background="@color/black"/>
18 19

  
19 20
    <TextView
20 21
        android:id="@+id/scoresScrambleRowName"
21
        android:layout_width="match_parent"
22
        android:layout_width="0dp"
22 23
        android:layout_height="match_parent"
23
        android:layout_weight="1"
24
        android:layout_weight="0.53"
24 25
        android:textSize="20sp"
25 26
        android:maxLines="1"
26
        android:gravity="left"
27
        android:gravity="start|center_vertical"
27 28
        android:background="@color/black"
29
        android:paddingStart="5dp"
28 30
        />
29 31

  
30 32
    <TextView
31 33
        android:id="@+id/scoresScrambleRowTime"
32
        android:layout_width="match_parent"
34
        android:layout_width="0dp"
33 35
        android:layout_height="match_parent"
34
        android:layout_weight="1.2"
36
        android:layout_weight="0.3"
35 37
        android:textSize="20sp"
36 38
        android:maxLines="1"
37
        android:gravity="end"
39
        android:gravity="end|center_vertical"
38 40
        android:background="@color/black"
39
        android:paddingEnd="3dp"
41
        android:paddingEnd="5dp"
40 42
        />
41 43
</LinearLayout>

Also available in: Unified diff