Skip to content

Commit

Permalink
issue #115 stabilized scrolling a recyler view
Browse files Browse the repository at this point in the history
  • Loading branch information
tobexyz committed Dec 25, 2024
1 parent 828e724 commit fac23e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ public boolean onBackPressed() {
}
// currentPosition
initBrowsItemAdapter(itemList);
itemList.postDelayed(() -> itemList.smoothScrollToPosition(lastPosition.getPositionId()), 100);
((LinearLayoutManager) itemList.getLayoutManager()).scrollToPositionWithOffset(lastPosition.getPositionId(), 0);
itemList.postDelayed(() -> {
((LinearLayoutManager) itemList.getLayoutManager()).scrollToPositionWithOffset(lastPosition.getPositionId(), 0);
}, 200);
bItemAdapter.clear();
bItemAdapter.loadMore();

Expand Down
7 changes: 6 additions & 1 deletion yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package de.yaacc.browser;

import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
Expand Down Expand Up @@ -202,7 +203,11 @@ private void checkBatteryOptimizationEnabled() {
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + packageName));
}
startActivity(intent);
try {
startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.d(getClass().getName(), "Ignoring exception ActivityNotFoundException during check for battery optimization");
}
}

@Override
Expand Down

0 comments on commit fac23e7

Please sign in to comment.