Revision d05e7629
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/dialogs/RubikDialogExplainStars.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2022 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Magic Cube. // |
|
5 |
// // |
|
6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
9 |
|
|
10 |
package org.distorted.dialogs; |
|
11 |
|
|
12 |
import android.app.Dialog; |
|
13 |
import android.content.DialogInterface; |
|
14 |
import android.os.Bundle; |
|
15 |
import android.util.DisplayMetrics; |
|
16 |
import android.util.TypedValue; |
|
17 |
import android.view.LayoutInflater; |
|
18 |
import android.view.View; |
|
19 |
import android.view.Window; |
|
20 |
import android.widget.Button; |
|
21 |
|
|
22 |
import androidx.annotation.NonNull; |
|
23 |
import androidx.appcompat.app.AlertDialog; |
|
24 |
import androidx.appcompat.app.AppCompatDialogFragment; |
|
25 |
import androidx.fragment.app.FragmentActivity; |
|
26 |
|
|
27 |
import org.distorted.main.R; |
|
28 |
import org.distorted.main.RubikActivity; |
|
29 |
|
|
30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
31 |
|
|
32 |
public class RubikDialogExplainStars extends AppCompatDialogFragment |
|
33 |
{ |
|
34 |
@NonNull |
|
35 |
@Override |
|
36 |
public Dialog onCreateDialog(Bundle savedInstanceState) |
|
37 |
{ |
|
38 |
FragmentActivity act = getActivity(); |
|
39 |
LayoutInflater inflater = act.getLayoutInflater(); |
|
40 |
AlertDialog.Builder builder = new AlertDialog.Builder(act); |
|
41 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
|
42 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
43 |
final float butSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
44 |
final View view = inflater.inflate(R.layout.dialog_explain_stars, null); |
|
45 |
|
|
46 |
builder.setCancelable(true); |
|
47 |
|
|
48 |
builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() |
|
49 |
{ |
|
50 |
@Override |
|
51 |
public void onClick(DialogInterface dialog, int which) { } |
|
52 |
}); |
|
53 |
|
|
54 |
builder.setView(view); |
|
55 |
|
|
56 |
final Dialog dialog = builder.create(); |
|
57 |
dialog.setCanceledOnTouchOutside(false); |
|
58 |
Window window = dialog.getWindow(); |
|
59 |
|
|
60 |
if( window!=null ) |
|
61 |
{ |
|
62 |
window.getDecorView().setSystemUiVisibility(RubikActivity.FLAGS); |
|
63 |
} |
|
64 |
|
|
65 |
dialog.setOnShowListener(new DialogInterface.OnShowListener() |
|
66 |
{ |
|
67 |
@Override |
|
68 |
public void onShow(DialogInterface dialog) |
|
69 |
{ |
|
70 |
Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE); |
|
71 |
btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, butSize); |
|
72 |
Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE); |
|
73 |
btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, butSize); |
|
74 |
} |
|
75 |
}); |
|
76 |
|
|
77 |
return dialog; |
|
78 |
} |
|
79 |
} |
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
import org.distorted.config.ConfigActivity; |
37 | 37 |
import org.distorted.bandaged.BandagedCreatorActivity; |
38 |
import org.distorted.dialogs.RubikDialogExplainStars; |
|
38 | 39 |
import org.distorted.library.main.DistortedLibrary; |
39 | 40 |
|
40 | 41 |
import org.distorted.library.main.DistortedScreen; |
... | ... | |
49 | 50 |
import org.distorted.external.RubikNetwork; |
50 | 51 |
import org.distorted.objects.RubikObject; |
51 | 52 |
import org.distorted.objects.RubikObjectList; |
53 |
import org.distorted.overlays.DataStars; |
|
54 |
import org.distorted.overlays.OverlayStars; |
|
52 | 55 |
import org.distorted.purchase.PurchaseActivity; |
53 | 56 |
import org.distorted.screens.RubikScreenSolving; |
54 | 57 |
import org.distorted.screens.ScreenList; |
... | ... | |
108 | 111 |
private int mCurrentApiVersion; |
109 | 112 |
private int mHeightUpperBar, mHeightLowerBar; |
110 | 113 |
private int mOldVersion1, mOldVersion2, mOldVersion3; |
111 |
private String mCurrVersion; |
|
114 |
private String mOldVersion, mCurrVersion;
|
|
112 | 115 |
|
113 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
114 | 117 |
|
... | ... | |
279 | 282 |
int object = RubikObjectList.getCurrObject(); |
280 | 283 |
changeIfDifferent(object,view.getObjectControl()); |
281 | 284 |
|
282 |
if( mIsChinese && !mPolicyAccepted ) PrivacyPolicy(); |
|
285 |
if( mIsChinese && !mPolicyAccepted ) privacyPolicy(); |
|
286 |
|
|
287 |
if( USE_IAP && mOldVersion!=null && oldVersionLessThan(1,11,5) && !mCurrVersion.equals("1.11.4") ) |
|
288 |
{ |
|
289 |
explainStars(); |
|
290 |
} |
|
291 |
else |
|
292 |
{ |
|
293 |
RubikScores scores = RubikScores.getInstance(); |
|
294 |
int totStars = scores.getNumStars(); |
|
295 |
DistortedScreen screen = getScreen(); |
|
296 |
OverlayStars stars = new OverlayStars(); |
|
297 |
DataStars data = new DataStars(totStars,0,getResources()); |
|
298 |
stars.startOverlay(screen,null,data); |
|
299 |
} |
|
283 | 300 |
} |
284 |
|
|
301 |
|
|
302 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
303 |
|
|
304 |
private void privacyPolicy() |
|
305 |
{ |
|
306 |
RubikDialogPrivacy priDiag = new RubikDialogPrivacy(); |
|
307 |
priDiag.show(getSupportFragmentManager(), null); |
|
308 |
} |
|
309 |
|
|
310 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
311 |
|
|
312 |
private void explainStars() |
|
313 |
{ |
|
314 |
RubikDialogExplainStars staDiag = new RubikDialogExplainStars(); |
|
315 |
staDiag.show(getSupportFragmentManager(), null); |
|
316 |
} |
|
317 |
|
|
285 | 318 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
286 | 319 |
|
287 | 320 |
@Override |
... | ... | |
354 | 387 |
private void restorePreferences(SharedPreferences preferences, boolean justStarted) |
355 | 388 |
{ |
356 | 389 |
mPolicyAccepted = preferences.getBoolean("policyAccepted", false); |
357 |
String oldVersion = preferences.getString("appVersion","");
|
|
358 |
parseVersion(oldVersion);
|
|
390 |
mOldVersion = preferences.getString("appVersion","");
|
|
391 |
parseOldVersion(mOldVersion);
|
|
359 | 392 |
|
360 | 393 |
RubikObjectList.restorePreferences(this,preferences,justStarted); |
361 | 394 |
|
... | ... | |
407 | 440 |
// So in such case, i.e. on fresh upgrade from version<=1.8.6 to version>=1.9.0, do not |
408 | 441 |
// restore the object scrambling. |
409 | 442 |
|
410 |
if( !oldVersion.equals("") )
|
|
443 |
if( !mOldVersion.equals("") )
|
|
411 | 444 |
{ |
412 | 445 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
413 | 446 |
view.getObjectControl().restorePreferences(preferences); |
... | ... | |
416 | 449 |
|
417 | 450 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
418 | 451 |
|
419 |
private void parseVersion(String version) |
|
452 |
private void parseOldVersion(String version)
|
|
420 | 453 |
{ |
421 | 454 |
if( version==null ) return; |
422 | 455 |
|
... | ... | |
468 | 501 |
} |
469 | 502 |
} |
470 | 503 |
|
471 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
472 |
|
|
473 |
private void PrivacyPolicy() |
|
474 |
{ |
|
475 |
RubikDialogPrivacy priDiag = new RubikDialogPrivacy(); |
|
476 |
priDiag.show(getSupportFragmentManager(), null); |
|
477 |
} |
|
478 |
|
|
479 | 504 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
480 | 505 |
|
481 | 506 |
void OpenGLError() |
src/main/java/org/distorted/overlays/OverlayStars.java | ||
---|---|---|
374 | 374 |
mNodeFalling=null; |
375 | 375 |
} |
376 | 376 |
|
377 |
mListener.overlayFinished(id); |
|
377 |
if( mListener!=null ) mListener.overlayFinished(id);
|
|
378 | 378 |
} |
379 | 379 |
} |
380 | 380 |
|
src/main/res/layout/dialog_explain_stars.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:layout_width="fill_parent" |
|
4 |
android:layout_height="fill_parent" |
|
5 |
android:gravity="center|fill_horizontal" |
|
6 |
android:layout_marginLeft="10dp" |
|
7 |
android:layout_marginRight="10dp" |
|
8 |
android:layout_marginTop="0dp" |
|
9 |
android:background="@color/grey" |
|
10 |
android:orientation="vertical"> |
|
11 |
|
|
12 |
<TextView |
|
13 |
android:id="@+id/privacy_string" |
|
14 |
android:layout_width="match_parent" |
|
15 |
android:layout_height="match_parent" |
|
16 |
android:gravity="center" |
|
17 |
android:textSize="24sp" |
|
18 |
android:text="@string/explain_stars_text" |
|
19 |
android:layout_marginTop="10dp" |
|
20 |
android:layout_marginLeft="10dp" |
|
21 |
android:layout_marginRight="10dp" |
|
22 |
android:layout_marginBottom="10dp"/> |
|
23 |
</LinearLayout> |
src/main/res/values-de/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Hübsche Muster von Walter Randelshofer. Sehen Sie <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Rubik und Rubik Cube sind eingetragene Warenzeichen. Wir sind damit nicht verbunden.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">In dieser Version wird das Konzept der Sterne eingeführt. Verdiene Sterne durch das Lösen von Rätseln. Sie können auch Sterne kaufen. Geben Sie Sterne aus, um Rätsel und andere Funktionen in der App freizuschalten.</string> |
|
74 | 75 |
<string name="solver_generic_error1">Löser für dieses Objekt und diese Größe noch nicht implementiert!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">Es gibt nur %1$d %2$s Facelets.</string> |
src/main/res/values-es/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns por Walter Randelshofer. Mira <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Rubik y Rubik Cube son marcas registradas. No estamos afiliados a ella.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">Esta versión introduce el concepto de estrellas. Gana estrellas resolviendo puzles. También puedes comprar estrellas. Gasta estrellas para desbloquear puzles y otras funciones de la aplicación.</string> |
|
74 | 75 |
<string name="solver_generic_error1">¡Aún no se implementado el solucionador para este objeto y tamaño!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">Solo hay %1$d facetas %2$s.</string> |
src/main/res/values-fr/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns par Walter Randelshofer. Voir <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Rubik et Rubik Cube sont des marques déposées. Nous n\'y sommes pas affiliés.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">Cette version introduit le concept d\'étoiles. Gagnez des étoiles en résolvant des puzzles. Vous pouvez également acheter des étoiles. Dépensez des étoiles pour débloquer des puzzles et d\'autres fonctionnalités de l\'application.</string> |
|
74 | 75 |
<string name="solver_generic_error1">Solutionneur pour cet objet et cette taille non encore mis en place !</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">Il n\'y a que %1$d facettes %2$s.</string> |
src/main/res/values-ja/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns 沿って Walter Randelshofer. 見る <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">ルービックキューブおよびルービックキューブは登録商標です。 私たちはそれと提携していません。</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">このバージョンでは、星の概念が導入されています。パズルを解くとスターがもらえます。また、スターを購入することもできます。スターを消費して、アプリ内のパズルやその他の機能をアンロックします。</string> |
|
74 | 75 |
<string name="solver_generic_error1">このオブジェクトとサイズのソルバーはまだ実装されていません!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">%2$s小顔は%1$dつだけ</string> |
src/main/res/values-ko/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns 으로 Walter Randelshofer. 보다 <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Rubik 및 Rubik Cube는 등록 상표입니다. 우리는 그것과 제휴하지 않습니다.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">이 버전은 별의 개념을 소개합니다. 퍼즐을 풀어 별을 획득하세요. 별을 살 수도 있습니다. 앱에서 퍼즐 및 기타 기능을 잠금 해제하려면 별을 사용하세요.</string> |
|
74 | 75 |
<string name="solver_generic_error1">아직 구현되지 않은 이 개체 및 크기에 대한 해결사!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">%2$s작은 얼굴은 %1$d개뿐입니다.</string> |
src/main/res/values-pl/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Piękne Wzory Waltera Randelshofera. Zobacz <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Rubik i RubikCube to zarejestrowane znaki towarowe. Nie jesteśmy z nimi powiązani.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">Ta wersja wprowadza koncepcję gwiazdek. Zdobywaj gwiazdki, rozwiązując poziomy. Możesz także kupić gwiazdki. Wydawaj gwiazdki, aby odblokować obiekty i inne funkcje w aplikacji.</string> |
|
74 | 75 |
<string name="solver_generic_error1">Rozwiązywacz takiego obiektu jest jeszcze nie zaimplementowany!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">Jest tylko %1$d %2$s ścian.</string> |
src/main/res/values-ru/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns по Walter Randelshofer. Смотри <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">Рубик и Кубик Рубика являются зарегистрированными товарными знаками. Мы не связаны с этим.</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">В этой версии введена концепция звезд. Зарабатывайте звезды, решая головоломки. Вы также можете покупать звезды. Тратьте звезды, чтобы разблокировать головоломки и другие возможности приложения.</string> |
|
74 | 75 |
<string name="solver_generic_error1">Решебника для этого объекта и размера еще нет!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">Всего %1$d %2$s граней!</string> |
src/main/res/values-zh-rCN/strings.xml | ||
---|---|---|
77 | 77 |
<string name="accept">接受</string> |
78 | 78 |
<string name="decline">拒绝</string> |
79 | 79 |
|
80 |
<string name="explain_stars_text">这个版本引入了星星的概念。通过解开谜题获得星星。你也可以购买星星。花费星星来解锁谜题和应用程序中的其他功能。</string> |
|
80 | 81 |
<string name="solver_generic_error1">此对象和尺寸的求解器尚未实现!</string> |
81 | 82 |
|
82 | 83 |
<string name="solver_cube3_error1">只有%1$d个%2$s小面</string> |
src/main/res/values-zh-rTW/strings.xml | ||
---|---|---|
71 | 71 |
<string name="credits2">Pretty Patterns by Werner Randelshofer. 請看 <a href="http://www.randelshofer.ch">http://www.randelshofer.ch</a></string> |
72 | 72 |
<string name="credits3">魔方和魔方是註冊商標。 我們不隸屬於它。</string> |
73 | 73 |
|
74 |
<string name="explain_stars_text">这个版本引入了星星的概念。通过解开谜题获得星星。你也可以购买星星。花费星星来解锁谜题和应用程序中的其他功能。</string> |
|
74 | 75 |
<string name="solver_generic_error1">此對象和尺寸的求解器尚未實現!</string> |
75 | 76 |
|
76 | 77 |
<string name="solver_cube3_error1">只有%1$d個%2$s小臉</string> |
src/main/res/values/strings.xml | ||
---|---|---|
75 | 75 |
<string name="credits3">Rubik and Rubik Cube are registered trademarks. We are not affiliated with it.</string> |
76 | 76 |
<string name="credits4" translatable="false">Please see our <a href="https://distorted.org/redmine/projects/magic-cube/wiki/Privacy_policy">Privacy Policy</a></string> |
77 | 77 |
|
78 |
<string name="explain_stars_text">This version introduces the concept of stars. Earn stars by solving puzzles. You can also buy stars. Spend stars to unlock puzzles and other features in the app.</string> |
|
78 | 79 |
<string name="privacy_policy" translatable="false">Privacy Policy</string> |
79 | 80 |
<string name="privacy_policy_text" translatable="false">Please see and accept our <a href="https://distorted.org/redmine/projects/magic-cube/wiki/Privacy_policy">Privacy Policy</a></string> |
80 | 81 |
<string name="accept" translatable="false">Accept</string> |
Also available in: Unified diff
Stars: introductory dialog explaining the concept of stars.