Skip to content

Commit

Permalink
fix: installer buttons not going away in highlight mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza417 committed Jan 2, 2025
1 parent 34788fa commit c84218f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/src/main/assets/html/changelogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ <h4>Bug Fixes</h4>
<li>Fixed header overlapping with the list in <b>Preferences</b>.</li>
<li>Fixed various animations still playing when <i>Reduce Animations</i> is toggled.</li>
<li>Fixed charts not appearing when <i>Reduce Animations</i> is toggled.</li>
<li>Fixed buttons in <b>Installer</b> not hiding itself when <i>Static Background</i> is on in
<b>Accessibility Preferences</b>.
</li>
<li>Various minor fixes.</li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ public boolean onTouchEvent(MotionEvent event) {
.scaleY(1F)
.scaleX(1F)
.alpha(1F)
.setStartDelay(50)
.setInterpolator(new LinearOutSlowInInterpolator())
.setDuration(getResources().getInteger(R.integer.animation_duration))
.start();
}

return super.onTouchEvent(event);
}
}
return super.onTouchEvent(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class FloatingMenuRecyclerView extends CustomHorizontalRecyclerView {
private static final String TAG = "BottomMenuRecyclerView";
private int containerHeight;
private int displayWidth;
private int postTranslationY = 0;
private boolean isScrollListenerAdded = false;
private boolean isInitialized = false;
private boolean isBottomMenuVisible = true;
Expand Down Expand Up @@ -141,6 +142,8 @@ public void initBottomMenu(ArrayList <Pair <Integer, Integer>> bottomMenuItems,
}
}
}

executePostTranslationY();
});
}

Expand Down Expand Up @@ -332,6 +335,8 @@ public void setTranslationY(int dy) {
if (getTranslationY() < containerHeight) {
setTranslationY(getTranslationY() + dy);
setTranslationY(RangesKt.coerceAtMost(getTranslationY(), containerHeight));
} else {
setTranslationY(containerHeight);
}
} else {
if (getTranslationY() > 0) {
Expand All @@ -345,6 +350,20 @@ public void setInitialized(boolean initialized) {
isInitialized = initialized;
}

public void setPostTranslationY(int postTranslationY) {
this.postTranslationY = postTranslationY;
}

public boolean isPostTranslationY() {
return postTranslationY != 0;
}

private void executePostTranslationY() {
if (isPostTranslationY()) {
setTranslationY(postTranslationY);
}
}

public void clear() {
setAdapter(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
super.onViewCreated(view, savedInstanceState)
kotlin.runCatching {
bottomRightCornerMenu = requireActivity().findViewById(R.id.bottom_menu)
bottomRightCornerMenu?.setPostTranslationY(requireArguments().getInt(BOTTOM_MENU_POSITION, 0))
}

animateBlur()
Expand Down Expand Up @@ -199,6 +200,12 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
registerSharedPreferenceChangeListener()
}

override fun onPause() {
super.onPause()
Log.d(TAG, "onPause: ${bottomRightCornerMenu?.translationY}")
requireArguments().putInt(BOTTOM_MENU_POSITION, bottomRightCornerMenu?.translationY?.toInt() ?: 0)
}

override fun onStop() {
bottomRightCornerMenu?.clearAnimation()
bottomRightCornerMenu?.gone()
Expand Down Expand Up @@ -780,7 +787,7 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
}
}

@Suppress("unused", "UNUSED_VARIABLE")
@Suppress("unused", "UNUSED_VARIABLE", "UnusedReceiverParameter")
@RequiresApi(Build.VERSION_CODES.R)
protected fun View.setKeyboardChangeListener() {
val cb = object : WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) {
Expand Down Expand Up @@ -868,5 +875,6 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
private const val MAX_WINDOW_HEIGHT = 5

private const val TAG = "ScopedFragment"
private const val BOTTOM_MENU_POSITION = "bottom_menu_position"
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/app/simple/inure/ui/panels/Installer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@ class Installer : ScopedFragment(), InstallerCallbacks {
update.gone()
uninstall.gone()
launch.gone()
installerViewModel.install(null)
installerViewModel.install()
}
} else {
loader.visible(true)
install.gone()
update.gone()
uninstall.gone()
launch.gone()
installerViewModel.install(null)
installerViewModel.install()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class InstallerViewModel(application: Application, private val uri: Uri?, val fi
}
}

fun install(user: User?) {
fun install(user: User? = null) {
this.user = user

if (ConfigurationPreferences.isUsingShizuku() || ConfigurationPreferences.isUsingRoot()) {
Expand All @@ -313,7 +313,8 @@ class InstallerViewModel(application: Application, private val uri: Uri?, val fi

try {
val uris = files!!.map { file ->
FileProvider.getUriForFile(applicationContext(), "${applicationContext().packageName}.provider", file)
FileProvider.getUriForFile(
applicationContext(), "${applicationContext().packageName}.provider", file)
}

val packageInstaller = PackageInstaller()
Expand Down

0 comments on commit c84218f

Please sign in to comment.