Skip to content

Commit

Permalink
IDE-154 Add a play button to the landing page (#4915)
Browse files Browse the repository at this point in the history
* IDE-154 Add Playbutton to main menu

* IDE-154 Add Playbutton Test

* IDE-154 Fix Warnings

* IDE-154 Move Playbutton below Uploadbutton

* IDE-154 Redo playbutton placment

* IDE-154 update copyright dates

---------

Co-authored-by: Jakob <[email protected]>
  • Loading branch information
Jr9992 and Jakob authored Jul 9, 2024
1 parent 8574863 commit 1a4dde7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2023 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -196,6 +196,17 @@ class MainMenuFragmentTest : KoinTest {
.check(matches(isDisplayed()))
}

@Test
fun testBackButtonAfterTappingOnPlayButton() {
syncBeforeLaunch(false)
onView(withId(R.id.playProject))
.perform(ViewActions.click())
pressBack()
pressBack()
onView(withId(R.id.projectImageView))
.check(matches(isDisplayed()))
}

private fun createProject() {
projectManager.createNewEmptyProject(
javaClass.simpleName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2023 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -47,6 +47,7 @@ import org.catrobat.catroid.io.ProjectAndSceneScreenshotLoader
import org.catrobat.catroid.io.asynctask.ProjectLoader
import org.catrobat.catroid.io.asynctask.ProjectLoader.ProjectLoadListener
import org.catrobat.catroid.io.asynctask.loadProject
import org.catrobat.catroid.stage.StageActivity
import org.catrobat.catroid.ui.PROJECT_DIR
import org.catrobat.catroid.ui.ProjectActivity
import org.catrobat.catroid.ui.ProjectListActivity
Expand Down Expand Up @@ -119,6 +120,7 @@ class MainMenuFragment : Fragment(),
binding.newProjectFloatingActionButton.setOnClickListener(this)
binding.myProjectsTextView.setOnClickListener(this)
binding.projectImageView.setOnClickListener(this)
binding.playProject.setOnClickListener(this)
binding.featuredProjectsTextView.setOnClickListener(this)

setFragment(this)
Expand Down Expand Up @@ -329,6 +331,11 @@ class MainMenuFragment : Fragment(),
startActivity(intent)
}

R.id.playProject -> {
viewModel.setIsLoading(true)
StageActivity.handlePlayButton(projectManager, activity)
}

R.id.myProjectsTextView -> {
viewModel.setIsLoading(true)
startActivity(Intent(activity, ProjectListActivity::class.java))
Expand Down
45 changes: 45 additions & 0 deletions catroid/src/main/res/drawable/ic_play_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2023 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ An additional term exception under section 7 of the GNU Affero
~ General Public License, version 3, is available at
~ http://developer.catrobat.org/license_additional_term
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:alpha="0.9"
android:autoMirrored="true"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillAlpha="0.3"
android:fillColor="@color/solid_black"
android:pathData="M11.995,19.997c4.412,0,7.988-3.6,7.988-8.04c0-0.817-0.123-1.604-0.348-2.347C18.615,6.363,15.578,4,12,4
c-4.118,0-7.52,3.131-7.952,7.137c-0.027,0.27-0.041,0.543-0.041,0.82C4.007,16.397,7.583,19.997,11.995,19.997z M10,7.5l6,4.5
l-6,4.5V7.5z" />
<path
android:fillColor="@color/solid_white"
android:pathData="M12,2C6.48,2,2,6.48,2,12c0,5.52,4.48,10,10,10c5.52,0,10-4.48,10-10C22,6.48,17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8
c0-0.292,0.018-0.579,0.048-0.863C4.48,7.131,7.882,4,12,4c3.578,0,6.615,2.363,7.635,5.61C19.871,10.365,20,11.168,20,12
C20,16.41,16.41,20,12,20z" />
<path
android:fillColor="@color/solid_white"
android:pathData="M 10 7.5 L 10 16.5 L 16 12 Z" />
</vector>
15 changes: 13 additions & 2 deletions catroid/src/main/res/layout/fragment_main_menu.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Catroid: An on-device visual programming system for Android devices
~ Copyright (C) 2010-2022 The Catrobat Team
~ Copyright (C) 2010-2023 The Catrobat Team
~ (<http://developer.catrobat.org/credits>)
~
~ This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -75,14 +75,25 @@
android:layout_centerInParent="true"
android:src="@drawable/ic_edit_circle" />

<ImageView
android:id="@+id/playProject"
android:contentDescription="@string/main_menu_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="12dp"
android:layout_marginEnd="12dp"
android:src="@drawable/ic_play_circle" />

<ImageView
android:id="@+id/uploadProject"
android:contentDescription="@string/main_menu_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="12dp"
android:layout_marginBottom="75dp"
android:layout_marginEnd="12dp"
android:src="@drawable/ic_publish_circle" />

Expand Down
1 change: 1 addition & 0 deletions catroid/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<string formatted="false" name="main_menu_help">Help</string>
<string formatted="false" name="main_menu_web">Catrobat community</string>
<string formatted="false" name="main_menu_upload">Upload project</string>
<string formatted="false" name="main_menu_play">Play project</string>

<string formatted="false" name="main_menu_rate_app">Rate us!</string>
<string formatted="false" name="main_menu_terms_of_use">Terms of Use and Service</string>
Expand Down

0 comments on commit 1a4dde7

Please sign in to comment.