This commit is contained in:
khanhduytran0 2020-12-19 15:01:12 +07:00
parent 273fa6f952
commit cadb0ab12f
313 changed files with 206 additions and 14 deletions

View file

@ -0,0 +1,34 @@
package net.kdt.pojavlaunch;
import android.content.res.*;
import android.graphics.*;
import android.view.*;
import android.widget.*;
import android.content.*;
import com.kdt.mcgui.*;
public class FontChanger
{
private static Typeface fNotoSans, fMinecraftTen;
public static void initFonts(Context ctx) {
fNotoSans = Typeface.createFromAsset(ctx.getAssets(), "font/NotoSans-Bold.ttf");
fMinecraftTen = Typeface.createFromAsset(ctx.getAssets(), "font/minecraft-ten.ttf");
}
public static void changeFonts(ViewGroup viewTree) {
View child;
for(int i = 0; i < viewTree.getChildCount(); ++i) {
child = viewTree.getChildAt(i);
if (child instanceof ViewGroup) {
changeFonts((ViewGroup) child);
} else if (child instanceof TextView) {
changeFont((TextView) child);
}
}
}
public static void changeFont(TextView view) {
view.setTypeface(view instanceof MineButton ? fMinecraftTen : fNotoSans);
}
}