Permalink
Browse files

Fix some bugs and add new improvments, see readme for more info

  • Loading branch information...
lorensiuswlt committed Oct 15, 2011
1 parent 0af27e9 commit 6bed1abe07448a3c6dfc0307447795699f10acf3
Showing with 566 additions and 161 deletions.
  1. +1 −1 AndroidManifest.xml
  2. BIN bin/NewQuickAction3D.apk
  3. BIN bin/classes.dex
  4. BIN bin/net/londatiga/android/ActionItem.class
  5. BIN bin/net/londatiga/android/NewQuickAction3DActivity$1.class
  6. BIN bin/net/londatiga/android/NewQuickAction3DActivity$2.class
  7. BIN bin/net/londatiga/android/NewQuickAction3DActivity$3.class
  8. BIN bin/net/londatiga/android/NewQuickAction3DActivity$4.class
  9. BIN bin/net/londatiga/android/NewQuickAction3DActivity.class
  10. BIN bin/net/londatiga/android/QuickAction$1.class
  11. BIN bin/net/londatiga/android/QuickAction$OnActionItemClickListener.class
  12. BIN bin/net/londatiga/android/QuickAction.class
  13. BIN bin/net/londatiga/android/R$drawable.class
  14. BIN bin/net/londatiga/android/R$id.class
  15. BIN bin/net/londatiga/android/R$layout.class
  16. BIN bin/net/londatiga/android/R$string.class
  17. BIN bin/net/londatiga/android/R$style.class
  18. BIN bin/resources.ap_
  19. +15 −7 gen/net/londatiga/android/R.java
  20. +113 −7 readme.md
  21. BIN res/drawable/dashboard.png
  22. BIN res/drawable/kontak.png
  23. BIN res/drawable/menu_cancel.png
  24. BIN res/drawable/menu_down_arrow.png
  25. BIN res/drawable/menu_eraser.png
  26. BIN res/drawable/menu_info.png
  27. BIN res/drawable/menu_ok.png
  28. BIN res/drawable/menu_search.png
  29. BIN res/drawable/menu_up_arrow.png
  30. +28 −0 res/layout/action_item_horizontal.xml
  31. 0 res/layout/{action_item.xml → action_item_vertical.xml}
  32. +12 −0 res/layout/horiz_separator.xml
  33. +1 −0 res/layout/main.xml
  34. +41 −0 res/layout/popup_horizontal.xml
  35. 0 res/layout/{popup.xml → popup_vertical.xml}
  36. +87 −15 src/net/londatiga/android/ActionItem.java
  37. +107 −0 src/net/londatiga/android/ExampleActivity.java
  38. +0 −83 src/net/londatiga/android/NewQuickAction3DActivity.java
  39. +161 −48 src/net/londatiga/android/QuickAction.java
View
@@ -6,7 +6,7 @@
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".NewQuickAction3DActivity"
+ <activity android:name=".ExampleActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
@@ -33,10 +33,15 @@
public static final int action_item_selected=0x7f020001;
public static final int arrow_down=0x7f020002;
public static final int arrow_up=0x7f020003;
- public static final int dashboard=0x7f020004;
- public static final int icon=0x7f020005;
- public static final int kontak=0x7f020006;
- public static final int popup=0x7f020007;
+ public static final int icon=0x7f020004;
+ public static final int menu_cancel=0x7f020005;
+ public static final int menu_down_arrow=0x7f020006;
+ public static final int menu_eraser=0x7f020007;
+ public static final int menu_info=0x7f020008;
+ public static final int menu_ok=0x7f020009;
+ public static final int menu_search=0x7f02000a;
+ public static final int menu_up_arrow=0x7f02000b;
+ public static final int popup=0x7f02000c;
}
public static final class id {
public static final int arrow_down=0x7f070008;
@@ -50,9 +55,12 @@
public static final int tv_title=0x7f070001;
}
public static final class layout {
- public static final int action_item=0x7f030000;
- public static final int main=0x7f030001;
- public static final int popup=0x7f030002;
+ public static final int action_item_horizontal=0x7f030000;
+ public static final int action_item_vertical=0x7f030001;
+ public static final int horiz_separator=0x7f030002;
+ public static final int main=0x7f030003;
+ public static final int popup_horizontal=0x7f030004;
+ public static final int popup_vertical=0x7f030005;
}
public static final class string {
public static final int app_name=0x7f050001;
View
120 readme.md
@@ -1,23 +1,129 @@
NewQuickAction3D
================
-NewQuickAction3D is a small android library to show quickaction dialog just like quickaction on Gallery3D app.
+NewQuickAction3D is a small android library to create QuickAction dialog with Gallery3D app style.
+
+How to Use
+==========
+This repo includes a sample Activity (__ExampleActivity.java__) to show how to use QuickAction.
+
+ public class ExampleActivity extends Activity {
+ //action id
+ private static final int ID_UP = 1;
+ private static final int ID_DOWN = 2;
+ private static final int ID_SEARCH = 3;
+ private static final int ID_INFO = 4;
+ private static final int ID_ERASE = 5;
+ private static final int ID_OK = 6;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+
+ ActionItem nextItem = new ActionItem(ID_DOWN, "Next", getResources().getDrawable(R.drawable.menu_down_arrow));
+ ActionItem prevItem = new ActionItem(ID_UP, "Prev", getResources().getDrawable(R.drawable.menu_up_arrow));
+ ActionItem searchItem = new ActionItem(ID_SEARCH, "Find", getResources().getDrawable(R.drawable.menu_search));
+ ActionItem infoItem = new ActionItem(ID_INFO, "Info", getResources().getDrawable(R.drawable.menu_info));
+ ActionItem eraseItem = new ActionItem(ID_ERASE, "Clear", getResources().getDrawable(R.drawable.menu_eraser));
+ ActionItem okItem = new ActionItem(ID_OK, "OK", getResources().getDrawable(R.drawable.menu_ok));
+
+ //use setSticky(true) to disable QuickAction dialog being dismissed after an item is clicked
+ prevItem.setSticky(true);
+ nextItem.setSticky(true);
+
+ //create QuickAction. Use QuickAction.VERTICAL or QuickAction.HORIZONTAL param to define layout
+ //orientation
+ final QuickAction quickAction = new QuickAction(this, QuickAction.VERTICAL);
+
+ //add action items into QuickAction
+ quickAction.addActionItem(nextItem);
+ quickAction.addActionItem(prevItem);
+ quickAction.addActionItem(searchItem);
+ quickAction.addActionItem(infoItem);
+ quickAction.addActionItem(eraseItem);
+ quickAction.addActionItem(okItem);
+
+ //Set listener for action item clicked
+ quickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
+ @Override
+ public void onItemClick(QuickAction source, int pos, int actionId) {
+ //here we can filter which action item was clicked with pos or actionId parameter
+ ActionItem actionItem = quickAction.getActionItem(pos);
+
+ Toast.makeText(getApplicationContext(), actionItem.getTitle() + " selected", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ //set listnener for on dismiss event, this listener will be called only if QuickAction dialog was dismissed
+ //by clicking the area outside the dialog.
+ quickAction.setOnDismissListener(new QuickAction.OnDismissListener() {
+ @Override
+ public void onDismiss() {
+ Toast.makeText(getApplicationContext(), "Dismissed", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ //show on btn1
+ Button btn1 = (Button) this.findViewById(R.id.btn1);
+ btn1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ }
+ });
+
+ Button btn2 = (Button) this.findViewById(R.id.btn2);
+ btn2.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ }
+ });
+
+ Button btn3 = (Button) this.findViewById(R.id.btn3);
+ btn3.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ quickAction.show(v);
+ quickAction.setAnimStyle(QuickAction.ANIM_REFLECT);
+ }
+ });
+ }
+ }
**See http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/ for more information.**
-![Example Image] [2]
+![Example Image](http://londatiga.net/images/quickaction3d_horizontal.png) ![Example Image](http://londatiga.net/images/quickaction3d_vertical.png)
Developed By
============
* Lorensius W. L. T - <lorenz@londatiga.net>
+Contributors
+============
+
+* Kevin Peck - <kevinwpeck@gmail.com>
+
Changes
=======
-2011-10-05:
-- Fix force close that occured when tapping randomly on a view to show quickaction dialog.
- Thanx to [Zammbi][1] for bug fix..
+### 2011-10-15:
+* Fix 'container moves' bug as addressed in this [issue](https://github.com/lorensiuswlt/NewQuickAction3D/issues/1). Thanx to [The Vaan](TheVaan@gmail.com) for giving me the clue.
+2. New improvements added by [Kevin Pack](kevinpeck@gmail.com):
+ 3. Action Item – new constructor with action id, title, icon
+ 4. Callback enhanced to return QuickAction object as source and action id (allows you to add items in any order as you base what was clicked on by the ID, not the pos)
+ 5. Action item supports sticky mode, if that is enabled the menu does not dismiss post button press. I needed this for my application.
+ 6. QuickAction has getActionItem(pos) call so you can get action item back. QuickAction has ArrayList of added items to support this
+ 7. QuickAction supports constructor with horizontal flag so you can run menu horizontally instead of just vertically
+ 8. If doing horizontal QuickAction loads the action_item_horizontal.xml and popup_horizontal.xml files instead of the vertical ones
+ 9. Added action_item_horizontal.xml with a centered image over a centered text label
+ 10. Added horiz_separator.xml file so you can show a separator between items in a horizontal layout
+ 11. Updated NewQuickAction3DActivity to show the toast message based on label of action item clicked as you now have enough info in callback to do that generically
+ 12. Update sample code to show sticky items in action, watching for dismiss action and extra menu items
+3. New listener to handle on dismiss event.
-[1]: http://github.com/zammbi
-[2]: http://londatiga.net/images/quickactions/gl3d2.jpg
+### 2011-10-05:
+* Fix force close that occured when tapping randomly on a view to show QuickAction dialog ([issue](https://github.com/lorensiuswlt/NewQuickAction3D/issues/2)). Thanx to [Zammbi](zammbi@gmail.com) for bug fixing..
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,28 @@
+<RelativeLayout
+ 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_btn">
+
+ <ImageView
+ android:id="@+id/iv_icon"
+ android:layout_centerHorizontal="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:id="@+id/tv_title"
+ android:layout_below="@+id/iv_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:gravity="center_horizontal"
+ android:paddingLeft="5dip"
+ android:paddingRight="5dip"
+ android:text="Chart"
+ android:textColor="#fff"/>
+
+</RelativeLayout>
File renamed without changes.
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent">
+<TextView android:layout_height="fill_parent"
+ android:gravity="center"
+ android:layout_width="2px"
+ android:text=" "
+ android:background="#000000"/>
+</RelativeLayout>
View
@@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
+ android:padding="10dp"
android:orientation="vertical">
<LinearLayout
@@ -0,0 +1,41 @@
+<?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/popup"
+ android:fadingEdgeLength="5dip"
+ android:scrollbars="none">
+
+ <LinearLayout
+ android:id="@+id/tracks"
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ 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_up" />
+
+ <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_down" />
+
+</RelativeLayout>
File renamed without changes.
Oops, something went wrong.

0 comments on commit 6bed1ab

Please sign in to comment.