VoiceMessage.smali

.class public Lio/rong/message/VoiceMessage;
.super Lio/rong/imlib/model/MessageContent;
.source "VoiceMessage.java"


# annotations
.annotation runtime Lio/rong/imlib/DestructionTag;
    destructionFlag = 0x0
.end annotation

.annotation runtime Lio/rong/imlib/MessageTag;
    flag = 0x3
    messageHandler = Lio/rong/message/VoiceMessageHandler;
    value = "RC:VcMsg"
.end annotation


# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/Parcelable$Creator<",
            "Lio/rong/message/VoiceMessage;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field protected extra:Ljava/lang/String;

.field private mBase64:Ljava/lang/String;

.field private mDuration:I

.field private mUri:Landroid/net/Uri;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .line 1
    new-instance v0, Lio/rong/message/VoiceMessage$1;

    invoke-direct {v0}, Lio/rong/message/VoiceMessage$1;-><init>()V

    sput-object v0, Lio/rong/message/VoiceMessage;->CREATOR:Landroid/os/Parcelable$Creator;

    return-void
.end method

.method private constructor <init>(Landroid/net/Uri;I)V
    .registers 3

    .line 24
    invoke-direct {p0}, Lio/rong/imlib/model/MessageContent;-><init>()V

    .line 25
    iput-object p1, p0, Lio/rong/message/VoiceMessage;->mUri:Landroid/net/Uri;

    .line 26
    iput p2, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    return-void
.end method

.method public constructor <init>(Landroid/os/Parcel;)V
    .registers 4

    .line 1
    invoke-direct {p0}, Lio/rong/imlib/model/MessageContent;-><init>()V

    .line 2
    invoke-static {p1}, Lio/rong/common/ParcelUtils;->readFromParcel(Landroid/os/Parcel;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lio/rong/message/VoiceMessage;->setExtra(Ljava/lang/String;)V

    .line 3
    const-class v0, Landroid/net/Uri;

    invoke-static {p1, v0}, Lio/rong/common/ParcelUtils;->readFromParcel(Landroid/os/Parcel;Ljava/lang/Class;)Landroid/os/Parcelable;

    move-result-object v0

    check-cast v0, Landroid/net/Uri;

    iput-object v0, p0, Lio/rong/message/VoiceMessage;->mUri:Landroid/net/Uri;

    .line 4
    invoke-static {p1}, Lio/rong/common/ParcelUtils;->readIntFromParcel(Landroid/os/Parcel;)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    iput v0, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    .line 5
    const-class v0, Lio/rong/imlib/model/UserInfo;

    invoke-static {p1, v0}, Lio/rong/common/ParcelUtils;->readFromParcel(Landroid/os/Parcel;Ljava/lang/Class;)Landroid/os/Parcelable;

    move-result-object v0

    check-cast v0, Lio/rong/imlib/model/UserInfo;

    invoke-virtual {p0, v0}, Lio/rong/imlib/model/MessageContent;->setUserInfo(Lio/rong/imlib/model/UserInfo;)V

    .line 6
    invoke-static {p1}, Lio/rong/common/ParcelUtils;->readIntFromParcel(Landroid/os/Parcel;)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    const/4 v1, 0x1

    if-ne v0, v1, :cond_35

    goto :goto_36

    :cond_35
    const/4 v1, 0x0

    :goto_36
    invoke-virtual {p0, v1}, Lio/rong/imlib/model/MessageContent;->setDestruct(Z)V

    .line 7
    invoke-static {p1}, Lio/rong/common/ParcelUtils;->readLongFromParcel(Landroid/os/Parcel;)Ljava/lang/Long;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1}, Lio/rong/imlib/model/MessageContent;->setDestructTime(J)V

    return-void
.end method

.method public constructor <init>([B)V
    .registers 9

    const-string v0, "burnDuration"

    const-string v1, "isBurnAfterRead"

    const-string v2, "user"

    const-string v3, "extra"

    const-string v4, "content"

    const-string v5, "duration"

    .line 8
    invoke-direct {p0}, Lio/rong/imlib/model/MessageContent;-><init>()V

    .line 9
    new-instance v6, Ljava/lang/String;

    invoke-direct {v6, p1}, Ljava/lang/String;-><init>([B)V

    .line 10
    :try_start_14
    new-instance p1, Lorg/json/JSONObject;

    invoke-direct {p1, v6}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 11
    invoke-virtual {p1, v5}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_26

    .line 12
    invoke-virtual {p1, v5}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    move-result v5

    invoke-virtual {p0, v5}, Lio/rong/message/VoiceMessage;->setDuration(I)V

    .line 13
    :cond_26
    invoke-virtual {p1, v4}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v5

    if-eqz v5, :cond_33

    .line 14
    invoke-virtual {p1, v4}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {p0, v4}, Lio/rong/message/VoiceMessage;->setBase64(Ljava/lang/String;)V

    .line 15
    :cond_33
    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_40

    .line 16
    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {p0, v3}, Lio/rong/message/VoiceMessage;->setExtra(Ljava/lang/String;)V

    .line 17
    :cond_40
    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_51

    .line 18
    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v2

    invoke-virtual {p0, v2}, Lio/rong/imlib/model/MessageContent;->parseJsonToUserInfo(Lorg/json/JSONObject;)Lio/rong/imlib/model/UserInfo;

    move-result-object v2

    invoke-virtual {p0, v2}, Lio/rong/imlib/model/MessageContent;->setUserInfo(Lio/rong/imlib/model/UserInfo;)V

    .line 19
    :cond_51
    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_5e

    .line 20
    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getBoolean(Ljava/lang/String;)Z

    move-result v1

    invoke-virtual {p0, v1}, Lio/rong/imlib/model/MessageContent;->setDestruct(Z)V

    .line 21
    :cond_5e
    invoke-virtual {p1, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_76

    .line 22
    invoke-virtual {p1, v0}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J

    move-result-wide v0

    invoke-virtual {p0, v0, v1}, Lio/rong/imlib/model/MessageContent;->setDestructTime(J)V
    :try_end_6b
    .catch Lorg/json/JSONException; {:try_start_14 .. :try_end_6b} :catch_6c

    goto :goto_76

    :catch_6c
    move-exception p1

    .line 23
    invoke-virtual {p1}, Lorg/json/JSONException;->getMessage()Ljava/lang/String;

    move-result-object p1

    const-string v0, "JSONException"

    invoke-static {v0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :cond_76
    :goto_76
    return-void
.end method

.method public static obtain(Landroid/net/Uri;I)Lio/rong/message/VoiceMessage;
    .registers 3

    .line 1
    new-instance v0, Lio/rong/message/VoiceMessage;

    invoke-direct {v0, p0, p1}, Lio/rong/message/VoiceMessage;-><init>(Landroid/net/Uri;I)V

    return-object v0
.end method


# virtual methods
.method public describeContents()I
    .registers 2

    const/4 v0, 0x0

    return v0
.end method

.method public encode()[B
    .registers 5

    .line 1
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    :try_start_5
    const-string v1, "content"

    .line 2
    iget-object v2, p0, Lio/rong/message/VoiceMessage;->mBase64:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v1, "duration"

    .line 3
    iget v2, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    .line 4
    invoke-virtual {p0}, Lio/rong/message/VoiceMessage;->getExtra()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-nez v1, :cond_24

    const-string v1, "extra"

    .line 5
    iget-object v2, p0, Lio/rong/message/VoiceMessage;->extra:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 6
    :cond_24
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->getJSONUserInfo()Lorg/json/JSONObject;

    move-result-object v1

    if-eqz v1, :cond_33

    const-string v1, "user"

    .line 7
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->getJSONUserInfo()Lorg/json/JSONObject;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    :cond_33
    const-string v1, "isBurnAfterRead"

    .line 8
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->isDestruct()Z

    move-result v2

    invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Z)Lorg/json/JSONObject;

    const-string v1, "burnDuration"

    .line 9
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->getDestructTime()J

    move-result-wide v2

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;
    :try_end_45
    .catch Lorg/json/JSONException; {:try_start_5 .. :try_end_45} :catch_46

    goto :goto_50

    :catch_46
    move-exception v1

    .line 10
    invoke-virtual {v1}, Lorg/json/JSONException;->getMessage()Ljava/lang/String;

    move-result-object v1

    const-string v2, "JSONException"

    invoke-static {v2, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :goto_50
    const/4 v1, 0x0

    .line 11
    iput-object v1, p0, Lio/rong/message/VoiceMessage;->mBase64:Ljava/lang/String;

    .line 12
    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->getBytes()[B

    move-result-object v0

    return-object v0
.end method

.method public getBase64()Ljava/lang/String;
    .registers 2

    .line 1
    iget-object v0, p0, Lio/rong/message/VoiceMessage;->mBase64:Ljava/lang/String;

    return-object v0
.end method

.method public getDuration()I
    .registers 2

    .line 1
    iget v0, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    return v0
.end method

.method public getExtra()Ljava/lang/String;
    .registers 2

    .line 1
    iget-object v0, p0, Lio/rong/message/VoiceMessage;->extra:Ljava/lang/String;

    return-object v0
.end method

.method public getUri()Landroid/net/Uri;
    .registers 2

    .line 1
    iget-object v0, p0, Lio/rong/message/VoiceMessage;->mUri:Landroid/net/Uri;

    return-object v0
.end method

.method public setBase64(Ljava/lang/String;)V
    .registers 2

    .line 1
    iput-object p1, p0, Lio/rong/message/VoiceMessage;->mBase64:Ljava/lang/String;

    return-void
.end method

.method public setDuration(I)V
    .registers 2

    .line 1
    iput p1, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    return-void
.end method

.method public setExtra(Ljava/lang/String;)V
    .registers 2

    .line 1
    iput-object p1, p0, Lio/rong/message/VoiceMessage;->extra:Ljava/lang/String;

    return-void
.end method

.method public setUri(Landroid/net/Uri;)V
    .registers 2

    .line 1
    iput-object p1, p0, Lio/rong/message/VoiceMessage;->mUri:Landroid/net/Uri;

    return-void
.end method

.method public writeToParcel(Landroid/os/Parcel;I)V
    .registers 5

    .line 1
    iget-object p2, p0, Lio/rong/message/VoiceMessage;->extra:Ljava/lang/String;

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Ljava/lang/String;)V

    .line 2
    iget-object p2, p0, Lio/rong/message/VoiceMessage;->mUri:Landroid/net/Uri;

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Landroid/os/Parcelable;)V

    .line 3
    iget p2, p0, Lio/rong/message/VoiceMessage;->mDuration:I

    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p2

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Ljava/lang/Integer;)V

    .line 4
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->getUserInfo()Lio/rong/imlib/model/UserInfo;

    move-result-object p2

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Landroid/os/Parcelable;)V

    .line 5
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->isDestruct()Z

    move-result p2

    if-eqz p2, :cond_22

    const/4 p2, 0x1

    goto :goto_23

    :cond_22
    const/4 p2, 0x0

    :goto_23
    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p2

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Ljava/lang/Integer;)V

    .line 6
    invoke-virtual {p0}, Lio/rong/imlib/model/MessageContent;->getDestructTime()J

    move-result-wide v0

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p2

    invoke-static {p1, p2}, Lio/rong/common/ParcelUtils;->writeToParcel(Landroid/os/Parcel;Ljava/lang/Long;)V

    return-void
.end method