Merge pull request #1432 from alexbakker/fix-1417

Simplify approach for animating advanced entry settings
This commit is contained in:
Michael Schättgen 2024-07-19 22:59:26 +02:00 committed by GitHub
commit 52f8c709b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 116 additions and 126 deletions

View file

@ -127,7 +127,7 @@ public class EditEntryActivity extends AegisActivity {
private KropView _kropView; private KropView _kropView;
private RelativeLayout _advancedSettingsHeader; private RelativeLayout _advancedSettingsHeader;
private RelativeLayout _advancedSettings; private LinearLayout _advancedSettingsLayout;
private BackPressHandler _backPressHandler; private BackPressHandler _backPressHandler;
private IconBackPressHandler _iconBackPressHandler; private IconBackPressHandler _iconBackPressHandler;
@ -241,7 +241,7 @@ public class EditEntryActivity extends AegisActivity {
_advancedSettingsHeader = findViewById(R.id.accordian_header); _advancedSettingsHeader = findViewById(R.id.accordian_header);
_advancedSettingsHeader.setOnClickListener(v -> openAdvancedSettings()); _advancedSettingsHeader.setOnClickListener(v -> openAdvancedSettings());
_advancedSettings = findViewById(R.id.expandableLayout); _advancedSettingsLayout = findViewById(R.id.layout_advanced);
// fill the fields with values if possible // fill the fields with values if possible
GlideHelper.loadEntryIcon(Glide.with(this), _origEntry, _iconView); GlideHelper.loadEntryIcon(Glide.with(this), _origEntry, _iconView);
@ -411,17 +411,13 @@ public class EditEntryActivity extends AegisActivity {
fadeOut.setDuration((long) (220 * AnimationsHelper.Scale.ANIMATOR.getValue(this))); fadeOut.setDuration((long) (220 * AnimationsHelper.Scale.ANIMATOR.getValue(this)));
_advancedSettingsHeader.startAnimation(fadeOut); _advancedSettingsHeader.startAnimation(fadeOut);
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new AccelerateInterpolator());
fadeIn.setDuration((long) (250 * AnimationsHelper.Scale.ANIMATOR.getValue(this)));
fadeOut.setAnimationListener(new SimpleAnimationEndListener((a) -> { fadeOut.setAnimationListener(new SimpleAnimationEndListener((a) -> {
_advancedSettingsHeader.setVisibility(View.GONE); _advancedSettingsHeader.setVisibility(View.GONE);
_advancedSettings.startAnimation(fadeIn); _advancedSettingsLayout.setVisibility(View.VISIBLE);
})); _advancedSettingsLayout.animate()
.setInterpolator(new AccelerateInterpolator())
fadeIn.setAnimationListener(new SimpleAnimationEndListener((a) -> { .setDuration((long) (250 * AnimationsHelper.Scale.ANIMATOR.getValue(this)))
_advancedSettings.setVisibility(View.VISIBLE); .alpha(1);
})); }));
} }

View file

@ -251,16 +251,13 @@
android:textStyle="bold" /> android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/expandableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<LinearLayout <LinearLayout
android:id="@+id/layout_advanced" android:id="@+id/layout_advanced"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"
android:alpha="0"
android:layout_marginHorizontal="10dp"> android:layout_marginHorizontal="10dp">
<LinearLayout <LinearLayout
android:id="@+id/layout_type_algo" android:id="@+id/layout_type_algo"
@ -392,9 +389,6 @@
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
</RelativeLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</FrameLayout> </FrameLayout>