1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-22 07:42:52 +00:00

Inset undo snackbar

This commit is contained in:
M66B 2024-10-27 18:04:48 +01:00
parent b202847ab7
commit c06b9e09e0
2 changed files with 12 additions and 1 deletions

View file

@ -71,6 +71,7 @@ import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceManager;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.snackbar.Snackbar;
import java.io.File;
import java.io.FileNotFoundException;
@ -214,10 +215,18 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
if (cf != null) {
Insets nav = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars());
int pad = Math.max(0, cfpb + (nav.bottom - nav.top));
Snackbar.SnackbarLayout sl = Helper.findSnackbarLayout(cf.getRootView());
if (sl != null) {
pad = cfpb;
if (sl.getPaddingBottom() != nav.bottom - nav.top)
sl.setPaddingRelative(
sl.getPaddingStart(), sl.getPaddingTop(),
sl.getPaddingEnd(), nav.bottom - nav.top);
}
if (pad != cf.getPaddingBottom())
cf.setPaddingRelative(
cf.getPaddingStart(), cf.getPaddingTop(),
cf.getPaddingEnd(), cfpb + (nav.bottom - nav.top));
cf.getPaddingEnd(), pad);
}
//for (View child : Helper.getViewsWithTag(v, "inset")) {
// mlp = (ViewGroup.MarginLayoutParams) child.getLayoutParams();

View file

@ -1577,6 +1577,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
lparam.bottomMargin = snackbar.getView().getHeight();
content.setLayoutParams(lparam);
content.requestApplyInsets();
}
@Override
@ -1584,6 +1585,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
lparam.bottomMargin = 0;
content.setLayoutParams(lparam);
content.requestApplyInsets();
}
});