Android tools‎ > ‎

auito

 This page is under construction.

Previous information about autoandroid can be found here and here.

introduction

Some time ago, while working on some Linux projects requiring GUIs for some commands I've started autoglade, an Open Source project aiming to fill some gap between scripts and command line utilities and GUIs.
As a proof of concept, I'm wondering if a similar approach would be possible in Android, so let's find out what can be done.
Your comments and suggestions are greatly appreciated.

This new project was then called autoandroid, but incidentally the name is used by another project and this project is now called auito.

Would it be at all possible to take a autoglade's approach to streamline android UI design and implementation, factoring the repetitive tasks you have to write again and again for many applications ?
auito library is distributed as a jar file that you can add to your android project java build path.

auito 5 minute tour

dialog sample

The custom Dialog displayed has an EditText and a Button. The EditText starts empty and the Button disabled.
Once some text is entered the button is enabled.



Instead of having to provide all the boilerplate code we are accustom in such cases, using auito is as simpler as

 1 <?xml version="1.0" encoding="utf-8"?>
 2    <!--
 3       * Copyright © 2009 COD Technologies Ltd. www.codtech.com *
          * $Id: 
 4       dialog_sample.xml 115 2009-08-12 22:19:23Z diego $ *
 5    -->
 6    <!--
 7       IMPORTANT: The root element must have it's id defined, unless it's not
 8       possible to automatically find it and should be explicitly defined by
 9       setAutoRootViewId(), but unless you were using an internal root, this
10       top level element should have its id defined anyway to be able to be
11       passed as an argument to this method. For some reason the namespace
12       should be specified as:
13
14       xmlns:auto="http://schemas.android.com/apk/res/com.codtech.android.samples.auito"
15
16       instead of:
17
18       xmlns:auto="http://schemas.android.com/apk/res/com.codtech.android.auto"
19
20       and the file attrs.xml should have <declare-styleable
21       name="com.codtech.android.samples.autoandroid"> instead of
22
23       <declare-styleable name="com.codtech.android.auto">
24    -->
25 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
26    xmlns:auito="http://schemas.android.com/apk/res/com.codtech.android.samples.auito"
27    android:layout_height="wrap_content" android:layout_width="fill_parent"
28    android:orientation="vertical" android:id="@+id/Root" style="@style/CustomDialogTheme">
29    <com.codtech.android.auto.view.AutoEditText
30       android:id="@+id/EditText01" android:layout_height="wrap_content"
31       android:layout_width="fill_parent" android:layout_margin="6dip"
32       auito:sensitize="@+id/Button01"
33       android:hint="@string/edittext_hint" />
34    <Button android:id="@id/Button01" android:layout_width="wrap_content"
35       android:layout_height="wrap_content" android:text="OK" android:width="150dip"
36       android:layout_gravity="right" android:enabled="false"
37       android:clickable="false" autio:dialog_action="positive" />
38 </LinearLayout>

The steps followed are:
  1. define auito namespace
  2. use AutoEditText which is the EditText equivalent with Auto behavior
  3. declare auito:sensitize="@+id/Button01" as the view we want to sensitize or un-sensitize depending on this EditText content. Note that the id is defined here, using @+id, because is its first occurrence.
  4. use the previously defined id, Button01, as the id for the Button
  5. declare the positive button

pizza order sample



resources

external links

Comments