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