diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java index 3660883..250d871 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java @@ -60,6 +60,7 @@ public class MainActivity extends AppCompatActivity { private String packageName; private MainBinding binding; private ApplicationListAdapter.OnAppClickListener onAppClickListener; + private int appPosition; @Override protected void onCreate(Bundle savedInstanceState) { @@ -70,7 +71,7 @@ public class MainActivity extends AppCompatActivity { getSupportActionBar().setTitle(R.string.app_title); } fragments = new ArrayList<>(); - + appPosition = 0; NetworkListener networkListener = new NetworkListener() { @Override public void onSuccess() { @@ -119,11 +120,11 @@ public class MainActivity extends AppCompatActivity { .commit(); }; - onAppClickListener = vm -> { + onAppClickListener = (vm, position) -> { try { PackageManager pm = getPackageManager(); PackageInfo packageInfo = pm.getPackageInfo(vm.packageName, PackageManager.GET_PERMISSIONS); - + appPosition = position; ReportFragment report = ReportFragment.newInstance(pm, vm, packageInfo, onTrackerClickListener); fragments.add(report); FragmentManager manager = getSupportFragmentManager(); @@ -166,6 +167,10 @@ public class MainActivity extends AppCompatActivity { else { getSupportFragmentManager().popBackStack(); fragments.remove(fragments.size() - 1); + Updatable updatable = fragments.get(fragments.size() - 1); + if (updatable instanceof HomeFragment) { + ((HomeFragment) updatable).scrollTo(appPosition); + } } } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/Utils.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/Utils.java index 984f117..5979fd5 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/Utils.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/Utils.java @@ -18,6 +18,7 @@ import java.util.regex.Pattern; public class Utils { + public static final String TAG = "Exodus_privacy"; @SuppressLint("PackageManagerGetSignatures") public static String getCertificateSHA1Fingerprint(PackageManager pm, String packageName) { int flags = PackageManager.GET_SIGNATURES; diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/ApplicationListAdapter.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/ApplicationListAdapter.java index c64988e..f506f65 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/ApplicationListAdapter.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/ApplicationListAdapter.java @@ -90,7 +90,7 @@ public class ApplicationListAdapter extends RecyclerView.Adapter 0) { + appListFragment.scrollTo(scrollTo); + scrollTo = 0; + } + } + + public void scrollTo(int position) { + scrollTo = position; + } + @Override public void onUpdateComplete() { refreshInProgress = false;