Rimossa tab bar dal main fragment

This commit is contained in:
Giuseppe Scorrano 2025-10-02 11:29:48 +02:00
parent 2774eaecbf
commit 01028f9888
4 changed files with 179 additions and 268 deletions

View File

@ -102,7 +102,7 @@ public class MainActivity extends BaseActivity
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, mBinding.drawerLayout, mBinding.appBarMain.toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mBinding.drawerLayout.setDrawerListener(toggle);
mBinding.drawerLayout.addDrawerListener(toggle);
toggle.syncState();
@ -122,6 +122,16 @@ public class MainActivity extends BaseActivity
startActivity(myIntent);
}
public void toggleDrawer() {
if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
mBinding.drawerLayout.closeDrawer(GravityCompat.START);
} else {
mBinding.drawerLayout.openDrawer(GravityCompat.START);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
@ -294,9 +304,13 @@ public class MainActivity extends BaseActivity
for (int i = 0; i < count; i++) {
getSupportFragmentManager().popBackStack();
}
mBinding.appBarMain.elevatedToolbar.setVisibility(getSupportFragmentManager().getBackStackEntryCount() > 1 ? View.VISIBLE : View.GONE);
}
private void adaptViewToFragment(Fragment fragment) {
mBinding.appBarMain.elevatedToolbar.setVisibility(fragment instanceof MainFragment ? View.GONE : View.VISIBLE);
if (fragment instanceof ISearchableFragment) {
mBinding.appBarMain.mainSearch.setOnQueryTextListener((SearchView.OnQueryTextListener) fragment);
mBinding.appBarMain.mainSearch.setVisibility(View.VISIBLE);

View File

@ -1,10 +1,7 @@
package it.integry.integrywmsnative.gest.main;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
@ -122,7 +119,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
mBindings.setView(this);
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(false, false);
return mBindings.getRoot();
}
@ -246,6 +242,13 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
}
public void toggleDrawer() {
if (getActivity() != null && getActivity() instanceof MainActivity) {
((MainActivity) getActivity()).toggleDrawer();
}
}
private void collapseNoConnectionLayout() {
if (getActivity() != null)
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
@ -335,89 +338,6 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
this.mOnPreDestroyList.add(onPreDestroy);
}
public void toggleEasterEggMode() {
easterEggToggle = !easterEggToggle;
int rootBgStart, rootBgEnd;
int profileBgStart, profileBgEnd;
float titleFlipStart, titleFlipEnd;
int animationTimeMillis = 0;
if (easterEggToggle) {
rootBgStart = Color.argb(255, 255, 255, 255);
rootBgEnd = Color.argb(255, 0, 0, 0);
profileBgStart = Color.argb(255, 26, 115, 232);
profileBgEnd = Color.argb(255, 211, 47, 47);
animationTimeMillis = 2500;
titleFlipStart = 1f;
titleFlipEnd = -1f;
} else {
rootBgStart = Color.argb(255, 0, 0, 0);
rootBgEnd = Color.argb(255, 255, 255, 255);
profileBgStart = Color.argb(255, 211, 47, 47);
profileBgEnd = Color.argb(255, 26, 115, 232);
animationTimeMillis = 750;
titleFlipStart = -1f;
titleFlipEnd = 1f;
}
mBindings.easterEggHorrorBloodExpandableLayout.setDuration(animationTimeMillis);
mBindings.easterEggHorrorBloodExpandableLayout.setExpanded(easterEggToggle, true);
View rootActivityView = requireActivity().findViewById(R.id.drawer_layout);
ObjectAnimator colorFadeRootBg = ObjectAnimator.ofObject(rootActivityView, "backgroundColor",
new ArgbEvaluator(),
rootBgStart,
rootBgEnd);
colorFadeRootBg.setDuration(animationTimeMillis);
colorFadeRootBg.start();
View toolbarActivityView = requireActivity().findViewById(R.id.toolbar);
ObjectAnimator colorFadeToolbarBg = ObjectAnimator.ofObject(toolbarActivityView, "backgroundColor",
new ArgbEvaluator(),
rootBgStart,
rootBgEnd);
colorFadeToolbarBg.setDuration(animationTimeMillis);
colorFadeToolbarBg.start();
ObjectAnimator colorFadeProfileBg = ObjectAnimator.ofObject(mBindings.profileRootContainer, "backgroundColor",
new ArgbEvaluator(),
profileBgStart,
profileBgEnd);
colorFadeProfileBg.setDuration(animationTimeMillis);
colorFadeProfileBg.start();
View toolbarTitleActivityView = requireActivity().findViewById(R.id.toolbar_title);
ObjectAnimator flipToolbarTitleX = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleX",
titleFlipStart,
titleFlipEnd);
flipToolbarTitleX.setDuration(animationTimeMillis);
flipToolbarTitleX.start();
ObjectAnimator flipToolbarTitleY = ObjectAnimator.ofFloat(toolbarTitleActivityView, "scaleY",
titleFlipStart,
titleFlipEnd);
flipToolbarTitleY.setDuration(animationTimeMillis);
flipToolbarTitleY.start();
ObjectAnimator colorFadeTitleTextColor = ObjectAnimator.ofObject(toolbarTitleActivityView, "textColor",
new ArgbEvaluator(),
rootBgEnd,
rootBgStart);
colorFadeTitleTextColor.setDuration(animationTimeMillis);
colorFadeTitleTextColor.start();
}
public void changeUserDepo() {
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
.show(getParentFragmentManager(), "switch-user-depo");

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="488.3dp"
android:height="168.7dp"
android:viewportWidth="488.3"
android:viewportHeight="168.7">
<path
android:pathData="M484.96,0c0.1,1.5 0.2,3.6 -0.3,6c-0.7,3.4 -2.1,5.8 -3.6,8.5c-0.9,1.7 -2,3.3 -3.5,5.2c-3.5,4.7 -7.2,17.7 -9.9,39.7s-1.3,59.4 1.5,72s-0.1,22.1 -4.6,26.3s0.9,2.1 -6.7,5.1c-7.6,3 -18.9,-5.4 -21.2,-17.7l0,0c-2.3,-12.3 -3.1,-9.1 -0.1,-21.5c3,-12.4 7.6,-24.9 7.7,-36.7c0.1,-11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-1.8C171.66,0 328.26,0 484.96,0z"
android:fillColor="#D32F2F"/>
</vector>

View File

@ -8,6 +8,7 @@
type="it.integry.integrywmsnative.gest.main.MainFragment" />
<import type="android.view.View" />
<import type="it.integry.integrywmsnative.core.settings.SettingsManager" />
</data>
@ -25,6 +26,162 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="16dp"
app:cardElevation="4dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/profile_root_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/user_icon"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_menu_24dp"
android:tint="@android:color/white"
android:background="?attr/selectableItemBackgroundBorderless"
app:singleClick="@{() -> view.toggleDrawer() }"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/user_detail_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/switch_depo_button"
android:layout_toEndOf="@id/user_icon"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_user_name"
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
tools:text="MARIO ROSSI" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_deposito"
style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
tools:text="Deposito: 01 - Centrale" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/switch_depo_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:clickable="true"
android:focusable="true"
android:onClick="@{() -> view.changeUserDepo()}"
android:src="@drawable/ic_rounded_change_circle_24"
android:tint="@android:color/white"
android:visibility="@{SettingsManager.iDB().isFlagForceAllToColli() ? View.VISIBLE : View.GONE}" />
</RelativeLayout>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/recover_data_expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:el_duration="400"
app:el_expanded="false">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:src="@drawable/ic_black_recover"
android:tint="@android:color/white" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/recovering_data"
android:textColor="@android:color/white" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar"
style="?attr/linearProgressIndicatorStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:indeterminate="true"
app:indicatorColor="@android:color/white"
app:trackColor="@color/colorPrimaryDark"
app:trackCornerRadius="4dp"
app:trackThickness="8dp" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/wait_a_moment" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</net.cachapa.expandablelayout.ExpandableLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
</RelativeLayout>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/no_connection_top_layout"
android:layout_width="match_parent"
@ -61,177 +218,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
app:cardCornerRadius="16dp"
app:cardElevation="4dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/profile_root_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:orientation="vertical"
android:padding="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/user_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:clickable="true"
android:focusable="true"
app:multipleClick="@{() -> view.toggleEasterEggMode()}"
android:src="@drawable/ic_outline_account_circle_48px"
android:tint="@android:color/white" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/user_detail_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="16dp"
android:layout_toEndOf="@id/user_icon"
android:layout_toStartOf="@id/switch_depo_button">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_user_name"
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
tools:text="MARIO ROSSI" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_deposito"
style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
tools:text="Deposito: 01 - Centrale" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/switch_depo_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true"
android:layout_alignParentEnd="true"
android:visibility="@{SettingsManager.iDB().isFlagForceAllToColli() ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> view.changeUserDepo()}"
android:src="@drawable/ic_rounded_change_circle_24"
android:tint="@android:color/white" />
</RelativeLayout>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/recover_data_expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:el_duration="400"
app:el_expanded="false">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
android:adjustViewBounds="true"
android:src="@drawable/ic_black_recover"
android:tint="@android:color/white" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/recovering_data"
android:textColor="@android:color/white" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar"
style="?attr/linearProgressIndicatorStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:indeterminate="true"
app:trackThickness="8dp"
app:trackCornerRadius="4dp"
app:indicatorColor="@android:color/white"
app:trackColor="@color/colorPrimaryDark"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/wait_a_moment" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</net.cachapa.expandablelayout.ExpandableLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/easter_egg__horror_blood_expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="50dp"
app:el_expanded="false">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/easter_egg__horror_blood"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/easter_egg__horror_blood" />
</net.cachapa.expandablelayout.ExpandableLayout>
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/menu_container"