diff --git a/src/ru/nsu/ccfit/zuev/osu/MainScene.java b/src/ru/nsu/ccfit/zuev/osu/MainScene.java index e1b3e0e3b..302b3bc82 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainScene.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainScene.java @@ -1,12 +1,11 @@ package ru.nsu.ccfit.zuev.osu; import android.content.Context; -import android.content.Intent; import android.graphics.PointF; -import android.net.Uri; import android.os.PowerManager; import android.util.Log; +import com.reco1l.andengine.shape.RoundedBox; import com.reco1l.osu.data.BeatmapInfo; import com.reco1l.osu.Execution; import com.reco1l.osu.ui.entity.MainMenu; @@ -51,7 +50,6 @@ import java.util.Arrays; import java.util.LinkedList; -import java.util.Locale; import java.util.TimerTask; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -172,66 +170,49 @@ public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, menu = new MainMenu(this); - final Text author = new Text(10, 530, ResourceManager - .getInstance().getFont("font"), - String.format( - Locale.getDefault(), - "osu!droid %s\nby osu!droid Team\nosu! is © peppy 2007-2024", - BuildConfig.VERSION_NAME + " (" + BuildConfig.BUILD_TYPE + ")" - )) { + // Only show build type if it's not release + String versionString = BuildConfig.VERSION_NAME + String.format(" (%s)", BuildConfig.BUILD_TYPE).replace(" (release)", ""); + RoundedBox box = new RoundedBox() { - @Override - public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { - if (pSceneTouchEvent.isActionDown()) { + { + Text versionText = new Text(10f, 2f, ResourceManager.getInstance().getFont("font"), "osu!droid " + versionString); + attachChild(versionText); - new MessageDialog() - .setMessage(context.getString(com.osudroid.resources.R.string.dialog_visit_osu_website)) - .addButton("Yes", dialog -> { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://osu.ppy.sh")); - GlobalManager.getInstance().getMainActivity().startActivity(browserIntent); - dialog.dismiss(); - return null; - }) - .addButton("No", dialog -> { - dialog.dismiss(); - return null; - }) - .show(); - - return true; - } - return false; + setSize(versionText.getWidth() + 20f, versionText.getHeight() + 4f); + setPosition(10f, Config.getRES_HEIGHT() - getHeight() - 10f); + setColor(0f, 0f, 0f, 0.5f); // Black + setCornerRadius(12f); } - }; - author.setPosition(10, Config.getRES_HEIGHT() - author.getHeight() - 10); - - final Text yasonline = new Text(720, 530, ResourceManager.getInstance().getFont("font"), " Global Ranking\n Provided by iBancho") { - - @Override - public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { - if (pSceneTouchEvent.isActionDown()) { + public boolean onAreaTouched(TouchEvent event, float localX, float localY) { + if (event.isActionUp()) { new MessageDialog() - .setMessage(context.getString(com.osudroid.resources.R.string.dialog_visit_osudroid_website)) - .addButton("Yes", dialog -> { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + OnlineManager.hostname)); - GlobalManager.getInstance().getMainActivity().startActivity(browserIntent); - dialog.dismiss(); - return null; - }) - .addButton("No", dialog -> { + .setTitle("About") + .setMessage( + "

osu!droid

\n" + + "
Version " + versionString + "
\n" + + "

Made by osu!droid team
osu! is © peppy 2007-2024

\n" + + "
\n" + + "Visit official osu! website ↗\n" + + "
\n" + + "
\n" + + "Visit official osu!droid website ↗\n" + + "
\n" + + "
\n" + + "Join the official Discord server ↗\n", + true + ) + .addButton("Close", dialog -> { dialog.dismiss(); return null; }) .show(); - - return true; } - return false; + return true; } }; - yasonline.setPosition(Config.getRES_WIDTH() - yasonline.getWidth() - 40, Config.getRES_HEIGHT() - yasonline.getHeight() - 10); + scene.attachChild(box); final Sprite music_prev = new Sprite(Config.getRES_WIDTH() - 50 * 6 + 35, 47, 40, 40, ResourceManager.getInstance().getTexture( @@ -362,14 +343,6 @@ public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final TextureRegion nptex = ResourceManager.getInstance().getTexture("music_np"); music_nowplay = new Sprite(Utils.toRes(Config.getRES_WIDTH() - 500), 0, (float) (40 * nptex.getWidth()) / nptex.getHeight(), 40, nptex); - final Rectangle bgTopRect = new Rectangle(0, 0, Config.getRES_WIDTH(), Utils.toRes(120)); - bgTopRect.setColor(0, 0, 0, 0.3f); - - final Rectangle bgbottomRect = new Rectangle(0, 0, Config.getRES_WIDTH(), - Math.max(author.getHeight(), yasonline.getHeight()) + Utils.toRes(15)); - bgbottomRect.setPosition(0, Config.getRES_HEIGHT() - bgbottomRect.getHeight()); - bgbottomRect.setColor(0, 0, 0, 0.3f); - for (int i = 0; i < 120; i++) { final float pX = (float) Config.getRES_WIDTH() / 2; final float pY = (float) Config.getRES_HEIGHT() / 2; @@ -456,10 +429,6 @@ public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX menuBarX = menu.getFirst().getX(); scene.attachChild(lastBackground, 0); - scene.attachChild(bgTopRect); - scene.attachChild(bgbottomRect); - scene.attachChild(author); - scene.attachChild(yasonline); menu.attachButtons(); @@ -475,9 +444,8 @@ public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX scene.attachChild(beatmapDownloader); scene.registerTouchArea(logo); - scene.registerTouchArea(author); + scene.registerTouchArea(box); scene.registerTouchArea(beatmapDownloader); - scene.registerTouchArea(yasonline); scene.registerTouchArea(music_prev); scene.registerTouchArea(music_play); scene.registerTouchArea(music_pause);