-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
actionListener not called with snackbar attached to ViewGroup. #88
Comments
Hi. Could you provide more detail of this issue? I am trying to reproduce this issue with the "Show in Dialog" sample which attaches snackbar to RelativeLayout, but actionListener called properly though. |
Hello. @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.fragment_main, container, false);
ButterKnife.inject(this, mRootView);
SnackbarManager.show(Snackbar.with(mActivity)
.text("Text")
.actionLabel("Label")
.actionListener(this)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.eventListener(this), container);
} |
Can't reproduce. However, I'm using a bit different code which uses public class TestFragmentActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_empty);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceHolderFragment())
.commit();
}
public static class PlaceHolderFragment extends Fragment implements ActionClickListener, EventListener {
private View mRootView;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.fragment_dialog_list, container, false);
ButterKnife.inject(this, mRootView);
return mRootView;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SnackbarManager.show(Snackbar.with(getActivity())
.text("Text")
.actionLabel("Label")
.actionListener(this)
.duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
.eventListener(this), (ViewGroup) mRootView.getParent());
}
@Override
public void onActionClicked(Snackbar snackbar) {
}
@Override
public void onShow(Snackbar snackbar) {
}
@Override
public void onShowByReplace(Snackbar snackbar) {
}
@Override
public void onShown(Snackbar snackbar) {
}
@Override
public void onDismiss(Snackbar snackbar) {
}
@Override
public void onDismissByReplace(Snackbar snackbar) {
}
@Override
public void onDismissed(Snackbar snackbar) {
}
}
} |
I was able to reproduce this issue with a viewgroup after dismiss and show again the snackbar. Do you have an idea why this occurs? |
@AndreRoss Okay, reproduced. But I think that is not the same issue of which @pawelantczak has reported. Are you reusing the same instance of ref.) Reusing same snackbar instance #23 |
Hello.
Like in titie.
Regards.
The text was updated successfully, but these errors were encountered: