You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all a big thanks to your component. I am currently developing my first android app with the help of your component.
I have added some enhancements and if you don't mind, you can review and probably add them
Added home click listener
public void setOnHomeClickListener(OnClickListener listener) {
mHomeBtn.setOnClickListener(listener);
}
Added Action listener - a copy of your removeAction but this one is overriding the listener
public void setActionOnClickListener(Action action, OnClickListener listener) {
int childCount = mActionsView.getChildCount();
for (int i = 0; i < childCount; i++) {
View view = mActionsView.getChildAt(i);
if (view != null) {
final Object tag = view.getTag();
if (tag instanceof Action && tag.equals(action)) {
v.setOnClickListener(listener);
}
}
}
}
Example implementation
The setHomeOnClickListener will intercept the action before proceeding. Basically it will just validate if you want to discard changes made on the create screen.
actionBar.setOnHomeClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new AlertDialog.Builder(CreateActivity.this);
builder.setMessage("Discard changes?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
actionBar.onClick(v);
CreateActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}) ;
The setActionOnClickListener will intercept the action by first saving the data before proceding with the request.
actionBar.setActionOnClickListener(saveAction, new OnClickListener() {
@Override
public void onClick(View v) {
//save data
actionBar.onClick(v);
}
});
The text was updated successfully, but these errors were encountered:
First of all a big thanks to your component. I am currently developing my first android app with the help of your component.
I have added some enhancements and if you don't mind, you can review and probably add them
Added home click listener
public void setOnHomeClickListener(OnClickListener listener) {
mHomeBtn.setOnClickListener(listener);
}
Added Action listener - a copy of your removeAction but this one is overriding the listener
public void setActionOnClickListener(Action action, OnClickListener listener) {
int childCount = mActionsView.getChildCount();
for (int i = 0; i < childCount; i++) {
View view = mActionsView.getChildAt(i);
if (view != null) {
final Object tag = view.getTag();
if (tag instanceof Action && tag.equals(action)) {
v.setOnClickListener(listener);
}
}
}
}
Example implementation
The setHomeOnClickListener will intercept the action before proceeding. Basically it will just validate if you want to discard changes made on the create screen.
The setActionOnClickListener will intercept the action by first saving the data before proceding with the request.
The text was updated successfully, but these errors were encountered: