Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/github/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="false"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="false"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app.simple.inure.activities.app
import android.content.Intent
import android.content.SharedPreferences
import android.content.res.Configuration
import android.net.wifi.hotspot2.pps.HomeSp
import android.os.Build
import android.os.Bundle
import android.util.Log
Expand Down Expand Up @@ -242,11 +243,11 @@ class MainActivity : BaseActivity() {
if (isNewIntent.invert()) { // Maybe the app was opened from launcher, need more checks?
if (AppUtils.isDebug()) {
supportFragmentManager.beginTransaction()
.replace(R.id.app_container, SplashScreen.newInstance(false), SplashScreen.TAG)
.replace(R.id.app_container, Home.newInstance(), SplashScreen.TAG)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify fragment tag consistency with the new fragment type.

The code now instantiates Home.newInstance() but still uses SplashScreen.TAG as the fragment tag. This creates a mismatch between the actual fragment type and its tag, which could lead to confusion when debugging or managing fragment transactions.

Consider either:

  1. Using Home.TAG instead of SplashScreen.TAG for consistency
  2. Or keeping SplashScreen.TAG if there's a specific reason (e.g., maintaining backward compatibility with existing fragment management logic)

Also applies to: 250-250


🏁 Script executed:

#!/bin/bash
# Search for usage of SplashScreen.TAG to understand if this tag is used elsewhere
# and whether changing it would break existing functionality
rg -A 3 -B 3 "SplashScreen\.TAG"

# Also check if Home.TAG exists and how it's used
rg -A 3 -B 3 "Home\.TAG"

Length of output: 2252


Align Home fragment tag with its type in MainActivity

The debug and non-debug branches for isNewIntent are still using SplashScreen.TAG when replacing with Home.newInstance(). Update both occurrences to use Home.TAG for clarity and consistency.

• File: app/src/main/java/app/simple/inure/activities/app/MainActivity.kt
– Around lines 246 and 250

Diff:

- .replace(R.id.app_container, Home.newInstance(), SplashScreen.TAG)
+ .replace(R.id.app_container, Home.newInstance(), Home.TAG)

If there’s a deliberate reason to continue using SplashScreen.TAG here (e.g., legacy logic), please document it in a comment.

🤖 Prompt for AI Agents
In app/src/main/java/app/simple/inure/activities/app/MainActivity.kt around
lines 246 and 250, the fragment replacement calls for Home.newInstance()
incorrectly use SplashScreen.TAG as the tag. Update both occurrences to use
Home.TAG instead to maintain clarity and consistency with the fragment type. If
there is a specific reason to keep using SplashScreen.TAG, add a comment
explaining this decision.

.commit()
} else {
supportFragmentManager.beginTransaction()
.replace(R.id.app_container, SplashScreen.newInstance(false), SplashScreen.TAG)
.replace(R.id.app_container, Home.newInstance(), SplashScreen.TAG)
.commit()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package app.simple.inure.decorations.transitions;

import android.animation.Animator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.transition.TransitionValues;
import androidx.transition.Visibility;

public class SeekableSharedAxisZTransition extends Visibility {
public static final int DECELERATE_FACTOR = 3;
private static final float SCALE_IN_FROM = 0.9f;
private static final float SCALE_OUT_TO = 1.1f;
private static final long DEFAULT_DURATION = 500L;
private final boolean forward;

public SeekableSharedAxisZTransition(boolean forward) {
this.forward = forward;
setDuration(DEFAULT_DURATION);
}

@Override
public boolean isSeekingSupported() {
// Important for predictive back
return true;
}

private Animator createAnimator(final View view, final float startScale, final float endScale,
final float startAlpha, final float endAlpha) {
if (view instanceof ImageView) {
return null;
}

ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
animator.setDuration(DEFAULT_DURATION);
animator.setInterpolator(new DecelerateInterpolator(DECELERATE_FACTOR));
animator.addUpdateListener(animation -> {
float progress = (float) animation.getAnimatedValue();
float scale = startScale + (endScale - startScale) * progress;
float alpha = startAlpha + (endAlpha - startAlpha) * progress;
view.setScaleX(scale);
view.setScaleY(scale);
view.setAlpha(alpha);
});

return animator;
}
Comment on lines +32 to +51
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add null safety check for the view parameter.

The createAnimator method should validate the view parameter to prevent potential NPEs.

 private Animator createAnimator(final View view, final float startScale, final float endScale,
         final float startAlpha, final float endAlpha) {
+    if (view == null) {
+        return null;
+    }
     if (view instanceof ImageView) {
         return null;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private Animator createAnimator(final View view, final float startScale, final float endScale,
final float startAlpha, final float endAlpha) {
if (view instanceof ImageView) {
return null;
}
ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
animator.setDuration(DEFAULT_DURATION);
animator.setInterpolator(new DecelerateInterpolator(DECELERATE_FACTOR));
animator.addUpdateListener(animation -> {
float progress = (float) animation.getAnimatedValue();
float scale = startScale + (endScale - startScale) * progress;
float alpha = startAlpha + (endAlpha - startAlpha) * progress;
view.setScaleX(scale);
view.setScaleY(scale);
view.setAlpha(alpha);
});
return animator;
}
private Animator createAnimator(final View view, final float startScale, final float endScale,
final float startAlpha, final float endAlpha) {
if (view == null) {
return null;
}
if (view instanceof ImageView) {
return null;
}
ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
animator.setDuration(DEFAULT_DURATION);
animator.setInterpolator(new DecelerateInterpolator(DECELERATE_FACTOR));
animator.addUpdateListener(animation -> {
float progress = (float) animation.getAnimatedValue();
float scale = startScale + (endScale - startScale) * progress;
float alpha = startAlpha + (endAlpha - startAlpha) * progress;
view.setScaleX(scale);
view.setScaleY(scale);
view.setAlpha(alpha);
});
return animator;
}
🤖 Prompt for AI Agents
In
app/src/main/java/app/simple/inure/decorations/transitions/SeekableSharedAxisZTransition.java
around lines 32 to 51, the createAnimator method lacks a null check for the view
parameter, which can cause NullPointerExceptions. Add a null check at the start
of the method to return null or handle the case appropriately if view is null
before proceeding with any operations on it.


@Override
public Animator onAppear(@NonNull ViewGroup sceneRoot,
@NonNull View view,
TransitionValues startValues,
TransitionValues endValues) {
// Entering: scale from behind, fade in
float startScale = forward ? SCALE_IN_FROM : SCALE_OUT_TO;
float endScale = 1f;
return createAnimator(view, startScale, endScale, 0f, 1f);
}

@Override
public Animator onDisappear(@NonNull ViewGroup sceneRoot, @NonNull View view,
TransitionValues startValues, TransitionValues endValues) {
// Exiting: scale out, fade out
float endScale = forward ? SCALE_OUT_TO : SCALE_IN_FROM;
float startScale = 1f;
return createAnimator(view, startScale, endScale, 1f, 0f);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import app.simple.inure.R
import app.simple.inure.apk.utils.PackageUtils
import app.simple.inure.constants.BundleConstants
import app.simple.inure.decorations.transitions.DetailsTransitionArc
import app.simple.inure.decorations.transitions.SeekableSharedAxisZTransition
import app.simple.inure.decorations.views.FloatingMenuRecyclerView
import app.simple.inure.dialogs.app.FullVersion.Companion.showFullVersion
import app.simple.inure.dialogs.app.Sure.Companion.newSureInstance
Expand Down Expand Up @@ -293,10 +294,10 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
returnTransition = MaterialSharedAxis(MaterialSharedAxis.Y, false)
}
PopupTransitionType.SHARED_AXIS_Z -> {
enterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true)
exitTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true)
reenterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false)
returnTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false)
enterTransition = SeekableSharedAxisZTransition(true)
exitTransition = SeekableSharedAxisZTransition(true)
reenterTransition = SeekableSharedAxisZTransition(false)
returnTransition = SeekableSharedAxisZTransition(false)
}
PopupTransitionType.THROUGH -> {
exitTransition = MaterialFadeThrough()
Expand Down Expand Up @@ -622,7 +623,7 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference

view.scaleX = 1F - (0.1F * interpolatedProgress)
view.scaleY = 1F - (0.1F * interpolatedProgress)
// view.alpha = 1F - (0.5F * interpolatedProgress)
view.alpha = 1F - (0.5F * interpolatedProgress)
}

@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
Expand Down Expand Up @@ -748,7 +749,7 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
val transaction = requireActivity().supportFragmentManager.beginTransaction().apply {
setReorderingAllowed(true)
addSharedElement(icon, icon.transitionName)
replace(R.id.app_container, fragment, tag)
add (R.id.app_container, fragment, tag)
if (tag.isNotNull()) {
addToBackStack(tag)
}
Expand All @@ -759,7 +760,7 @@ abstract class ScopedFragment : Fragment(), SharedPreferences.OnSharedPreference
val transaction = requireActivity().supportFragmentManager.beginTransaction().apply {
setReorderingAllowed(true)
addSharedElement(icon, icon.transitionName)
replace(R.id.app_container, fragment, tag)
add(R.id.app_container, fragment, tag)
if (tag.isNotNull()) {
addToBackStack(tag)
}
Expand Down