Example #1
0
 @Override
 public boolean equalTo(Tab other) {
   boolean equal =
       getTitle().equals(other.getTitle())
           && isHeader() == other.isHeader()
           && getPopupMenu() == other.getPopupMenu()
           && getLayout() == other.getLayout();
   if (getContent() != null) {
     equal = equal && getContent().equals(other.getContent());
   } else {
     equal = equal && other.getContent() == null;
   }
   if (getThumbnail() != null) {
     Bitmap one = ((BitmapDrawable) getThumbnail()).getBitmap();
     Bitmap two = ((BitmapDrawable) other.getThumbnail()).getBitmap();
     equal = equal && one.sameAs(two);
   } else {
     equal = equal && other.getThumbnail() == null;
   }
   return equal;
 }
 /**
  * @return {@code true} if both {@link Bitmap bitmaps} are {@code null} or if the {@link Bitmap
  *     bitmaps} are equal according to {@link
  *     android.graphics.Bitmap#sameAs(android.graphics.Bitmap)}, {@code false} otherwise.
  */
 private boolean sameAs(@Nullable Bitmap bitmap, @Nullable Bitmap bitmap2) {
   return bitmap == bitmap2 || bitmap != null && bitmap2 != null && bitmap.sameAs(bitmap2);
 }