mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-12 17:40:11 -07:00
34 lines
1,008 B
Java
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);
|
|
}
|
|
}
|