Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

layoutxml-control-extractor

Tools for extracting control IDs from Android Layout XML and writing findByViewId code.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

LayoutXML Control Extractor

Tools for extracting control IDs from Android Layout XML and writing findByViewId code.

It creates a Kotlin, Kotlin(BindExt), Java code by Android Layout XML.

Compile

Use Delphi XE5. :)

Usage

  1. Copy the Android Layout XML to the left size
  2. Select output options
  3. Click the Extract button.
  4. Copy & Paste created code :)

Example

https://github.com/googlesamples/android-ConstraintLayoutExamples/blob/master/app/src/main/res/layout/constraint_example_5.xml

Java output

pascal
private TextView mTextView3;
private TextView mTextView4;
private TextView mTextView5;
private ImageView mImageView;
private ImageButton mImageButton;

mTextView3 = (TextView) findViewById(R.id.textView3);
mTextView4 = (TextView) findViewById(R.id.textView4);
mTextView5 = (TextView) findViewById(R.id.textView5);
mImageView = (ImageView) findViewById(R.id.imageView);
mImageButton = (ImageButton) findViewById(R.id.imageButton);

Kotlin output

pascal
private val mTextView3 = findViewById(R.id.textView3) as TextView
private val mTextView4 = findViewById(R.id.textView4) as TextView
private val mTextView5 = findViewById(R.id.textView5) as TextView
private val mImageView = findViewById(R.id.imageView) as ImageView
private val mImageButton = findViewById(R.id.imageButton) as ImageButton

Kotlin(BindExt) output

pascal
private val mTextView3: TextView by bind(R.id.textView3)
private val mTextView4: TextView by bind(R.id.textView4)
private val mTextView5: TextView by bind(R.id.textView5)
private val mImageView: ImageView by bind(R.id.imageView)
private val mImageButton: ImageButton by bind(R.id.imageButton)

History

v1.1

Added clipboard function

v1.0

Implemented basic functionality

License

MIT License