diff --git a/app_pojavlauncher/src/main/assets/about_en.txt b/app_pojavlauncher/src/main/assets/about_en.txt index 7dcdcd9ab..37e1f7767 100644 --- a/app_pojavlauncher/src/main/assets/about_en.txt +++ b/app_pojavlauncher/src/main/assets/about_en.txt @@ -1,9 +1,9 @@ %s (Minecraft Java Launcher for Android), version %s by Tran Khanh Duy (based on "Boardwalk" app)
* License:
- • This application is licensed under GNU GPLv3.
+ • This application is licensed under GNU GPLv3.
-* Third party components and their licenses:
+* Credits / Third party components and their licenses:
• Apache Commons Compress (unknown or Apache License 2.0).
• exp4j: Apache License 2.0.
• GL4ES: MIT License.
@@ -11,9 +11,12 @@ • OpenJDK: GNU GPLv2 License.
• LWJGL: LWJGL 2's License.

• pro-gradle: Apache License 2.0.
+ • More (check at GitHub). + • Privacy policy. + • Thanks to MCHeads for providing Minecraft avatars. * Notes:
- - This app is under development and will not be stable.
+ - This app is under development and might not be stable.
- This app is not affiliated with Minecraft, Mojang or Microsoft.

* Translators can be found at Crowdin diff --git a/app_pojavlauncher/src/main/assets/ic_steve.png b/app_pojavlauncher/src/main/assets/ic_steve.png deleted file mode 100644 index cbc47f01a..000000000 Binary files a/app_pojavlauncher/src/main/assets/ic_steve.png and /dev/null differ diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java index ede7330b4..b3b2a3f03 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java @@ -136,7 +136,6 @@ public class PojavLoginActivity extends BaseActivity Thread.sleep(2000); } catch (InterruptedException e) {} - publishProgress("visible"); while (Build.VERSION.SDK_INT >= 23 && !isStorageAllowed()){ @@ -655,22 +654,12 @@ public class PojavLoginActivity extends BaseActivity String accNameStr = s.substring(0, s.length() - 5); String skinFaceBase64 = MinecraftAccount.load(accNameStr).skinFaceBase64; - Bitmap bitmap = Bitmap.createBitmap(8, 8, Bitmap.Config.ARGB_8888); - if (skinFaceBase64 != null) { - byte[] faceIconBytes = Base64.decode(skinFaceBase64, Base64.DEFAULT); - bitmap = BitmapFactory.decodeByteArray(faceIconBytes, 0, faceIconBytes.length); - } else { - try { - bitmap = BitmapFactory.decodeStream(getAssets().open("ic_steve.png")); - } catch (IOException e) { - // Should never happen - e.printStackTrace(); - } - } - accountName.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(getResources(), - Bitmap.createScaledBitmap(bitmap, 80, 80, false)), - null, null, null); + byte[] faceIconBytes = Base64.decode(skinFaceBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(faceIconBytes, 0, faceIconBytes.length); + accountName.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(getResources(), + bitmap), + null, null, null); accountName.setText(accNameStr); accountListLayout.addView(child); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/value/MinecraftAccount.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/value/MinecraftAccount.java index 7469c5b4b..422afe521 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/value/MinecraftAccount.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/value/MinecraftAccount.java @@ -6,36 +6,24 @@ import java.io.*; import com.google.gson.*; import android.graphics.Bitmap; import android.util.Base64; +import org.apache.commons.io.IOUtils; public class MinecraftAccount { public String accessToken = "0"; // access token public String clientToken = "0"; // clientID: refresh and invalidate - public String profileId = "0"; // authenticate UUID + public String profileId = "0"; // profile UUID, for obtaining skin public String username = "Steve"; public String selectedVersion = "1.7.10"; public boolean isMicrosoft = false; public String msaRefreshToken = "0"; public String skinFaceBase64; - public void updateSkinFace() { + void updateSkinFace(String uuid) { try { - Bitmap bSkin = AccountSkin.getSkin(profileId); - if (bSkin.getWidth() != 64 || bSkin.getHeight() != 64) { - Log.w("SkinLoader", "Only skin size 64x64 is currently supported, this skin is " + bSkin.getWidth() + "x" + bSkin.getHeight()); - return; - } - - int[] pixels = new int[8 * 8]; - bSkin.getPixels(pixels, 0, 8, 8, 8, 8, 8); - bSkin.recycle(); - - ByteArrayOutputStream outByteArr = new ByteArrayOutputStream(); - Bitmap bFace = Bitmap.createBitmap(pixels, 8, 8, Bitmap.Config.ARGB_8888); - bFace.compress(Bitmap.CompressFormat.PNG, 100, outByteArr); - bFace.recycle(); - skinFaceBase64 = Base64.encodeToString(outByteArr.toByteArray(), Base64.DEFAULT); - outByteArr.close(); + File skinFile = File.createTempFile("skin", ".png", new File(Tools.DIR_DATA, "cache")); + Tools.downloadFile("https://mc-heads.net/head/" + uuid + "/100", skinFile.getAbsolutePath()); + skinFaceBase64 = Base64.encodeToString(IOUtils.toByteArray(new FileInputStream(skinFile)), Base64.DEFAULT); Log.i("SkinLoader", "Update skin face success"); } catch (IOException e) { @@ -45,6 +33,10 @@ public class MinecraftAccount } } + public void updateSkinFace() { + updateSkinFace(profileId); + } + public String save(String outPath) throws IOException { Tools.write(outPath, Tools.GLOBAL_GSON.toJson(this)); return username; @@ -79,6 +71,9 @@ public class MinecraftAccount if (acc.msaRefreshToken == null) { acc.msaRefreshToken = "0"; } + if (acc.skinFaceBase64 == null) { + acc.updateSkinFace("MHF_Steve"); + } return acc; } catch(IOException e) { Log.e(MinecraftAccount.class.getName(), "Caught an exception while loading the profile",e);