Falcosc / locus-addon-tasker

Locus Maps API useable as Tasker Plugin
GNU General Public License v3.0
9 stars 2 forks source link

hardware button refreshing value #2

Closed emariu closed 5 years ago

emariu commented 5 years ago

Autoinput.. another program to buy and to learn to use .. hmm is getting more difficult Anyway it's clever what you had done for switching presets But wouln't it be more easier if you could directly access the locus API and trigger a Recalculation of the route when pressing a hardware buton? Or make a tasker task with Intents

Thanks for your tip..

Falcosc commented 5 years ago

First way to solve - Hardwarebutton Handling as part of my App

The problem is the customisation. There is no general solution for hardware button refresh.

Your device may need button 21 And my device need button 45

Fine, just need to configure that, right? Oh well, that need a configuraion UI, doesn't have one Well, isn't such easy, I need to finetune it for different device sizes And I need to store some thing on the device, didn't implement any functionality to store things on your device. Ok, let's do the 4 things, lot of work but maybe it's cool to have this.

Oh wait, this whole thing is a little bit complicated to setup, I need to write a manual for all this new configuration things.

Ok, do the 5 things to get it done.

Wait, some people don't need just a button press. Why? For example I use the shutter button. To press the button it does activate the focus button (half press) I need to skip this, but wait, how do you configure skip button? This isn't a thing in android :( And then, the Button press need only be executed when locus is online. I would need to implement this as well. And more, I can't access the tasker scene by my app, I would need to create an hardcoded overlay or I would need to write an UI building engine to make it flexible. And if I do all of this things correct to make it configureable I would need to call the App "Tasker" because I would basically rewrite Tasker which doesn't make sense.

Basically to implement Hardware Button support I would need to hardcode every little configuration you see in Tasker and we all know what a hardcoded way to do some thing would lead us to. A device and usecase bound product with no need for most people or 1000 of products to be compatible to all devices and usecases.

Do you know why Locus can't have anything as native support? This is the reason for. You can only include things which don't need customisation. Anytime you do something which does depend on your hardware or on your usecase you need to use tools like Tasker to configure the trigger. Or you reinvent Tasker

After we did talk about it I would like to tell you the correct solution for this problem: "Develop some thing which could execute Locus features by accepting inputs from automation tools" Well I did this by selecting a well known automation tool "Tasker" and made it compatible with Locus by using there Plugin API to translate every user action to an Locus action.

Second way - use Tasker to handle Harewarebutton actions

And here the solution which you may already know: Configure your button click profile with Tasker by handling your device specific hardware buttons and execute a Task which does 2 things:

  1. get new value from Locus by using the plugin.
  2. write the new value to your Tasker Scene You could just reuse the Task which is boundled with the example profile and call this task with your new hardwarebuttonclick profile.

Did you now understand why I did not reimplement things like button handling as native app solution?

Which topic did sound wired and need an other way to describe it?

emariu commented 5 years ago

Hello,I managed to implement the hardware button to execute a tasker task.Please guide me from this to finish.. Is it enough to execute your UpdateElevationOverlay  task with the press of hardware button? Or do I need something more? P.S. I a very beginner with tasker, sorry Thank you,Marius

On Sunday, November 11, 2018 7:14 PM, Falcosc <notifications@github.com> wrote:

First way to solve - Hardwarebutton Handling as part of my App The problem is the customisation. There is no general solution for hardware button refresh.Your device may need button 21 And my device need button 45Fine, just need to configure that, right? Oh well, that need a configuraion UI, doesn't have one Well, isn't such easy, I need to finetune it for different device sizes And I need to store some thing on the device, didn't implement any functionality to store things on your device. Ok, let's do the 4 things, lot of work but maybe it's cool to have this.Oh wait, this whole thing is a little bit complicated to setup, I need to write a manual for all this new configuration things.Ok, do the 5 things to get it done.Wait, some people don't need just a button press. Why? For example I use the shutter button. To press the button it does activate the focus button (half press) I need to skip this, but wait, how do you configure skip button? This isn't a thing in android :( And then, the Button press need only be executed when locus is online. I would need to implement this as well. And if I do all of this things correct to make it configureable I would need to call the App "Tasker with Autoinput" because I would basically rewrite these things by my own which doesn't make sense.Basically to implement Hardware Button support I would need to hardcode every little configuration you see in Tasker and we all know what a hardcoded way to do some thing would lead us to. A device and usecase bound product with no need for most people or 1000 of products to be compatible to all devices and usecases.Do you know why Locus can't have anything as native support? This is the reason for. You can only include things which don't need customisation. Anytime you do something which does depend on your hardware or on your usecase you need to use tools like Tasker to configure the trigger. Or you reinvent TaskerAfter we did talk about it I would like to tell you the correct solution for this problem: "Develop some thing which could execute Locus features by accepting inputs from automation tools" Well I did this by selecting a well known automation tool "Tasker" and made it compatible with Locus by using there Plugin API to translate every user action to an Locus action. Second way - use Tasker to handle Harewarebutton actions And here the solution which you may already know: Configure your button click profile with Tasker by handling your device specific hardware buttons and execute a Task which does 2 things:

Falcosc commented 5 years ago

Very good that you don't ask for native hardware button support because this can't be done without reinventing the Wheel.

Yes you just need a 2nd Profile to call "UpdateElevationOverlay" Use a simple "Alert->Flash" Task to find out if your new hardwarebutton event profile does work.

If it does work you can change from your Test Task to "UpdateElevationOverlay" by doing a normal click on the profile to show the contents and then long click on the Task to change it from Test to UpdateElevationOverlay.

If you want to finetune it, you could create a new Task which does execute the preset and which will do call UpdateElevationOverlay (You can call Tasks in Tasks, there is an "Run Task" command available. And you will have timing issues for example the "UpdateElevationOverlay" does check if you do have an open Dashboard. But if you enable the preset on step 1 (Dashboard is available after 1 Second) but the Task is done only after 0.1 second. if you then do call UpdateElevationOverlay on step 2 it will check the dashboard on time + 0.2 seconds which is 0.8 seconds to soon. You may want to ask why the plugin can't wait for locus, Locus won't tell me when it is done, the Locus Action API does use Intents and these things does just send actions but don't respond anything which means it won't wait it will go on immediately. The most easy way is to set a wait Task between "Enable Preset" and "Run Task UpdateElevationOverlay" Start with 5 seconds to make sure that everything is correct and make an alert->flash after wait with text "done waiting 5 seconds" to make you able to see if the dashboard is ready when the wait was done.

Here an overview of all the nice features you need to have this working. I am sure you are not aware of all of them because many of them were already preconfigured in the example task.

Falcosc commented 5 years ago

And I very usefull tipp:

Hardware Button assignment to Tasker Profiles are a bit tricky. Sometimes you need to turn Tasker completely off and enable it again. You can do that on the top right corner. And use your "Alert->Flash" to display a rolling number to show if your changes was applied or not by do some thing like "Flash: Test 5" and after a configuration change make "Flash: Test 6". If you do something wrong it may not enable your new config and you will see that because your task does start with "Test 5" instead of "Test 6"