That fuck shit the fascists are using
at master 65 lines 1.6 kB view raw
1package org.tm.archive.groups; 2 3import android.os.Parcel; 4import android.os.Parcelable; 5 6public final class SelectionLimits implements Parcelable { 7 private static final int NO_LIMIT = Integer.MAX_VALUE; 8 9 public static final SelectionLimits NO_LIMITS = new SelectionLimits(NO_LIMIT, NO_LIMIT); 10 11 private final int recommendedLimit; 12 private final int hardLimit; 13 14 public SelectionLimits(int recommendedLimit, int hardLimit) { 15 this.recommendedLimit = recommendedLimit; 16 this.hardLimit = hardLimit; 17 } 18 19 public int getRecommendedLimit() { 20 return recommendedLimit; 21 } 22 23 public int getHardLimit() { 24 return hardLimit; 25 } 26 27 public boolean hasRecommendedLimit() { 28 return recommendedLimit != NO_LIMIT; 29 } 30 31 public boolean hasHardLimit() { 32 return hardLimit != NO_LIMIT; 33 } 34 35 @Override 36 public int describeContents() { 37 return 0; 38 } 39 40 @Override 41 public void writeToParcel(Parcel dest, int flags) { 42 dest.writeInt(recommendedLimit); 43 dest.writeInt(hardLimit); 44 } 45 46 public static final Creator<SelectionLimits> CREATOR = new Creator<SelectionLimits>() { 47 @Override 48 public SelectionLimits createFromParcel(Parcel in) { 49 return new SelectionLimits(in.readInt(), in.readInt()); 50 } 51 52 @Override 53 public SelectionLimits[] newArray(int size) { 54 return new SelectionLimits[size]; 55 } 56 }; 57 58 public SelectionLimits excludingSelf() { 59 return excluding(1); 60 } 61 62 public SelectionLimits excluding(int count) { 63 return new SelectionLimits(recommendedLimit - count, hardLimit - count); 64 } 65}