How can these commands be executed by "Tasker"?

116 views
Skip to first unread message

Stefan Hofmeister

unread,
Mar 22, 2017, 11:21:34 PM3/22/17
to Tasker
Hello,

I would like to dim the system bars as desribed here:https://developer.android.com/training/system-ui/dim.html#dim

Dim the Status and Navigation Bars
----------------------------------------------------
// This example uses decor view, but you can use any visible view.
View decorView = getActivity().getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;
decorView.setSystemUiVisibility(uiOptions);

Reveal the Status and Navigation Bars
-------------------------------------------------------
View decorView = getActivity().getWindow().getDecorView();
// Calling setSystemUiVisibility() with a value of 0 clears
// all flags.
decorView.setSystemUiVisibility(0);

Unfortunately, since I don't know anything about these programming language (guess it's "Java", right?), I have no idea how to "transfer" these commands to "Tasker's code action options".

Could someone be so kind to give me the exact Tasker sequence, please?

Thank you in advance!

John Doe

unread,
Mar 23, 2017, 2:27:56 AM3/23/17
to Tasker
You can't do it in that way. You can change Android settings using SecureTask changing the immersive mode parameter.

Stefan Hofmeister

unread,
Mar 23, 2017, 4:21:55 AM3/23/17
to Tasker
Just for clarification:
When you say "you can*t do in that way", you mean "Task" isn'nt capable to execute these commands?

Or do you mean the goal of dimming the system bars as described under https://developer.android.com/training/system-ui/dim.html#dim wouldn't work on a smartphone with an "up-to-date" version of Android?
The article states " it describes how to dim the system bars ... on Android 4.0 (API level 14) and higher. Android does not provide a built-in way to dim the system bars on earlier versions." Well, I'm forced to use Android JellyBean v4.1.1 and can't upgrade to anything higher on that "old" particular smartphone, so if I understand this correctly, this technical system requirement is fulfilled in my case? The immersive mode you mentioned was introduced under Android v.4.4, so sadly, this is no option for me:-(

I was hoping that somebody could show me the right way how to "transfer" these commands to "Tasker's code action options".Like in the example of changing the bluetooth status described in another artcicle: http://itnerd.space/2017/01/01/how-to-run-android-java-code-from-tasker/


John Doe

unread,
Mar 23, 2017, 8:51:31 AM3/23/17
to Tasker
It won't work because Tasker uses an application context in java actions and you can't use a "getActivity" method and you can't manupulate any UI components.

Pent

unread,
Mar 23, 2017, 9:50:48 AM3/23/17
to Tasker


It won't work because Tasker uses an application context in java actions and you can't use a "getActivity" method and you can't manupulate any UI components.

I really need to provide an activity context for scenes.

But: in any case, I believe the solution OP is trying to use will only last will Tasker is showing the foreground activity, could be wrong.

Pent

Pent

unread,
Mar 23, 2017, 2:38:20 PM3/23/17
to Tasker


I really need to provide an activity context for scenes.

Will try to get that in for next version, it's not so difficult, the tricky bit is being
100% positive the activity gets GC'd.

Pent

John Doe

unread,
Mar 24, 2017, 2:20:17 AM3/24/17
to Tasker
Keeping a reference of a no more visible activity is a memory leak and that context shouldn't be used. In addition it would be possible to apply the OP code only to a tasker scene, it's not applicable to any activity in the system.

Pent

unread,
Mar 24, 2017, 2:49:27 AM3/24/17
to Tasker

Keeping a reference of a no more visible activity is a memory leak and that context shouldn't be used.

That's what I meant with the GC comment.
 
In addition it would be possible to apply the OP code only to a tasker scene, it's not applicable to any activity in the system.

That's what I meant with the comment in the post before last :-)

Anyway, for tasks run directly from a scene element event in non-overlay scenes, the CONTEXT object is now the Activity
associated with the scene.

Pent
Reply all
Reply to author
Forward
0 new messages