GithubHelp home page GithubHelp logo

Comments (4)

drewhannay avatar drewhannay commented on September 17, 2024

It would probably be simplest to add a new method to ShakeDelegate that you can optionally override to set the sensitivity int. I'm skeptical that there are enough other things people would want to customize to be worth letting them set a custom ShakeDetector (but feel free to disagree and explain why).

Happy to accept a PR for this, thanks for flagging it :)

from shaky-android.

akalra avatar akalra commented on September 17, 2024

That's interesting, I actually hadn't thought about that.

In my mental conception of the entities, ShakeDelegate was the thing you delegated the shake event to, to figure out how to process it. I didn't expect it to have any configuration for the ShakeDetector, though I see now that it already does a little bit of that (isEnabled()).

I'm not yet sure how I feel about that, it seems odd to be injecting something to a ShakeDetector that both configures it and processes its output. They seem like two semantically different things to me, so I would have assumed you would inject a ShakeDetectionConfiguration and a ShakeDelegate separately.

Am I thinking about your modeling the wrong way?

from shaky-android.

drewhannay avatar drewhannay commented on September 17, 2024

From a "pure" modeling perspective, your approach is probably more correct. My reasoning is mostly just that this is a fairly simple library and I was hoping to keep a fairly simple API, where most things just work out of the box with no configuration.

ShakeDelegate is maybe not the greatest name because I'm really thinking of it as the way the app hooks into the library, both for configuration and for processing. It's possible we might want to separate out two objects like you described, but since isEnabled is already in ShakeDelegate, we can't do that without a breaking change.

So how about for now we just add the extra method to ShakeDelegate and then if we keep getting more requests for configuration options, I'll make a major version bump down the line and separate it out into a separate configuration object. I'm hoping that strikes the right balance between correctness and practicality, what do you think?

from shaky-android.

akalra avatar akalra commented on September 17, 2024

Sent in a basic PR based off of your comments. Held off on doing anything too fancy for now, though I did restrict knowledge of the Seismic constants to the one class that interacts with Seismic, and created corresponding values for within Shaky.

Not ideal, but leaking abstractions or using weaker modeling (strings or something) made me a little uncomfortable.

Ankur

from shaky-android.

Related Issues (17)

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.