lorensiuswlt / newquickaction3d Goto Github PK
View Code? Open in Web Editor NEWGallery3D like quickaction
Home Page: http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
License: Apache License 2.0
Gallery3D like quickaction
Home Page: http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
License: Apache License 2.0
Hi, awesome lib but there's an annoying major bug :
Each time the QuickAction is showed, the container (not the arrow) moves to the left for some pixels.
After few openings, the QuickAction is not even under the arrow.
I used it with a button (in an action bar) at the maximum right of the screen.
Best regards,
Alex.
Screenshot : http://hpics.li/b1da65e
Hey, I'm currently using NewQuickAction. Is there any simple way to convert NewQuickAction to NewQuickAction3D ?? Will adding the new resources ( if any ) and updating layout file work fine or there are other functionality changes also ? @lorensiuswlt
Afer a few times tappting on the button like a monkey, the app crashes :
LogCat:
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3129)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.view.View.measure(View.java:8313)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.os.Looper.loop(Looper.java:130)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at java.lang.reflect.Method.invoke(Method.java:507)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-02 14:31:51.183: ERROR/AndroidRuntime(8552): at dalvik.system.NativeStart.main(Native Method)
Screenshot : http://hpics.li/c69cd8f
Best regards,
Alexandre
What would if i add 10 menu to this Lib.Menu ?
Can we provide Scroll to Menu ?
do rply
Hi! I used your code in my own project. I'd like to contribute some code for you!
This code is QuickActionInflater, use it as MenuInflater, example:
QuickActionInflater mInflater = new QuickActionInflater(this);
mQuickAction = new QuickAction(this, QuickAction.VERTICAL);
mInflater.inflate(R.menu.options_menu_playback, mQuickAction);
Source code:
/*
* Copyright (C) 2012 The MusicMod Project
*
* 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.
*/
package net.londatiga.android;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
import android.view.InflateException;
/**
* This class is used to instantiate menu XML files into Menu objects.
* <p>
* For performance reasons, menu inflation relies heavily on pre-processing of
* XML files that is done at build time. Therefore, it is not currently possible
* to use MenuInflater with an XmlPullParser over a plain XML file at runtime;
* it only works with an XmlPullParser returned from a compiled resource (R.
* <em>something</em> file.)
*/
public class QuickActionInflater {
/** Menu tag name in XML. */
private static final String XML_MENU = "menu";
/** Item tag name in XML. */
private static final String XML_ITEM = "item";
/** Namespaces to read attributes */
private static final String ANDROID_NS = "http://schemas.android.com/apk/res/android";
/** Attribute names */
private static final String ATTR_ID = "id";
private static final String ATTR_TITLE = "title";
private static final String ATTR_ICON = "icon";
private Context mContext;
/**
* Constructs a menu inflater.
*
* @see Activity#getMenuInflater()
*/
public QuickActionInflater(Context context) {
mContext = context;
}
/**
* Inflate a menu hierarchy from the specified XML resource. Throws
* {@link InflateException} if there is an error.
*
* @param menuRes Resource ID for an XML layout resource to load (e.g.,
* <code>R.menu.main_activity</code>)
* @param menu The Menu to inflate into. The items and submenus will be
* added to this Menu.
*/
public void inflate(int menuRes, QuickAction action) {
XmlResourceParser parser = null;
try {
parser = mContext.getResources().getLayout(menuRes);
AttributeSet attrs = Xml.asAttributeSet(parser);
parseMenu(parser, attrs, action);
} catch (XmlPullParserException e) {
throw new InflateException("Error inflating menu XML", e);
} catch (IOException e) {
throw new InflateException("Error inflating menu XML", e);
} finally {
if (parser != null) parser.close();
}
}
/**
* Called internally to fill the given menu. If a sub menu is seen, it will
* call this recursively.
*/
private void parseMenu(XmlPullParser parser, AttributeSet attrs, QuickAction action)
throws XmlPullParserException, IOException {
QuickActionState quickActionState = new QuickActionState(action);
int eventType = parser.getEventType();
String tagName;
boolean lookingForEndOfUnknownTag = false;
String unknownTagName = null;
// This loop will skip to the menu start tag
do {
if (eventType == XmlPullParser.START_TAG) {
tagName = parser.getName();
if (tagName.equals(XML_MENU)) {
// Go to next tag
eventType = parser.next();
break;
}
throw new RuntimeException("Expecting menu, got " + tagName);
}
eventType = parser.next();
} while (eventType != XmlPullParser.END_DOCUMENT);
boolean reachedEndOfMenu = false;
while (!reachedEndOfMenu) {
switch (eventType) {
case XmlPullParser.START_TAG:
if (lookingForEndOfUnknownTag) {
break;
}
tagName = parser.getName();
if (tagName.equals(XML_ITEM)) {
quickActionState.readItem(attrs);
} else {
lookingForEndOfUnknownTag = true;
unknownTagName = tagName;
}
break;
case XmlPullParser.END_TAG:
tagName = parser.getName();
if (lookingForEndOfUnknownTag && tagName.equals(unknownTagName)) {
lookingForEndOfUnknownTag = false;
unknownTagName = null;
} else if (tagName.equals(XML_ITEM)) {
// Add the item if it hasn't been added (if the item was
// a submenu, it would have been added already)
if (!quickActionState.hasAddedItem()) {
quickActionState.addItem();
}
} else if (tagName.equals(XML_MENU)) {
reachedEndOfMenu = true;
}
break;
case XmlPullParser.END_DOCUMENT:
throw new RuntimeException("Unexpected end of document");
}
eventType = parser.next();
}
}
/**
* State for the current menu.
* <p>
* Groups can not be nested unless there is another menu (which will have
* its state class).
*/
private class QuickActionState {
private QuickAction action;
private boolean itemAdded;
private int itemId;
private String itemTitle;
private Drawable itemIcon;
public QuickActionState(final QuickAction action) {
this.action = action;
}
/**
* Called when the parser is pointing to an item tag.
*/
public void readItem(AttributeSet attrs) {
// Inherit attributes from the group as default value
Log.d("QuickActionInflater", "item read! itemId = " + itemId);
itemId = attrs.getAttributeResourceValue(ANDROID_NS, ATTR_ID, 0);
itemTitle = mContext.getString(attrs.getAttributeResourceValue(ANDROID_NS, ATTR_TITLE, 0));
itemIcon = mContext.getResources().getDrawable(attrs.getAttributeResourceValue(ANDROID_NS, ATTR_ICON, android.R.color.transparent));
itemAdded = false;
}
private ActionItem setItem() {
return new ActionItem(itemId,itemTitle,itemIcon);
}
public void addItem() {
itemAdded = true;
action.addActionItem(setItem());
}
public boolean hasAddedItem() {
return itemAdded;
}
}
}
Please add the maven support in the same way as SherlockActionBar.
You can only copy pom.xml from SherlockActionBar and modify it for your project
Next step should be upload your library to any public maven repository, but pom.xml make this simple for everyone.
ActionItem faceItem = new ActionItem(FACEBOOK, "FACEBOOK");
ActionItem twitItem = new ActionItem(TWİTTER, "TWİTTER");
ActionItem smsItem = new ActionItem(SMS, "SMS");
ActionItem emailItem = new ActionItem(EMAİL, "EMAİL");
QuickAction mquickAction = new QuickAction(this,QuickAction.VERTICAL);
mquickAction.addActionItem(faceItem);
09-25 18:32:44.424: E/ViewRootImpl(24600): sendUserActionEvent() mView == null
09-25 18:32:51.304: E/AndroidRuntime(24600): FATAL EXCEPTION: main
09-25 18:32:51.304: E/AndroidRuntime(24600): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ip_dergi/com.ip_dergi.ItemContent}: java.lang.NullPointerException
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread.access$700(ActivityThread.java:150)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.os.Looper.loop(Looper.java:137)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread.main(ActivityThread.java:5279)
09-25 18:32:51.304: E/AndroidRuntime(24600): at java.lang.reflect.Method.invokeNative(Native Method)
09-25 18:32:51.304: E/AndroidRuntime(24600): at java.lang.reflect.Method.invoke(Method.java:511)
09-25 18:32:51.304: E/AndroidRuntime(24600): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
09-25 18:32:51.304: E/AndroidRuntime(24600): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
09-25 18:32:51.304: E/AndroidRuntime(24600): at dalvik.system.NativeStart.main(Native Method)
09-25 18:32:51.304: E/AndroidRuntime(24600): Caused by: java.lang.NullPointerException
09-25 18:32:51.304: E/AndroidRuntime(24600): at net.londatiga.android.QuickAction.addActionItem(QuickAction.java:170)
09-25 18:32:51.304: E/AndroidRuntime(24600): at com.ip_dergi.ItemContent.onCreate(ItemContent.java:68)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.Activity.performCreate(Activity.java:5267)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
09-25 18:32:51.304: E/AndroidRuntime(24600): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
09-25 18:32:51.304: E/AndroidRuntime(24600): ... 11 more
hi, there's problem with listview, when i'm clicking on items, the popup will resize to its minimal height.
please see this screenshot : http://i.imgur.com/ouaEP.png
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
quickVerticalAction.show(arg1);
}
});
It would be nice to have a 'grid' in addition to the horizontal and vertical modes that are available.
Hi there,
Its a nice working example and worked exactly as you described.
But I want to use this in a little different way.
As per my project's requirement, I need to place the button on the right side and title on the left side. For that I edited the "action_item_horizontal" file because I want to display the action item horizontally. I placed the TextView before ImageView in the RelativeLayout. Doing so and I run the project, I am getting ClassCastException : android.widget.textview...
How can I resolve this?
Waiting for your quick response.
Regards
you have to remove the bin folder from the version control and also specify it in .gitignore
When i am changing the orientation Pop up automatically get closed
I don't understand why two almost the same project exist as two repository NeqQuickAction and NewQuickAction3D. Don't be better only one project with customizable animation? This situation cause two Issues list, much more forks and mess int the project :-(
when ActionItem has onclick effect like action_item_btn.xml and quickAction dismissed,
it sometimes cause popupwindow has transparent rectangle.
like below:
https://docs.google.com/leaf?id=0BwrpgpmcQWZXMTI0NzExZWUtMmNlMS00MzBhLWEzODAtYTgwZDk3N2NlYTVl&hl=zh_TW
Please give me any suggestion.How to increase text font size and each text field in between space.
When I use it as library, it has some runtime errors. I fixed it. please review my patch.
https://gist.github.com/1385738
Thank you.
You should add code to offset (H of actionBar) + (H of system Bar) on newer platform. Otherwise yPos won;t be correct.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.