Tasker Smart NavBar #7 Smarter NavBar

It’s time to wrap all standalone NavBar actions with a single controller that will enable you to use all NavBar at once (you can pick & mix NavBars)! Up until now, you could only display a single NavBar that would be destroyed once you exit the application or context or a new Smart NavBar would override the old one. This project aims to fix this creating the ultimate Smarter NavBar experience.

Smarter NavBar actions

Let’s say you were listening to music while taking advantage of the Smart NavBar #6 Music Playback controls. Then you decided to open Facebook and enable the Smart NavBar #1 ActivePC which changed the playback control into cast icons (great and intuitive!) but once you left the Facebook, playback controls were nowhere to be found!

Smarter NavBar fixes this by creating an index of importanceā„¢ (šŸ˜) which will decide which NavBar should be displayed next. The index of importanceā„¢ can be tailored to your needs and there is a mechanism to override it as well. Here is my proposed index:

  1. short term actions (ie. display clipboard)
  2. contextual actions (ie. open app like Facebook, WhatsApp)
  3. timed or persistent actions (ie. play music)
  4. location based actions (ie. alarms at home)
  5. other actions (ie. USB plugged in)
  6. background actions (ie. login to room)

You can introduce as many levels as you want, the important bit is to have the numeric order of importance with the highest action being the most important. You can assign the importance to your preference, but each standalone Smart NavBar action has to have the index of importanceā„¢ assigned.

How do Smarter NavBar actions work

When a NavBar is created, Tasker sends the name of that task to the variable with an appropriate importance level %SNBorder1-6. This keeps track of all NavBar actions that should be relevant at this point.

When the NavBar is destroyed, it is removed from the %SNBorderX (Variable Clear action) and separate task checks if there is another NavBar that should be displayed instead.

Manual override

There will be rare occasions where the system will fail to display the correct NavBar. This is where a double tap (if not used) can be assigned to manually remove the present NavBar from the list and to display the next one in the order.

Each standalone Smart NavBar action will have to have the double tap task assigned to do so. You can enable this by adding: =:=SNB Manual Override 1-6 line to the NavBar creation action. (1-6 is the correct %SNBorder variable to clear)

task(NB Facebook WIFI)[1.0]
to
task(NB Facebook WIFI=:=SNB Manual Override1)[1.0]
TASKER TASK: SNB Manual override1
SNB Manual Override1 
	
	A1: Variable Clear [ Name:%SNBorder1 Pattern Matching:Off Local Variables Only:Off ] 
	A2: Perform Task [ Name:SNB Clear NavBar Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]

When pressed, the task will kill the current NavBar and restores the next one according to the index of importanceā„¢.

SNB Clear NavBar Task

This is the action I want to perform each time when a NavBar is removed. It will check what %SNBorder1-6 variables are set and will apply the one with the biggest importance – this is why it’s important to select STOP in the Perform Task action.

TASKER TASK: SNB Clear NavBar
SNB Clear NavBar
	
	A1: Perform Task [ Name:%SNBorder1 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder1 Set ]
	
	A2: Perform Task [ Name:%SNBorder2 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder2 Set ]
	
	A3: Perform Task [ Name:%SNBorder3 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder3 Set ]
	
	A4: Perform Task [ Name:%SNBorder4 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder4 Set ]
	
	A5: Perform Task [ Name:%SNBorder5 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder5 Set ]
	
	A6: Perform Task [ Name:%SNBorder6 Priority:%priority Parameter 1 (%par1 Set 1): 
Parameter 2 (%par2): Return Value Variable: Stop:On ] 
	If [ %SNBorder6 Set ]

Note that the 6th action has been modified to pass a %par value – explanation in exceptions. Each time this task runs, Tasker is checking if there is another NavBar action it should set.

Exceptions

Smart NavBar #3 NFC actions

To make this standalone project work correctly, in the entry task we have to duplicate the entry IF condition and make it run only IF %par1 = 1 (Be sure to pass %par1 = 1 in SNB Manual Override6 and SMB Clear NavBar). This way tasker won’t log you out when running the entry task again:

A11: If [ %par eq 1 ]
         A12: Variable Set [ Name:%SNBorder6 To:NB Set Room Recurse  Variables:Off Do Maths:Off Append:Off ]          
         A13: Perform Task [ Name:NB NFC %NBactiveTag Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 
         A14: Stop [ With Error:Off Task: ] 
         A15: End If

I also changed the local variable %evtpem2 to %NBactiveTag:

A1: Variable Set [ Name:%NBroomTag To:off  ]
     If [ %NBroomTag !Set ] 
 A2: If [ %NBroomTag ~ on | %NBactiveTag !~R none|%evtprm2 ]
 A3: Variable Set [ Name:%SNBorder6 To:NB Set Room]
 A4: Flash [ Text:Logging in please wait Long:Off ] 
 A5: Variable Set [ Name:%NBactiveTag To:%evtprm2 ] 
     If [ %evtprm2 Set ] 
 A6: Perform Task [ Name:NB NFC %NBactiveTag Priority:%priority Parameter 1     (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 
 A7: Flash [ Text:Logged in to %NBactiveTag Long:Off ] 
 A8: Variable Set [ Name:%NBroomTag To:off ] 
 A9: Stop [ With Error:Off Task: ] 
 A10: End If

Conclusion

Once you get the hang of the modifications needed for the Smart NavBar, you will be able to quickly modify all standalone actions to work with this system. Just a side note – the time context in Clipboard is little temperamental. I spoke to Joao about this and he is looking into the time contexts which are short-lived. You can download the project files from this link.

If you like my work you can always buy me a coffee or support me via Patreon.

Liked it? Take a second to support Pocketables on Patreon!

Mat Zolnierczyk

I am passionate about technology, cycling, and art. This would explain why my bike has more computing power than your average office. I own notenoughtech.com and I write for xda-developers.com and pocketables.com NotEnoughTECH | Facebook | Twitter |YouTube |Instagram | Google+ |Donate |Patreon