mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
- Clean FontChanger
- Put fonts in the res folder - Progressive transition towards a clean architecture detection system
This commit is contained in:
parent
ea9c821676
commit
bcb9957e0c
@ -17,7 +17,7 @@ public class MineButton extends androidx.appcompat.widget.AppCompatButton
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "font/NotoSans-Bold.ttf"));
|
||||
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "font/noto_sans_bold.ttf"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ public class Architecture
|
||||
* @return The architecture as an int.
|
||||
*/
|
||||
public static int archAsInt(String arch){
|
||||
arch = arch.toLowerCase();
|
||||
if(arch.equals("arm64-v8a") || arch.equals("aarch64")) return ARCH_ARM64;
|
||||
if(arch.contains("armeabi") ||arch.contains("armv7")) return ARCH_ARM;
|
||||
arch = arch.toLowerCase().trim().replace(" ", "");
|
||||
if(arch.contains("arm64") || arch.equals("aarch64") || arch.equals("adm64")) return ARCH_ARM64;
|
||||
if(arch.contains("arm")) return ARCH_ARM;
|
||||
if(arch.equals("x86_64")) return ARCH_X86_64;
|
||||
if(arch.equals("x86") || (arch.startsWith("i") && arch.endsWith("86"))) return ARCH_X86;
|
||||
//Shouldn't happen
|
||||
|
@ -1,33 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
public class JVersion extends Object
|
||||
{
|
||||
private String version;
|
||||
private JVersion(String version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
public static JVersion from(String version)
|
||||
{
|
||||
return new JVersion(version);
|
||||
}
|
||||
public boolean isVersionCode()
|
||||
{
|
||||
return !version.contains(".");
|
||||
}
|
||||
public JVersion toVersionCode()
|
||||
{
|
||||
if(!isVersionCode()){
|
||||
version = version.replace(".", "");
|
||||
return this;
|
||||
} else throw new RuntimeException("Can't convert version code to itself");
|
||||
}
|
||||
public JVersion toVersionName()
|
||||
{
|
||||
if(isVersionCode()){
|
||||
StringBuilder charList = new StringBuilder();
|
||||
for(int i=0; i<version.length(); i++){
|
||||
charList.append(version.substring(i, i+1));
|
||||
if(i != version.length() - 1){
|
||||
charList.append(".");
|
||||
}
|
||||
}
|
||||
version = charList.toString();
|
||||
return this;
|
||||
} else throw new RuntimeException("Can't convert version name to itself");
|
||||
}
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
@ -60,23 +60,17 @@ public class PojavApplication extends Application
|
||||
Tools.DIR_ACCOUNT_NEW = Tools.DIR_DATA + "/accounts";
|
||||
// Tools.FILE_ACCOUNT_JSON = getFilesDir().getAbsolutePath() + "/account_profiles.json";
|
||||
|
||||
File nativeLibDir = new File(getApplicationInfo().nativeLibraryDir);
|
||||
|
||||
Tools.CURRENT_ARCHITECTURE = nativeLibDir.getName();
|
||||
switch (Tools.CURRENT_ARCHITECTURE) {
|
||||
case "arm": Tools.CURRENT_ARCHITECTURE = "arm/aarch32"; break;
|
||||
case "arm64": Tools.CURRENT_ARCHITECTURE = "arm64/aarch64"; break;
|
||||
case "x86": Tools.CURRENT_ARCHITECTURE = "x86/i386"; break;
|
||||
case "x86_64": Tools.CURRENT_ARCHITECTURE = "x86_64/amd64"; break;
|
||||
}
|
||||
Tools.CURRENT_ARCHITECTURE = Architecture.getDeviceArchitecture();
|
||||
//Force x86 lib directory for Asus x86 based zenfones
|
||||
if(Architecture.isx86Device() && Architecture.is32BitsDevice()){
|
||||
String originalJNIDirectory = getApplicationInfo().nativeLibraryDir;
|
||||
getApplicationInfo().nativeLibraryDir = originalJNIDirectory.substring(0,
|
||||
originalJNIDirectory.lastIndexOf("/"))
|
||||
.concat("/x86");
|
||||
}
|
||||
|
||||
// Special case for Asus x86 devixes
|
||||
if (Build.SUPPORTED_ABIS[0].equals("x86")) {
|
||||
getApplicationInfo().nativeLibraryDir = nativeLibDir.getParent() + "/x86";
|
||||
Tools.CURRENT_ARCHITECTURE = "x86/i386";
|
||||
}
|
||||
|
||||
FontChanger.initFonts(this);
|
||||
} catch (Throwable th) {
|
||||
Intent ferrorIntent = new Intent(this, FatalErrorActivity.class);
|
||||
ferrorIntent.putExtra("throwable", th);
|
||||
|
@ -110,7 +110,7 @@ public class PojavLoginActivity extends BaseActivity
|
||||
LinearLayout startScr = new LinearLayout(PojavLoginActivity.this);
|
||||
LayoutInflater.from(PojavLoginActivity.this).inflate(R.layout.start_screen,startScr);
|
||||
PojavLoginActivity.this.setContentView(startScr);
|
||||
FontChanger.changeFonts(startScr);
|
||||
|
||||
progress = (ProgressBar) findViewById(R.id.startscreenProgress);
|
||||
if(isStarting) progress.setVisibility(View.VISIBLE);
|
||||
startupTextView = (TextView) findViewById(R.id.startscreen_text);
|
||||
|
@ -45,7 +45,7 @@ public final class Tools {
|
||||
public static String DIR_DATA = "/data/data/" + BuildConfig.APPLICATION_ID;
|
||||
public static String MULTIRT_HOME = DIR_DATA+"/runtimes";
|
||||
public static String LOCAL_RENDERER = null;
|
||||
public static String CURRENT_ARCHITECTURE;
|
||||
public static int CURRENT_ARCHITECTURE;
|
||||
|
||||
// New since 3.3.1
|
||||
public static String DIR_ACCOUNT_NEW;
|
||||
@ -191,7 +191,7 @@ public final class Tools {
|
||||
|
||||
overrideableArgList.add("-Dnet.minecraft.clientmodname=" + Tools.APP_NAME);
|
||||
|
||||
// Disable FML Early Loading Screen to get Forge 1.14+ works
|
||||
// Disable FML Early Loading Screen to get Forge 1.14+ to work
|
||||
overrideableArgList.add("-Dfml.earlyprogresswindow=false");
|
||||
|
||||
// Override args
|
||||
|
@ -11,12 +11,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_short_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:fontFamily="@font/noto_sans_bold"
|
||||
android:textSize="40sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/app_motd"
|
||||
android:fontFamily="@font/noto_sans_bold"
|
||||
android:id="@+id/startscreen_text"/>
|
||||
|
||||
<ProgressBar
|
||||
|
Loading…
x
Reference in New Issue
Block a user