add progress

This commit is contained in:
ShirosakiMio 2024-09-09 15:23:24 +08:00
parent 988b177011
commit d0797720eb
2 changed files with 18 additions and 12 deletions

View File

@ -228,6 +228,7 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
setupVersionDisplay()
UpdateChecker.getInstance().checkAuto(this@MainActivity).start()
}
playAnim()
}
}
}
@ -249,11 +250,6 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
_uiManager?.onResume()
}
override fun onStart() {
super.onStart()
playAnim()
}
override fun onSelect(view: FCLMenuView) {
refreshMenuView(view)
bind.apply {
@ -389,6 +385,7 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
@SuppressLint("UseCompatLoadingForDrawables")
private fun loadVersion(version: String?) {
bind.versionProgress.visibility = View.VISIBLE
if (Profiles.getSelectedProfile() != profile) {
profile = Profiles.getSelectedProfile()
if (profile != null) {
@ -431,17 +428,16 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
)
}
}
val drawable = Profiles.getSelectedProfile().repository.getVersionIconImage(version)
Schedulers.androidUIThread().execute {
bind.versionProgress.visibility = View.GONE
bind.versionName.text = version
bind.versionHint.text = libraries.toString()
bind.icon.setBackgroundDrawable(
Profiles.getSelectedProfile().repository.getVersionIconImage(
version
)
)
bind.icon.setBackgroundDrawable(drawable)
}
}
} else {
bind.versionProgress.visibility = View.GONE
bind.versionName.text = getString(R.string.version_no_version)
bind.versionHint.text = getString(R.string.version_manage)
bind.icon.setBackgroundDrawable(getDrawable(R.drawable.img_grass))
@ -471,13 +467,13 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
bind.apply {
AnimUtil.playTranslationX(
leftMenu,
ThemeEngine.getInstance().getTheme().animationSpeed * 200L,
ThemeEngine.getInstance().getTheme().animationSpeed * 100L,
-100f,
0f
).interpolator(BounceInterpolator()).start()
AnimUtil.playTranslationX(
rightMenu,
ThemeEngine.getInstance().getTheme().animationSpeed * 200L,
ThemeEngine.getInstance().getTheme().animationSpeed * 100L,
100f,
0f
).interpolator(BounceInterpolator()).start()

View File

@ -261,6 +261,16 @@
</androidx.appcompat.widget.LinearLayoutCompat>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:layout_marginTop="10dp"
android:id="@+id/version_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
app:layout_constraintTop_toBottomOf="@id/view2"
app:layout_constraintStart_toStartOf="parent"/>
<com.tungsten.fcllibrary.component.view.FCLButton
android:id="@+id/execute_jar"
android:layout_width="match_parent"