/*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
package net.ktnx.mobileledger.ui;
-import net.ktnx.mobileledger.ui.activity.MainActivity;
-import net.ktnx.mobileledger.ui.transaction_list.TransactionListAdapter;
-import net.ktnx.mobileledger.utils.Colors;
-
+import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+import net.ktnx.mobileledger.ui.activity.MainActivity;
+import net.ktnx.mobileledger.ui.transaction_list.TransactionListAdapter;
+import net.ktnx.mobileledger.utils.Colors;
+
public class MobileLedgerListFragment extends Fragment {
- protected MainActivity mActivity;
- public SwipeRefreshLayout swiper;
- protected RecyclerView root;
+ public SwipeRefreshLayout refreshLayout;
public TransactionListAdapter modelAdapter;
+ protected RecyclerView root;
+ @NonNull
+ public MainActivity getMainActivity() {
+ return (MainActivity) requireActivity();
+ }
protected void themeChanged(Integer counter) {
- swiper.setColorSchemeColors(Colors.primary);
+ refreshLayout.setColorSchemeColors(Colors.getSwipeCircleColors());
}
public void onBackgroundTaskRunningChanged(Boolean isRunning) {
- if (mActivity == null) return;
- if (swiper == null) return;
- swiper.setRefreshing(isRunning);
+ if (getActivity() == null)
+ return;
+ if (refreshLayout == null)
+ return;
+ refreshLayout.setRefreshing(isRunning);
}
}