mirror of
https://github.com/FatttSnake/OxygenToolbox.git
synced 2026-04-06 07:01:26 +08:00
Fixed multilingual bug. Optimized the open source license page card color. Fixed incomplete display of license details.
This commit is contained in:
@@ -22,22 +22,15 @@ public class App extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
try {
|
||||
ToolsList.init(getResources().getAssets().open("json/BasicTools.json"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getApplicationContext(), R.string.init_tools_failed, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle bundle) {
|
||||
SharedPreferencesUtils.init(App.this);
|
||||
ResourceUtil.init(App.this);
|
||||
SharedPreferencesUtils.init(App.this);
|
||||
ResourceUtil.setAppLocale(SharedPreferencesUtils.getPreferenceLocale());
|
||||
ResourceUtil.loadAppTheme(activity);
|
||||
loadAppUiMode();
|
||||
loadTools();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,4 +88,13 @@ public class App extends Application {
|
||||
ResourceUtil.setAppUiMode(ResourceUtil.getSystemUiMode());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTools() {
|
||||
try {
|
||||
ToolsList.init(getResources().getAssets().open("json/BasicTools.json"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getApplicationContext(), R.string.init_tools_failed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ public class LibrariesAdapter extends RecyclerView.Adapter<LibrariesAdapter.View
|
||||
String licenseStr = new JSONObject(dependencies.getLicenses()).getString(license);
|
||||
LicenseJson licenseObject = new Gson().fromJson(licenseStr, new TypeToken<LicenseJson>() {
|
||||
}.getType());
|
||||
new MaterialAlertDialogBuilder(context).setMessage(licenseObject.getContent()).show();
|
||||
new MaterialAlertDialogBuilder(context).setMessage(licenseObject.getContent()).show()
|
||||
.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
} catch (JSONException e) {
|
||||
new MaterialAlertDialogBuilder(context).setMessage(String.format("Could not load license \"%s\"", license)).show();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/app_on_background_theme"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
</string-array>
|
||||
<string-array name="setting_language_values">
|
||||
<item>SYSTEM</item>
|
||||
<item>ZH_CN</item>
|
||||
<item>EN_US</item>
|
||||
<item>zh_CN</item>
|
||||
<item>en_US</item>
|
||||
</string-array>
|
||||
<string name="setting_language_default_value" translatable="false">SYSTEM</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user