bug fix, dependency update

This commit is contained in:
nuclearfog 2023-10-05 21:41:03 +02:00
parent b728208f03
commit fd0a01dd2e
No known key found for this signature in database
GPG Key ID: 03488A185C476379
3 changed files with 15 additions and 6 deletions

View File

@ -23,7 +23,7 @@ android {
shrinkResources true shrinkResources true
debuggable false debuggable false
multiDexEnabled false multiDexEnabled false
proguardFile 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
debug { debug {
applicationIdSuffix '.debug' applicationIdSuffix '.debug'
@ -66,7 +66,7 @@ dependencies {
implementation 'com.github.nuclearfog:LinkAndScrollMovement:1.4.1' implementation 'com.github.nuclearfog:LinkAndScrollMovement:1.4.1'
implementation 'com.github.kyleduo:SwitchButton:2.0.3-SNAPSHOT' implementation 'com.github.kyleduo:SwitchButton:2.0.3-SNAPSHOT'
implementation 'com.github.UnifiedPush:android-connector:2.1.1' implementation 'com.github.UnifiedPush:android-connector:2.1.1'
implementation 'com.google.android.material:material:1.9.0' implementation 'com.google.android.material:material:1.10.0'
implementation 'jp.wasabeef:picasso-transformations:2.4.0' implementation 'jp.wasabeef:picasso-transformations:2.4.0'
implementation 'net.danlew:android.joda:2.12.5' implementation 'net.danlew:android.joda:2.12.5'
implementation 'org.jsoup:jsoup:1.16.1' implementation 'org.jsoup:jsoup:1.16.1'

View File

@ -50,6 +50,8 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
private RecyclerView list; private RecyclerView list;
private SwipeRefreshLayout reload; private SwipeRefreshLayout reload;
private ItemViewModel viewModel;
protected GlobalSettings settings; protected GlobalSettings settings;
private boolean enableSwipe = true; private boolean enableSwipe = true;
@ -66,7 +68,7 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
list.setLayoutManager(new LinearLayoutManager(requireContext())); list.setLayoutManager(new LinearLayoutManager(requireContext()));
AppStyles.setSwipeRefreshColor(reload, settings); AppStyles.setSwipeRefreshColor(reload, settings);
ItemViewModel viewModel = new ViewModelProvider(requireActivity()).get(ItemViewModel.class); viewModel = new ViewModelProvider(requireActivity()).get(ItemViewModel.class);
viewModel.getSelectedItem().observe(getViewLifecycleOwner(), this); viewModel.getSelectedItem().observe(getViewLifecycleOwner(), this);
reload.setOnRefreshListener(this); reload.setOnRefreshListener(this);
@ -74,6 +76,13 @@ public abstract class ListFragment extends Fragment implements OnRefreshListener
} }
@Override
public void onDestroyView() {
viewModel.getSelectedItem().removeObserver(this);
super.onDestroyView();
}
@Override @Override
public final void onRefresh() { public final void onRefresh() {
onReload(); onReload();

View File

@ -40,8 +40,8 @@ public class LockableConstraintLayout extends ConstraintLayout {
case MotionEvent.ACTION_SCROLL: case MotionEvent.ACTION_SCROLL:
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
float deltaY = ev.getAxisValue(MotionEvent.AXIS_Y) - yPos; float deltaY = ev.getAxisValue(MotionEvent.AXIS_Y) - yPos;
// detect scroll down, then aquire scroll lock // detect swipe up, then aquire scroll lock
if (!yLock && deltaY < 0.0f && callback != null) { if (deltaY < 0.0f && callback != null) {
yLock = callback.aquireVerticalScrollLock(); yLock = callback.aquireVerticalScrollLock();
} }
// fall through // fall through