Comments (2)
Thanks for the awesome idea!
At first I didn't know how to approach this from the API perspective but now I think I have a good solution. Here are the changes that can be used from version 1.10.0. To summarize:
- The Slider, Toggle, SingleSelectionList and MultipleSelectionList tricks now contain an optional parameter called 'needsConfirmation' (false by default). If this confirmation is enabled, the usual callback that belongs to the trick (
onValueChanged
oronItemSelectionChanged
) will not be called immediately as before, only after the Apply button that you suggested is pressed. - The Apply button appears and disappears dynamically (it's only visible if there are changes to be applied) - the animation and the gradient are work-in-progress...
- There also is a Reset button which, by default, appeares besides Apply - the
Beagle.imprint()
function'sshouldShowResetButton
can be used to hide it. - The texts that appear on the button can be changed in the Appearance instance that is provided to
Beagle.imprint()
. - If multiple pending changes are waiting to be applied, they will be called one after the other the moment the user presses the Apply button. If you need to perform an action after the last callback is called (like restarting the app), you can check the value of
Beagle.hasPendingChanges
. Now that I think about it, it might be a good idea to add a separate callback for this in a future version. - The demo app has been updated to contain examples for Toggle and SingleSelectionList.
This is very early stuff so it's possible to contain bugs... Please let me know if you find any.
And of course if the API is not suitable for what you had in mind, we'll get back to brainstorming :)
from beagle.
I've fixed some issues, added some new features and improved some of the recent things in 1.10.1. With those changes in mind, my suggestion for your specific usecase:
- For all modules that modify settings needing an app restart to take effect, set the
needsConfirmation
constructor parameter to true when defining the trick. - In the lambdas for these tricks update the value stored in shared preferences, as these callbacks will only get invoked when the user presses "Apply".
- Set a lamda value for
Beagle.onAllChangesApplied
where you kill the application process / restart the app / whatever. This is new in v1.10.1 and will get called after the lambdas I mentioned previously. - If you'd like to fine-tune the behavior, the
Beagle.imprint()
function can handle a new,Behavior
object besides the oldAppearance
. The relevant properties:- In Appearance: applyButtonText and resetButtonText as mentioned before
- In Behavior: shouldShowResetPendingChangesButton and shouldResetPendingChangesOnClose. The latter is new: if you set it to true, all pending changes will be reset when the user closes the drawer without pressing "Apply".
from beagle.
Related Issues (20)
- NoSuchMethodError somewhere in Beagle.initialize() after moving to Hilt HOT 4
- Coil update HOT 3
- TextInputModule Crash HOT 2
- On SDK 31 and above the screen recording crashes when started HOT 1
- Beagle crash logging doesn't work HOT 2
- Crash with DrawerLayout when getting permissions HOT 3
- Drawer doesn't appear when using content.viewTreeObserver.addOnPreDrawListener on the Acitivty HOT 5
- Beagle should not cause a crash if a value is set to the Slider module that is outside the specified range HOT 1
- The drawer opening gesture does not respect the value of `shouldShowDebugMenu` HOT 1
- Can't open Activity when try to forceCrash from debug panel HOT 7
- ListModules should support the isEnabled flag.
- TextInputModule. Suggestion for improving the validator
- Buggy inset handling in edge-to-edge apps
- SwitchModule. Ui data not re-initialize. Reset selected state HOT 5
- Double debug-panel HOT 3
- When activity theme is not a material theme, Beagle view crashes. HOT 3
- Implement dynamic notification permission support HOT 1
- Support for Beagle on Jetpack Compose? HOT 7
- Possibility to change the width of the drawer HOT 2
- The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant). HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beagle.