soarcn / undobar Goto Github PK
View Code? Open in Web Editor NEW[Deprecated] Android Library that implements Snackbars (former known as Undobar) from Google's Material Design documentation.
Home Page: http://soarcn.github.io/UndoBar
[Deprecated] Android Library that implements Snackbars (former known as Undobar) from Google's Material Design documentation.
Home Page: http://soarcn.github.io/UndoBar
Hello,
I downloaded the code and add the project as an Android library to my eclipse project.
When trying to invoke the undobar from my adapter I got the following error
java.lang.NullPointerException
at com.cocosw.undobar.UndoBarController.<init>(UndoBarController.java:89)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:272)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:259)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:251)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:305)
at rainstudios.kelo.ui.FavoriteAdapter$1.onDismiss(FavoriteAdapter.java:64)
at androidextras.widget.SwipeDismissTouchListener$2.onAnimationEnd(SwipeDismissTouchListener.java:228)
at com.nineoldandroids.animation.ValueAnimator.endAnimation(ValueAnimator.java:1034)
at com.nineoldandroids.animation.ValueAnimator.access$900(ValueAnimator.java:43)
at com.nineoldandroids.animation.ValueAnimator$AnimationHandler.handleMessage(ValueAnimator.java:669)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
It seems that the inflation fails and the mButton variable is null.
I don't understand what is wrong with my application (API 11 and using AndroidAnnotations).
Here's the code I use to invoke undobar
@EBean
public class FavoriteAdapter extends BaseAdapter implements UndoListener {
@SuppressWarnings("unchecked")
List<Favorite> items = Collections.EMPTY_LIST;
@RootContext
Activity context;
....
@Override
public View getView(int position, View convertView, ViewGroup parent) {
FavoriteItemView view;
if (convertView == null) {
view = FavoriteItemView_.build(context);
} else {
view = (FavoriteItemView) convertView;
}
view.setLongClickable(false);
view.setClickable(false);
view.setOnClickListener(null);
view.bind(getItem(position));
final int pos = position;
// Create a generic swipe-to-dismiss touch listener.
view.setOnTouchListener(new SwipeDismissTouchListener(view, null,
new SwipeDismissTouchListener.OnDismissCallback() {
@Override
public void onDismiss(View view, Object token) {
Favorite item = items.get(pos);
db.deleteFavorite(FavoriteType.Subreddit, item.title);
items.remove(pos);
UndoBarController.show(context, "Undo-bar title",
FavoriteAdapter.this, null);
}
}));
return view;
}
Is it possible to set of of the UndoBar? I'd like to place it in the middle of the screen
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="undo">ביטול</string>
<string name="retry">נסה שנית</string>
</resources>
"you better store duplicate copies in both values-iw/ and values-he/ just to make sure it works in all devices."
Material Design guidelines have changed: now the "undo bars" (snackbars) fill the bottom of screen.
You can check it out at http://www.google.com/design/spec/components/snackbars-and-toasts.html#snackbars-and-toasts-specs
I tried to include the undobar in my project using gradle with the suggested gradle command "compile 'com.cocosw:undobar:0.5@aar'" and mavenCentral(), but the classes.jar in that aar is empty.
I tried to call UndoBarController.show() inside of onUndo() callback, but it doesn't seem to show the UndoBar again.
Any ideas as to why this might be happening ?
07-17 22:57:26.072 28476-28476/com.paybay.qtrace.lite E/ActivityThread﹕ Failed to inflate
android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:262)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:262)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:470)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at android.support.v7.internal.widget.ActionBarView.(ActionBarView.java:223)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:470)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at android.support.v7.internal.widget.ActionBarView.(ActionBarView.java:223)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01004c a=-1}
at android.content.res.Resources.loadDrawable(Resources.java:2166)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.widget.ImageView.(ImageView.java:129)
at android.widget.ImageView.(ImageView.java:119)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:470)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at android.support.v7.internal.widget.ActionBarView.(ActionBarView.java:223)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
07-17 22:57:26.080 28476-28476/com.paybay.qtrace.lite E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.paybay.qtrace.lite, PID: 28476
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.paybay.qtrace.lite/com.paybay.qtrace.lite.activity.QTraceLiteActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2216)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:262)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:262)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:470)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at android.support.v7.internal.widget.ActionBarView.(ActionBarView.java:223)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:470)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at android.support.v7.internal.widget.ActionBarView.(ActionBarView.java:223)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:238)
at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:466)
at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:316)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:604)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:607)
at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:509)
at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:594)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:422)
at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:372)
at com.cocosw.undobar.UndoBarController.(UndoBarController.java:90)
at com.cocosw.undobar.UndoBarController.ensureView(UndoBarController.java:199)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:186)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:178)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:238)
at com.paybay.qtrace.lite.activity.QTraceLiteActivity.onCreate(QTraceLiteActivity.java:111)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01004c a=-1}
at android.content.res.Resources.loadDrawable(Resources.java:2166)
at android.content.res.TypedArray.getDrawab
I need a function is that undobar can dismiss if it's showing when I touch screen
Hi! First of all thanks for your work and very useful library!
My problem is that on device rotation a visible undo bar is not restored. It seems UndoBar instance state is not saved.
I tried to debug and noticed that onSaveInstanceState
and onRestoreInstanceState
are not being invoked on device rotation.
May it happen because UndoBar view is added dynamically?
When I try to compile with the new v7 support library, I get the following error:
Error: Attribute "buttonStyle" has already been defined
I do not get this error with 22.0. I assume this caused by the definition in attrs.xml conflicting with one introduced in the new support library version.
Check for version 1.3 here:
http://search.maven.org/#artifactdetails|com.cocosw|undobar|1.3|jar
Sizes of sources and javadoc are just some bytes.
It would be great to have recent sources and javadoc available, too.
I want to hide the undobar by myself,what should I do?
subject says it all :)
API chapter,
"Or you can also use UndoBar with builder style.
new UndoBar(getActivity()).message("Undo-bar title").listener(listener).show;"
should be show() in the end, I assume ;)
I really like the UndoBar, works great! I just have one problem. I'm using the new Material Design UndoBar and want to move my Floating Action Button out of the way. The thing is that I only know its max height is 80dp, but I want to know the exact height for the best animation. Thanks in advance!
Well, as said in the title: The parcelable in onHide is null while onUndo is working just fine.
Hello,
if you press on the "Undo" button of Undobar and hold your press on the button, the Undobar disappears after the specified timeout. This is still correct. If you release your press on the button now (AFTER Undobar disappeared) the Undobar crashes.
We reproduced the bug on a device with Android 4 and Android 5.
See stacktrace:
11-25 14:26:03.830 3058-3058/de.whs.moa.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: de.whs.moa.app, PID: 3058
java.lang.NullPointerException: Attempt to read from field 'android.os.Parcelable com.cocosw.undobar.UndoBarController$Message.undoToken' on a null object reference
at com.cocosw.undobar.UndoBarController$Message.access$200(UndoBarController.java:775)
at com.cocosw.undobar.UndoBarController$2.onClick(UndoBarController.java:127)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Currently the button highlights when pressed are the old Holo blue colour. It would be nice to also have the new Holo gray colour when running on KitKat.
OnHide() is not called when a new UndoBar is created before a previous UndoBar has time to time out and execute OnHide().
For example, I have an UndoBar come up every time I swipe away a list item. If I swipe away one list item, an UndoBar appears. If I then swipe away another list item immediately after, not giving the first UndoBar time to time out and animate out, then the first UndoBar's onHide() is not executed, and a new UndoBar comes up for the second item swiped away, replacing the first.
If I swipe two items away, I need the onHide callback to run for both items. Is this the intended functionality?
in
private LinkedList<Message> mMessages = new LinkedList<>();
I am using eclipse and building with 1.6
I get this "No resource found that matches the given name (at 'id' with value '@android:id/mask')" error in "UndoBar / library / res / drawable-v21 /undobar_material_button.xml" resource file. Do I need to add a new dependency? I did not face this any time before. I see you have updated the lib few hours back. Please help.
compile 'com.cocosw:undobar:1.+'
Causes the app to crash at the line
UndoBarController.show(mActivity, "Item removed", ItemSwipeListener.this, bundle);
With the error
'void android.widget.TextView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
However, using'com.cocosw:undobar:1.+@aar'
to compile works fine. Also using this way asks me to implement "onClear", but it doesn't when the @aar isn't there.
Is it possible to get a listener hook for when the Undo Bar vanishes after the time limit?
This could be used to clean up state when an action is NOT Undone.
For example:
This could be done by extending the current listener to support an extra function. eg;
void onUndo(Parcelable token, Boolean undone);
...and then implementations could check "undone" to determine if, for the token, the action was undone, or can proceed with committing the action.
It seems there's an issue when using this library together with the Android Support Library V7 (ActionBarCompat one, didn't try the rest).
a simple call from the main activity or from a fragment to: UndoBarController.show(getActivity(), "Retry"); will throw an exception.
The Logcat:
FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
...
Any ideas? I've tried it without the Support Library or with the version 4 of it and it's working properly, so it seems the issue is just with the SLv7.
Thanks
When calling the option clear() on the undoBar, this does not clear the animation of the undobar leaving the screen.
For example, I have two fragments in an fragmentactivity: Frag1 & Frag2 in FragActivity.
EDIT: this was in version 0.3. May have been fixed in the meantime?
Could you please create an aar for this page? http://gradleplease.appspot.com/
Thank you!
Just a suggestion to add the following to the UndoBarMessageKitKat
style:
<item name="android:layout_marginLeft">25dp</item>
and the following to the UndoBarButtonKitKat
style:
<item name="android:paddingRight">25dp</item>
These changes make the UndoBar look a bit more similar to the ones used in Google apps.
When I am trying to show a new UndoBar, you are using the old one and customize it. This makes sense. But there is a problem. If the bar is a just a message bar you are hiding the buttons and then if it is a UndoBar you are not showing them again.
You shoul add to that if statement. I wish I could send you a pull request but I am new here. :)
button.setVisibility(View.VISIBLE);
findViewById(id.undobar_divider).setVisibility(View.VISIBLE);
Instead of using
new UndoBarController.UndoBar(MainActivity.this).message(msg).listener(mUndoListener).duration(duration).show();
I want to use UndoBar by referencing to a variable so i can cancel/hide it from somewhere in my activity.
For example, define it
UndoBarController.UndoBar mUndobar;
and set values when i need it
mUndobar = new UndoBarController.UndoBar(MainActivity.this).message(msg).listener(mUndoListener).duration(duration);
mUndoBar.show();
Then close/hide it when i want/need with
if(mUndoBar!=null)
{
mUndoBar.clear();
}
Do you thing there would be issues with concurrency? For example when user uses it again while undo duration of previous action continuing? I use UndoBar for file deletions and I prevent user deleting another file while UndoBar duration is active
I have a similar issue of #53 but with support 23.0.2
Attribute "buttonStyle" has already been defined
It points me on a generated values.xml
<declare-styleable name="Undobar"><attr format="reference" name="undoBarStyle"/><attr format="reference" name="inAnimation"/><attr format="reference" name="outAnimation"/><attr format="reference" name="containerStyle"/><attr format="reference" name="messageStyle"/><attr format="reference" name="**buttonStyle**"/><attr format="reference" name="dividerStyle"/></declare-styleable>
I used :
compile 'com.cocosw:undobar:1.+@aar'
Crashes instantly after calling it:
Caused by: java.lang.NullPointerException
at com.cocosw.undobar.UndoBarController.<init>(UndoBarController.java:75)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:203)
at com.cocosw.undobar.UndoBarController.show(UndoBarController.java:225)
Hi, I really love your library it isn't compatible with android Studio because it's an apklib could you publish an .aar on maven?
As far as I know there is no way I can set the word "Undo". I would like to be able to translate the "Undo" word as well. In your example screenshots you have shown you can change the text but I can't find any public setters for this. Am I missing something?
When implementing the translucent Navigationbar, the Undobar pops up behind this bar.
I'd suggest changing the position depending on whether it is used or not.
(e.g. by passing a boolean to the constructor and switching the position depending on this boolean)
For multiline undo bar message the text is very close to the top and bottom edges of the undo bar.
It would be nice to have some top and bottom margin for undo bar message.
I'm following the approach to do the actual work in onHide which is why I'd like to call onHide from onClear. But I need the parcelable to do this. Would really love this addition :)
there is no need for using compile 'com.cocosw:undobar:0.6@aar'
anymore for latest gradle. It auto-resolves the type of dependency.
This can be changed into compile 'com.cocosw:undobar:0.6'
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.