Skip to content
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

Simplified show method #136

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/src/main/java/com/nispok/snackbar/Snackbar.java
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,16 @@ public void showByReplace(ViewGroup parent, boolean usePhoneLayout) {
show(parent, usePhoneLayout);
}



/**
* SnackbarManager show method
*
*/
public void show() {
SnackbarManager.show(this);
}

/**
* Displays the {@link Snackbar} at the bottom of the
* {@link android.app.Activity} provided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,24 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_sample);

Button singleLineButton = (Button) findViewById(R.id.single_line);

//Simplified show method
singleLineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SnackbarManager.show(
Snackbar.with(SnackbarSampleActivity.this)
.text("Single-line snackbar"));
Snackbar.with(SnackbarSampleActivity.this)
.text("Single-line snackbar").show();
}
});

// singleLineButton.setOnClickListener(new View.OnClickListener() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dusunboy could you please delete all the commented code?

// @Override
// public void onClick(View v) {
// SnackbarManager.show(
// Snackbar.with(SnackbarSampleActivity.this)
// .text("Single-line snackbar"));
// }
// });

Button singleLineWithActionButton = (Button) findViewById(R.id.single_line_with_action);
singleLineWithActionButton.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down