Fixed multilingual bug. Optimized the open source license page card color. Fixed incomplete display of license details.

This commit is contained in:
2022-08-08 19:01:41 +08:00
parent a58dff2830
commit f2bb384c3d
5 changed files with 17 additions and 33 deletions

View File

@@ -12,26 +12,6 @@
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-08-07T06:23:39.099208800Z" />
<runningDeviceTargetsSelectedWithDialog>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="G:\Android\Avd\Pixel_4_API_31.avd" />
</Key>
</deviceKey>
</Target>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="G:\Android\Avd\Pixel_4_API_30.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetsSelectedWithDialog>
<timeTargetWasSelectedWithDropDown value="2022-08-08T11:00:08.583258100Z" />
</component>
</project>

View File

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

View File

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

View File

@@ -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

View File

@@ -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>