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,149 +251,143 @@
android:textStyle="bold" /> android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <LinearLayout
android:id="@+id/expandableLayout" 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:visibility="gone"> android:orientation="vertical"
android:visibility="gone"
android:alpha="0"
android:layout_marginHorizontal="10dp">
<LinearLayout <LinearLayout
android:id="@+id/layout_advanced" android:id="@+id/layout_type_algo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginTop="10dp"
android:layout_marginHorizontal="10dp"> android:orientation="horizontal">
<LinearLayout <ImageView
android:id="@+id/layout_type_algo" android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:src="@drawable/ic_outline_info_24"
app:tint="?attr/colorOnSurface"
android:layout_marginStart="5dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center_vertical"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_outline_info_24"
app:tint="?attr/colorOnSurface"
android:layout_marginStart="5dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center_vertical"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_weight="2"
android:hint="@string/type"
style="?attr/dropdownStyle">
<AutoCompleteTextView
android:id="@+id/dropdown_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/dropdown_algo_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="2"
android:hint="@string/algorithm_hint"
style="?attr/dropdownStyle">
<AutoCompleteTextView
android:id="@+id/dropdown_algo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="44.5dp">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_period_counter_layout"
android:hint="@string/period_hint"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_weight="1"> android:layout_weight="2"
<com.google.android.material.textfield.TextInputEditText android:hint="@string/type"
android:id="@+id/text_period_counter" style="?attr/dropdownStyle">
<AutoCompleteTextView
android:id="@+id/dropdown_type"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="text"/> android:inputType="none"/>
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_digits_layout" android:id="@+id/dropdown_algo_layout"
android:hint="@string/digits"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_weight="1"> android:layout_weight="2"
<com.google.android.material.textfield.TextInputEditText android:hint="@string/algorithm_hint"
android:id="@+id/text_digits" style="?attr/dropdownStyle">
<AutoCompleteTextView
android:id="@+id/dropdown_algo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="text"/> android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout> </LinearLayout>
<LinearLayout </LinearLayout>
android:id="@+id/layout_usage_count" <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginStart="44.5dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_period_counter_layout"
android:hint="@string/period_hint"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginEnd="5dp"
android:weightSum="2" android:layout_weight="1">
android:orientation="horizontal"> <com.google.android.material.textfield.TextInputEditText
<ImageView android:id="@+id/text_period_counter"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_counter_black_24" android:inputType="text"/>
app:tint="?attr/colorOnSurface" </com.google.android.material.textfield.TextInputLayout>
android:layout_marginStart="5dp" <com.google.android.material.textfield.TextInputLayout
android:layout_marginEnd="15dp" android:id="@+id/text_digits_layout"
android:layout_gravity="center_vertical"/> android:hint="@string/digits"
android:layout_width="0dp"
<LinearLayout android:layout_height="match_parent"
android:layout_width="0dp" android:layout_marginStart="5dp"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/text_digits"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:inputType="text"/>
android:orientation="horizontal"> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout <LinearLayout
android:hint="@string/usage_count" android:id="@+id/layout_usage_count"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp"> android:layout_marginTop="10dp"
<com.google.android.material.textfield.TextInputEditText android:weightSum="2"
android:id="@+id/text_usage_count" android:orientation="horizontal">
android:layout_width="match_parent" <ImageView
android:layout_height="wrap_content"
android:enabled="false"
android:inputType="number"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/text_last_used"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:src="@drawable/ic_counter_black_24"
android:paddingBottom="16dp" app:tint="?attr/colorOnSurface"
android:layout_centerInParent="true" android:layout_marginStart="5dp"
android:layout_gravity="bottom|center" android:layout_marginEnd="15dp"
android:textSize="14sp" /> android:layout_gravity="center_vertical"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:hint="@string/usage_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/text_usage_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:inputType="number"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/text_last_used"
</RelativeLayout> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:layout_centerInParent="true"
android:layout_gravity="bottom|center"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>