AvatarBuilderImageHelper.java 4.59 KB
package com.bitstrips.imoji.abv3.camera;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import java.io.File;

public class AvatarBuilderImageHelper
{
  private static String a = AvatarBuilderImageHelper.class.getSimpleName();
  
  public static boolean deleteImage(Context paramContext, String paramString)
  {
    return new File(getImagePath(paramContext, paramString)).delete();
  }
  
  public static String getImagePath(Context paramContext, String paramString)
  {
    return new File(paramContext.getFilesDir(), paramString).getPath();
  }
  
  public static Bitmap loadImage(String paramString)
  {
    BitmapFactory.Options localOptions = new BitmapFactory.Options();
    localOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
    return BitmapFactory.decodeFile(paramString, localOptions);
  }
  
  /* Error */
  public static boolean saveImage(Context paramContext, Bitmap paramBitmap, String paramString)
  {
    // Byte code:
    //   0: new 73	java/io/FileOutputStream
    //   3: dup
    //   4: aload_0
    //   5: aload_2
    //   6: invokestatic 28	com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper:getImagePath	(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
    //   9: invokespecial 74	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   12: astore_2
    //   13: aload_2
    //   14: astore_0
    //   15: aload_1
    //   16: getstatic 80	android/graphics/Bitmap$CompressFormat:PNG	Landroid/graphics/Bitmap$CompressFormat;
    //   19: bipush 100
    //   21: aload_2
    //   22: invokevirtual 86	android/graphics/Bitmap:compress	(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z
    //   25: pop
    //   26: aload_2
    //   27: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   30: iconst_1
    //   31: ireturn
    //   32: astore_0
    //   33: getstatic 16	com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper:a	Ljava/lang/String;
    //   36: ldc 91
    //   38: aload_0
    //   39: invokestatic 97	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   42: pop
    //   43: goto -13 -> 30
    //   46: astore_3
    //   47: aconst_null
    //   48: astore_1
    //   49: aload_1
    //   50: astore_0
    //   51: getstatic 16	com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper:a	Ljava/lang/String;
    //   54: ldc 99
    //   56: aload_3
    //   57: invokestatic 102	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   60: pop
    //   61: aload_1
    //   62: ifnull +7 -> 69
    //   65: aload_1
    //   66: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   69: iconst_0
    //   70: ireturn
    //   71: astore_0
    //   72: getstatic 16	com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper:a	Ljava/lang/String;
    //   75: ldc 91
    //   77: aload_0
    //   78: invokestatic 97	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   81: pop
    //   82: goto -13 -> 69
    //   85: astore_1
    //   86: aconst_null
    //   87: astore_0
    //   88: aload_0
    //   89: ifnull +7 -> 96
    //   92: aload_0
    //   93: invokevirtual 89	java/io/FileOutputStream:close	()V
    //   96: aload_1
    //   97: athrow
    //   98: astore_0
    //   99: getstatic 16	com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper:a	Ljava/lang/String;
    //   102: ldc 91
    //   104: aload_0
    //   105: invokestatic 97	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   108: pop
    //   109: goto -13 -> 96
    //   112: astore_1
    //   113: goto -25 -> 88
    //   116: astore_3
    //   117: aload_2
    //   118: astore_1
    //   119: goto -70 -> 49
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	122	0	paramContext	Context
    //   0	122	1	paramBitmap	Bitmap
    //   0	122	2	paramString	String
    //   46	11	3	localIOException1	java.io.IOException
    //   116	1	3	localIOException2	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   26	30	32	java/io/IOException
    //   0	13	46	java/io/IOException
    //   65	69	71	java/io/IOException
    //   0	13	85	finally
    //   92	96	98	java/io/IOException
    //   15	26	112	finally
    //   51	61	112	finally
    //   15	26	116	java/io/IOException
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/camera/AvatarBuilderImageHelper.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */