diff --git a/app/src/main/assets/font/minecraft-ten.ttf b/app/src/main/assets/font/minecraft-ten.ttf new file mode 100644 index 000000000..a81102232 Binary files /dev/null and b/app/src/main/assets/font/minecraft-ten.ttf differ diff --git a/app/src/main/java/com/kdt/mcgui/MineButton.java b/app/src/main/java/com/kdt/mcgui/MineButton.java index 1e4da5b2a..cba7f6df7 100644 --- a/app/src/main/java/com/kdt/mcgui/MineButton.java +++ b/app/src/main/java/com/kdt/mcgui/MineButton.java @@ -7,9 +7,12 @@ import android.util.*; import android.view.*; import android.widget.*; import android.view.View.*; +import net.kdt.pojavlaunch.*; public class MineButton extends Button { + private static FontChanger fontChangerMinecraftTen; + private ColorDrawable left = new ColorDrawable(Color.parseColor("#80000000")); private ColorDrawable top = new ColorDrawable(Color.parseColor("#64FC20")); private ColorDrawable right = new ColorDrawable(Color.parseColor("#40000000")); @@ -42,20 +45,19 @@ public class MineButton extends Button private LayerDrawable layerdrawable, layerdrawablefocus; - public MineButton(Context ctx) - { - super(ctx); - init(); + public MineButton(Context ctx) { + this(ctx, null); } - public MineButton(Context ctx, AttributeSet attrs) - { + public MineButton(Context ctx, AttributeSet attrs) { super(ctx, attrs); init(); } public void init() { + if (fontChangerMinecraftTen == null) fontChangerMinecraftTen = new FontChanger(getContext().getAssets(), "font/minecraft-ten.ttf"); + fontChangerMinecraftTen.replaceFont(this); getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { diff --git a/app/src/main/java/net/kdt/pojavlaunch/FontChanger.java b/app/src/main/java/net/kdt/pojavlaunch/FontChanger.java index dd24642d0..3d327c481 100644 --- a/app/src/main/java/net/kdt/pojavlaunch/FontChanger.java +++ b/app/src/main/java/net/kdt/pojavlaunch/FontChanger.java @@ -9,13 +9,11 @@ public class FontChanger { private Typeface typeface; - public FontChanger(Typeface typeface) - { + public FontChanger(Typeface typeface) { this.typeface = typeface; } - public FontChanger(AssetManager assets, String assetsFontFileName) - { + public FontChanger(AssetManager assets, String assetsFontFileName) { typeface = Typeface.createFromAsset(assets, assetsFontFileName); } @@ -25,7 +23,7 @@ public class FontChanger for(int i = 0; i < viewTree.getChildCount(); ++i) { child = viewTree.getChildAt(i); if (child instanceof ViewGroup) { - replaceFonts((ViewGroup)child); + replaceFonts((ViewGroup) child); } else if (child instanceof TextView) { replaceFont((TextView) child); } diff --git a/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java b/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java index 773dc69f0..18f12b7b2 100644 --- a/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java +++ b/app/src/main/java/net/kdt/pojavlaunch/PojavLoginActivity.java @@ -234,10 +234,15 @@ public class PojavLoginActivity extends AppCompatActivity private void uiInit() { setContentView(R.layout.launcher_login_v2); - LinearLayout loginLayout = findViewById(R.id.login_layout_linear); - ImageView imageLogo = findViewById(R.id.login_image_logo); - imageLogo.setTranslationY(loginLayout.getY() - (imageLogo.getHeight() / 4f)); - + final LinearLayout loginLayout = findViewById(R.id.login_layout_linear); + final ImageView imageLogo = findViewById(R.id.login_image_logo); + loginLayout.postDelayed(new Runnable(){ + @Override + public void run(){ + imageLogo.setTranslationY(loginLayout.getY() - (imageLogo.getHeight() / 2f)); + } + }, 100); + edit2 = (EditText) findViewById(R.id.login_edit_email); edit3 = (EditText) findViewById(R.id.login_edit_password); if(prb == null) prb = (ProgressBar) findViewById(R.id.launcherAccProgress); diff --git a/app/src/main/res/layout/launcher_login_v2.xml b/app/src/main/res/layout/launcher_login_v2.xml index e57cfa72c..cd5ee75a2 100644 --- a/app/src/main/res/layout/launcher_login_v2.xml +++ b/app/src/main/res/layout/launcher_login_v2.xml @@ -106,7 +106,6 @@ android:layout_height="48dp" android:layout_width="300dp" android:src="@drawable/logo" - android:layout_centerInParent="true" android:id="@+id/login_image_logo" android:layout_gravity="center_horizontal"/>