Patch: Maths in Alarm

Rating: 
5
Your rating: None Average: 5 (6 votes)

Note: The latest version of the patch has only been tested on 2.0.0 Saimaa, but it should also work in 1.1.9 Eineheminlampi.

NEW SINCE 2.0.0.10-1: A new custom keyboard has been included, so that now the patch works in "act dead" mode.

Oh, the pulley menus! They are so good that you are able to use them without looking at the screen.
And that's really a problem with the morning alarm :)

This simple patch adds to the Alarm user interface a simple Maths question, that you need to resolve to make the alarm dismiss for good.

Timers and Calendar reminders are not affected by this patch.

 

This patch requires PatchManager. Ensure to remove the patch before upgrading to a new SailfishOS release.

Code is available at GitHub.

Note: you won't find divisions, I don't hate myself that much to make my alarm ask me for a division at 5:30 AM :P

 

If you like my work, you can buy me a beer :)

Screenshots: 
Changelog: 

- [patch] Show the keyboard only when displayedAlarm's type is Alarm.Clock

Comments

tualatin's picture

Can we please have some kind of tuning over the math difficulty? )) I like divisions and other operations. I continue my sleeping after "7-1" operation like nothing happend. Though maybe I'm having problems with responsebility.

 

Thans anyway for your work!!! It really helps a lot :)

BillyHalley's picture

Great, thanks! :)

alina's picture

Great idea!

BillyHalley's picture

Credo anche di aver capito perchè ogni tanto operator è "undefined", questo lo scrivo in italiano perchè non so se saprei spiegarmi in inglese ;)

Il problema è che Math.random() restituisce un numero tra 0 e 0.9999999999 ( non 1 )

Quindi moltiplicato per 4 e nel Math.floor() puoi ottenere 0, 1, 2, 3

e visto che operators ha solo 3 elementi, operators[3] è undefined

Quindi dovresti usare Math.floor(Math.random() * 3 )

Spero di averti dato una mano con la tua, già ottima, patch ;)

( Questo messaggio potrebbe essere doppio perchè la prima volta è scomparso :/ )

eugenio's picture

Senza dubbio. Grazie :)

Rikudou_Sennin's picture

will you make it work on 1.1.9?

eugenio's picture

Yes, once the release is public.

veeall's picture

Alarm ui doesn't have a keypad nor bottom pulley when phone wakes up from shutoff state to fire an alarm. Can this be fixed?

Otherwise so great patch, much needed, as alarms are just too easy to cancel while sleeping.

eugenio's picture

Latest patch has a built-in keyboard that also works in this particular usecase. Thanks to @BillyHalley for the idea :)

eugenio's picture

Yes, you're right. I admit I haven't tested the alarm wake up from shutdown at all.

I'll take a look into it :)

Eugenio

BillyHalley's picture

I don't know if you're working on it, but i found a way.
Since i didn't want to find out how to "wake" the keyboard, i just created a new keyboard of buttons, that looks even really nice with the new buttons:

    Flow {
        id: flow
        width: parent.width - x * 2
        spacing: Theme.paddingMedium
        Repeater {
            model: 9
            delegate: Button {
                width: ( parent.width - parent.spacing * 2 ) / 3
                text: index + 1
                onClicked: {
                    if ( mathsField.text !== "0" )
                        mathsField.text += index + 1
                    else
                        mathsField.text = index + 1
                }
            }
        }
        Row {
            id: lastRow
            width: parent.width - x * 2
            spacing: Theme.paddingMedium
            Button {
                width: ( parent.width - parent.spacing * 2 ) / 3
                text: "C"
                onClicked: mathsField.text = ""
    
            }
            Button {
                width: ( parent.width - parent.spacing * 2 ) / 3
                text: "0"
                onClicked: {
                    if ( mathsField.text !== "0" )
                        mathsField.text += text
                }
            }
            Button {
                width: ( parent.width - parent.spacing * 2 ) / 3
                onClicked: mathsField.text = mathsField.text.slice(0,mathsField.text.length - 1)
                Image {
                    anchors.fill: parent
                    fillMode: Image.PreserveAspectFit
                    source: "image://theme/icon-l-backspace"
                }
            }
        }
    }

and set the mathsField to readonly

It seems to work this way;)

 

eugenio's picture

Thank you. The problem is that maliit is not started in the special mode that notifies the alarm when the phone is off, so no keyboard in that special case.

Admittedly having a custom keyboard is pretty nice. I'll have fun with it later I guess :)

Mariusmssj's picture

LOVE IT!!!

eugenio's picture

Glad you love it :)