Merge remote-tracking branch 'origin/main'

This commit is contained in:
Luca Warmenhoven
2024-05-30 16:38:56 +02:00
6 changed files with 83 additions and 52 deletions

View File

@@ -56,8 +56,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
VideoView videoView = findViewById(R.id.videoView); VideoView videoView = findViewById(R.id.videoView);
FitnessCycle.playVideo(videoView, this); FitnessCycle.playVideo(videoView, this);
NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class); NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class);
// Implement your logic when the robot focus is gained
NavigationManager.hideSystemUI(this);
} }
@Override @Override

View File

@@ -1,5 +1,6 @@
package com.example.fitbot.ui.activities; package com.example.fitbot.ui.activities;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
@@ -16,16 +17,6 @@ public class HelpActivity extends AppCompatActivity {
NavigationManager.setupButtonNavigation(this, R.id.homeButtonHelp, MainActivity.class); NavigationManager.setupButtonNavigation(this, R.id.homeButtonHelp, MainActivity.class);
// Hide system UI NavigationManager.hideSystemUI(this);
hideSystemUI();
}
private void hideSystemUI() {
View decorView = getWindow().getDecorView();
// Hide the status bar and navigation bar
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
} }
} }

View File

@@ -48,7 +48,7 @@ public class MainActivity extends AppCompatActivity {
setUpUi(); setUpUi();
// Hide system UI // Hide system UI
hideSystemUI(); NavigationManager.hideSystemUI(this);
} }
private void setUpUi() { private void setUpUi() {
@@ -79,33 +79,22 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
hideSystemUI();
} }
@Override @Override
public void onDrawerClosed(View drawerView) { public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView); super.onDrawerClosed(drawerView);
hideSystemUI();
} }
}; };
drawerLayout.addDrawerListener(toggle); drawerLayout.addDrawerListener(toggle);
toggle.syncState(); // Synchronize the state of the navigation drawer toggle.syncState(); // Synchronize the state of the navigation drawer
} }
private void hideSystemUI() {
View decorView = getWindow().getDecorView();
// Hide the status bar and navigation bar
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
@Override @Override
public void onWindowFocusChanged(boolean hasFocus) { public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus); super.onWindowFocusChanged(hasFocus);
if (hasFocus) { if (hasFocus) {
hideSystemUI(); NavigationManager.hideSystemUI(this);
} }
} }

View File

@@ -8,6 +8,7 @@ import android.widget.Button;
import com.example.fitbot.ui.activities.FitnessActivity; import com.example.fitbot.ui.activities.FitnessActivity;
import com.example.fitbot.ui.activities.MainActivity; import com.example.fitbot.ui.activities.MainActivity;
import com.example.fitbot.ui.activities.HelpActivity;
public class NavigationManager { public class NavigationManager {
@@ -51,4 +52,14 @@ public class NavigationManager {
Intent intent = new Intent(context, targetActivity); Intent intent = new Intent(context, targetActivity);
context.startActivity(intent); context.startActivity(intent);
} }
public static void hideSystemUI(Activity currentActivity) {
View decorView = currentActivity.getWindow().getDecorView();
// Hide the status bar and navigation bar
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
} }

View File

@@ -1,42 +1,67 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/darkBlue" android:background="@color/darkBlue"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".ui.activities.FitnessActivity" tools:context=".ui.activities.FitnessActivity"
tools:openDrawer="start"> tools:openDrawer="start">
<LinearLayout <LinearLayout
android:layout_width="900dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="30dp"
android:layout_marginTop="30dp" android:layout_marginTop="30dp"
android:layout_marginEnd="30dp"
android:padding="15dp"
android:background="@drawable/help2_background" android:background="@drawable/help2_background"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="20dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.505"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<VideoView <LinearLayout
android:id="@+id/videoView" android:layout_width="wrap_content"
android:layout_width="400dp" android:layout_height="wrap_content"
android:layout_height="400dp" android:layout_gravity="center"
android:layout_marginStart="20dp" android:layout_marginRight="20dp"
/> android:background="@drawable/help2_background"
android:orientation="horizontal"
android:padding="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.example.fitbot.ui.components.PersonalMotionPreviewElement <VideoView
android:id="@+id/personalMotionPreviewElement" android:id="@+id/videoView"
android:layout_width="400dp" android:layout_width="350dp"
android:layout_height="400dp" android:layout_height="350dp"
android:layout_marginStart="20dp" android:layout_gravity="center"
/> android:layout_margin="2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:background="@drawable/help2_background"
android:orientation="horizontal"
android:padding="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.example.fitbot.ui.components.PersonalMotionPreviewElement
android:id="@+id/personalMotionPreviewElement"
android:layout_width="350dp"
android:layout_height="350dp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
@@ -44,8 +69,8 @@ tools:openDrawer="start">
android:id="@+id/homeButtonFitness" android:id="@+id/homeButtonFitness"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="75dp" android:layout_height="75dp"
android:layout_marginStart="404dp" android:layout_marginStart="200dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="30dp"
android:background="@drawable/red_button_gradient" android:background="@drawable/red_button_gradient"
android:drawableTop="@drawable/ic_baseline_home_48" android:drawableTop="@drawable/ic_baseline_home_48"
android:drawableTint="@color/white" android:drawableTint="@color/white"
@@ -54,4 +79,18 @@ tools:openDrawer="start">
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="SpeakableTextPresentCheck" /> tools:ignore="SpeakableTextPresentCheck" />
<Button
android:id="@+id/homeButtonFitness3"
android:layout_width="150dp"
android:layout_height="75dp"
android:layout_marginEnd="200dp"
android:layout_marginBottom="30dp"
android:background="@drawable/red_button_gradient"
android:drawableTop="@drawable/ic_baseline_home_48"
android:drawableTint="@color/white"
android:padding="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="SpeakableTextPresentCheck" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@@ -31,4 +31,5 @@
<item name= "android:textStyle">bold</item> <item name= "android:textStyle">bold</item>
<item name="android:padding">6dp</item> <item name="android:padding">6dp</item>
</style> </style>
</resources> </resources>