Fix for issues from crash logs

pull/14/head
Tim Su 15 years ago
parent ca002ae33c
commit 80449df0e5

@ -283,8 +283,10 @@ public class TagFilterExposer extends BroadcastReceiver {
protected boolean ok() { protected boolean ok() {
int deleted = tagService.delete(tag); int deleted = tagService.delete(tag);
TagData tagData = PluginServices.getTagDataService().getTag(tag, TagData.ID, TagData.DELETION_DATE); TagData tagData = PluginServices.getTagDataService().getTag(tag, TagData.ID, TagData.DELETION_DATE);
tagData.setValue(TagData.DELETION_DATE, DateUtilities.now()); if(tagData != null) {
PluginServices.getTagDataService().save(tagData); tagData.setValue(TagData.DELETION_DATE, DateUtilities.now());
PluginServices.getTagDataService().save(tagData);
}
Toast.makeText(this, getString(R.string.TEA_tags_deleted, tag, deleted), Toast.makeText(this, getString(R.string.TEA_tags_deleted, tag, deleted),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
return true; return true;

@ -22,6 +22,7 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -36,7 +37,7 @@ import com.cyrilmottier.android.greendroid.R;
* displayed on top of the user interface (it overlaps all UI elements but the * displayed on top of the user interface (it overlaps all UI elements but the
* notification bar). Clients may listen to user actions using a * notification bar). Clients may listen to user actions using a
* {@link OnQuickActionClickListener} . * {@link OnQuickActionClickListener} .
* *
* @author Benjamin Fellous * @author Benjamin Fellous
* @author Cyril Mottier * @author Cyril Mottier
*/ */
@ -66,7 +67,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Interface that may be used to listen to clicks on quick actions. * Interface that may be used to listen to clicks on quick actions.
* *
* @author Benjamin Fellous * @author Benjamin Fellous
* @author Cyril Mottier * @author Cyril Mottier
*/ */
@ -74,7 +75,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Clients may implement this method to be notified of a click on a * Clients may implement this method to be notified of a click on a
* particular quick action. * particular quick action.
* *
* @param position Position of the quick action that have been clicked. * @param position Position of the quick action that have been clicked.
*/ */
void onQuickActionClicked(QuickActionWidget widget, int position); void onQuickActionClicked(QuickActionWidget widget, int position);
@ -82,7 +83,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Creates a new QuickActionWidget for the given context. * Creates a new QuickActionWidget for the given context.
* *
* @param context The context in which the QuickActionWidget is running in * @param context The context in which the QuickActionWidget is running in
*/ */
public QuickActionWidget(Context context) { public QuickActionWidget(Context context) {
@ -106,7 +107,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Equivalent to {@link PopupWindow#setContentView(View)} but with a layout * Equivalent to {@link PopupWindow#setContentView(View)} but with a layout
* identifier. * identifier.
* *
* @param layoutId The layout identifier of the view to use. * @param layoutId The layout identifier of the view to use.
*/ */
public void setContentView(int layoutId) { public void setContentView(int layoutId) {
@ -120,7 +121,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Returns the arrow offset for the Y axis. * Returns the arrow offset for the Y axis.
* *
* @see {@link #setArrowOffsetY(int)} * @see {@link #setArrowOffsetY(int)}
* @return The arrow offset. * @return The arrow offset.
*/ */
@ -133,7 +134,7 @@ public abstract class QuickActionWidget extends PopupWindow {
* particular useful to warn which view the QuickActionWidget is related to. * particular useful to warn which view the QuickActionWidget is related to.
* By setting a positive offset, the arrow will overlap the view given by * By setting a positive offset, the arrow will overlap the view given by
* {@link #show(View)}. The default value is 5dp. * {@link #show(View)}. The default value is 5dp.
* *
* @param offsetY The offset for the Y axis * @param offsetY The offset for the Y axis
*/ */
public void setArrowOffsetY(int offsetY) { public void setArrowOffsetY(int offsetY) {
@ -142,7 +143,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Returns the width of the screen. * Returns the width of the screen.
* *
* @return The width of the screen * @return The width of the screen
*/ */
protected int getScreenWidth() { protected int getScreenWidth() {
@ -151,7 +152,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Returns the height of the screen. * Returns the height of the screen.
* *
* @return The height of the screen * @return The height of the screen
*/ */
protected int getScreenHeight() { protected int getScreenHeight() {
@ -162,7 +163,7 @@ public abstract class QuickActionWidget extends PopupWindow {
* By default, a {@link QuickActionWidget} is dismissed once the user * By default, a {@link QuickActionWidget} is dismissed once the user
* clicked on a {@link QuickAction}. This behavior can be changed using this * clicked on a {@link QuickAction}. This behavior can be changed using this
* method. * method.
* *
* @param dismissOnClick True if you want the {@link QuickActionWidget} to * @param dismissOnClick True if you want the {@link QuickActionWidget} to
* be dismissed on click else false. * be dismissed on click else false.
*/ */
@ -186,7 +187,7 @@ public abstract class QuickActionWidget extends PopupWindow {
* {@link QuickAction} while the {@link QuickActionWidget} is currently * {@link QuickAction} while the {@link QuickActionWidget} is currently
* being shown does nothing. The new {@link QuickAction} will be displayed * being shown does nothing. The new {@link QuickAction} will be displayed
* on the next call to {@link #show(View)}. * on the next call to {@link #show(View)}.
* *
* @param action The new {@link QuickAction} to add * @param action The new {@link QuickAction} to add
*/ */
public void addQuickAction(QuickAction action) { public void addQuickAction(QuickAction action) {
@ -209,7 +210,7 @@ public abstract class QuickActionWidget extends PopupWindow {
/** /**
* Call that method to display the {@link QuickActionWidget} anchored to the * Call that method to display the {@link QuickActionWidget} anchored to the
* given view. * given view.
* *
* @param anchor The view the {@link QuickActionWidget} will be anchored to. * @param anchor The view the {@link QuickActionWidget} will be anchored to.
*/ */
public void show(View anchor) { public void show(View anchor) {
@ -241,7 +242,12 @@ public abstract class QuickActionWidget extends PopupWindow {
showArrow(); showArrow();
prepareAnimationStyle(); prepareAnimationStyle();
showAtLocation(anchor, Gravity.NO_GRAVITY, 0, mPopupY);
try {
showAtLocation(anchor, Gravity.NO_GRAVITY, 0, mPopupY);
} catch (Exception e) {
Log.w("quick-action-show", e);
}
} }
protected void clearQuickActions() { protected void clearQuickActions() {

Loading…
Cancel
Save