You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
578 lines
16 KiB
578 lines
16 KiB
.class public Lcom/viatech/gallery/AttachPopupWindow; |
|
.super Landroid/widget/PopupWindow; |
|
.source "AttachPopupWindow.java" |
|
|
|
|
|
# annotations |
|
.annotation system Ldalvik/annotation/MemberClasses; |
|
value = { |
|
Lcom/viatech/gallery/AttachPopupWindow$AttachRecyclerAdapter;, |
|
Lcom/viatech/gallery/AttachPopupWindow$AttachPageAdapter;, |
|
Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener; |
|
} |
|
.end annotation |
|
|
|
|
|
# instance fields |
|
.field private mAttachList:Ljava/util/ArrayList; |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"Ljava/util/ArrayList", |
|
"<", |
|
"Ljava/lang/String;", |
|
">;" |
|
} |
|
.end annotation |
|
.end field |
|
|
|
.field private mAttachView:Landroid/view/View; |
|
|
|
.field private mContext:Landroid/content/Context; |
|
|
|
.field private mListener:Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener; |
|
|
|
.field private mPointLayout:Landroid/widget/LinearLayout; |
|
|
|
.field private mViewPage:Landroid/support/v4/view/ViewPager; |
|
|
|
.field private preferences:Landroid/content/SharedPreferences; |
|
|
|
|
|
# direct methods |
|
.method public constructor <init>(Landroid/app/Activity;)V |
|
.locals 3 |
|
|
|
.prologue |
|
const/4 v2, 0x0 |
|
|
|
.line 43 |
|
invoke-direct {p0, p1}, Landroid/widget/PopupWindow;-><init>(Landroid/content/Context;)V |
|
|
|
.line 40 |
|
new-instance v0, Ljava/util/ArrayList; |
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachList:Ljava/util/ArrayList; |
|
|
|
.line 60 |
|
iput-object v2, p0, Lcom/viatech/gallery/AttachPopupWindow;->preferences:Landroid/content/SharedPreferences; |
|
|
|
.line 44 |
|
const-string v0, "layout_inflater" |
|
|
|
invoke-virtual {p1, v0}, Landroid/app/Activity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Landroid/view/LayoutInflater; |
|
|
|
.line 45 |
|
const v1, 0x7f03003b |
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View; |
|
|
|
move-result-object v0 |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachView:Landroid/view/View; |
|
|
|
.line 46 |
|
iput-object p1, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
.line 47 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachView:Landroid/view/View; |
|
|
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setContentView(Landroid/view/View;)V |
|
|
|
.line 48 |
|
const/4 v0, -0x1 |
|
|
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setWidth(I)V |
|
|
|
.line 49 |
|
const/4 v0, -0x2 |
|
|
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setHeight(I)V |
|
|
|
.line 50 |
|
const/4 v0, 0x1 |
|
|
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setFocusable(Z)V |
|
|
|
.line 51 |
|
const v0, 0x7f0900f4 |
|
|
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setAnimationStyle(I)V |
|
|
|
.line 53 |
|
new-instance v0, Landroid/graphics/drawable/ColorDrawable; |
|
|
|
invoke-virtual {p1}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources; |
|
|
|
move-result-object v1 |
|
|
|
const v2, 0x7f0b0089 |
|
|
|
invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I |
|
|
|
move-result v1 |
|
|
|
invoke-direct {v0, v1}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V |
|
|
|
.line 55 |
|
invoke-virtual {p0, v0}, Lcom/viatech/gallery/AttachPopupWindow;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V |
|
|
|
.line 56 |
|
invoke-direct {p0}, Lcom/viatech/gallery/AttachPopupWindow;->initData()V |
|
|
|
.line 57 |
|
invoke-direct {p0}, Lcom/viatech/gallery/AttachPopupWindow;->initView()V |
|
|
|
.line 58 |
|
return-void |
|
.end method |
|
|
|
.method static synthetic access$000(Lcom/viatech/gallery/AttachPopupWindow;)Ljava/util/ArrayList; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 34 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachList:Ljava/util/ArrayList; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method static synthetic access$100(Lcom/viatech/gallery/AttachPopupWindow;)Landroid/widget/LinearLayout; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 34 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mPointLayout:Landroid/widget/LinearLayout; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method static synthetic access$300(Lcom/viatech/gallery/AttachPopupWindow;)Landroid/content/Context; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 34 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method static synthetic access$400(Lcom/viatech/gallery/AttachPopupWindow;)Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 34 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mListener:Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method private addPointView()V |
|
.locals 8 |
|
|
|
.prologue |
|
const/high16 v7, 0x3f000000 # 0.5f |
|
|
|
const/high16 v6, 0x41a00000 # 20.0f |
|
|
|
.line 126 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mPointLayout:Landroid/widget/LinearLayout; |
|
|
|
invoke-virtual {v0}, Landroid/widget/LinearLayout;->removeAllViews()V |
|
|
|
.line 127 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachList:Ljava/util/ArrayList; |
|
|
|
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I |
|
|
|
move-result v0 |
|
|
|
div-int/lit8 v0, v0, 0x8 |
|
|
|
.line 128 |
|
iget-object v1, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachList:Ljava/util/ArrayList; |
|
|
|
invoke-virtual {v1}, Ljava/util/ArrayList;->size()I |
|
|
|
move-result v1 |
|
|
|
mul-int/lit8 v2, v0, 0x8 |
|
|
|
if-le v1, v2, :cond_0 |
|
|
|
.line 129 |
|
add-int/lit8 v0, v0, 0x1 |
|
|
|
.line 131 |
|
:cond_0 |
|
const/4 v1, 0x0 |
|
|
|
:goto_0 |
|
if-ge v1, v0, :cond_2 |
|
|
|
.line 132 |
|
new-instance v2, Landroid/view/View; |
|
|
|
iget-object v3, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
invoke-direct {v2, v3}, Landroid/view/View;-><init>(Landroid/content/Context;)V |
|
|
|
.line 133 |
|
const v3, 0x7f02016b |
|
|
|
invoke-virtual {v2, v3}, Landroid/view/View;->setBackgroundResource(I)V |
|
|
|
.line 134 |
|
new-instance v3, Landroid/widget/LinearLayout$LayoutParams; |
|
|
|
iget-object v4, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
invoke-static {v4, v6}, Lcom/viatech/util/UIUtils;->dp2px(Landroid/content/Context;F)F |
|
|
|
move-result v4 |
|
|
|
add-float/2addr v4, v7 |
|
|
|
float-to-int v4, v4 |
|
|
|
iget-object v5, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
.line 135 |
|
invoke-static {v5, v6}, Lcom/viatech/util/UIUtils;->dp2px(Landroid/content/Context;F)F |
|
|
|
move-result v5 |
|
|
|
add-float/2addr v5, v7 |
|
|
|
float-to-int v5, v5 |
|
|
|
invoke-direct {v3, v4, v5}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V |
|
|
|
.line 136 |
|
if-eqz v1, :cond_1 |
|
|
|
.line 137 |
|
iget-object v4, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
const/high16 v5, 0x41400000 # 12.0f |
|
|
|
invoke-static {v4, v5}, Lcom/viatech/util/UIUtils;->dp2px(Landroid/content/Context;F)F |
|
|
|
move-result v4 |
|
|
|
float-to-int v4, v4 |
|
|
|
iput v4, v3, Landroid/widget/LinearLayout$LayoutParams;->leftMargin:I |
|
|
|
.line 138 |
|
iget-object v4, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
invoke-static {v4, v6}, Lcom/viatech/util/UIUtils;->dp2px(Landroid/content/Context;F)F |
|
|
|
move-result v4 |
|
|
|
float-to-int v4, v4 |
|
|
|
iput v4, v3, Landroid/widget/LinearLayout$LayoutParams;->bottomMargin:I |
|
|
|
.line 143 |
|
:goto_1 |
|
iget-object v4, p0, Lcom/viatech/gallery/AttachPopupWindow;->mPointLayout:Landroid/widget/LinearLayout; |
|
|
|
invoke-virtual {v4, v2, v3}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V |
|
|
|
.line 131 |
|
add-int/lit8 v1, v1, 0x1 |
|
|
|
goto :goto_0 |
|
|
|
.line 141 |
|
:cond_1 |
|
const v4, 0x7f02016c |
|
|
|
invoke-virtual {v2, v4}, Landroid/view/View;->setBackgroundResource(I)V |
|
|
|
goto :goto_1 |
|
|
|
.line 145 |
|
:cond_2 |
|
return-void |
|
.end method |
|
|
|
.method private initData()V |
|
.locals 7 |
|
|
|
.prologue |
|
const/4 v6, 0x0 |
|
|
|
const/4 v0, 0x0 |
|
|
|
.line 64 |
|
:try_start_0 |
|
iget-object v1, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
const/4 v2, 0x0 |
|
|
|
invoke-virtual {v1, v2}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File; |
|
|
|
move-result-object v1 |
|
|
|
.line 65 |
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
const-string v2, "/attach" |
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
.line 66 |
|
new-instance v2, Ljava/io/File; |
|
|
|
invoke-direct {v2, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V |
|
|
|
.line 67 |
|
invoke-virtual {v2}, Ljava/io/File;->exists()Z |
|
|
|
move-result v3 |
|
|
|
if-nez v3, :cond_0 |
|
|
|
.line 68 |
|
invoke-virtual {v2}, Ljava/io/File;->mkdirs()Z |
|
|
|
.line 70 |
|
:cond_0 |
|
iget-object v3, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
const-string v4, "attach" |
|
|
|
iget-object v5, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
const/4 v5, 0x0 |
|
|
|
invoke-virtual {v3, v4, v5}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences; |
|
|
|
move-result-object v3 |
|
|
|
iput-object v3, p0, Lcom/viatech/gallery/AttachPopupWindow;->preferences:Landroid/content/SharedPreferences; |
|
|
|
.line 72 |
|
iget-object v3, p0, Lcom/viatech/gallery/AttachPopupWindow;->preferences:Landroid/content/SharedPreferences; |
|
|
|
const-string v4, "isFirst" |
|
|
|
const/4 v5, 0x1 |
|
|
|
invoke-interface {v3, v4, v5}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z |
|
|
|
move-result v3 |
|
|
|
if-nez v3, :cond_1 |
|
|
|
invoke-virtual {v2}, Ljava/io/File;->listFiles()[Ljava/io/File; |
|
|
|
move-result-object v3 |
|
|
|
array-length v3, v3 |
|
|
|
const/16 v4, 0x50 |
|
|
|
if-eq v3, v4, :cond_2 |
|
|
|
.line 73 |
|
:cond_1 |
|
invoke-virtual {v2}, Ljava/io/File;->delete()Z |
|
|
|
.line 75 |
|
iget-object v2, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
const-string v3, "attach.zip" |
|
|
|
invoke-static {v2, v3, v1}, Lcom/viatech/util/ZipUtil;->unZip(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V |
|
|
|
.line 76 |
|
iget-object v1, p0, Lcom/viatech/gallery/AttachPopupWindow;->preferences:Landroid/content/SharedPreferences; |
|
|
|
invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor; |
|
|
|
move-result-object v1 |
|
|
|
.line 77 |
|
const-string v2, "isFirst" |
|
|
|
const/4 v3, 0x0 |
|
|
|
invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor; |
|
|
|
.line 78 |
|
invoke-interface {v1}, Landroid/content/SharedPreferences$Editor;->apply()V |
|
:try_end_0 |
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 |
|
|
|
.line 84 |
|
:cond_2 |
|
:goto_0 |
|
iget-object v1, p0, Lcom/viatech/gallery/AttachPopupWindow;->mContext:Landroid/content/Context; |
|
|
|
invoke-virtual {v1, v6}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File; |
|
|
|
move-result-object v1 |
|
|
|
.line 85 |
|
new-instance v2, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
const-string v2, "/attach" |
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
.line 86 |
|
new-instance v2, Ljava/io/File; |
|
|
|
invoke-direct {v2, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V |
|
|
|
.line 87 |
|
invoke-virtual {v2}, Ljava/io/File;->listFiles()[Ljava/io/File; |
|
|
|
move-result-object v1 |
|
|
|
.line 88 |
|
:goto_1 |
|
array-length v2, v1 |
|
|
|
if-ge v0, v2, :cond_3 |
|
|
|
.line 89 |
|
iget-object v2, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachList:Ljava/util/ArrayList; |
|
|
|
aget-object v3, v1, v0 |
|
|
|
invoke-virtual {v3}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; |
|
|
|
move-result-object v3 |
|
|
|
invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z |
|
|
|
.line 88 |
|
add-int/lit8 v0, v0, 0x1 |
|
|
|
goto :goto_1 |
|
|
|
.line 80 |
|
:catch_0 |
|
move-exception v1 |
|
|
|
.line 81 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_0 |
|
|
|
.line 91 |
|
:cond_3 |
|
return-void |
|
.end method |
|
|
|
.method private initView()V |
|
.locals 3 |
|
|
|
.prologue |
|
.line 94 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachView:Landroid/view/View; |
|
|
|
const v1, 0x7f0c0154 |
|
|
|
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Landroid/support/v4/view/ViewPager; |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mViewPage:Landroid/support/v4/view/ViewPager; |
|
|
|
.line 95 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mAttachView:Landroid/view/View; |
|
|
|
const v1, 0x7f0c0155 |
|
|
|
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Landroid/widget/LinearLayout; |
|
|
|
iput-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mPointLayout:Landroid/widget/LinearLayout; |
|
|
|
.line 96 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mViewPage:Landroid/support/v4/view/ViewPager; |
|
|
|
new-instance v1, Lcom/viatech/gallery/AttachPopupWindow$1; |
|
|
|
invoke-direct {v1, p0}, Lcom/viatech/gallery/AttachPopupWindow$1;-><init>(Lcom/viatech/gallery/AttachPopupWindow;)V |
|
|
|
invoke-virtual {v0, v1}, Landroid/support/v4/view/ViewPager;->setOnPageChangeListener(Landroid/support/v4/view/ViewPager$OnPageChangeListener;)V |
|
|
|
.line 121 |
|
iget-object v0, p0, Lcom/viatech/gallery/AttachPopupWindow;->mViewPage:Landroid/support/v4/view/ViewPager; |
|
|
|
new-instance v1, Lcom/viatech/gallery/AttachPopupWindow$AttachPageAdapter; |
|
|
|
const/4 v2, 0x0 |
|
|
|
invoke-direct {v1, p0, v2}, Lcom/viatech/gallery/AttachPopupWindow$AttachPageAdapter;-><init>(Lcom/viatech/gallery/AttachPopupWindow;Lcom/viatech/gallery/AttachPopupWindow$1;)V |
|
|
|
invoke-virtual {v0, v1}, Landroid/support/v4/view/ViewPager;->setAdapter(Landroid/support/v4/view/PagerAdapter;)V |
|
|
|
.line 122 |
|
invoke-direct {p0}, Lcom/viatech/gallery/AttachPopupWindow;->addPointView()V |
|
|
|
.line 123 |
|
return-void |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method public setOnAttachItemSelectListener(Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener;)V |
|
.locals 0 |
|
|
|
.prologue |
|
.line 154 |
|
iput-object p1, p0, Lcom/viatech/gallery/AttachPopupWindow;->mListener:Lcom/viatech/gallery/AttachPopupWindow$OnAttachItemSelectListener; |
|
|
|
.line 155 |
|
return-void |
|
.end method
|
|
|