Fuck-Hard-Code

by kutear

This is a Tool to extract hard code from android layout

122 Stars 13 Forks Last release: over 3 years ago (v2.0.0) 41 Commits 5 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Build Status

中文文档

中文

Android hardcoding extraction tool

Extraction string and dimens from layout,Merge into strings.xml and dimens.xml

Download

Usage

Example

Programs description

Programs purpose: fixed Android project Hard Code Problems Args:

  • layout:the path of $project/appmodule/src/main/res/layout
    • config: configure file
    • existPixels:the path of $project/appmodule/src/main/res/values/dimens.xml
    • existStrings:the path of $project/appmodule/src/main/res/values/strings.xml
    • scaleRatio:px to dp,default 3px == 1dp
    • out:layout dir out path

after that you will see strings.xml and dimens.xml in

{layout output path}/out
and all xml file in
{layout output path}

Example

Create New Android Application and modify main layout

    

Now We Run This Tool,Over this,We can see the file in {out path/layout} with ```xml <?xml version="1.0" encoding="utf-8"?>

```

And {out path/layout/out} has two file ,strings.xml and dimens.xml

xml



    Hello Word


    40.0dp
    20.0sp

Before Copy New file to Replace original File,Please make sure everything is OK!!!!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.