Creating text inside artificially created Image / Button in Tasker, best android app - Tasker Tips & Tricks

In version 4.8u1m I tried to create variable %Desc that holds inside string "Image 01". Then I have created the Image1 itself using Element - Create and then in the 3rd line I have passed the variable into the button through Element - Text.
Unfortunately the image doesn't show at all. Is it version related or I misenterpreted code?
Thanks.

Related

how do I setup replacement words?

I have a scene that have the word "activate" that toggle a HA device.
I want to substitute the world "activate" to response to open,close,shut, secure,unlock
so in the "replacement" line I have "activate=open,close,shut,secure,unlock" without the quotation but it doesn't work.
am I missing something here?
also second question is, is it possible to to use replacements for multiple words,
example: I have a command to lock the entry door that reads "Lock Entry Door"
I want to be able to substitute both words LOCK and ENTRY with lock=secure,close and ENTRY=front, main
i
I'm guessing Activate is text/button within the scene.
Create a text file (HAoptionslist) with each option on a new line. Remember where you saved it
In the scene, set the button Label to %Entrybutton
In the Tap tab,
If %Entrybutton ~ front
do what you need it to
End If
If %Entrybutton ~ main
do what you need that to
End If
Set variable %HAoptions to %HAoptions +1
File/Read Line: Filelocation/HAoptionslist), Line: %HAoptions To variable: %Entrybutton
Scene/Show Scene: HAscene
If your HA device resets the functions (for example, if it always starts with secure), when you destroy the scene, set %HAoptions variable to whichever line you need the scene to start with.
I know there are better ways to do this but I think this will be easiest to fix if you want to add or change functions later.

[GUIDE][THEMING]How to find in the code what you want to theme

Hi there, in this guide I’ll try to explain the most complicated part of theming (at least for me) : Finding what line of code I want to modify in order to change one specific element of the app I want to theme.
I will show you the method that I use in order to do so, and trust me, that was a pain in the neck to find this method, because I had to try hard, make test, theme many apps…
But XDA is a place of sharing, and I want to share my experience with you, so you don’t toil as I did.
This tutorial isn’t for newbies, I would recommend to check XML 101 from @Ticklefish
And the How to theme any android apps guide from me, where I use the color method detailed in the third post.
Once you’re more comfortable with those, you’ll understand better what I’m telling you now.
Required knowledge:
XML basics that you can learn with XML 101
Know how to use apktool (Go there, thanks @A_U, it's pretty old but it can get the job done)
Being comfortable with sublime text or notepad++ (or another text editing software file "search in folder" feature)
Know approximately how an apk file works (file structure, check out that: it's a quick summary)
One general method:
Unless you are a genius, you can’t guess how a developer named elements of the app you want to theme in the code.
For example, factory reset in the setting app from Xiaomi is named « master_clear_... »
Several lines referenced the same name:
- master_clear_apply for the apply menu
- master_clear_button for the button to press in order to reset the phone
- etc …
What you want to do in order to find the name of those elements (for example the reset button that someone asked me to erase), you have to find something that characterizes it, something that only this element has, and it can be many things. This thing will help you recognize the element in the code, so you’ll be able to find how it’s named in the code. I call this name a code name, what you should do is find this code name with the method I'll give you, and then search for those codenames in the layout folder.
The posts below will detail methods that I use to find the code name of the element I want to theme.
Update : What I call a code name is called a resource ID
Summary :
Strings
Colors
Drawables
Layout
To search for something in every file of one directory, you can use notepad++ or sublime Text (on Linux)
Strings :​The first thing I recommend to dig into are strings.
Strings are the most specific thing in the element you want to theme.
To go back to my example, I wanted to erase the « Reset » button from the setting app (a user asked).
The things that I know just by looking at this element:
-It’s a button
-« reset » is written on this button
So I go to the Strings.xml file and I search for the « reset » keyword.
How lucky! I found exactly what I wanted, next to the reset word, was written:
Code:
<string_name=master_clear_...
But there were several line mentioning it: whatever!
I just found the name for factory reset! It’s called master_clear (usually, names in the code make sense, so when I saw reset next to « <string_name=crypto… » I knew that it wasn’t the right name. Master clear fits perfectly, because I knew that factory reset means cleaning the device. Plus the other lines with a name starting by « master_clear » were the text warning before doing a factory reset, the « cancel » button, etc…)
So now that I’m sure that master_clear is for factory reset I searched in the layout folder (in every file using Notepad++) if some lines in those files were referencing « matser_clear_... »
Hopefully I found some files named maste_clear_....xml and they were pretty short, so I read them and I saw in one of them a « <Button… », with an attribute referring to the reset text I saw on the button.
The line was:
Code:
<Button android:gravity="center" android:layout_gravity="center_horizontal" android:id="@id/initiate_master_clear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20.0dip" android:layout_marginBottom="12.0dip" android:text="@string/master_clear_button_text" />
You see the android:text attribute ? It's referring to a line in the String.xml file:
Code:
<string name="master_clear_button_text">Reset phone</string>
Hopefully, we found the exact button with the "reset phone" text on it: let’s add the android:visibility="gone" attribute to make this button gone.
Usually it’s a bit more painful because sometimes you have large layout files that are difficult to read and understand, I’ve been lucky this time.
That’s how you do when the thing that characterize your element is a string (a text)
Colors :​So the element you want to theme has nothing particularly, except his color, what you want to do is to identify the hex code of the colors corresponding to the element you want to theme.
Use this app to proceed:
https://play.google.com/store/apps/details?id=net.blackdevelopers.colorpicker
Also check out my tutorial part II-1 and part I-2)A) to know how to identify the colors.
https://forum.xda-developers.com/android/themes/guide-how-to-theme-android-app-t3777101
Now that you got the hex code of your color, search for it in /value/colors.xml file. If you don’t find it there, search for it in the whole /color directory (it's veeeeerry rare that a dev puts colors here, I haven't seen that yet). If you don’t find it, it means that the hex code is wrong, maybe the alpha channel is wrong, give it another try.
An example:
I have an element with this color code: 80cbc4 and this alpha channel: 66 (go check out my guide to know how to find approximately the alpha channel)
I found this line in the colors.xml (in the value folder)
Code:
<color name="highlighted_text_material_dark">#6680cbc4</color>
It means that the code name is : "highlighted_text_material_dark" (but that's just an example, if I want to find the code name of an element with text, I won't search for the color of the text, I would search for the text codename itself)
Again, the code name must be logical. If you want to theme a factory reset button and the code name is “wifi_confirmation_reset”, that may not be the one that you’re looking for.
But sometimes, some elements have a weird code name, if you’re hesitating, give a try to both code names: try to modify the color for the first one, recompile everything and see if it changes something. If not, modify the second one, make some test.
Once you get the codename, search for it on the layout folder and here you go, you’ll find one file or some file mentioning it. If it’s only one, you’re lucky, if there are more files, try to see by reading them if they correspond to the layout where your element is located.
Once you got the right layout, have fun modifying it
Drawable:​Let’s say now that you have on your element an image, this image can be find under /drawable-…
The “…” thing is for hdpi, xhdpi… and every folders starting by drawable. Once you found the right image (make sure it’s the right one, if there are two similar images), copy its name and search for it on the layout folder.
Open the file that mentions it and modify it.
This method doesn’t work every time so make sure that you have a backup idea (like a color or something)
Layouts:​If you haven’t any idea of what makes your element special, just look into the layout folder and try to find a name that seems to be correct and logical (if you want to modify a volume rocker, try to find a name related to that)
Try to read some layouts and draw them fast on a piece of paper next to you. If it looks like yours, then try to modify it and see if you get what you expected.
Conclusion:​You’ll always make a LOT of test before getting what you want because code is always like that. But don’t give up, and with those method, I’m sure I’ll save you some time.
Enjoy !
I'm open to every questions, come on, don't be shy
So in conclusion, yee haw
My Guides​[GUIDE][INDEX]How to modify an apk
[GUIDE][THEMING]How to find in the code what you want to theme
[THEME & GUIDE][XDA]XDA Reloaded
[GUIDE][THEMING]How to theme any Android App
[Newbies][Documentation]What's an apk and how does it work
My "Welcome to XDA" thread​[WELCOME]Hello iPhone Users, Quick message for you fellow "old" XDA users

[How To] Post your task or profile DESCRIPTION when asking for help

If you have a task (or profile) that doesn't work the way you expect, it helps others help you if you post the entire task (profile) description (not xml). This will give a human readable snapshot of your task (profile) to aid troubleshooting.
Before exporting, if you have sensitive information such as log-ins, api keys or anything else, you might consider setting those values to a variable and use the variable in your tasks so the value won't export with the task.
Make sure the task or profile is named - not a default name assigned by tasker.
If you have an anonymous task, either export the entire profile, or name the task. Once named, the task will be available in the tasks tab. To name an anonymous task, long press on it in the profile, a context menu will appear including an entry "name".
To name a profile if it isn't already, long press on the name to highlight the profile and, at the top, tap the square with the A. Any linked tasks will be exported with the profile they are linked to.
Now, long press on the name to highlight the task or profile. Go to the 3-dot menu and select export -> Description to Clipboard.
Now you'll be able to paste it. Be aware, it easier to use something like pastebin.com / hastebin.com and link to a post here. If you paste in a post here, the forum software will convert semicolons with characters directly after, into emoticons making it very hard to read.
If you are posting to the forum using a desktop browser instead of an app or mobile view, make sure to enable (check the box) 'Disable smilies in text" in the advanced posting editor. That will also prevent the conversion of characters into emoticons.

Resize "Popup task buttons" layout

I created a task which show the "Popup task buttons", but unfortunately the default window which popups is really too small. I tried to manually resize the layout but the result was a true mess: the buttons size and position behave erratically between the Scene editor and the real window which popup. Any idea?
Hard to tell what is happening without seeing how you are trying to resize. I have attached a modified pop-up task button scene. You could import this into your tasker and see if it is closer to what you want.
To import the modified scene, put it in a scenes subdirectory within the Tasker folder on your device, which is usually:
Code:
/sdcard/tasker/scenes/
The scene name can be changed I've imported. These days, I tend to add my user name to prevent import issues due to name space collisions.
I've made only small a change so I can try to get an idea as to what you want. Showing a picture of what the stock scene is doing that you want to fix might help.
Thanks for your reply. What I'd like to get is something like this:
https://ibb.co/WkSSs3K
but if I create this in Scene Editor, what I get in the real task is this
https://ibb.co/ncgNZbP
Obviously I am missing something here but what?
When you tried to resize the buttons, did you use the resize touch mode (hand icon -> resize) or did you try to drag in either the default normal touch mode (hand icon -> normal) or edit touch mode (hand icon -> edit)? It's easier to control using the resize and move touch modes. But, in order to enter the element editor, it helps to be in normal touch mode.
There is a magnifying glass at the lower right. Tapping that will toggle between the editor (default - magnifying glass will display a minus sign) and display (default - magnifying glass will display a plus sign). When in the editor, the scene is often zoomed in which can change how the scene appears.
If it helps, I've attached a scene modified similar to your first picture.
I really don't know what is going on here, but something odd is happening.
I create a simple task using your layout (which is exactly what I'd like to get), but when I actually run the preview of the task i see this instead.
https://ibb.co/n00VqhH
This behaviour is the same with almost every layout I create: I see an image in the scene editor and a totally different one when I run the task.
Any ideas?
daniele62 said:
I really don't know what is going on here, but something odd is happening.
I create a simple task using your layout (which is exactly what I'd like to get), but when I actually run the preview of the task i see this instead.
https://ibb.co/n00VqhH
This behaviour is the same with almost every layout I create: I see an image in the scene editor and a totally different one when I run the task.
Any ideas?
Click to expand...
Click to collapse
I have no idea. Could you post your task that displays this scene. For help find that, please see this post.
Also, what device and OS is this?
Conferma (25)
A1: Popup Task Buttons [ Text:Sure? Mode:Text Task:Ripristina Task:No Task: Background Image: Layoutopup Task Buttons - Ktmom Larger Timeout (Seconds):10 Show Over Keyguardn ]
Sorry. This is a little different task because I deleted the previous one, but the behavior is exactly the same.
Ahhh, I see. Try using this scene, but use a display scene action. Make sure to have an action in the task or the tasks associated with pop-up buttons, which destroys the scene when you're done.
Thanks. I used "Display scene" instead of "Popup task button" and now it works as expected.
The pop-up button action "should" work. Unfortunately, Tasker's current developer has made it clear he will not support the built in scenes. I'm guessing there will be a day where the scenes become even more problematic and we'll be forced to AutoTools web scenes.
«rant»I have spent days trying to convert one of my many custom scenes to a web scene. You need html, css, and JavaScript plus an understanding of how to set and receive variables back and forth. It's second to impossible to develop on the device. Which at least in my case means I can't tweak when in at the doctors office or hospital with my son. And I rarely have time to sit on the computer at home «/rant»

Add the value taken from the user to my range for ActiveX ComboBox

Hi everyone,
I defined
a ActiveX ComboBox named "cmbPeymankar",
a Text Box (ActiveX control) called "txtNewPeymankar".
a Command Button (ActiveX control) called "Add".
I have a table named "Table1" in sheet "DATA" so that the first column of Table1 contains the names that should be displayed in the cmbPeymankar list and 10 items are already written in it.
I have three questions:
How to define the value of "ListFillRange" of cmbPeymankar so that the values of column 1 of Table1 are displayed in its list?
What command should I write for Add button to add the value taken from the user for txtNewPeymankar to the end of the column 1 of Table1?
The value of cmbPeymankar can be selected from its list. If the user wants to type its value, how can I write an error message if the entered value is not equal to any of the predefined items for cmbPeymankar (in column 1 of Table1)?
Click to expand...
Click to collapse

Categories

Resources