Skip to content

Commit

Permalink
Fix some bugs and add new improvments, see readme for more info
Browse files Browse the repository at this point in the history
  • Loading branch information
lorensiuswlt committed Oct 15, 2011
1 parent 0af27e9 commit 6bed1ab
Show file tree
Hide file tree
Showing 39 changed files with 566 additions and 161 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Expand Up @@ -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" />
Expand Down
Binary file modified bin/NewQuickAction3D.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/net/londatiga/android/ActionItem.class
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 modified bin/net/londatiga/android/QuickAction$1.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/net/londatiga/android/QuickAction.class
Binary file not shown.
Binary file modified bin/net/londatiga/android/R$drawable.class
Binary file not shown.
Binary file modified bin/net/londatiga/android/R$id.class
Binary file not shown.
Binary file modified bin/net/londatiga/android/R$layout.class
Binary file not shown.
Binary file modified bin/net/londatiga/android/R$string.class
Binary file not shown.
Binary file modified bin/net/londatiga/android/R$style.class
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
22 changes: 15 additions & 7 deletions gen/net/londatiga/android/R.java
Expand Up @@ -33,10 +33,15 @@ public static final class drawable {
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;
Expand All @@ -50,9 +55,12 @@ public static final class id {
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;
Expand Down
120 changes: 113 additions & 7 deletions 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..
Binary file removed res/drawable/dashboard.png
Binary file not shown.
Binary file removed res/drawable/kontak.png
Binary file not shown.
Binary file added res/drawable/menu_cancel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_down_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_eraser.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_info.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_ok.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/menu_up_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions res/layout/action_item_horizontal.xml
@@ -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.
12 changes: 12 additions & 0 deletions res/layout/horiz_separator.xml
@@ -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>
1 change: 1 addition & 0 deletions res/layout/main.xml
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions res/layout/popup_horizontal.xml
@@ -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.

0 comments on commit 6bed1ab

Please sign in to comment.