github.com/Kutear/Fuck-Hard-Code


Properties

Last built 2 weeks ago using go version go1.7.5 linux/amd64 and 45 seconds of time

Downloads
Filename
File Size
 
Fuck-Hard-Code_master_darwin-386.zip
747KiB
Fuck-Hard-Code_master_darwin-amd64.zip
795KiB
Fuck-Hard-Code_master_linux-386.zip
751KiB
Fuck-Hard-Code_master_linux-amd64.zip
804KiB
Fuck-Hard-Code_master_linux-arm.zip
747KiB
Fuck-Hard-Code_master_windows-386.zip
781KiB
Fuck-Hard-Code_master_windows-amd64.zip
836KiB
Project-Readme for this version

Build Status

中文文档

中文

Android hardcoding extraction tool

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

Download

Usage

Example

Fuck-Hard-Code -input="{layout path}" -output="{layout output 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

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:orientation="horizontal">
	<TextView
		android:id="@+id/content"
		android:layout_width="wrap_content"
		android:layout_height="40dp"
		android:text="Hello Word"
		android:textSize="20sp" />
</LinearLayout>

Now We Run This Tool

#linux/mac
./Fuck-Hard-Code -input="{layout path}" -output="{layout output path}"

#windows
Fuck-Hard-Code.exe -input="{layout path}" -output="{layout output path}"

Ok,This Over,we Can See the file in {out path/layout} with

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:orientation="horizontal"
	android:gravity="top">
	<TextView
		android:id="@+id/content"
		android:layout_width="wrap_content"
		android:layout_height="@dimen/dp_0040_0"
		android:text="@string/strings_0"
		android:textSize="@dimen/sp_0020_0" />
</LinearLayout>

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

<!--strings.xml-->
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string	name="strings_0">Hello Word</string>
</resources>
<!--dimens.xml-->
<?xml version="1.0" encoding="utf-8"?>

<resources>
	<dimen	name="dp_0040_0">40.0dp</dimen>
	<dimen	name="sp_0020_0">20.0sp</dimen>
</resources>

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