fixed the main menu bars and theme

This commit is contained in:
SebasKoedam
2024-05-29 16:12:37 +02:00
parent 34dc294d06
commit 4b46738bf0
8 changed files with 109 additions and 50 deletions

View File

@@ -20,6 +20,7 @@
<entry key="..\:/Users/Niels/muupooviixee66-3/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.1234375" />
<entry key="..\:/Users/Niels/muupooviixee66-3/code/src/Fitbot/app/src/main/res/layout/toolbar.xml" value="0.1234375" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.25" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/box_background.xml" value="0.2555" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/darkred_button_gradient.xml" value="0.346" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/ic_baseline_home_48.xml" value="0.25" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/ic_baseline_settings_48.xml" value="0.25" />
@@ -27,13 +28,14 @@
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/ic_launcher_background.xml" value="0.25" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/drawable/red_button_gradient.xml" value="0.346" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_bicepvideo.xml" value="0.22826086956521738" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.176" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main.xml" value="0.4" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_main_screen.xml" value="0.1" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_power_screen.xml" value="0.1" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_sport_item.xml" value="0.1" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/activity_sport_menu.xml" value="0.1" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.125" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/header.xml" value="0.128" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/layout/toolbar.xml" value="0.125" />
<entry key="..\:/Users/sebas/Documents/HvA/Reposetories/muupooviixee66/code/src/Fitbot/app/src/main/res/menu/main_menu.xml" value="0.4" />
<entry key="app/src/main/res/layout/activity_end_screen.xml" value="0.1" />
<entry key="app/src/main/res/layout/activity_fitness.xml" value="0.23550724637681159" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />

View File

@@ -11,26 +11,34 @@ import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import com.example.fitbot.R;
public class MainActivity extends AppCompatActivity {
//Variables
// Variables
DrawerLayout drawerLayout;
NavigationView navigationView;
Toolbar toolbar;
Button startButton;
@SuppressLint("WrongViewCast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button startButton = findViewById(R.id.startButton);
// Set full screen mode
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Hide system UI
hideSystemUI();
startButton = findViewById(R.id.startButton);
startButton.setOnClickListener(v -> {
Uri videoUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bicepvideo);
Intent intent = new Intent(MainActivity.this, FitnessActivity.class);
@@ -48,32 +56,61 @@ public class MainActivity extends AppCompatActivity {
toolbar = findViewById(R.id.toolbar);
startButton = findViewById(R.id.startButton);
startButton.setOnClickListener(v -> { // Switch to fitness activity
Log.i("MainActivity", "Switching to FitnessActivity");
Intent intent = new Intent(MainActivity.this, FitnessActivity.class);
startActivity(intent);
});
// Hide the action bar
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
/*---Tool Bar---*/
setSupportActionBar(toolbar); // Make the toolbar act as the action bar
getSupportActionBar().setDisplayShowTitleEnabled(false); // Remove the title from the toolbar
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false); // Remove the title from the toolbar
}
/*---Navigation Drawer Menu---*/
navigationView.bringToFront(); // Make the navigation drawer menu clickable
ActionBarDrawerToggle toggle=new // Create a toggle for the navigation drawer
ActionBarDrawerToggle(this,drawerLayout,toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
ActionBarDrawerToggle toggle = new // Create a toggle for the navigation drawer
ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
hideSystemUI();
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
hideSystemUI();
}
};
drawerLayout.addDrawerListener(toggle);
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
public void onBackPressed(){ // Close the navigation drawer when the back button is pressed
if(drawerLayout.isDrawerOpen(GravityCompat.START)){
drawerLayout.closeDrawer(GravityCompat.START);
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
hideSystemUI();
}
else
{super.onBackPressed();
}
@Override
public void onBackPressed() { // Close the navigation drawer when the back button is pressed
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
drawerLayout.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
}

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/darkBlue" />
<stroke android:width="4dp" android:color="@color/white" />
<corners android:radius="8dp" />
</shape>

View File

@@ -5,7 +5,7 @@ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:background="@color/darkBlue"
android:fitsSystemWindows="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context=".ui.activities.FitnessActivity"

View File

@@ -4,9 +4,7 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#232323"
android:fitsSystemWindows="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context=".ui.activities.MainActivity"
tools:openDrawer="start">
@@ -26,36 +24,41 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="232dp"
android:layout_marginStart="208dp"
android:layout_marginTop="120dp"
android:text="@string/welkom_bij_fitbot"
android:textColor="@color/white"
android:textSize="64sp"
android:background="@drawable/box_background"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="240dp"
android:layout_marginTop="200dp"
android:text="@string/robot_helpt"
android:textColor="@color/white"
android:textSize="32sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/welkom_bij_fitbot"
android:textColor="@color/white"
android:textSize="64sp" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/robot_helpt"
android:textColor="@color/white"
android:textSize="32sp"
android:translationX="8dp" />
</LinearLayout>
<Button
android:id="@+id/startButton"
android:layout_width="200dp"
android:layout_height="100dp"
android:layout_marginStart="380dp"
android:layout_marginTop="280dp"
android:layout_marginStart="368dp"
android:layout_marginTop="312dp"
android:background="@drawable/red_button_gradient"
android:text="@string/start"
android:textAllCaps="false"
@@ -68,8 +71,8 @@
android:id="@+id/helpButton"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginStart="428dp"
android:layout_marginTop="400dp"
android:layout_marginStart="420dp"
android:layout_marginTop="424dp"
android:background="@drawable/darkred_button_gradient"
android:text="@string/help"
android:textAllCaps="false"
@@ -96,7 +99,11 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/darkBlue"
app:headerLayout="@layout/header"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:menu="@menu/main_menu" />
</android.support.v4.widget.DrawerLayout>

View File

@@ -24,7 +24,7 @@
android:layout_marginTop="60dp"
android:text="FitBot"
android:textSize="48sp"
android:textColor="@color/black"
android:textColor="@color/darkBlue"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -7,4 +7,10 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
<color name="darkBlue">#1C1C27</color>
<color name="lightBlue">#2C2C37</color>
<color name="invertedBackground">#FFFFFF</color>
<color name="invertedTextColor">#000000</color>
<color name="invertedIconTint">#000000</color>
</resources>

View File

@@ -2,10 +2,15 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:colorBackground">@color/darkBlue</item>
</style>
<!-- Custom text appearance for NavigationView items -->
<style name="CustomTextAppearance" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColor">@color/white</item>
</style>
<style name="ButtonStyle">
<item name="android:textSize">24sp</item>
<item name="android:textColor">#000000</item>