[app] Add swipe to refresh to app list (#275)
This commit is contained in:
parent
329a19b448
commit
d5dcb29c08
|
|
@ -147,6 +147,7 @@ dependencies {
|
|||
implementation("androidx.core:core:1.3.2")
|
||||
implementation("androidx.fragment:fragment:1.3.0")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("com.caverock:androidsvg-aar:1.4")
|
||||
implementation("com.github.bumptech.glide:glide:$glideVersion")
|
||||
implementation("com.github.bumptech.glide:okhttp3-integration:$glideVersion")
|
||||
|
|
|
|||
|
|
@ -269,9 +269,6 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_refresh) {
|
||||
refresh(true);
|
||||
return true;
|
||||
} else if (itemId == R.id.item_show_system) {
|
||||
item.setChecked(!item.isChecked());
|
||||
preferences.edit().putBoolean("show_system_apps", item.isChecked()).apply();
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class AppListActivity extends BaseActivity {
|
|||
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
||||
RecyclerViewKt.addFastScroller(binding.recyclerView, binding.recyclerView);
|
||||
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
|
||||
binding.swipeRefreshLayout.setOnRefreshListener(() -> scopeAdapter.refresh(true));
|
||||
|
||||
searchListener = new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
|
|
@ -166,6 +167,7 @@ public class AppListActivity extends BaseActivity {
|
|||
public void onDataReady() {
|
||||
runOnUiThread(() -> {
|
||||
binding.progress.setIndeterminate(false);
|
||||
binding.swipeRefreshLayout.setRefreshing(false);
|
||||
String queryStr = searchView != null ? searchView.getQuery().toString() : "";
|
||||
scopeAdapter.getFilter().filter(queryStr);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,14 +67,20 @@
|
|||
android:indeterminate="true"
|
||||
app:hideAnimationBehavior="outward" />
|
||||
|
||||
<rikka.widget.borderview.BorderRecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
app:borderTopVisibility="whenTop"
|
||||
app:borderTopDrawable="@null"
|
||||
app:borderBottomVisibility="never"
|
||||
app:fitSystemWindowsInsets="bottom" />
|
||||
android:id="@+id/swipeRefreshLayout">
|
||||
|
||||
<rikka.widget.borderview.BorderRecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
app:borderTopVisibility="whenTop"
|
||||
app:borderTopDrawable="@null"
|
||||
app:borderBottomVisibility="never"
|
||||
app:fitSystemWindowsInsets="bottom" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
@ -33,12 +33,6 @@
|
|||
android:icon="@drawable/ic_settings"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_refresh"
|
||||
android:title="@string/refresh"
|
||||
android:icon="@drawable/ic_refresh"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/use_recommended"
|
||||
android:title="@string/use_recommended" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue