mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-13 05:17:37 -08:00
My brain hurts...
This commit is contained in:
@@ -3,7 +3,9 @@ package com.topjohnwu.magisk;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -11,6 +13,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.module.Module;
|
||||
import com.topjohnwu.magisk.module.Repo;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,11 +26,16 @@ public abstract class BaseRepoFragment extends Fragment {
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.empty_rv)
|
||||
TextView emptyTv;
|
||||
|
||||
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.single_module_fragment, container, false);
|
||||
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout);
|
||||
mSwipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
refreshItems();
|
||||
});
|
||||
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
if (listRepos().size() == 0) {
|
||||
@@ -43,5 +51,18 @@ public abstract class BaseRepoFragment extends Fragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
void refreshItems() {
|
||||
Log.d("Magisk", "Calling refreshitems for online");
|
||||
new Utils.LoadModules(getActivity(),true).execute();
|
||||
onItemsLoadComplete();
|
||||
}
|
||||
|
||||
void onItemsLoadComplete() {
|
||||
// Update the adapter and notify data set changed
|
||||
// ...
|
||||
|
||||
// Stop refresh animation
|
||||
mSwipeRefreshLayout.setRefreshing(false);
|
||||
}
|
||||
protected abstract List<Repo> listRepos();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user