Android QuickAction

Related tags

UI/UX NewQuickAction
Overview

NewQuickAction

NewQuickAction is a small android library to create QuickAction dialog.

How to Use

This repo includes a sample Activity (ExampleActivity1.java) to show how to use QuickAction.

public class Example1Activity extends Activity {
	private static final int ID_ADD = 1;
	private static final int ID_ACCEPT = 2;
	private static final int ID_UPLOAD = 3;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	
		setContentView(R.layout.example1);
	
		ActionItem addItem 		= new ActionItem(ID_ADD, "Add", getResources().getDrawable(R.drawable.ic_add));
		ActionItem acceptItem 	= new ActionItem(ID_ACCEPT, "Accept", getResources().getDrawable(R.drawable.ic_accept));
    	ActionItem uploadItem 	= new ActionItem(ID_UPLOAD, "Upload", getResources().getDrawable(R.drawable.ic_up));
   
    	//use setSticky(true) to disable QuickAction dialog being dismissed after an item is clicked
    	uploadItem.setSticky(true);
    
		final QuickAction mQuickAction 	= new QuickAction(this);
	
		mQuickAction.addActionItem(addItem);
		mQuickAction.addActionItem(acceptItem);
		mQuickAction.addActionItem(uploadItem);
	
		//setup the action item click listener
		mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
			@Override
			public void onItemClick(QuickAction quickAction, int pos, int actionId) {
				ActionItem actionItem = quickAction.getActionItem(pos);
			
				if (actionId == ID_ADD) {
					Toast.makeText(getApplicationContext(), "Add item selected", Toast.LENGTH_SHORT).show();
				} else {
					Toast.makeText(getApplicationContext(), actionItem.getTitle() + " selected", Toast.LENGTH_SHORT).show();
				}
			}
		});
	
		mQuickAction.setOnDismissListener(new QuickAction.OnDismissListener() {
			@Override
			public void onDismiss() {
				Toast.makeText(getApplicationContext(), "Ups..dismissed", Toast.LENGTH_SHORT).show();
			}
		});
	
		Button btn1 = (Button) this.findViewById(R.id.btn1);
		btn1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mQuickAction.show(v);
			}
		})

		Button btn2 = (Button) this.findViewById(R.id.btn2);
		btn2.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				mQuickAction.show(v);
				mQuickAction.setAnimStyle(QuickAction.ANIM_GROW_FROM_CENTER);
			}
		});
	}
}

See http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/ for more information.

Example Image Example Image

Developed By

Contributors

Changes

See CHANGELOG for details

License

Copyright 2011 Lorensius W. L. T

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • 'activity has leaked window' exception on change orientation

    'activity has leaked window' exception on change orientation

    Hi Lorensius,

    Android recreates the view on change orientation but dont manage it for us.

    If you open the quickaction and changes orientation, you ll see an 'activity leaked a window' exception.

    Log: 10-25 04:30:47.686: E/WindowManager(221): Activity test has leaked window android.widget.PopupWindow$PopupViewContainer@44e0ab60 that was originally added here 10-25 04:30:47.686: E/WindowManager(221): android.view.WindowLeaked: Activity test has leaked window android.widget.PopupWindow$PopupViewContainer@44e0ab60 that was originally added here 10-25 04:30:47.686: E/WindowManager(221): at android.view.ViewRoot.(ViewRoot.java:227) 10-25 04:30:47.686: E/WindowManager(221): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) 10-25 04:30:47.686: E/WindowManager(221): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 10-25 04:30:47.686: E/WindowManager(221): at android.view.Window$LocalWindowManager.addView(Window.java:424)

    A possible solution, dismiss the quickaction: Mark Murphy said "Move that logic out of the the View and into the Activity. Then, dismiss them in whichever of onPause/onStop/onDestroy fits your needs best. Save a flag or something in onSaveInstanceState() to let you know to re-open them after the orientation change." http://comments.gmane.org/gmane.comp.handhelds.android.devel/60167

    A better explanation of the problem and the two possible solutions:

    Avoid dialog leak issue: http://androiddev.orkitra.com/?p=111

    Handle configuration or orientation change: http://androiddev.orkitra.com/?p=108

    opened by ardock 5
  • Transparent background of QuickActionItem

    Transparent background of QuickActionItem

    I found out an issue on Android 2.2/2.3. After click the popup item fast, the item background will disappear. The whole quick action item displayed transparent background.

    opened by cfanboy 3
  • Android 4.0 Compatibility?

    Android 4.0 Compatibility?

    Is this library known to work with ICS (4.0) ? I get the following stacktrace when I try to use this library on 4.0+

    02-25 11:41:29.047: E/AndroidRuntime(535): FATAL EXCEPTION: main 02-25 11:41:29.047: E/AndroidRuntime(535): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.towson.snackoverflow/com.towson.snackoverflow.activities.BountyDetailsActivity}: android.view.InflateException: Binary XML file line #40: Error inflating class 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread.access$600(ActivityThread.java:123) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.os.Handler.dispatchMessage(Handler.java:99) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.os.Looper.loop(Looper.java:137) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread.main(ActivityThread.java:4424) 02-25 11:41:29.047: E/AndroidRuntime(535): at java.lang.reflect.Method.invokeNative(Native Method) 02-25 11:41:29.047: E/AndroidRuntime(535): at java.lang.reflect.Method.invoke(Method.java:511) 02-25 11:41:29.047: E/AndroidRuntime(535): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 02-25 11:41:29.047: E/AndroidRuntime(535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 02-25 11:41:29.047: E/AndroidRuntime(535): at dalvik.system.NativeStart.main(Native Method) 02-25 11:41:29.047: E/AndroidRuntime(535): Caused by: android.view.InflateException: Binary XML file line #40: Error inflating class 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 02-25 11:41:29.047: E/AndroidRuntime(535): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 02-25 11:41:29.047: E/AndroidRuntime(535): at net.londatiga.android.QuickAction.setRootViewId(QuickAction.java:102) 02-25 11:41:29.047: E/AndroidRuntime(535): at net.londatiga.android.QuickAction.(QuickAction.java:78) 02-25 11:41:29.047: E/AndroidRuntime(535): at com.towson.snackoverflow.activities.BountyDetailsActivity.setupQuickActions(BountyDetailsActivity.java:110) 02-25 11:41:29.047: E/AndroidRuntime(535): at com.towson.snackoverflow.activities.BountyDetailsActivity.onCreate(BountyDetailsActivity.java:51) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.Activity.performCreate(Activity.java:4465) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 02-25 11:41:29.047: E/AndroidRuntime(535): ... 11 more 02-25 11:41:29.047: E/AndroidRuntime(535): Caused by: java.lang.reflect.InvocationTargetException 02-25 11:41:29.047: E/AndroidRuntime(535): at java.lang.reflect.Constructor.constructNative(Native Method) 02-25 11:41:29.047: E/AndroidRuntime(535): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 02-25 11:41:29.047: E/AndroidRuntime(535): ... 25 more 02-25 11:41:29.047: E/AndroidRuntime(535): Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x2/d=0x7f010022 a=-1} 02-25 11:41:29.047: E/AndroidRuntime(535): at android.content.res.Resources.loadColorStateList(Resources.java:2042) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.content.res.TypedArray.getColorStateList(TypedArray.java:342) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.widget.TextView.(TextView.java:774) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.widget.Button.(Button.java:108) 02-25 11:41:29.047: E/AndroidRuntime(535): at android.widget.Button.(Button.java:104) 02-25 11:41:29.047: E/AndroidRuntime(535): ... 28 more

    opened by alexfu 1
  • Background drawables could use 24-bits

    Background drawables could use 24-bits

    The quickaction_slider_background.png drawable files are 8-bit, but a gradient like this could stand to be exported in 24-bit so it looks more smooth.

    Thanks for a great library.

    opened by kenfehling 1
  • Bugfixes

    Bugfixes

    hi,

    made a few changes that you might find useful

    1. fixed a bug with the viewgroup index (minor)
    2. changed the listener to include the anchor view element along with the position. This makes writing listeners easier and getting the domain object associated with the current invocation easier (if you save it in a tag in the anchor)
    3. Delayed setting the icon and text from the action item to when the item is shown. THis allows changing the state of the action items based on conditions and have them reflect properly when the quick action is shown

    hth, Raghu

    opened by raghur 0
  • In landscape popup menu appears off top of screen

    In landscape popup menu appears off top of screen

    The pop-up menu is not being displayed properly with the device (a Samsung Galaxy Tab 3 in this case) in landscape orientation. The full list appears correctly when the device is in portrait orientation.

    opened by amigax 0
  • QuickAction menus shift position when scrolled in a list.

    QuickAction menus shift position when scrolled in a list.

    Hello,

    I have encountered a unique bug, I have a list of say 100 records which the user generates itself, on longpress on a row i show the quick action menus. Problem is when i scroll once, and if i longpress on 1st showing row after sroll, the quickaction shifts 2 positions below, When i scroll twice and if i longpress on 1st showing row after sroll, the quickaction shifts say 3 or 4 positions below, that means the quick action menu is shown but below 4 rows that was actually long pressed. When i long press the last item in my list i.e. the 100th item, since after each scroll the quick action menus shift position, as per your algorithm written in QuickAction.java class, the show() method is called but due to 4-5 scrolls the quickaction menu is way below the last item in the list, which obstructs it from Showing.

    I hope you will help me in this .

    Thanks, Varun Thakur.

    opened by varun2264 0
  • how to make it shrink to fit items?

    how to make it shrink to fit items?

    The default implementation looks like it was made for 4+ items to be in the bar. I'm using 3, and so I have grey space to the right. I tried using the modification for the HD screen code (one of your pull requests) but this slides the action bar to the left of the screen instead of the middle.

    Please see the stackoverflow post here:http://stackoverflow.com/questions/16828210/struggling-with-quickaction-not-displaying-correctly

    Any help would be greatly appreciated as this is delaying an alpha test of an app i was commissioned to work on.

    opened by evanrich 0
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#

Xamarin.Android Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#. Build Status Platform

Xamarin 1.8k Jan 5, 2023
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Jan 3, 2023
[] A fast PDF reader component for Android development

This project is no longer maintained. You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PD

Joan Zapata 2.8k Dec 16, 2022
[] Define and render UI specs on top of your Android UI

dspec A simple way to define and render UI specs on top of your Android UI. Usage Enclose the target UI with a DesignSpecFrameLayout, usually the root

Lucas Rocha 561 Dec 16, 2022
A Material design Android pincode library. Supports Fingerprint.

LolliPin A Lollipop material design styled android pincode library (API 14+) To include in your project, add this to your build.gradle file: //Loll

Omada Health 1.6k Nov 25, 2022
Android Library to implement simple touch/tap/swipe gestures

SimpleFingerGestures An android library to implement simple 1 or 2 finger gestures easily Example Library The library is inside the libSFG folder Samp

Arnav Gupta 315 Dec 21, 2022
Android layout decorators : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views

Decor Decor is a library that applies decorators to Android layout with additional attributes without the need to extend and create a custom View for

Mouna Cheikhna 304 Nov 25, 2022