Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
the Android Library Package for QuickAction
branch: master

This branch is even with yanzm:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
res
src/yanzm/products/quickaction/lib
.gitignore
AndroidManifest.xml
README
default.properties

README

usage samples:

===========================================

package yanzm.example.quickactiontest2;

import yanzm.products.quickaction.lib.ActionItem;
import yanzm.products.quickaction.lib.QuickAction;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class QuickActionTest2 extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		
		// 1st item
		final ActionItem chart = new ActionItem();
		
		chart.setTitle("Chart");
		chart.setIcon(getResources().getDrawable(R.drawable.chart));
		chart.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(QuickActionTest2.this, "Chart selected" , Toast.LENGTH_SHORT).show();
			}
		});
		
		
		// 2nd item
		final ActionItem production = new ActionItem();
		
		production.setTitle("Products");
		production.setIcon(getResources().getDrawable(R.drawable.production));
		production.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(QuickActionTest2.this, "Products selected", Toast.LENGTH_SHORT).show();
			}
		});
		
		
		// 3rd item
		final ActionItem budget = new ActionItem();
		
		budget.setTitle("Budget");
		budget.setIcon(getResources().getDrawable(R.drawable.budget));
		budget.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(QuickActionTest2.this, "Budget selected", Toast.LENGTH_SHORT).show();
			}
		});

		// 4th item
		final ActionItem dashboard = new ActionItem();
		
		dashboard.setIcon(getResources().getDrawable(R.drawable.dashboard));
		dashboard.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(QuickActionTest2.this, "dashboard selected" , Toast.LENGTH_SHORT).show();
			}
		});
		
		
		// 5th item
		final ActionItem users = new ActionItem();
		
		users.setIcon(getResources().getDrawable(R.drawable.users));
		users.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(QuickActionTest2.this, "Products selected", Toast.LENGTH_SHORT).show();
			}
		});
		
		
		// Default Setting
		Button btn1 = (Button) this.findViewById(R.id.btn1);
		btn1.setText("Default Setting");
		btn1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(chart);
				qa.addActionItem(production);
				
				qa.show();
			}
		});
		
		// ANIM_AUTO
		Button btn2 = (Button) this.findViewById(R.id.btn2);
		btn2.setText("QuickAction.ANIM_AUTO\nmany Items");
		btn2.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.setAnimStyle(QuickAction.ANIM_AUTO);
				
				qa.show();
			}
		});
			
		
		// ANIM_GROW_FROM_CENTER
		Button btn3 = (Button) this.findViewById(R.id.btn3);
		btn3.setText("QuickAction.ANIM_GROW_FROM_CENTER\nItems have no title\nNo Interpolator");
		btn3.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(dashboard);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_CENTER);
				qa.setAnimTrack(R.anim.rail2, null);
				
				qa.show();
			}
		});

		// ANIM_GROW_FROM_CENTER
		Button btn4 = (Button) this.findViewById(R.id.btn4);
		btn4.setText("QuickAction.ANIM_GROW_FROM_LEFT\nItems have no title\nNo Track Animation");
		btn4.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(dashboard);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_LEFT);
				qa.setAnimTrackEnabled(false);
				
				qa.show();
			}
		});

		// ANIM_GROW_FROM_CENTER
		Button btn5 = (Button) this.findViewById(R.id.btn5);
		btn5.setText("QuickAction.ANIM_GROW_FROM_RIGHT");
		btn5.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(chart);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_RIGHT);
				
				qa.show();
			}
		});
		
		// ANIM_GROW_FROM_CENTER
		Button btn6 = (Button) this.findViewById(R.id.btn6);
		btn6.setText("QuickAction.ANIM_REFLECT");
		btn6.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(dashboard);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_REFLECT);
				qa.setLayoutStyle(QuickAction.STYLE_BUTTON);
				
				qa.show();
			}
		});
		
		
				
		//////////////////////////////////////////////////////

		// Default Setting + STYLE_LIST
		Button btn7 = (Button) this.findViewById(R.id.btn7);
		btn7.setText("QuickAction.STYLE_LIST");
		btn7.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.setLayoutStyle(QuickAction.STYLE_LIST);
				
				qa.show();
			}
		});
		
		// ANIM_AUTO
		Button btn8 = (Button) this.findViewById(R.id.btn8);
		btn8.setText("QuickAction.ANIM_AUTO\nQuickAction.STYLE_LIST with Constractor");
		btn8.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v, R.layout.popup2, QuickAction.STYLE_LIST);
				
				qa.addActionItem(chart);
				qa.addActionItem(production);
				qa.setAnimStyle(QuickAction.ANIM_AUTO);
				
				qa.show();
			}
		});
		
		// ANIM_GROW_FROM_CENTER
		Button btn9 = (Button) this.findViewById(R.id.btn9);
		btn9.setText("QuickAction.ANIM_GROW_FROM_CENTER\nQuickAction.STYLE_LIST\nsetItemLayoutId()");
		btn9.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(dashboard);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_CENTER);
				qa.setLayoutStyle(QuickAction.STYLE_LIST);
				qa.setItemLayoutId(R.layout.action_item);
				
				qa.show();
			}
		});

		// ANIM_GROW_FROM_CENTER
		Button btn10 = (Button) this.findViewById(R.id.btn10);
		btn10.setText("QuickAction.ANIM_GROW_FROM_LEFT");
		btn10.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(budget);
				qa.addActionItem(production);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_LEFT);
				qa.setLayoutStyle(QuickAction.STYLE_LIST);
				qa.setItemLayoutId(R.layout.action_item2);
				
				qa.show();
			}
		});

		// ANIM_GROW_FROM_CENTER
		Button btn11 = (Button) this.findViewById(R.id.btn11);
		btn11.setText("QuickAction.ANIM_GROW_FROM_RIGHT\ncustom layout");
		btn11.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v, R.layout.popup2, QuickAction.STYLE_LIST);
				
				qa.addActionItem(budget);
				qa.addActionItem(production);
				qa.setAnimStyle(QuickAction.ANIM_GROW_FROM_RIGHT);
				qa.setItemLayoutId(R.layout.action_item3);
				
				qa.show();
			}
		});
		
		// ANIM_GROW_FROM_CENTER
		Button btn12 = (Button) this.findViewById(R.id.btn12);
		btn12.setText("QuickAction.ANIM_REFLECT");
		btn12.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				QuickAction qa = new QuickAction(v);
				
				qa.addActionItem(dashboard);
				qa.addActionItem(users);
				qa.setAnimStyle(QuickAction.ANIM_REFLECT);
				qa.setLayoutStyle(QuickAction.STYLE_LIST);
				
				qa.show();
			}
		});		
	}
}

=====================================================

samples : layout xml for list style


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

	<ScrollView 
		android:id="@+id/scroller"
		android:layout_marginTop="16dip"
		android:layout_width="wrap_content"
    		android:layout_height="wrap_content"
    		android:background="@drawable/popup2"
    		android:fadingEdgeLength="5dip"
    		android:scrollbars="none">

    	<LinearLayout
	    	android:id="@+id/tracks"
	    	android:orientation="vertical"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_weight="1"
	        android:padding="10dip"/>
       
	</ScrollView >
 	
 	<ImageView
	        android:id="@+id/arrow_up"
        	android:layout_width="wrap_content"
        	android:layout_height="wrap_content"
        	android:src="@drawable/arrow_up2" />
        
 	<ImageView
	        android:id="@+id/arrow_down"
        	android:layout_width="wrap_content"
        	android:layout_height="wrap_content"
    		android:layout_below="@id/scroller"
      		android:layout_marginTop="-4dip"
        	android:src="@drawable/arrow_down2" />
</RelativeLayout>


======================================

samples : layout xml for item

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal"
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:clickable="true"
	android:focusable="true"
	android:padding="20dip"
	android:background="@drawable/action_item_btn2">

	<ImageView
		android:id="@+id/icon"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"/>

	<TextView
		android:id="@+id/title"
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:gravity="center_vertical"
		android:paddingLeft="5dip"
		android:paddingRight="10dip"
		android:text="Chart"
		android:textColor="#fff"/>
</LinearLayout> 

----------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal"
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:clickable="true"
	android:focusable="true"
	android:background="@drawable/action_item_btn2">
        	
	<ImageView
		android:id="@+id/icon"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"/>

	<TextView
		android:id="@+id/title"
		android:layout_width="200dip"
		android:layout_height="fill_parent"
		android:gravity="center_vertical"
		android:paddingLeft="10dip"
		android:paddingRight="10dip"
		android:layout_gravity="left"
		android:text="Chart"
		android:textColor="#fff"/>
</LinearLayout>

--------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal"
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:clickable="true"
	android:focusable="true"
	android:background="@drawable/action_item_btn2">

	<ImageView
		android:id="@+id/icon"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"/>

	<TextView
		android:id="@+id/title"
		android:layout_width="200dip"
		android:layout_height="fill_parent"
		android:gravity="center_vertical"
		android:paddingLeft="10dip"
		android:paddingRight="10dip"
		android:layout_gravity="left"
		android:text="Chart"
		android:textColor="#003"/>
</LinearLayout>

Something went wrong with that request. Please try again.