material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.34k stars 3.06k forks source link

What is Material 3? #2402

Closed hansemannn closed 3 years ago

hansemannn commented 3 years ago

Please excuse me for taking up space in the Issues here, but I am very interested to know more about the Material 3 epic that's currently being developed. Are there any examples or designs that should the difference to the current Material design? Or is Material 3 = Material You (the Android 12+ UI concept)? Thanks in advance!

OxygenCobalt commented 3 years ago

From what I've been able to gather, Material 3 is kind of like "Material 2 + Material You" with some extra tweaks here and there.

Material 2 was the minor refresh that occurred around Android Oreo, it:

Material 3 is a major refresh that seems to do the following:

This is mostly observations/speculation from the alpha builds. The actual devs will probably have a better explanation than I do.

dsn5ft commented 3 years ago

@OxygenCobalt that is a solid summary. The term "Material You" is more focused on the personalization features coming in Android 12 (e.g., dynamic wallpaper color), while "Material 3" is more for the update to the design system as a whole. E.g., the FAB's shape has been changed from a circle to a rounded rectangle - changes like this to the library's components and themes are not tied to Android 12 and are supported on older API levels.

Some more detail can be found in the 1.5.0-alpha03 and 1.5.0-alpha04 release notes, and in the updated developer documentation.

Additionally, there will be a higher level summary and more detail from the design side coming soon, so stay tuned.

lozn00 commented 2 years ago

dynamic color not work

OxygenCobalt commented 2 years ago

@qssq Noticed this was well. You need to add this to your values-v31:

<item name="android:theme">@style/ThemeOverlay.Material3.DynamicColors.DayNight</item>

But this causes strange coloring in places for whatever reason, so I would recommend just copying and pasting the values from this theme overlay into your theme.

lozn00 commented 2 years ago

my phone api version only api 30 thank you @OxygenCobalt

lozn00 commented 2 years ago

I like the transition animation of switching pages in the demo, but I don't know how to use it in the activity. After I use it, I don't think it has achieved the actual effect, and there is a flashing black screen. onCLick item will launcher activty onClick

      activity.setExitSharedElementCallback(new MaterialContainerTransformSharedElementCallback());
            activity.getWindow().setSharedElementsUseOverlay(false);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, v, activityTarget.getSimpleName());
            Intent intent = new Intent(activity, activityTarget);
            ViewCompat.setTransitionName(v,activityTarget.getClass().getSimpleName());
            intent.putExtra("share_element",activityTarget.getClass().getSimpleName());
            activity.startActivity(intent, options.toBundle());

launch after taregt activity

            Method inflate = getActivityBindingClass().getDeclaredMethod("inflate", LayoutInflater.class);
            activityBinding = (T) inflate.invoke(null, getLayoutInflater());
            setContentView(activityBinding.getRoot());
            init(savedInstanceState);
            /**
             * @see com.sotrun.app.utils.AppUtils#startNewActivityAnim(FragmentActivity, Class, View) 
             */
            if(getIntent()!=null){
                String share_element = getIntent().getStringExtra("share_element");
                if(!TextUtils.isEmpty(share_element)){
                    ViewCompat.setTransitionName(getBinding().getRoot(),share_element);
                }
            }
lozn00 commented 2 years ago

demo anim is from center to top and bottom ..

lozn00 commented 2 years ago

demo test

  Intent intent = new Intent(TestActivity.this, MusicPlayerDemoActivity.class);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
          // Set up shared element transition and disable overlay so views don't show above system bars
          FragmentActivity activity = TestActivity.this;
          activity.setExitSharedElementCallback(new MaterialContainerTransformSharedElementCallback());
          activity.getWindow().setSharedElementsUseOverlay(false);

          ActivityOptions options =
              ActivityOptions.makeSceneTransitionAnimation(activity, view, "test");
          intent.putExtra(DemoActivity.EXTRA_TRANSITION_NAME, "test");
          startActivity(intent, options.toBundle());

        } else {
          startActivity(intent);
        }

is work ,but my project flash black screen?how to solve?

OxygenCobalt commented 2 years ago

Could you make your problem a separate issue? What you're asking about is completely off-topic.

lozn00 commented 2 years ago

@OxygenCobalt sorry ,thank you