Guest User

Untitled

a guest
Nov 22nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import android.support.design.widget.Snackbar
  2. import android.view.View
  3. import com.github.clans.fab.FloatingActionMenu
  4.  
  5. fun View.visible(){
  6. this.visibility = View.VISIBLE
  7. }
  8. fun View.visible(visible : Boolean){
  9. if(visible){
  10. visible()
  11. }else{
  12. gone()
  13. }
  14. }
  15. fun View.gone(){
  16. this.visibility = View.GONE
  17. }
  18. fun View.invisible(){
  19. this.visibility = View.INVISIBLE
  20. }
  21. fun View.snackbar(resId: Int, duration: Int = Snackbar.LENGTH_SHORT) {
  22. snackbar(this.resources.getString(resId), duration)
  23. }
  24.  
  25. fun View.snackbar(msg: String, duration: Int = Snackbar.LENGTH_SHORT) {
  26. Snackbar.make(this, msg, duration).show()
  27. }
  28. fun View.longSnackbar(resId: Int) {
  29. snackbar(resId, Snackbar.LENGTH_LONG)
  30. }
Add Comment
Please, Sign In to add comment