Coder Social home page Coder Social logo

material-components-android-examples's Introduction

Material Components: Shared Documentation and Policies

Material Components for Android, iOS, web and Flutter help developers execute Material Design with modular and customizable UI components. Developed by a core team of engineers and UX designers at Google, these components enable a reliable development workflow to build beautiful and functional user experiences.

This repo contains all common documentation for Material Components projects across the different platforms.

Repos

Useful Links

material-components-android-examples's People

Contributors

afohrman avatar codingjeremy avatar dsn5ft avatar eightmoons avatar etonotieno avatar guilhe avatar heyalex avatar hunterstich avatar leticiarossi avatar material-admin avatar melaniegoetz avatar n-apps avatar nickbutcher avatar ricknout avatar yasmineevjen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

material-components-android-examples's Issues

Reply: Email card snatches touch events from scrolling view

The email card with the title "Bonjour from" has a scrolling view of pictures. When you first open the app and scroll the pictures all the way to the right, and then try and rescroll to the left, the card steals the touch events and starts performing the slide-to-favorite action. The only way to slide the pictures back is to first slide right again (as if you were scrolling to the end again, even though it is already all the way at the end), and then scroll left, and this time the card won't steal the touch events and it will scroll.

MaterialThemeBuilder crash

material-components: 1.3.0

Reproduce:

  1. Checkout repo
  2. Put this line <item name="android:textColorSecondary">#FA0632</item> in app theme
  3. Launch app, go to components, scroll to bottom
    android.view.InflateException: Binary XML file line #37 in io.material.materialthemebuilder:layout/component_bottom_navigation: Binary XML file line #37 in io.material.materialthemebuilder:layout/component_bottom_navigation: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
    Caused by: android.view.InflateException: Binary XML file line #37 in io.material.materialthemebuilder:layout/component_bottom_navigation: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:854)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
        at io.material.materialthemebuilder.ui.component.ComponentViewHolder$Companion.inflate(ComponentViewHolder.kt:215)
        at io.material.materialthemebuilder.ui.component.ComponentViewHolder$Companion.access$inflate(ComponentViewHolder.kt:187)

O

K

LessonsBottomSheetBehavior not working while dragging down

One of our tester today found a small bug with the newly fixed LessonsBottomSheetBehavior.
We had the same fix just merged here: #20

But if the sheet is dragged down then the sheet stops in the middle until touched inside again like in the GIF below

device-2020-01-09-114305

[Owl] Screen rotation crash

Hi,
When the smartphone is rotated, the app crash came with backtrace:

2020-12-19 20:59:43.866 13774-13774/com.materialstudies.owl E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.materialstudies.owl, PID: 13774
    java.lang.IllegalArgumentException: width and height must be > 0
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1113)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1080)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1030)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:991)
        at androidx.core.view.ViewKt.drawToBitmap(View.kt:230)
        at androidx.core.view.ViewKt.drawToBitmap$default(View.kt:226)
        at com.materialstudies.owl.util.ViewExtensionsKt.show(ViewExtensions.kt:194)
        at com.materialstudies.owl.ui.MainActivity$onCreate$1$1$1.onDestinationChanged(MainActivity.kt:46)
        at androidx.navigation.NavController.addOnDestinationChangedListener(NavController.java:233)
        at com.materialstudies.owl.ui.MainActivity$onCreate$1$1.invokeSuspend(MainActivity.kt:44)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
        at androidx.lifecycle.DispatchQueue.drainQueue(DispatchQueue.kt:76)
        at androidx.lifecycle.DispatchQueue.resume(DispatchQueue.kt:55)
        at androidx.lifecycle.LifecycleController$observer$1.onStateChanged(LifecycleController.kt:40)
        at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361)
        at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:300)
        at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:339)
        at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145)
        at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131)
        at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
        at androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPostResumed(ReportFragment.java:188)
        at android.app.Activity.dispatchActivityPostResumed(Activity.java:1278)
        at android.app.Activity.performResume(Activity.java:7970)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2020-12-19 20:59:43.878 13774-13774/com.materialstudies.owl I/Process: Sending signal. PID: 13774 SIG: 9

Run on: Google Pixel and Android 10. App crashes only when the BottomNavigationView is visible.

Organising apps as sub-projects

Hi all!
Right now each example is a project, so to execute it you need an instance of android studio for it.
I organised the apps as sub-project so you can run each of them without open a new instance of android studio, would be possible for me to push a new branch and open a PR?

FAB loses it's position [Reply App]

BUG

Hello everyone! I noticed that compose button (center of bottom nav bar) loses it's position when i cancel the email compose action having keyboard opened and rest bottom nav bar not visible.

WAY TO REPRODUCE

  1. Tap "Compose" button and start writing a message
  2. With keyboard opened close compose fragment
  3. Scroll down to hide bottom nav bar and the close keyboard
  4. Fab will remain unanchored in the center of the screen

See the video below for better understanding.

Screen.Recording.2021-04-19.at.1.31.04.PM.mov

RuntimeException when toggling dark mode (com.materialstudies.owl)

This throws in some menus, to reproduce the following stack trace just open Search and toggle themes:

2020-03-09 17:58:46.516 10999-10999/com.materialstudies.owl E/rialstudies.ow: Unknown bits set in runtime_flags: 0x8000
2020-03-09 18:00:50.873 10999-10999/com.materialstudies.owl E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.materialstudies.owl, PID: 10999
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.materialstudies.owl/com.materialstudies.owl.ui.MainActivity}: java.lang.IllegalArgumentException: width and height must be > 0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5279)
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5187)
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: java.lang.IllegalArgumentException: width and height must be > 0
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1113)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1080)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1030)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:991)
        at androidx.core.view.ViewKt.drawToBitmap(View.kt:181)
        at androidx.core.view.ViewKt.drawToBitmap$default(View.kt:177)
        at com.materialstudies.owl.util.ViewExtensionsKt.show(ViewExtensions.kt:194)
        at com.materialstudies.owl.ui.MainActivity$onCreate$1$1.onDestinationChanged(MainActivity.kt:44)
        at androidx.navigation.NavController.addOnDestinationChangedListener(NavController.java:204)
        at com.materialstudies.owl.ui.MainActivity.onCreate(MainActivity.kt:42)
        at android.app.Activity.performCreate(Activity.java:7825)
        at android.app.Activity.performCreate(Activity.java:7814)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) 
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5279) 
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5187) 
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7356) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

It seems it restarts the MainActivity and forward the navigation but it fails in this extension:

fun View.drawToBitmap(config: Bitmap.Config = Bitmap.Config.ARGB_8888): Bitmap {
    if (!ViewCompat.isLaidOut(this)) {
        throw IllegalStateException("View needs to be laid out before calling drawToBitmap()")
    }
    return Bitmap.createBitmap(width, height, config).applyCanvas {
        translate(-scrollX.toFloat(), -scrollY.toFloat())
        draw(this)
    }
}

Because width and height will be 0.
One way to fix this is adding lifecycleScope.launchWhenResumed in MainActivity:

lifecycleScope.launchWhenResumed {
                navController.addOnDestinationChangedListener { _, destination, _ ->
                    when (destination.id) {
                        R.id.myCourses, R.id.featured, R.id.search -> bottomNav.show()
                        else -> bottomNav.hide()
                    }
                }
            }

Is this fix optimal? I can make a PR if needed.

[Owl] AGP version should be stable

The current AGP version for the Owl example is 3.6.0-beta01. To prevent users having to use a specific preview version of Android Studio, this should be reverted to 3.5.0 (until such time that a new stable version of AS/AGP is released).

MainActivity Switch DarkMode Crash

    Process: com.materialstudies.owl, PID: 16808
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.materialstudies.owl/com.materialstudies.owl.ui.MainActivity}: java.lang.IllegalArgumentException: width and height must be > 0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3895)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4074)
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6046)
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5936)
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8347)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
     Caused by: java.lang.IllegalArgumentException: width and height must be > 0
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1257)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1224)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1174)
        at android.graphics.Bitmap.createBitmap(Bitmap.java:1135)
        at androidx.core.view.ViewKt.drawToBitmap(View.kt:181)
        at androidx.core.view.ViewKt.drawToBitmap$default(View.kt:177)
        at com.materialstudies.owl.util.ViewExtensionsKt.show(ViewExtensions.kt:194)
        at com.materialstudies.owl.ui.MainActivity$onCreate$1$1.onDestinationChanged(MainActivity.kt:44)
        at androidx.navigation.NavController.addOnDestinationChangedListener(NavController.java:204)
        at com.materialstudies.owl.ui.MainActivity.onCreate(MainActivity.kt:42)
        at android.app.Activity.performCreate(Activity.java:8085)
        at android.app.Activity.performCreate(Activity.java:8073)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3868)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4074) 
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6046) 
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5936) 
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473) 
        at android.os.Handler.dispatchMessage(Handler.java:110) 
        at android.os.Looper.loop(Looper.java:219) 
        at android.app.ActivityThread.main(ActivityThread.java:8347) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.