PianoView | 原创自定义控件之-仿最美应用的琴键控件

 by   north2016 Java Version: Current License: No License

kandi X-RAY | PianoView Summary

kandi X-RAY | PianoView Summary

PianoView is a Java library. PianoView has no vulnerabilities and it has low support. However PianoView has 3 bugs and it build file is not available. You can download it from GitHub.

原创自定义控件之-仿最美应用的琴键控件
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PianoView has a low active ecosystem.
              It has 324 star(s) with 50 fork(s). There are 9 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              PianoView has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of PianoView is current.

            kandi-Quality Quality

              PianoView has 3 bugs (0 blocker, 0 critical, 0 major, 3 minor) and 79 code smells.

            kandi-Security Security

              PianoView has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              PianoView code analysis shows 0 unresolved vulnerabilities.
              There are 1 security hotspots that need review.

            kandi-License License

              PianoView does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              PianoView releases are not available. You will need to build from source code and install.
              PianoView has no build file. You will be need to create the build yourself to build the component from source.
              PianoView saves you 334 person hours of effort in developing the same functionality from scratch.
              It has 800 lines of code, 40 functions and 22 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PianoView
            Get all kandi verified functions for this library.

            PianoView Key Features

            No Key Features are available at this moment for PianoView.

            PianoView Examples and Code Snippets

            No Code Snippets are available at this moment for PianoView.

            Community Discussions

            QUESTION

            How to model parent-child relationship in Android MVVM VMs?
            Asked 2020-Oct-23 at 14:06

            I'm working on an Android piano "quiz" app - users tap on the piano keys and then click the yellow "check" button to submit the answer for evaluation and see the correct answer drawn on the piano. The main QuizActivity has this layout:

            The upper part of the screen hosts a couple of controls (Text, submit buttons, etc.). The lower part of the screen is occupied by a custom PianoView component, that handles drawing of the piano keyboard.

            According to the MVVM principles, the PianoView should have its own PianoViewModel, that stores its state (i.e. currently pressed keys, highlighted keys, etc...) in a KeysStateRepository. The enclosing QuizActivity should also have a QuizActivityViewModel, that handles the various controls (submitting an answer, skipping a question...). The QuizActivityViewModel needs to be able to query the selected keys from the PianoView (or rather from its KeysStateRepository), submit them to the Domain layer for evaluation and then send the results back to the PianoView for visualization.

            In other words, the QuizActivity's ViewModel should own/be a parent of the PianoView's ViewModel to facilitate communication and data sharing.

            How can I model this parent-child relationship to communicate between the ViewModels?

            AFAIK a ViewModel cannot depend on another ViewModel (What would I pass as the ViewModelStoreOwner to obtain a ViewModel in another Viewmodel?). I don't think it's possible to achieve with Dagger-Hilt at least.

            Three solutions to work around this problem came to mind, all of them unusable:

            1 - The official way of sharing data between Views

            The Android dev docs recommend using a shared ViewModel to facilitate sharing of data between two Fragments / Views. However, this does not fit my use-case. The PianoView (or its ViewModel) should be the sole owner of its state with a Repository scoped to its ViewModel. Otherwise, the PianoView component would not be reusable. Consider for example another Activity, where I'd like to have two independent PianoView instances visible:

            Reusing a Shared ViewModel from the quiz activity would be obviously wrong, because it contains irrelevant methods and logic (i.e. submitting quiz answers) and would not fit the two-keyboard scenario.

            2 - Application-scoped repository

            A similar problem was tackled on Reddit with a proposed solution of using a shared instance of the repository. However, using a @Singleton KeyStateRepository would once again prevent the two independent keyboards to display different data.

            3(EDIT) - 2 duplicate repositories replicated by an Event Bus

            I could in theory create 2 independent ViewModels and 2 KeyStateRepository instances. The ViewModels would subscribe to an event bus. Each time a ViewModel invokes a mutable operation on its repository, it would also fire an event and the operation would get replicated via the other ViewModel subscribed to the same event bus.

            However, this feels like a fragile & complicated hack. I'd like to have a simple MVVM-compatible solution. I can't believe a simple parent-child relationship for two UI components is something unattainable in MVVM.

            ...

            ANSWER

            Answered 2020-Oct-14 at 06:43

            I would do the following, if you don't want to tie the PianoViewModel to your ActivityViewModel, I'd just create an interface, which the ActivityViewModel implements, and the PianoVM could have a nullable reference to that interface. This way neither the implementation, nor the existence of the component would be required for the PianoViewModel to work.

            How you get the ActivityViewModel is another question. Check out by activityViewModels() implementation for fragments, you probably can do the same with by viewModels() passing in the viewModelStore of the activity instead

            Source https://stackoverflow.com/questions/64339055

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PianoView

            You can download it from GitHub.
            You can use PianoView like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the PianoView component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/north2016/PianoView.git

          • CLI

            gh repo clone north2016/PianoView

          • sshUrl

            git@github.com:north2016/PianoView.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by north2016

            T-MVP

            by north2016Java

            A-MusicView

            by north2016Java

            HighingRefresh

            by north2016Java

            PathRefresh

            by north2016Java

            Moduler

            by north2016Java