Snippet Manager

This article will cover on how to use add, create and insert snippets into the file

Understanding

A snippet is a generally a common pasted code which can be reused by others in a project.

const/4 v0, 0x1
const-string v1, "Message"
invoke-static {p0, v1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v0
invoke-virtual {v0}, Landroid/widget/Toast;->show()V

For eg: (as above) This is a smali code to display a toast message which can be used as common snippet. All snippets are stored in toolssnippets.xml file. It is read whenever application is started and Snippet Manager is opened, you can also manually edit it.

<?xml version="1.0" encoding="utf-8"?>
<Snippets>
   <Category>
    <Name>dot_os_banner</Name>
    <Type>1</Type>
    <Code>
ui_print("                                               ");
ui_print("***********************************************");
ui_print("            _____     _____    __              ");
ui_print("           |____    / ___   |  |             ");
ui_print("            _     | |   | |                ");
ui_print("           | |   | || |   | |                ");
ui_print("           | |__/ / | |___| |____|  |          ");
ui_print("           |_____/   _____/|______/           ");
ui_print("                 Droid On Time                 ");
ui_print("***********************************************");
ui_print("                                               ");
</Code>
  </Category>
</Snippets>

Above is an example of snippets.xml. Name is where the snippet name will exist, no two snippet can have same names, Type (generally 1,2 or 3) represents for which type of file the snippets are! For eg: Type 1 means for Updater-Script, Type 2 means for Smali, Type 3 is for all types of file irrespective of its extension. Code is where you actual snippet will present.

You can manually create your own snippet and append to this file or use built-in snippet manager to create one.

Creating Snippets

In ADK, go to Edit > Snippet Manager (or press Alt + Q) to open snippet manager. Now from above go to the tab says Create. Here you can create your snippet.

From bottom, you have to set come params.

Language: This is change the language of textbox (above) for proper syntax highlighting (nothing to do with code).

Name: You must mention a name for snippet. This will be the text for snippet item.

Type: As mentioned earlier, you have to select from this drop down box.

Export to Xml: This will export current document as XML file, you can then add or merge it (How? discussed below). You can also share this with any ADK user. Inshort, this will create a standalone snippet file.

Merge with exisiting Snippets: This will merge the snippet and append the document to toolssnippets.xml. No need to add or merge it again, this will automatically do it. This will not create standalone snippet file.

You can also do one thing to easily create a snippet. Just select a text in editor and right click, you will see a new option “Create a snippet”. When you click on it, you have to first specify the name for snippet and it will create same window like above.

Adding/Managing Snippets

As said earlier all snippets are stored in toolssnippets.xml. You can easily manage it from snippet manager itself.

So open snippet manager, you will get something like below.

On right side you will see your snippet file text. On left side is the list of snippets name stored in snippets.xml.

Add/Merge: This will add and merge a standalone snippet xml to your snippets.xml.

Delete: This will remove any selected snippets from left side.

Note: All changes are invoke only when this above form is close. Also making any changes to “Code” doesn’t affect snippets.xml, it will only depends on the snippets item (shown on left side). If you want to save changes to “Code” just click Export button to create standalone snippet and the add/merge it. Also, you cannot edit existing snippet within this editor; you must delete and recreate new one.

A tip, you can hover mouse on snippets item to see their codes.

Inserting Snippets

It is very easy, you just need to remember this things.

Type 1 (update-script) snippets will be added to Project > Add Templates with Text as the snippet name.

Type 2 (smali) snippets will be added to Project > Smali Insert with Text as the snippet name.

Type 3 (custom) snippets will be added to Project > Insert Snippets with Text as the snippet name.

You can then select the snippet item which will insert the snippet to current line position.

PRO TIP

To insert type 3 snippet you can also Press CTRL + SHIFT + I  to show a dialog like below then use arrow keys to select the snippet and press enter to insert it. You can also cancel it by pressing ESCAPE  button on keyboard.

A general workaround is shown below!

Installing and Configuring ADK (Must Read)

One of the most important task we all do wrong whenever installing a software is not reading their installation guide. If every user just take a 2 min time reading the installation guide can actually fix all the troubles they face in using them.

The same way goes for ADK, if you do these properly you can right away use it. But it needs 2-3 mins time of your life 🙂 Lol..

Installation is a 3 step process guided below. Kindly follow them carefully.

Downloading

First task is to download the latest release of software from Release section

Read the credits section over their to find which tools or libraries I’ve used in ADK.

Installing

  • Once you’ve downloaded the software, unzip the file you will see a file name setup.exe.
  • Run the setup.exe and you will see a screen like below.
  • Read and accept the license agreement, click Next Button from below.

  • Now here is the important task, kindly don’t change the installation folder (if possible). The reason is since ADK read and write files to its application directory so when you install it in C: drive ADK will additionally need some admin permissions to run from them. Now the problem is whenever you run ADK in admin mode some features automatically gets disabled due to windows limitation (like drag-drop files, etc). So if you want to change application folder directory just install it away from C: drive (like D: or E:, if you have it). Once done, click Next to proceed.

  • From here you have to choose your components, there are currently 3 components Full installation, IDE Only, Application Data Only
    • Full InstallationInstall IDE and Application data both.
    • IDE OnlyInstall IDE only, the one that stays in your application folder.
    • Application Data OnlyInstall Application data, a kind of SDK which contains third party tools used by ADK.
  • If you are performing fresh and clean install just select option Full Installation.

  • At last it will show you all the components and shortcuts you have set in between. Click on Install button to start the installation.
  • Once done, you can right away launch it (for configuring now) from desktop shortcut (if you have checked the option).

Configuring it

Before launching ADK, download and install ADB Drivers, Java development kit, Python (optional, Install old release 2.7). You can follow their standard guide on how-to install them.

  • Now launch ADK Application and go to Tools > Settings, you will see a dialog box like below
  • Now select Environment variables tab, from their browse for python.exe path and java jdk folder by clicking on browse button.
  • Heap size is used to set Java Ram consumption, the more you set the faster decompilation will run (Note: You must believe the fact, whenever you want good; you need to loose bad, similarly if you set it high you PC will become damn slow during the task — on verge of death. Why? Hey it’s java, it is also used to warm your PC 🙂

Other Paths

There are also some other paths which you have to browse, each will enable its own special feature.

  • When you install android SDK (platform tools), you can enable Dexpatcher mod for editing app.

Note: There is one thing you can do saving your lots of time downloading android SDK. Dexpatcher is a method of editing app at source level which is java, so you need to download one of the following file and install it.

DexScript Support files (Oreo update)

  • FFMPEG is required for editing boot animation (for processing gif and video files). You can download it and then browse these ffmpeg.exe in Environment Variables.

  • Once, everything done you can now move on using ADK.

Defining your own Language for ADK

This guide will teach you on how to create your own language for ADK.

Understanding

Whenever ADK is launched it collects all the language strings from a file which is stored in your lang folder. For eg: Take a look at appsettings.xml in ADK folder

You can see currently language file is en.xml located in lang folder. You can change this to anything from settings menu

Currently, there are only 7 languages ADK will accept (including this English version). All language has there two keywords (for eg: Enlglish language file is saved as en.xml) Similarly,

Persian – fa.xml
Chinese – zh.xml
German – de.xml
Spanish – es.xml
Arabic – ar.xml
Thailand – th.xml

Working Through

You can create one of these above languages file and submit to me on adk18kp@gmail.com. Your name will then be added to credits section (kindly submit your name with your profile link. I won’t add your name directly due to privacy issues).

To getting started with creating one, lets view this file.

<doc>
<File>&File</File>
<View>&View</View>
<Edit>&Edit</Edit>
<Encoding>&Encoding</Encoding>
<lang>&Language</lang>
<project>&Project</project>
<Debug>&Debug</Debug>
<Build>&Build</Build>
<Tools>&Tools</Tools>
<admint>Admin &Tools</admint>
<Window>&Window</Window>
<Help>&Help</Help>

<!-- File Menu -->

<New>&New</New>
<New_file>New &file</New_file>
<Import>&Import</Import>
...
...
</doc>

Now what you have to do is to add relevant replacement of text to this xml strings. Its a very big file about 18KB containing about 400 lines. So you need to replace them with your language and submit it to me 🙂

Note: Do not remove those text from the string if possible. Those are symbol for & in HTML and that it used by ADK to set a shortcut key for the option.

To test your language place the language file into lang folder with one of the above (mentioned) language code and change your language of ADK from settings menu

Settings | Configuring it

This guide is synchronized as per ADK 0.9.5.0 release

Settings menu consists of three tabs General (which contain some basic options), Environment (which contains some import path filling) and System (which is relevant to ADK only)

General

Following are the details of each check options

  • Show java tab as new text editor: Remember the feature of ADK which allows you to view Java code of Smali. If you’ve seen this then you must know that the viewing tab is stick to Output tab. When this is checked it will add the java file as a new file in editor window.
  • Clear log cat in each session: When using Option Debug > Android Logcat, this will clear logcat of previous session If saved on device.
  • Remove selected Do Not Show Message: There are some options which shows some dialog when using it and in that dialog there is a feature of “Do not show again” this will hide dialog from not showing everytime you used it. By clicking this button will remove all those saved instances of Message Box.
  • Check for updates: (Not for trial users) This will check for regular updates within the ADK and will let you know in each new session. For trial users, keep an eye over blog post in ADK as new updates will be notified here so you have to manually download and install it.
  • Start console at startup: Disables console window to load up at the beginning of ADK instance.
  • Check ADB frequently: This will disables scanning of connected ADB devices. (It helps to reduce memory consumption on low-spec devices, again IMP: some options may get disable due to it.)
  • Hide Start Page at startup: This will not show Start Page at start up.
  • Show autocomplete menu: Remember the feature of ADK to show auto suggest menu whenever you type something. This will enable or disable it.
  • Remind me about trial days: When not checked it will disable the pop up box shown at every start up when you launch ADK showing you your remaining trial days.
  • Clear Recent Projects: This will clear all recent project history. (Note: It will not delete all your projects)
  • Edit logo.bin sizes: Logo.bin is a raw file containing all your logo images of your device. When you actually load a logo.bin project in ADK. A tool convert this into a proper rgb format. From there it matches all the dimension sizes from a text file to convert it into proper png format. This option will allow you to edit that text file. (Note: If you are facing some issues that why my png are damaged in logo.bin project, editing this file and adding new dimensions will fixed it)

Environment Variables

This is one of the most important thing you must fill immediately after you install ADK.

From here you must set your Python (which is optional), JDK, Android SDKPlatform and FFmpeg path (Just click on Browse button and browse for your path. Read the description of the dialog box to make you clear what it wanted you to browse). FFmpeg will be used for creating bootanimation from videos or gif, you can’t proceed without this.

Heap Size will allow you to choose Java Heap size for editing Apk and Java Decompiler Project. You know how irritating is java when you run it. OMG even if you are using a high-spec PC, trust me you will feel that heat.

System

This tab (as of now) contain one option which allows you to change ADK language. All language xml should be present in lang folder. Currently it is in English only, but if you want you can define your own language and submit to me. How? Just read this

Getting your Unique ID

ADK creates a unique ID for every PC during installation which is different from other PC’s. This ID will help you to get license key. Therefore it must be included when writing an email to me.

Working Through

In ADK when you launch it you will get a pop up of showing trail period in ADK. There you will find a box which shows your ADK unique ID.

Now suppose in a case where your trial period has expired. In such case ADK won’t show this dialog and automatically exits. In such case your Unique ID can be found in appsettings.xml in ADK folder

Here you can see that BE1UPI-KB0FTU-HLLOI2-1NF18L9 is my Unique ID you have to include this key in your email post.

Design a site like this with WordPress.com
Get started