481 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
			
		
		
	
	
			481 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
| .class public Lcom/google/android/material/badge/BadgeUtils;
 | |
| .super Ljava/lang/Object;
 | |
| .source "BadgeUtils.java"
 | |
| 
 | |
| 
 | |
| # annotations
 | |
| .annotation build Lcom/google/android/material/badge/ExperimentalBadgeUtils;
 | |
| .end annotation
 | |
| 
 | |
| 
 | |
| # static fields
 | |
| .field private static final LOG_TAG:Ljava/lang/String; = "BadgeUtils"
 | |
| 
 | |
| .field public static final USE_COMPAT_PARENT:Z
 | |
| 
 | |
| 
 | |
| # direct methods
 | |
| .method public static constructor <clinit>()V
 | |
|     .locals 1
 | |
| 
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     .line 1
 | |
|     sput-boolean v0, Lcom/google/android/material/badge/BadgeUtils;->USE_COMPAT_PARENT:Z
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method private constructor <init>()V
 | |
|     .locals 0
 | |
| 
 | |
|     .line 1
 | |
|     invoke-direct {p0}, Ljava/lang/Object;-><init>()V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;)V
 | |
|     .locals 1
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroid/view/View;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     .line 1
 | |
|     invoke-static {p0, p1, v0}, Lcom/google/android/material/badge/BadgeUtils;->attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;Landroid/widget/FrameLayout;)V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;Landroid/widget/FrameLayout;)V
 | |
|     .locals 0
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroid/view/View;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p2    # Landroid/widget/FrameLayout;
 | |
|         .annotation build Landroidx/annotation/Nullable;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     .line 2
 | |
|     invoke-static {p0, p1, p2}, Lcom/google/android/material/badge/BadgeUtils;->setBadgeDrawableBounds(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;Landroid/widget/FrameLayout;)V
 | |
| 
 | |
|     .line 3
 | |
|     invoke-virtual {p0}, Lcom/google/android/material/badge/BadgeDrawable;->getCustomBadgeParent()Landroid/widget/FrameLayout;
 | |
| 
 | |
|     move-result-object p2
 | |
| 
 | |
|     if-eqz p2, :cond_0
 | |
| 
 | |
|     .line 4
 | |
|     invoke-virtual {p0}, Lcom/google/android/material/badge/BadgeDrawable;->getCustomBadgeParent()Landroid/widget/FrameLayout;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-virtual {p1, p0}, Landroid/widget/FrameLayout;->setForeground(Landroid/graphics/drawable/Drawable;)V
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     .line 5
 | |
|     :cond_0
 | |
|     sget-boolean p2, Lcom/google/android/material/badge/BadgeUtils;->USE_COMPAT_PARENT:Z
 | |
| 
 | |
|     if-nez p2, :cond_1
 | |
| 
 | |
|     .line 6
 | |
|     invoke-virtual {p1}, Landroid/view/View;->getOverlay()Landroid/view/ViewOverlay;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-virtual {p1, p0}, Landroid/view/ViewOverlay;->add(Landroid/graphics/drawable/Drawable;)V
 | |
| 
 | |
|     :goto_0
 | |
|     return-void
 | |
| 
 | |
|     .line 7
 | |
|     :cond_1
 | |
|     new-instance p0, Ljava/lang/IllegalArgumentException;
 | |
| 
 | |
|     const-string p1, "Trying to reference null customBadgeParent"
 | |
| 
 | |
|     invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw p0
 | |
| .end method
 | |
| 
 | |
| .method public static attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroidx/appcompat/widget/Toolbar;I)V
 | |
|     .locals 1
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroidx/appcompat/widget/Toolbar;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p2    # I
 | |
|         .annotation build Landroidx/annotation/IdRes;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     .line 8
 | |
|     invoke-static {p0, p1, p2, v0}, Lcom/google/android/material/badge/BadgeUtils;->attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroidx/appcompat/widget/Toolbar;ILandroid/widget/FrameLayout;)V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static attachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroidx/appcompat/widget/Toolbar;ILandroid/widget/FrameLayout;)V
 | |
|     .locals 1
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroidx/appcompat/widget/Toolbar;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p2    # I
 | |
|         .annotation build Landroidx/annotation/IdRes;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p3    # Landroid/widget/FrameLayout;
 | |
|         .annotation build Landroidx/annotation/Nullable;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     .line 9
 | |
|     new-instance v0, Lcom/google/android/material/badge/BadgeUtils$1;
 | |
| 
 | |
|     invoke-direct {v0, p1, p2, p0, p3}, Lcom/google/android/material/badge/BadgeUtils$1;-><init>(Landroidx/appcompat/widget/Toolbar;ILcom/google/android/material/badge/BadgeDrawable;Landroid/widget/FrameLayout;)V
 | |
| 
 | |
|     invoke-virtual {p1, v0}, Landroid/view/ViewGroup;->post(Ljava/lang/Runnable;)Z
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static createBadgeDrawablesFromSavedStates(Landroid/content/Context;Lcom/google/android/material/internal/ParcelableSparseArray;)Landroid/util/SparseArray;
 | |
|     .locals 4
 | |
|     .param p1    # Lcom/google/android/material/internal/ParcelableSparseArray;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .annotation build Landroidx/annotation/NonNull;
 | |
|     .end annotation
 | |
| 
 | |
|     .annotation system Ldalvik/annotation/Signature;
 | |
|         value = {
 | |
|             "(",
 | |
|             "Landroid/content/Context;",
 | |
|             "Lcom/google/android/material/internal/ParcelableSparseArray;",
 | |
|             ")",
 | |
|             "Landroid/util/SparseArray<",
 | |
|             "Lcom/google/android/material/badge/BadgeDrawable;",
 | |
|             ">;"
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     new-instance v0, Landroid/util/SparseArray;
 | |
| 
 | |
|     invoke-virtual {p1}, Landroid/util/SparseArray;->size()I
 | |
| 
 | |
|     move-result v1
 | |
| 
 | |
|     invoke-direct {v0, v1}, Landroid/util/SparseArray;-><init>(I)V
 | |
| 
 | |
|     const/4 v1, 0x0
 | |
| 
 | |
|     .line 2
 | |
|     :goto_0
 | |
|     invoke-virtual {p1}, Landroid/util/SparseArray;->size()I
 | |
| 
 | |
|     move-result v2
 | |
| 
 | |
|     if-ge v1, v2, :cond_1
 | |
| 
 | |
|     .line 3
 | |
|     invoke-virtual {p1, v1}, Landroid/util/SparseArray;->keyAt(I)I
 | |
| 
 | |
|     move-result v2
 | |
| 
 | |
|     .line 4
 | |
|     invoke-virtual {p1, v1}, Landroid/util/SparseArray;->valueAt(I)Ljava/lang/Object;
 | |
| 
 | |
|     move-result-object v3
 | |
| 
 | |
|     check-cast v3, Lcom/google/android/material/badge/BadgeDrawable$SavedState;
 | |
| 
 | |
|     if-eqz v3, :cond_0
 | |
| 
 | |
|     .line 5
 | |
|     invoke-static {p0, v3}, Lcom/google/android/material/badge/BadgeDrawable;->createFromSavedState(Landroid/content/Context;Lcom/google/android/material/badge/BadgeDrawable$SavedState;)Lcom/google/android/material/badge/BadgeDrawable;
 | |
| 
 | |
|     move-result-object v3
 | |
| 
 | |
|     .line 6
 | |
|     invoke-virtual {v0, v2, v3}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
 | |
| 
 | |
|     add-int/lit8 v1, v1, 0x1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     .line 7
 | |
|     :cond_0
 | |
|     new-instance p0, Ljava/lang/IllegalArgumentException;
 | |
| 
 | |
|     const-string p1, "BadgeDrawable\'s savedState cannot be null"
 | |
| 
 | |
|     invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw p0
 | |
| 
 | |
|     :cond_1
 | |
|     return-object v0
 | |
| .end method
 | |
| 
 | |
| .method public static createParcelableBadgeStates(Landroid/util/SparseArray;)Lcom/google/android/material/internal/ParcelableSparseArray;
 | |
|     .locals 4
 | |
|     .param p0    # Landroid/util/SparseArray;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .annotation build Landroidx/annotation/NonNull;
 | |
|     .end annotation
 | |
| 
 | |
|     .annotation system Ldalvik/annotation/Signature;
 | |
|         value = {
 | |
|             "(",
 | |
|             "Landroid/util/SparseArray<",
 | |
|             "Lcom/google/android/material/badge/BadgeDrawable;",
 | |
|             ">;)",
 | |
|             "Lcom/google/android/material/internal/ParcelableSparseArray;"
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     new-instance v0, Lcom/google/android/material/internal/ParcelableSparseArray;
 | |
| 
 | |
|     invoke-direct {v0}, Lcom/google/android/material/internal/ParcelableSparseArray;-><init>()V
 | |
| 
 | |
|     const/4 v1, 0x0
 | |
| 
 | |
|     .line 2
 | |
|     :goto_0
 | |
|     invoke-virtual {p0}, Landroid/util/SparseArray;->size()I
 | |
| 
 | |
|     move-result v2
 | |
| 
 | |
|     if-ge v1, v2, :cond_1
 | |
| 
 | |
|     .line 3
 | |
|     invoke-virtual {p0, v1}, Landroid/util/SparseArray;->keyAt(I)I
 | |
| 
 | |
|     move-result v2
 | |
| 
 | |
|     .line 4
 | |
|     invoke-virtual {p0, v1}, Landroid/util/SparseArray;->valueAt(I)Ljava/lang/Object;
 | |
| 
 | |
|     move-result-object v3
 | |
| 
 | |
|     check-cast v3, Lcom/google/android/material/badge/BadgeDrawable;
 | |
| 
 | |
|     if-eqz v3, :cond_0
 | |
| 
 | |
|     .line 5
 | |
|     invoke-virtual {v3}, Lcom/google/android/material/badge/BadgeDrawable;->getSavedState()Lcom/google/android/material/badge/BadgeDrawable$SavedState;
 | |
| 
 | |
|     move-result-object v3
 | |
| 
 | |
|     invoke-virtual {v0, v2, v3}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
 | |
| 
 | |
|     add-int/lit8 v1, v1, 0x1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     .line 6
 | |
|     :cond_0
 | |
|     new-instance p0, Ljava/lang/IllegalArgumentException;
 | |
| 
 | |
|     const-string v0, "badgeDrawable cannot be null"
 | |
| 
 | |
|     invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
 | |
| 
 | |
|     throw p0
 | |
| 
 | |
|     :cond_1
 | |
|     return-object v0
 | |
| .end method
 | |
| 
 | |
| .method public static detachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;)V
 | |
|     .locals 1
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/Nullable;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroid/view/View;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     if-nez p0, :cond_0
 | |
| 
 | |
|     return-void
 | |
| 
 | |
|     .line 1
 | |
|     :cond_0
 | |
|     sget-boolean v0, Lcom/google/android/material/badge/BadgeUtils;->USE_COMPAT_PARENT:Z
 | |
| 
 | |
|     if-nez v0, :cond_2
 | |
| 
 | |
|     invoke-virtual {p0}, Lcom/google/android/material/badge/BadgeDrawable;->getCustomBadgeParent()Landroid/widget/FrameLayout;
 | |
| 
 | |
|     move-result-object v0
 | |
| 
 | |
|     if-eqz v0, :cond_1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     .line 2
 | |
|     :cond_1
 | |
|     invoke-virtual {p1}, Landroid/view/View;->getOverlay()Landroid/view/ViewOverlay;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     invoke-virtual {p1, p0}, Landroid/view/ViewOverlay;->remove(Landroid/graphics/drawable/Drawable;)V
 | |
| 
 | |
|     goto :goto_1
 | |
| 
 | |
|     .line 3
 | |
|     :cond_2
 | |
|     :goto_0
 | |
|     invoke-virtual {p0}, Lcom/google/android/material/badge/BadgeDrawable;->getCustomBadgeParent()Landroid/widget/FrameLayout;
 | |
| 
 | |
|     move-result-object p0
 | |
| 
 | |
|     const/4 p1, 0x0
 | |
| 
 | |
|     invoke-virtual {p0, p1}, Landroid/widget/FrameLayout;->setForeground(Landroid/graphics/drawable/Drawable;)V
 | |
| 
 | |
|     :goto_1
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static detachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroidx/appcompat/widget/Toolbar;I)V
 | |
|     .locals 0
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/Nullable;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroidx/appcompat/widget/Toolbar;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p2    # I
 | |
|         .annotation build Landroidx/annotation/IdRes;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     if-nez p0, :cond_0
 | |
| 
 | |
|     return-void
 | |
| 
 | |
|     .line 4
 | |
|     :cond_0
 | |
|     invoke-static {p1, p2}, Lcom/google/android/material/internal/ToolbarUtils;->getActionMenuItemView(Landroidx/appcompat/widget/Toolbar;I)Landroidx/appcompat/view/menu/ActionMenuItemView;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     if-eqz p1, :cond_1
 | |
| 
 | |
|     .line 5
 | |
|     invoke-static {p0, p1}, Lcom/google/android/material/badge/BadgeUtils;->detachBadgeDrawable(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;)V
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_1
 | |
|     const-string p0, "Trying to remove badge from a null menuItemView: "
 | |
| 
 | |
|     const-string p1, "BadgeUtils"
 | |
| 
 | |
|     .line 6
 | |
|     invoke-static {p0, p2, p1}, Ld1/e;->a(Ljava/lang/String;ILjava/lang/String;)V
 | |
| 
 | |
|     :goto_0
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static setBadgeDrawableBounds(Lcom/google/android/material/badge/BadgeDrawable;Landroid/view/View;Landroid/widget/FrameLayout;)V
 | |
|     .locals 1
 | |
|     .param p0    # Lcom/google/android/material/badge/BadgeDrawable;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p1    # Landroid/view/View;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
|     .param p2    # Landroid/widget/FrameLayout;
 | |
|         .annotation build Landroidx/annotation/Nullable;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     .line 1
 | |
|     new-instance v0, Landroid/graphics/Rect;
 | |
| 
 | |
|     invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V
 | |
| 
 | |
|     .line 2
 | |
|     invoke-virtual {p1, v0}, Landroid/view/View;->getDrawingRect(Landroid/graphics/Rect;)V
 | |
| 
 | |
|     .line 3
 | |
|     invoke-virtual {p0, v0}, Landroid/graphics/drawable/Drawable;->setBounds(Landroid/graphics/Rect;)V
 | |
| 
 | |
|     .line 4
 | |
|     invoke-virtual {p0, p1, p2}, Lcom/google/android/material/badge/BadgeDrawable;->updateBadgeCoordinates(Landroid/view/View;Landroid/widget/FrameLayout;)V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public static updateBadgeBounds(Landroid/graphics/Rect;FFFF)V
 | |
|     .locals 2
 | |
|     .param p0    # Landroid/graphics/Rect;
 | |
|         .annotation build Landroidx/annotation/NonNull;
 | |
|         .end annotation
 | |
|     .end param
 | |
| 
 | |
|     sub-float v0, p1, p3
 | |
| 
 | |
|     float-to-int v0, v0
 | |
| 
 | |
|     sub-float v1, p2, p4
 | |
| 
 | |
|     float-to-int v1, v1
 | |
| 
 | |
|     add-float/2addr p1, p3
 | |
| 
 | |
|     float-to-int p1, p1
 | |
| 
 | |
|     add-float/2addr p2, p4
 | |
| 
 | |
|     float-to-int p2, p2
 | |
| 
 | |
|     .line 1
 | |
|     invoke-virtual {p0, v0, v1, p1, p2}, Landroid/graphics/Rect;->set(IIII)V
 | |
| 
 | |
|     return-void
 | |
| .end method
 |