[SOURCE CODE][DEV TOOL][SDK 21+]6thGear RomControl v2.+ for Devs

Search This thread

thereassaad

Recognized Contributor
Aug 22, 2013
7,620
9,713
Bierut
Ye I tried Clean Project option already. The error appeasers right after compiling a clean build or any change. Though no error on building the app.



Uninstall Android Studio completely from everywhere on ur pc , then after uninstall it & deleted all files & folders related to a.s restart ur pc then reinstall it again with updated everything all plugins , repository , gradle , then. Try it again , only this way fixed my errors when i start working on v2.1 , ..
 
  • Like
Reactions: micky387 and Kamy

Kamy

Senior Member
Aug 29, 2012
5,335
19,304
Beijing
Uninstall Android Studio completely from everywhere on ur pc , then after uninstall it & deleted all files & folders related to a.s restart ur pc then reinstall it again with updated everything all plugins , repository , gradle , then. Try it again , only this way fixed my errors when i start working on v2.1 , ..
Great. Thanks mate. Would do and report.

Sent from my SM-G935F using Tapatalk
 

edzamber

Senior Member
Feb 21, 2012
3,881
3,674
Hi all,

Just a question : how to add command for exemple : app:dependentValue="1" in others xml than ui_prefs.xml, for exemple in notification_panel_pref because studio can't build apk because an unbound prefix. There is no notification_panel fragment.

So i can only use this in ui_prefs.xml,
Solved !!!!

Many Thanks to @thereassaad for his tip [emoji6]

http://forum.xda-developers.com/showthread.php?p=68670992


So for use command as app:packageName ToKill, app:dependentValue, or any other commands witch are working in ui_prefs.xml into all others xml prefs :

Exemple for phone_prefs.xml

I replace at the beginning of xml :

Code:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

By

Code:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
 
Last edited:
  • Like
Reactions: sonnguyenpg

amtra

Senior Member
Jun 28, 2012
1,506
1,005
29
Chennai
i have got this during gradle built any one help me a im building RC for the first time..

PHP:
4:43:11 PM Gradle sync started
4:43:31 PM Gradle sync failed: Unable to start the daemon process.
           This problem might be caused by incorrect configuration of the daemon.
           For example, an unrecognized jvm option is used.
           Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
           Please read the following process output to find out more:
           -----------------------
           Error occurred during initialization of VM
           Could not reserve enough space for object heap
           Error: Could not create the Java Virtual Machine.
           Error: A fatal exception has occurred. Program will exit.
           Consult IDE log for more details (Help | Show Log)
4:43:47 PM Error Loading Project: Cannot load 2 modules Details...
 

thereassaad

Recognized Contributor
Aug 22, 2013
7,620
9,713
Bierut
i have got this during gradle built any one help me a im building RC for the first time..

PHP:
4:43:11 PM Gradle sync started4:43:31 PM Gradle sync failed: Unable to start the daemon process.           This problem might be caused by incorrect configuration of the daemon.           For example, an unrecognized jvm option is used.           Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html           Please read the following process output to find out more:           -----------------------           Error occurred during initialization of VM           Could not reserve enough space for object heap           Error: Could not create the Java Virtual Machine.           Error: A fatal exception has occurred. Program will exit.           Consult IDE log for more details (Help | Show Log)4:43:47 PM Error Loading Project: Cannot load 2 modules Details...




Delete all gradle golders / files from everywhere on ur pc then try to sync it again & let it got the updated by itself or u need to launch the latest gradle versions check google about this ,,
 

yash92duster

Senior Member
Jan 31, 2015
13,138
15,830
Chennai
Need some help
i have build the rc and it runs fine in emulator and in phone

when sharing to git -> success
but all files are not getting synced

See this pics all the green and red marked files are not present in git
1.png
2.jpg
3.png

For two drawable images its marked as red and is not present in git account
and new xml prefs are marked green and not shown in git
but its showing in rc fine
4.png5.png
when i click->> Validate for some of those red files I get This error
Error:(1, 56) schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
Error:(1, 56) s4s-elt-schema-ns: The namespace of element 'x' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
Error:(5, 39) cvc-elt.1.a: Cannot find the declaration of element 'vector'.
Error:(1, 56) s4s-elt-invalid: Element 'x' is not a valid element in a schema document.
C:\Users\Yashwanth\AndroidStudioProjects\6thGear-RomControl-v2.0\app\src\main\res\drawable\ic_button.xml

C:\Users\Yashwanth\AndroidStudioProjects\6thGear-RomControl-v2.0\app\src\main\res\xml\button_prefs.xml
Error:(2, 78) cvc-elt.1.a: Cannot find the declaration of element 'PreferenceScreen'.

My github link
https://github.com/yash92duster/Wanted_Rom_Control/tree/master/app/src/main/res

Sorry if i shouldn't ask this but i cant find any proper solution
thanks in advance:)
 
Last edited:

daxgirl

Senior Member
Jun 30, 2012
4,047
9,165
Jerusalem
Need some help
i have build the rc and it runs fine in emulator and in phone

when sharing to git -> success
but all files are not getting synced

See this pics all the green and red marked files are not present in git
View attachment 3884091
View attachment 3884092
View attachment 3884093

For two drawable images its marked as red and is not present in git account
and new xml prefs are marked green and not shown in git
but its showing in rc fine
View attachment 3884100View attachment 3884101
when i click->> Validate for some of those red files I get This error
Error:(1, 56) schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
Error:(1, 56) s4s-elt-schema-ns: The namespace of element 'x' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
Error:(5, 39) cvc-elt.1.a: Cannot find the declaration of element 'vector'.
Error:(1, 56) s4s-elt-invalid: Element 'x' is not a valid element in a schema document.
C:\Users\Yashwanth\AndroidStudioProjects\6thGear-RomControl-v2.0\app\src\main\res\drawable\ic_button.xml

C:\Users\Yashwanth\AndroidStudioProjects\6thGear-RomControl-v2.0\app\src\main\res\xml\button_prefs.xml
Error:(2, 78) cvc-elt.1.a: Cannot find the declaration of element 'PreferenceScreen'.

My github link
https://github.com/yash92duster/Wanted_Rom_Control/tree/master/app/src/main/res

Sorry if i shouldn't ask this but i cant find any proper solution
thanks in advance:)
Right click on files which are not synced > Git > add
Then commit and push changes again.

And yeah you can find proper solutions. Android studio git supports is well documented and you only needed to google. Tons of advice and answers on Google documentation and stackoverflow.

Sent from my SM-N920C using Tapatalk
 

edzamber

Senior Member
Feb 21, 2012
3,881
3,674
Hi all,

Is there a way for RC2.1 to auto switch ? I explain : i use a mod witch show Analog clock in Lockscreen instead of stock numeric one.

If i switch off Normal clock i would like to Analog clock switch on automaticly and virse-versa.

Is it possible ?
 
  • Like
Reactions: sonnguyenpg

daxgirl

Senior Member
Jun 30, 2012
4,047
9,165
Jerusalem
Hi all,

Is there a way for RC2.1 to auto switch ? I explain : i use a mod witch show Analog clock in Lockscreen instead of stock numeric one.

If i switch off Normal clock i would like to Analog clock switch on automaticly and virse-versa.

Is it possible ?
Did you miss the reverse dependency or what's wrong with you??? ???

Sent from my SM-N920C using Tapatalk
 

edzamber

Senior Member
Feb 21, 2012
3,881
3,674
Did you miss the reverse dependency or what's wrong with you??? ???

Sent from my SM-N920C using Tapatalk
No i do reverse dependency but it only disable second switch if first one is not enable. It not put on first and put off second off automaticly and virse-versa. So like a command :

if first switch is on then second switch is off

if first switch is off then second switch is on

Or i miss something...
 
Last edited:

daxgirl

Senior Member
Jun 30, 2012
4,047
9,165
Jerusalem
No i do reverse dependency but it only disable second switch if first one is not enable. It not put on first and put off second off automaticly and virse-versa. So like a command :

if first switch is on then second switch is off

if first switch is off then second switch is on

Or i miss something...
Oh I see. You want cross setChecked... That needs java edits, dear.

Sent from my SM-N920C using Tapatalk
 

daxgirl

Senior Member
Jun 30, 2012
4,047
9,165
Jerusalem
Hi @daxgirl

I want add more themes without default themes on rom control v2

On rom control v1 more easy but on v2 is little more difficult..

You can help me with it..

Thanks!

Is that a question? Are you asking if I can help you with it? Because if you are, the answer is in the op. No theming questions allowed. No theming requests. This is not an application, this is a source code. It comes with no support and no warranty. Anything you do with it is your right and responsibility.

If you're telling me that I can help you with it, well... in that case... LOL
 

daxgirl

Senior Member
Jun 30, 2012
4,047
9,165
Jerusalem
Hummm i don't hide you that i'am noob with java langage
You're a noob with any language, my friend. Nevertheless, this is not a request thread. We gave you a code, you can do what you want with it. Including java edits. It is your right. So go ahead and make an edit to cross switch. Read on SO, read on documentation. You can do it.
 

asc1977

Senior Member
Apr 15, 2012
5,330
6,989
Schwetzingen
Please how i can call this in Rc?
<dashboard-tile android:icon="@drawable/ic_setting_grid_autostarts" android:id="@id/autostarts_settings" android:title="@string/autostarts_title" android:fragment="com.android.settings.autostarts.LewaManageAutostarts" settings:tilecategoryid="@id/system_section" settings:removetileapps="KIOSKCONTAINER" />


Sent from my SM-N930F using XDA-Developers mobile app
 

asc1977

Senior Member
Apr 15, 2012
5,330
6,989
Schwetzingen
Please how i can call this in Rc?
<dashboard-tile android:icon="@drawable/ic_setting_grid_autostarts" android:id="@id/autostarts_settings" android:title="@string/autostarts_title" android:fragment="com.android.settings.autostarts.LewaManageAutostarts" settings:tilecategoryid="@id/system_section" settings:removetileapps="KIOSKCONTAINER" />

Nobody a idea?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 55

    6htGear Rom control V2.1
    By @Wuby986 & Daxgirl


    Hello everyone!

    So here we go again... V2.0

    Big thanks:
    We would like to begin from crediting people, who gave us ideas, inspiration and, most importantly, their free time, in order to make v2.0 a reality.
    To our dearest friends and talented developers, @tdunham and @DaOldMan:
    Guys, you OWN this. You made this happen. You pushed us and we pushed you, and together, you, us and rom control, have grown to be what we are today.
    No thanks can ever be enough for long nights of applying patches, merging sources, connecting through teamviewer and working out kinks together. @Wuby986 and I are forever in your debt.


    Why different thread?
    1. The entire application is different. It barely qualifies as an update anymore.
    2. All the preferences are different. The way they work is different. It requires new way of doing things. Radically new.
    3. new support library and new basic structure.
    4. To sum it up... it's too different to maintain same thread for both versions

    Project characteristics:
    1. Rom control is an open source project, designed to provide rom builders with a core code for compiling android application for controlling core functions of their roms and mods through Content Provider of Settings.System sqlite table
    2. Rom control is designed with consideration of the fact that most rom builders do not have sufficient skills in original android development to build application with this functionality on their own
    3. The emphasis is given in this version (even more than previous one) to outsource most conditions and attributes to xml, and so to minimize the need of the user (rom builder) to be subjected to java programming
    4. In addition to familiar utilization of ContentResolver to pass data between RomControl and system, the project offers additional properties, such as file based preference, URI selection preference, Direct intent to shortcut app preference, preference listing image thumbnails for previews, script running preference, automated template for "About Us" section, automated dialog for changelog, backup and restore finctionality and more.
    5. The project is designed to be compiled in Android Studio using the latest sdk tools and gradle tools.
    6. The project essentially is designed to be a system application with privileged access, and therefore needs to be installed in /system/priv-app to be granted some of its permissions
    7. The project requires root access for some of its functionality. Mainly running shell scripts with su and killing some app processes.

    License and sharing policy:
    1. This project is distributed under GNU General Public License as open source code. The copy of said license can be obtained and reviewed here
    2. As such, this project is protected from claiming exclusivity by anyone.
    3. Any developer wishing to use this code, with accordance to the license, must provide full source code for each updated version. That means, for any new version of the rom including updated RomControl application, a link to full source code of the latest version must be provided.
    4. By modifying and using this code, you automatically accept the License conditions and must be compliant with GPL, as stated below:
    You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
    5. You're under no obligation to thank us, credit us or tag us in your official postings while distributing your copy.
    6. You ARE, however, prohibited from removing our copyright information from our source code.
    7. You are obligated to keep the code open under GPL. Failure to provide sources for updated copies of your work will result in complaint first to XDA officials for license infringement and further to GPL legal department.
    8. Using the source code on any other forum outside of xda is of course allowed with accordance to the license and sharing policy, provided the sources are kept open and obtainable by anyone.
    9. Using apktool to compile a copy of this code after making changes in the decompiled form of someone else's application is strictly prohibited, as the developer will not be able to provide full open source of their version. Any illegal use of any copy of this project can be and should be legally stopped by the owner of the code copy.
    10. This voids rule number 12 of xda promising a developer exclusivity over their product. This product is yours, but the code belongs to the public. You are NOT TO HOLD COPY OF ROM CONTROL EXCLUSIVE.
    To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.

    For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

    Open source libraries included in this project:
    1. RootTools by Stericson
    2. Sergey Margaritov's ColorPickerPreference modified to adopt to our needs
    3. CircleImageView by hdodenhof

    Project requirements:
    1. Installed and updated android sdk, including but not limited to:
    Android SDK Build-Tools 24
    Android SDK Platform-Tools 24
    Android support repository 33
    Google repository, rev 29
    Latest android support library

    2. Android studio version AT LEAST the latest stable version (currently 2.1.2), you can use the canary channel as well, currently on 2.2.0 preview 5.
    3. Updated gradle tools
    4. Working knowledge of importing project into Android Studio and troubleshooting gradle sync. If you don't know how to, Google it.
    5. EXTENSIVE knowledge in android modding:
    This project is for rom developers and modders. It helps coordinate between your users and your mods. If you don't build roms or don't have mods, this project means nothing to you.

    What support you can expect to get:
    1. Code explanation regarding major functionality
    2. Adding new preferences and navigation items

    What support you CANNOT expect:
    1. Setting up android studio
    2. Debugging gradle issues and compiling
    3. Changing colors, strings, adding themes, design, changing setup... - Android documentation is vast and Stackoverflow is even vaster.
    4. Smali modding
    5. Private messaging support - DO NOT EVEN TRY
    6. Asking for compiled apk file.

    This is NOT an application thread. This is NOT an application. This is a SOURCE CODE for MAKING application.
    The answer to a question "Can someone give me a compiled version" is "And what are you going to do with it?"

    Project main Git repository:
    Here

    Thread list of contents:
    1. Starting the project
    2. Adding navigation drawer items
    3. Running android app: where, how, builds, gradle tasks and you-name-it
    4. Preferences - Part 1: Introduction
    5. Preferences - Part 2: Types of preferences
    6. Themes, About Us activity and Changelog dialog
    7. Backup and Restore

    XDA:DevDB Information
    6thGear RomControl v2.0, Tool/Utility for all devices (see above for details)

    Contributors
    daxgirl, wuby986, tdunham, DaOldMan

    Version Information
    Status: Testing
    Current Stable Version: 2.1
    Stable Release Date: 2016-08-26

    Created 2016-07-06
    Last Updated 2016-08-26


    Latest Update details:
    Post number 195
    23

    Step 1 - Importing the project:

    1. Perform full installation of the latest stable version of Android Studio in your environment. You can find info about stable and canary releases here

    2. You can have more than one version of android studio installed on single platform. For more information please read further on the same page in section Using Multiple Android Studio Versions. I personally do recommend the latest canary build, which is currently AndroidStudio 2.2.0 preview 5. But you can always go with the stable release. Or beta channel.

    3. Make sure your sdk is updated, including sdk for platform 24 (nougat). The compile sdk for this project is 24.

    4. Make sure your support repositories are configured and updated.

    5. Click on our github repository link on the OP first post and make sure you're connected with your github account. If you don't have one - create it! Why? because you will need to share your sources for this project. And because you all use as mantra that you can mod android apps because it's open source. So BE OPEN SOURCE. Have your name on github.

    6. Once you're logged in into github, fork our repository. In the right upper corner of our main git repository you have those buttons:
    git-fork.PNG

    Click "fork" to make a copy of this repository in your own repositories. Now you have your own repository.

    7. On YOUR repository find this green button on the top right above the code, which says "Clone and Download". DO NOT DOWNLOAD ZIP. Instead, click the little "clipboard" icon to copy the .git uri and return to studio.

    8. In studio: File > New >Project from Version Control > Git

    9. Paste the git uri and choose destination. Click ok. Android studio will import the project from git and open it for you.

    10. At this point if you're asked to update gradle build tools or anything else, do it. Wait for gradle to sync with project files. If you get errors, resolve them as referenced. If you cannot, google is your friend.
    We WILL provide some support for initial importing of the project and setting it up for a very limited period of time. Gradle can be a tricky business. Please be sure to provide us with specific error from gradle log and a line in the gradle script on which the error is made.

    11. We WILL know if your errors are because you didn't update sdk and build tools. And we will kick your butts for posting without following instructions. Remember, our time is valuable and given to you for free. Our instructions are clear and we made a huge effort to write them. If you can't be bothered with following them, beware.

    12. Once the gradle is done syncing without errors, just in case, click Build > Rebuild Project. Once that is done without errors and it says BUILD SUCCESSFUL, you can start building your project following the instructions on the next post.

    23

    Adding items to the Navigation Drawer:

    1. Switch to project view.

    It will be easier for you to navigate through project files. For that:
    On the left panel on top, below the android studio menu, find this:
    app_view.PNG

    This is what your project will look right after you import it. This is module view. By default it is categorized and to work with it you need some understanding of this view.

    Click the 2 arrow icon which is circled in blue and select "project"
    Your structure will now change.
    Navigate into the project by the following path: Project name > app > src > main
    Now you will see directories, like: java, res, assets... and so on.
    project-view.PNG

    This is your working directory. You will be making your code changes here.​

    2. Find a file called nav_drawer_arrays.xml. It is located in res/values folder. Double click on it to open.
    You will see the following 3 arrays inside. The first one is a reference array (simple typed array) and the other 2 are strings arrays.
    Those are WORKING ARRAYS. When you run the app as it is now, you will see all the items created in the navigation drawer based on this info.
    Please read the comments we wrote in the xml file for you:​
    Code:
    <resources>
        [COLOR="Green"][B][I]<!--The following array is for icons you want to use for your items
        You can create new icons bu right clicking the drawable folder and choosing
        New vector drawable
        You have a great selection of items in xml vector format.
        Those are supported starting lollipop.
        YOU SHOULD NOT USE PNG. not even material one. Vectors will work best with any device density.
        
        Once you have created the vector, reference it as regular drawable in the array below.
        
        MAKE SURE THE ITEMS IN ALL 3 ARRAYS CORRESPOND IN ORDER AND ALL 3 ARRAYS ARE SAME LENGTH-->[/I][/B][/COLOR]
        <array name="nav_menu_prefs_drawables">
            <item>@drawable/ic_system_ui</item>
            <item>@drawable/ic_phone</item>
            <item>@drawable/ic_framework</item>
            <item>@drawable/ic_notification_panel</item>
        </array>
    
        
        [COLOR="green"][B][I]<!--This array is for your items titles.
        Use @string reference, so later on your app can be translated with ease
        KEEP THE ORDER BETWEEN ALL YOUR ARRAYS-->[/I][/B][/COLOR]
        <string-array name="nav_menu_prefs_titles">
            <item>@string/systemui_prefs</item>
            <item>@string/phone_prefs</item>
            <item>@string/framework_prefs</item>
            <item>@string/notification_panel_prefs</item>
        </string-array>
    
        
       [COLOR="green"][B][I] <!--This array is the most valuable one
        
        Here you put the file names of the preference files you create in your xml directory
        THEY MUST BE PRECISE AND CASE SENSITIVE!!! DO NOT ADD .xml SUFFIX-->[/I][/B][/COLOR]
        <string-array name="nav_menu_xml_file_names" translatable="false">
            <item>ui_prefs</item>
            <item>phone_prefs</item>
            <item>framework_prefs</item>
            <item>notification_panel_prefs</item>
        </string-array>
    </resources>

    3. Let's say you have 10 preference files in directory called xml. That means you will want to have 10 items referring to your preference files in the navigation drawer. That means you will need to have 10 items in EACH array. Create 10 empty preference files. DO NOT COPY THE ONES FROM RC v1.0. Just right click the xml folder, choose "New" and choose "New XML resource file". Give it a name and click ok. Leave them empty for now. create all the icons you need for them in the navigation drawer.

    4. Populate the arrays with titles, icons and xml names. You're done. You now have a working items in the navigation drawer. You do not need any changes in java files. the items are being generated on run time and their onClicks redirected accordingly. If you run the app right now you should have 10 empty preference files.

    We strongly encourage you to keep the ui_prefs.xml file and references to it in your project while you're working on it. It contains most valuable information about the kinds of preferences we have included and their various usages. You can remove it from arrays before making the release version. You can have it as last item in your arrays and use it as test dummy to see how things should work properly
    23

    Preferences - Part 2: Types of Preferences

    1. Two state preferences (meaning - can be true or false)

    MySwitchPreference & MyCheckboxPreference

    SmartSelectImage_2016-07-14-03-27-41.png

    SmartSelectImage_2016-07-14-03-37-44.png

    Code:
       [COLOR="Teal"][B] <!--Following category shows variety of two state preferences-->[/B][/COLOR]
        <PreferenceCategory
            android:title="Two stated preferences test category">
    
           [COLOR="DarkGreen"][B] <!--Normal Switch preference-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MySwitchPreference
                android:defaultValue="true"
                android:key="normal_test_switch"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Normal test switch"/>
    
            <!--Switch preference which will throw a dialog that app reboot is required-->
            <com.wubydax.romcontrol.v2.prefs.MySwitchPreference
                android:defaultValue="true"
                android:key="kill_app_with_dialog_test_switch"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Kill app with dialog switch"
                app:isSilent="false"
                app:packageNameToKill="com.android.systemui"/>
    
           [COLOR="darkgreen"][B] <!--Switch preference which will in ADDITION to actual work, also silently restart app with given package-->
            <!--Note, that isSilent attribute is by default TRUE. So you don't need to specify it if you want silent app restart-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MySwitchPreference
                android:defaultValue="true"
                android:key="kill_app_silently_test_switch"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Kill app silently test switch"
                app:packageNameToKill="com.android.contacts"/>
    
           [COLOR="darkgreen"][B] <!--Switch preference which will throw a dialog that following it's action device reboot is required-->
            <!--Please note, even if you specify the need to kill app, once the rebootDevice attribute is TRUE, kill app attributes are ignored-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MySwitchPreference
                android:defaultValue="true"
                android:key="reboot_required_test_switch"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Switch reminding of need to reboot"
                app:rebootDevice="true"/>
    
            [COLOR="darkgreen"][B]<!--We can use kill app on checkboxes as well. Same goes for rebootDevice-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MyCheckBoxPreference
                android:defaultValue="true"
                android:key="test_checkbox_with_kill_app"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Kill app checkbox"
                app:isSilent="false"
                app:packageNameToKill="com.android.systemui"/>
        </PreferenceCategory>

    FilePreference
    SmartSelectImage_2016-07-14-03-40-03.png

    Code:
    <PreferenceCategory
            android:title="File preferences">
            [COLOR="darkgreen"][B]<!--File preference is a very special kind of preference, which works like switch but has different output.
            Normal switch preference, like any two state preference, write boolean true/false into preferences.
            In our app it also writes 1/0 into database.
    
            File preference doesn't write into database. If it is switched on, it creates a file in our app directory in data.
            That name of that file is what you set as key.
    
            This is widely used by [user=1042140]@tdunham[/user] for global boolean needs in systemui.
            Please refer to his guide about setting global boolean to see appropriate smali application for this preference.
    
            This is most useful for mods in smali files where you do not have context access to get content resolver.
            Because File class is native java class and checking for it's existence does not require android context.
    
            File preferences can have attribute to kill app or reboot device.-->[/B][/COLOR]
    
    
           [COLOR="darkgreen"][B] <!--This is a simple file preference. Note that once it's switched on, a file with the name identical to key is created in
            /data/data/com.wubydax.romcontro.v2l/files
            When it's switched off the file is deleted.-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.FilePreference
                android:key="new_file"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="New file preference"/>
    
    
           [COLOR="darkgreen"][B] <!--This file preferences upon change will prompt to kill app-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.FilePreference
                android:key="another_file"
                android:summaryOff="Disabled"
                android:summaryOn="Enabled"
                android:title="Kill app file preference"
                app:isSilent="false"
                app:packageNameToKill="com.android.systemui"/>
        </PreferenceCategory>

    2. Dialog preferences
    ColorPickerPreferece

    Custom attributes:
    alphaSlider, hexValue - both booleans, TRUE by default
    SmartSelectImage_2016-07-14-03-38-05.png

    Code:
    [COLOR="Teal"]<!--The following category demonstrates various ways of using ColorPickerPreference-->[/COLOR]
        <PreferenceCategory
            android:title="Color pickers test category">
    
            [COLOR="DarkGreen"][B]<!--Normal color picker preference-->
            <!--Please note, the [COLOR="Red"][U]hexValue and the alpha are there by default now[/U][/COLOR]. If you want to cancel them, you need to specify false-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
                android:defaultValue="#ffccdd"
                android:key="test_color_preference"
                android:title="Normal test color picker"/>
    
            [COLOR="DarkGreen"][B]<!--Color picker preference without the alpha slider and without the hex value
            You can set false to both or one of them-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
                alphaSlider="false"
                hexValue="false"
                android:defaultValue="#ffffff"
                android:key="no_alpha_color_key"
                android:title="Color picker with no alpha or hex"/>
    
            [COLOR="darkgreen"][B]<!--Color picker preference with kill app option
            Note, [U]you can also use rebootDevice attribute[/U], like with two stated preferences-->[/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
                android:key="app_kill_color_key"
                android:title="Color picker with app kill"
                app:isSilent="false"
                app:packageNameToKill="com.android.systemui"/>
        </PreferenceCategory>

    MyListPreference
    Custom attributes:
    app:dependentValue - will enable you to set dependencies upon choosing selected value. If a dependent value is selected by user, the dependent preference will become disabled.
    Screenshot_20160714-033854.png

    Code:
    [COLOR="DarkGreen"][I]<!--Example of simple list preference with radio button items
            You absolutely HAVE to set dafaultValue and it has to be one of your entryValues string arrays
            You can use any of the following with kill app attributes or rebootDevice attribute
            
            Note, that you can now use dependency on list preference. 
            Custom attribute app:dependentValue will allow you to decide which list item, if selected, 
            will set dependent preferences disabled.-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MyListPreference
                android:defaultValue="20"
                android:entries="@array/test_list_entries"
                android:entryValues="@array/test_list_values"
                android:key="test_list_key"
                app:dependentValue="1"
                android:title="Choose items from the list preference"/>

    ThumbnailListPreference
    Custom attributes:
    app:dependentValue - will enable you to set dependencies upon choosing selected value. If a dependent value is selected by user, the dependent preference will become disabled.
    app:drawableArray - references array which provides resources for the thumbnail images for each list item
    app:entryList - references array of strings to provide names for actual list items
    app:entryValuesList - references array of strings for the entry values to be written to preferences and database for selected list item
    Screenshot_20160714-033901.png

    Code:
    [COLOR="darkgreen"][I] <!--Thumbnail list preference is a special kind of preference which allows you to show preview of the selected image
            This can be useful f.e. for setting custom bg to toggles in systemui
            Needless to say you need to put the same images you put in systemui in Rom Control in drawables
            And you need to create 3 kinds of arrays in arrays.xml file. 2 string arrays for entryList and entryValuesList and one simple array
            for drawable references. You can see the arrays for the following preferences inside arrays.xml
            You have to set default and the default has to be one of entryValuesList strings-->
    
            <!--Example of simple Thumbnail preference with no additional attributes-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.ThumbnailListPreference
                android:defaultValue="1"
                android:key="test_thumbnail_key"
                android:title="Simple thumbnail preference"
                app:drawableArray="@array/thumbnail_drawables"
                app:entryList="@array/thumbnail_items"
                app:entryValuesList="@array/thumbnail_values"
                app:dependentValue="2"/>
    
            [COLOR="darkgreen"][I]<!--Example of Thumbnail preference which calls to kill app upon selected item-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.ThumbnailListPreference
                android:defaultValue="2"
                android:key="test_thumbnail_kill_app"
                android:title="Kill app thumbnail preference"
                android:dependency="test_thumbnail_key"
                app:drawableArray="@array/thumbnail_drawables"
                app:entryList="@array/thumbnail_items"
                app:entryValuesList="@array/thumbnail_values"
                app:isSilent="false"
                app:packageNameToKill="com.android.systemui"/>

    IntentDialogPreference
    Custom attributes:
    app:intentSeparator - to allow you to set the char which will separate the package name from activity name in the intent component name
    app:showSearch - boolean attribute which determines whether search field will be available in the dialog window. By default it's TRUE. If you want no search, set to FALSE
    Screenshot_20160714-033913.png

    Code:
    [COLOR="DarkGreen"][I]<!--The following preference is a special preference that's called IntentDialogPreference
            This preference allows you to choose an app from the list. it also conveniently includes search field
            This preference writes into database what's called component name for specific system needs.
            When we want to call an app in android, we need to provide some information as to which app we want to launch
            and which activity inside that app we want to lunch.
            Launching app by combination of those is called explicit intent. Explicit intent needs 2 things to run an app:
            1. Package name
            2. Activity or service name
    
            This preference is most useful for launching an specific app based on info you can fetch from database
            For example on double click on home key
    
            Intent dialog preference puts the info for explicit intent in a string. First package name, then separator, then activity name
    
            You can use any separator you want. The default separator is "##"
            But as you can see in following example we set the separator to be forward slash "/"
            The separator depends on how you build the mod in smali for your needs.
    
            Any kill app or reboot device attributes are applicable here as well-->
    [/I][/COLOR]
    
            [COLOR="darkgreen"][I]<!--This specific IntentDialogPreference has defaultValue set to Settings app.
            You DO NOT need to set default. Only if you want to. But it is in most cases not necessary and even not that good.
            This is just an example. When you run this, you will see that the preference has an icon of the chosen app on the right
            and a name of the app set as summary. When you choose a new app, those things change-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.IntentDialogPreference
                android:defaultValue="com.android.settings/com.android.settings.Settings"
                android:key="test_intent_with default"
                android:title="Select Test App with default"
                app:intentSeparator="/"/>
    
            [COLOR="darkgreen"][I]<!--This IntentDialogPreference comes with no default and no separator. So default separator will be applied "##"
            and it also has no search showing-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.IntentDialogPreference
                android:key="test_intent_without default"
                android:title="Select app, no default, no search, ## separator"
                app:showSearch="false"/>
    
            [COLOR="darkgreen"][I]<!--This preference will prompt to reboot device upon selection
            This is useful if f.e. you use it to set default app to open when home button is double clicked
            Reboot is advised but not necessary immediately. So user will be shown a dialog to let them know they need to reboot
            And they can reboot immediately or later-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.IntentDialogPreference
                android:key="test_intent_without_default"
                android:title="Select app and reboot device"
                app:intentSeparator="/"
                app:rebootDevice="true"
                app:showSearch="true"/>

    MyEditTextPreference

    Screenshot_20160715-091142.png

    Code:
    [COLOR="DarkGreen"][I][B] <!--Edit text preference is a dialog preference that allows you to enter custom text-->[/B][/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.MyEditTextPreference
                android:defaultValue="test"
                android:key="test_edit_text_key"
                android:title="Input custom text"/>


    3. Special Preferences
    OpenAppPreference

    Custom attributes:
    app:componentName - string type attribute to provide package name and desired activity name to open installed app. Please pay attention to instructions in code.
    SmartSelectImage_2016-07-14-03-40-33.png

    Code:
     [COLOR="darkgreen"][B][I]<!--The following category shows usage of  special preference we use to open an app based on component info
        All you need to provide for this preference is package name and activity name separated by forward slash "/" like shown below
        We will split the component info into components and check if the app is installed
        if it's installed, we will show the app icon as preference icon and app name as title
    
        If the app is not installed the preference is automatically removed from the list.
    
        You can set your own summary to explain about the app.
    
        If you wish to show a custom icon for that app shortcut or have custom title,
        if you wish to use custom icon or custom title, like you would do normally with preference,
        You are free to use android:title and android:icon attributes.
        Our class will then use the items you chose instead of the application title and icon.
    
        This WILL NOT affect the intent for opening application. It's a cosmetic measure for your convenience.-->[/I][/B][/COLOR]
        <PreferenceCategory
            android:title="Shortcut to apps preferences">
    
    [COLOR="darkgreen"][B][I]        <!--Example of simple app shortcuts. If those apps are not installed, the preferences will not show-->
    [/I][/B][/COLOR]        <com.wubydax.romcontrol.v2.prefs.OpenAppPreference
                android:summary="Application to browse your files, including root files"
                app:componentName="com.speedsoftware.rootexplorer/com.speedsoftware.rootexplorer.RootExplorer"/>
    
            <com.wubydax.romcontrol.v2.prefs.OpenAppPreference
                android:summary="Control samsung's toolbox, turn it on or off, choose available apps and rearrange them"
                app:componentName="com.wubydax.toolboxsettings/com.wubydax.toolboxsettings.ToolboxSettings"/>
    
    [COLOR="darkgreen"][B][I]        <!--Example of OpenAppPreference with custom title and icon-->
    [/I][/B][/COLOR]        <com.wubydax.romcontrol.v2.prefs.OpenAppPreference
                android:summary="Choose what app or shortcut to open when TW launcher is being swiped to the magazine page"
                android:title="Shortcut to GearTWSwipe"
                android:icon="@mipmap/ic_launcher"
                app:componentName="com.wubydax.geartwswipe/com.wubydax.geartwswipe.ResetDialogActivity"/>
    
    [COLOR="darkgreen"][B][I]        <!--Open app preference with only cuctom title and the icon which is loaded from the app-->
    [/I][/B][/COLOR]        <com.wubydax.romcontrol.v2.prefs.OpenAppPreference
                app:componentName="eu.chainfire.supersu/eu.chainfire.supersu.MainActivity-Material"
                android:title="Chainfire's SuperSu App"
                android:summary="Manage root permissions for apps and services"/>
        </PreferenceCategory>


    UriSelectionPreference

    SmartSelectImage_2016-07-14-03-39-41.png

    Code:
    <PreferenceCategory
            android:title="Select image preferences">
            [COLOR="darkgreen"][B][I]<!--Select image preferences allow the user to select any image from the gallery.
            The uri for that image will be written into the database
            Android can fetch images based on their uri (universal resource identifier).
            A type of uri that you all know is called URL, which is a web address.
            Uri for database is the "address" of an item inside the database.
            In android we have Media database, which hosts info about media items. In our case we are interested in images.
    
            Upon clicking this preference a Gallery will launch, upon selecting image, it's uri will be written into database.
            In your mods you can fetch the string, convert it to Uri and set that image as background to anything you want.
            We use this method for setting custom image in our mod for background to notification panel-->[/I][/B][/COLOR]
    
    
            <!--Those are examples of simple uri selection preference. The icon for them will be the selected image preview
            You need to set title and key. That's it.-->
            <com.wubydax.romcontrol.v2.prefs.UriSelectionPreference
                android:key="test_image_selection_key_2"
                android:title="Select Image 2"/>       
        </PreferenceCategory>


    RunScriptPreference

    Custom attributes:
    app:scriptFileName - string type attribute to provide script name to run, including the .sh extension.
    app:showConfirmDialog - a boolean type preference, dtetermining whether a warning dialog will be shown before executing the script. we have had this request for previous version, since users sometimes hit script preference by mistake and it executes immidiately. By default this boolean is TRUE. So for any script a warning dialog will show. Youc an set it to FALSE to execute without warning.
    app:rebootOptions - enum type attribute:
    Sometimes you will perform actions in script which will require a device reboot to take effect
    For this purpose we created this attribute, which can take 3 values:

    1. None - this is default. You do not need to specify "none". if you don't specify rebootOptions it will always be "none"
    This means reboot is not required upon running script

    2. Optional - this means that the execution of this script is ok without immediate reboot,
    but for the action to take effect, reboot is required. if you set rebootOption to "optional",
    upon successful script execution a user will be presented with a dialog.
    A dialog has 2 buttons: reboot now or reboot later.
    Use this option ONLY if reboot is required for action to take effect and reboot is not VITAL. Meaning no app will FC without reboot.

    3. Imminent- sometimes you will want to run scripts which replace key system components, such as entire apk
    or even jar files. When a script like that is executed, you want immediate reboot. Because other wise the app in question
    can throw FC. Most of you from what we have seen, use reboot option for scripts like these at the end of the script.
    You NO LONGER HAVE TO. We will handle the reboot for you ONLY if the script is executed successfully and "imminent" option was chosen.
    It is nice to WARN the user that their phone will reboot after running the script.
    That is why if you choose app:rebootOptions="imminent" a dialog will be shown to the user once they click on preference.
    This dialog will warn them that upon script execution their device will reboot

    If you use this option, once the script is done we will execute the reboot. Make sure you have your app in priv-app before testing this. It will need reboot permissions. Please read the gradle explanation 2 posts above, regarding those permissions.

    DO NOT use "reboot" or "kill zygote" commands at the end your scripts. Do yourselves and your users a favour and stop using those all together.
    SmartSelectImage_2016-07-14-03-41-18.png

    Code:
    [COLOR="darkgreen"][I][B]<!--Running scripts in rom modding is no silly business.
        We need shell scripts for purposes that can vary from writing a line into a file on sd,
        through replacing sound files and host files,
        to as far as replacing entire apk and jar files.
    
        Because shell scripts can vary in their complexity, we created a special preference that runs shell scripts.
    
        The major component in this preference is the scriptName attribute. The script name should be given in full,
        as string, including extension (.sh).
    
        The code for the preference knows where your scripts are found. It will locate the script if it's found there
        and execute it.
    
        if script execution fails, a number is being shown. That means the exit code of a script is not 0.
        That means something is wrong in the script.
    
        If the script is executed properly, a toast will be shown saying "Executed successfully"-->[/B][/I][/COLOR]
        <PreferenceCategory
            android:title="Run script preferences">
    
            [COLOR="darkgreen"][B][I]<!--This is the basic script preference. It will jujst run a script.-->[/I][/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.RunScriptPreference
                android:title="Execute script with prompt"
                app:scriptFileName="simple_test.sh"
                android:summary="This action will throw warning dialog before executing script"/>
    
    
            [COLOR="darkgreen"][I][B]<!--Because of the radical nature of running shall scripts with su,
            We included a dialog which is shown when a user clicks on script preference
    
            By default confirm dialog will be shown before executing eny script. If you wish to run a script without the warning dialog,
            You need to specify the custom attribute that a dialog should not be shown.
            We strongly encourage you to keep the dialog. It's better for your users to be sure they clicked on the right option-->[/B][/I][/COLOR]
    
            <com.wubydax.romcontrol.v2.prefs.RunScriptPreference
                android:title="Execute without prompt"
                app:scriptFileName="simple_test.sh"
                app:showConfirmDialog="false"
                android:summary="This action will execute script without warning"/>
    
    
            [COLOR="darkgreen"][I][B]<!--Script preference with optional reboot-->[/B][/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.RunScriptPreference
                android:title="Script with optional reboot"
                app:rebootOptions="optional"
                app:scriptFileName="simple_test.sh"
                android:summary="This action will write into a file on sd card and show dialog that reminds the user to reboot their phone at this time or later for the action to take effect"/>
    
            [COLOR="darkgreen"][I]<!--Script preference with imminent reboot-->[/I][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.RunScriptPreference
                android:title="Script with imminent reboot"
                android:summary="This action will run script which has reboot command at the end and warn user that reboot of device will follow the script execution immediately"
                app:rebootOptions="imminent"
                app:scriptFileName="simple_test.sh"/>
    
    
           [COLOR="DarkGreen"][B][I] <!--We were asked by some developers to make a kill app option available for script preference
            Therefore, you can also use the kill package attributes now, silent or with dialog,
            for your script preferences.
    
            The following RunScriptPreference will prompt killing contacts app f.e
            P.s. you can set icons to your run script preferences like any other preference-->[/I][/B][/COLOR]
            <com.wubydax.romcontrol.v2.prefs.RunScriptPreference
                android:title="Execute and kill app + icon"
                android:icon="@mipmap/ic_launcher"
                android:summary="Upon finishing, this script preference will prompt a user to kill app, since we set the isSilent attribute to false"
                app:packageNameToKill="com.android.contacts"
                app:isSilent="false"
                app:scriptFileName="simple_test.sh"/>
        </PreferenceCategory>


    ImageHeaderPreference

    Custom attributes:
    app:imageSource - reference type of attribute to set the image to show as header preference. The default size for image is width match_parent and height 200dp.

    This is just one of those little things we made for fun, but it ended up being @tdunham 's favourite toy :D
    Screenshot_20160714-034152.png

    Code:
     [COLOR="DarkGreen"][I]<!--This is one of those little bonus thingies what we made for our beta-testers
                and you all get to inherit it. It's a little preference class called ImageHeaderPreference
                It allows you to choose and image as header for your preference screen.
                Just to bring a little color and life into all those switches and checkboxes...-->[/I][/COLOR]
                <com.wubydax.romcontrol.v2.prefs.ImageHeaderPreference
                    app:imageSource="@drawable/android"/>
    21

    Preferences - Part 1: Introduction

    1. Major change in implementation:

    1. For this release we made a major change in how preferences are handled. They are not handled anymore. They handle themselves.
    2. For that to happen we needed to subclass ALL native android preferences except PreferenceScreen and PreferenceCategory.
    3. What does it mean to subclass? That means we created java classses which extend (resemble) native android preferences and we wrote our own implementation of how they should behave, how they should load their values and write their values.
    4. That being said - there is no more standard android preferences in this project. No more SwitchPreference, no more CheckboxPreference, no ListPreference... None of those.

    5. Two reasons for that:
    1. We didn't want you to get lost in special conditions anymore. We wanted you to be able to set if the preference should restart systemui from xml file when you declare preference. For that we needed to add custom xml attributes. For that we needed a preference class to be able to acknowledge that. So we needed a custom preference class.
    2. We wanted the preference to manage itself in by reading and writing from and to database. Instead of fragment running endless iterations and conditions. When our new preferences are born (attached to the screen), they get their value from the database directly. No one needs to set values to them. When they are changed, they know to write into database directly. From their own class. Not containing fragment doing that for them.​

    2. Types of preferences

    1. Two state preferences:
    MySwitchPreference
    MyCheckboxPreference
    FilePreference​

    2. Dialog preferences:
    MyListPreference
    MyEditTextPreference
    IntentDialogPreference
    ThumbnailListPreference
    ColorPickerPreference​

    3. Native preferences(PreferenceGroup subclasses):
    PreferenceScreen
    PreferenceCategory​

    4. Slider Preference:
    MySeekBarPreference​

    5. Special preferences:
    OpenAppPreference
    UriSelectionPreference
    RunScriptPreference
    ImageHeaderPreference​

    3. Setting defaults:
    It is ABSOLUTELY VITALLY IMPORTANT that you set android:defaultValue to all the preferences that change and read values. That means:

    MySwitchPreference
    MyCheckboxPreference
    FilePreference
    MyListPreference
    MyEditTextPreference
    ThumbnailListPreference
    ColorPickerPreference
    MySeekBarPreference


    4. What happens if we use regular android preferences? Like SwitchPreference or ListPreference?

    Nothing! Absolutely nothing will happen nor to this project, nor to your database and, MOST IMPORTANTLY, nor to your mods.
    It will act like normal preference. It will not write to database. Your mods will not be affected and WILL NOT WORK.


    5. Custom attributes for value changing preferences and RunScriptPreference

    1. app: packageNameToKill
    This attribute is of type string and you will need to provide which app you want to restart when this preference changes value.​
    2. app:isSilent
    This is a boolean type attribute, which is by default set to true. That means that if you don't set this attribute and you DO set the package name to kill, it will restart the app you want without warning as soon as the value has been changed. If it is set to "false", upon value change a dialog will appear with app icon and test informing user that for this action to take effect an app restart is required. They can then choose to kill app now or cancel the dialog and kill it later.​
    3. app:rebootRequired
    This is also a boolean type of preference which by default is set to false. If you set it to "true", upon preference value change a dialog will appear, informing the user that reboot is required for this action to take effect. good example for that is changing the default app intent to open on home button double click. That needs framework reload.
    If rebootRequired is set to true and you ALSO set package name to kill, reboot takes preference. Package to kill will be ignored.​


Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone