|
|
@ -123,7 +123,11 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|
|
|
getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
|
|
|
|
getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onBackStackChanged() {
|
|
|
|
public void onBackStackChanged() {
|
|
|
|
appbar.setExpanded(true);
|
|
|
|
try {
|
|
|
|
|
|
|
|
appbar.setExpanded(true);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -137,23 +141,31 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|
|
|
appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
|
|
|
appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
|
|
|
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
|
|
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
|
|
|
try {
|
|
|
|
mlp.topMargin = abh + i;
|
|
|
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
|
|
|
view.setLayoutParams(mlp);
|
|
|
|
mlp.topMargin = abh + i;
|
|
|
|
|
|
|
|
view.setLayoutParams(mlp);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
FragmentDialogTheme.setBackground(this, holder, this instanceof ActivityCompose);
|
|
|
|
FragmentDialogTheme.setBackground(this, holder, this instanceof ActivityCompose);
|
|
|
|
|
|
|
|
|
|
|
|
ViewCompat.setOnApplyWindowInsetsListener(holder, (v, windowInsets) -> {
|
|
|
|
ViewCompat.setOnApplyWindowInsetsListener(holder, (v, windowInsets) -> {
|
|
|
|
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
|
|
try {
|
|
|
|
|
|
|
|
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
|
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
|
|
|
|
|
|
|
|
mlp.leftMargin = insets.left;
|
|
|
|
ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
|
|
|
|
mlp.topMargin = insets.top;
|
|
|
|
mlp.leftMargin = insets.left;
|
|
|
|
mlp.rightMargin = insets.right;
|
|
|
|
mlp.topMargin = insets.top;
|
|
|
|
mlp.bottomMargin = insets.bottom;
|
|
|
|
mlp.rightMargin = insets.right;
|
|
|
|
v.setLayoutParams(mlp);
|
|
|
|
mlp.bottomMargin = insets.bottom;
|
|
|
|
|
|
|
|
v.setLayoutParams(mlp);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return WindowInsetsCompat.CONSUMED;
|
|
|
|
return WindowInsetsCompat.CONSUMED;
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -167,15 +179,19 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
|
|
|
public WindowInsetsCompat onProgress(
|
|
|
|
public WindowInsetsCompat onProgress(
|
|
|
|
@NonNull WindowInsetsCompat windowInsets,
|
|
|
|
@NonNull WindowInsetsCompat windowInsets,
|
|
|
|
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
|
|
|
|
@NonNull List<WindowInsetsAnimationCompat> runningAnimations) {
|
|
|
|
// https://developer.android.com/develop/ui/views/layout/sw-keyboard
|
|
|
|
try {
|
|
|
|
for (WindowInsetsAnimationCompat animation : runningAnimations)
|
|
|
|
// https://developer.android.com/develop/ui/views/layout/sw-keyboard
|
|
|
|
if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) {
|
|
|
|
for (WindowInsetsAnimationCompat animation : runningAnimations)
|
|
|
|
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
|
|
if ((animation.getTypeMask() & WindowInsetsCompat.Type.ime()) != 0) {
|
|
|
|
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
|
|
|
|
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
|
|
int pad = bottom - insets.bottom;
|
|
|
|
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.ime()).bottom;
|
|
|
|
holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad);
|
|
|
|
int pad = bottom - insets.bottom;
|
|
|
|
break;
|
|
|
|
holder.setPaddingRelative(0, 0, 0, pad < 0 ? 0 : pad);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return windowInsets;
|
|
|
|
return windowInsets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|