| 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()
|
Slightely improve the scores dialog.