• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Application to optimize layouts

Sylvaner

Lurker
Hello,

I am currently developing a plugin for Eclipse that will check for duplicate attributes in XML layout files for them as styles and I have you present for your review and feedback.

A sample file :
Code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.example.layouttest.MainActivity"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <RelativeLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <Button
                android:id="@+id/find"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="Rechercher" />
            <EditText
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:layout_toLeftOf="@+id/find"
                android:layout_centerVertical="true"
                android:inputType="text"/>
        </RelativeLayout>
        <TextView 
            android:text="Une option : "
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="#FF0000"
            android:gravity="center_horizontal"/>
        <RadioGroup 
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:orientation="horizontal">
            <RadioButton 
                android:text="Oui"
                android:layout_height="wrap_content"
                android:layout_width="0dp"
                android:layout_weight="0.5"/>
            <RadioButton 
                android:text="Non"
                android:layout_height="wrap_content"
                android:layout_width="0dp"
                android:layout_weight="0.5"/>
           </RadioGroup>
        <TextView 
            android:text="Une autre option : "
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="#FF0000"
            android:gravity="center_horizontal"/>
        <RadioGroup 
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:orientation="horizontal">
            <RadioButton 
                android:text="Oui"
                android:layout_height="wrap_content"
                android:layout_width="0dp"
                android:layout_weight="0.5"/>
            <RadioButton 
                android:text="Non"
                android:layout_height="wrap_content"
                android:layout_width="0dp"
                android:layout_weight="0.5"/>
           </RadioGroup>
           <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
            <TextView 
                   android:text="Un label : "
                   android:layout_width="0dp"
                   android:layout_weight="0.33"
                   android:layout_height="wrap_content"/>
            <Spinner 
                android:id="@+id/spinner"
                android:layout_width="0dp"
                android:layout_weight="0.66"
                android:layout_height="wrap_content"/>
        </LinearLayout>
           <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
            <TextView 
                   android:text="Un label : "
                   android:layout_width="0dp"
                   android:layout_weight="0.33"
                   android:layout_height="wrap_content"/>
            <EditText
                android:text="A remplir"
                android:layout_width="0dp"
                android:layout_weight="0.66"
                android:layout_height="wrap_content"/>
        </LinearLayout>
           <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:gravity="center_horizontal"
               android:orientation="horizontal">
            <ImageView 
                android:background="@drawable/ic_launcher"
                android:layout_width="128dip"
                android:layout_height="128dip"
                android:scaleType="fitCenter"/>
            <ImageView 
                android:background="@drawable/ic_launcher"
                android:layout_width="128dip"
                android:layout_height="128dip"
                android:scaleType="fitCenter"/>
            <ImageView 
                android:background="@drawable/ic_launcher"
                android:layout_width="128dip"
                android:layout_height="128dip"
                android:scaleType="fitCenter"/>
        </LinearLayout>
        <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal">
               <Button
                   android:text="Bouton 1"
                   android:layout_width="0dp"
                   android:layout_weight="0.33"
                   android:layout_height="wrap_content"/>
               <Button
                   android:text="Bouton 2"
                   android:layout_width="0dp"
                   android:layout_weight="0.33"
                   android:layout_height="wrap_content"/>
               <Button
                   android:text="Bouton 3"
                   android:layout_width="0dp"
                   android:layout_weight="0.33"
                   android:layout_height="wrap_content"/>
           </LinearLayout>
    </LinearLayout>
</ScrollView>

And a part of the result :

example_eclipse.png


How to install it :

  1. Download the plugin at this address : https://github.com/Sylvaner/LayoutInspector/raw/master/LayoutInspector_1.1.0.201406211518.jar
  2. Copy this file in the plugin directory of your Eclipse installation.
  3. Right click on the folder you want to scan. Layout Inspector -> Inspect this folder.
  4. See the result in the view.

The GitHub link https://github.com/Sylvaner/LayoutInspector
 
Back
Top Bottom