Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit ca479cf8 authored by Andy Scherzinger's avatar Andy Scherzinger
Browse files

fix(m3): Update to M3 design tokens

parent 32101fc9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public abstract class BrandedActivity extends AppCompatActivity implements Brand
        super.onStart();

        final var typedValue = new TypedValue();
        getTheme().resolveAttribute(R.attr.colorAccent, typedValue, true);
        getTheme().resolveAttribute(R.attr.colorSecondary, typedValue, true);
        colorAccent = typedValue.data;

        readBrandMainColorLiveData(this).observe(this, this::applyBrand);
+11 −6
Original line number Diff line number Diff line
@@ -31,7 +31,9 @@ import kotlinx.coroutines.launch
 * @see BrandingUtil for brand color resolution and application.
 * @see Branded for the interface definition related to branding behavior.
 */
abstract class BrandedFragment : Fragment(), Branded {
abstract class BrandedFragment :
    Fragment(),
    Branded {
    @JvmField
    @ColorInt
    protected var colorAccent: Int = 0
@@ -55,16 +57,16 @@ abstract class BrandedFragment : Fragment(), Branded {
        val typedValue = TypedValue()

        context.theme.resolveAttribute(
            com.google.android.material.R.attr.colorAccent,
            com.google.android.material.R.attr.colorSecondary,
            typedValue,
            true
            true,
        )
        colorAccent = typedValue.data

        context.theme.resolveAttribute(
            com.google.android.material.R.attr.colorPrimary,
            com.google.android.material.R.attr.colorPrimaryContainer,
            typedValue,
            true
            true,
        )
        colorPrimary = typedValue.data

@@ -75,7 +77,10 @@ abstract class BrandedFragment : Fragment(), Branded {

    @Suppress("DEPRECATION")
    @Deprecated("Deprecated in Java")
    override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
    override fun onCreateOptionsMenu(
        menu: Menu,
        inflater: MenuInflater,
    ) {
        super.onCreateOptionsMenu(menu, inflater)
        val utils = BrandingUtil.of(colorAccent, requireContext())

+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public class MultiSelectedActionModeCallback implements Callback {
        this.fragmentManager = fragmentManager;

        final TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(com.google.android.material.R.attr.colorAccent, typedValue, true);
        context.getTheme().resolveAttribute(com.google.android.material.R.attr.colorSecondary, typedValue, true);
        colorAccent = typedValue.data;
    }

+15 −11
Original line number Diff line number Diff line
@@ -25,18 +25,22 @@ object ExtendedFabUtil {
                extendedFab.hide()
            } else {
                if (extendedFab.animation == null) {
                    val animation = AnimationUtils.loadAnimation(
                    val animation =
                        AnimationUtils.loadAnimation(
                            extendedFab.context,
                        R.anim.abc_shrink_fade_out_from_bottom,
                            R.anim.design_bottom_sheet_slide_out,
                        )
                    animation.setAnimationListener(object : Animation.AnimationListener {
                    animation.setAnimationListener(
                        object : Animation.AnimationListener {
                            override fun onAnimationStart(animation: Animation) {}

                            override fun onAnimationEnd(animation: Animation) {
                                extendedFab.visibility = View.GONE
                            }

                            override fun onAnimationRepeat(animation: Animation) {}
                    })
                        },
                    )
                    extendedFab.startAnimation(animation)
                }
            }