2009Scape-mobile/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/FontChanger.java
khanhduytran0 cadb0ab12f Move dir
2020-12-19 15:01:12 +07:00

34 lines
1,008 B
Java

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);
}
}