Added hideUI in nav Manager
This commit is contained in:
@@ -55,8 +55,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
|
||||||
|
@@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 {
|
||||||
|
|
||||||
@@ -37,4 +38,14 @@ public class NavigationManager {
|
|||||||
Intent intent = new Intent(currentContext, targetActivity);
|
Intent intent = new Intent(currentContext, targetActivity);
|
||||||
currentContext.startActivity(intent);
|
currentContext.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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -45,7 +45,7 @@ tools:openDrawer="start">
|
|||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="75dp"
|
android:layout_height="75dp"
|
||||||
android:layout_marginStart="404dp"
|
android:layout_marginStart="404dp"
|
||||||
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"
|
||||||
|
Reference in New Issue
Block a user