Example #1
0
  public static Drawable getDraw9(final InitPackageResourcesParam resparam, final String nama) {

    Bitmap bitmap = BitmapFactory.decodeFile(S.DEFAULT_ICON_DIR + "/" + nama + ".png");
    final byte[] chunk = bitmap.getNinePatchChunk();
    if (NinePatch.isNinePatchChunk(chunk))
      return new NinePatchDrawable(
          resparam.res, bitmap, chunk, Npatch.deserialize(chunk).mPaddings, null);
    else return Drawable.createFromPath(S.DEFAULT_ICON_DIR + "/" + nama + ".png");
  }
Example #2
0
  private static Drawable getNinePathDrawable(InitPackageResourcesParam resparam, String str) {
    Bitmap bitmap = BitmapFactory.decodeFile(str);
    final byte[] chunk = bitmap.getNinePatchChunk();
    Drawable d;
    if (NinePatch.isNinePatchChunk(chunk)) {
      d =
          new NinePatchDrawable(
              resparam.res, bitmap, chunk, Npatch.deserialize(chunk).mPaddings, null);
    } else {
      d = Drawable.createFromPath(str);
    }

    return d;
  }