Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. package com.redlabel.ui.simpleswipeview.bean;
  2.  
  3. /**
  4.  * Created by rL on 17/03/2017.
  5.  */
  6.  
  7. public class DataBean {
  8.  
  9.     private String value;
  10.     private boolean checked;
  11.  
  12.     public DataBean() {
  13.  
  14.     }
  15.  
  16.     public DataBean(String value) {
  17.         this.value = value;
  18.         this.checked = false;
  19.     }
  20.  
  21.     public String getValue() {
  22.         return value;
  23.     }
  24.  
  25.     public boolean isChecked() {
  26.         return checked;
  27.     }
  28.  
  29.     public void toggleChecked() {
  30.         checked = !checked;
  31.     }
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. package com.redlabel.ui.simpleswipeview.bean;
  51.  
  52. import java.util.ArrayList;
  53.  
  54. /**
  55.  * Created by rL on 17/03/2017.
  56.  */
  57.  
  58. public class ListDataBean extends ArrayList {
  59.  
  60.     private DataBean dataBean;
  61.     private boolean selectionMode;
  62.  
  63.     public ListDataBean() {
  64.         selectionMode = false;
  65.     }
  66.  
  67.     public boolean getSelectionMode() {
  68.         return selectionMode;
  69.     }
  70.  
  71.     public void setSelectionMode(boolean selectionMode) {
  72.         this.selectionMode = selectionMode;
  73.     }
  74.  
  75.     public DataBean getDataBeanByValue(String value) {
  76.         for(Object dataBean : this) {
  77.             if(((DataBean) dataBean).getValue().equals(value)) {
  78.                 return (DataBean) dataBean;
  79.             }
  80.         }
  81.         return null;
  82.     }
  83.  
  84.     public boolean containsCheckedItems() {
  85.         for(Object dataBean : this) {
  86.             if(((DataBean) dataBean).isChecked()) {
  87.                 return true;
  88.             }
  89.         }
  90.         return false;
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement