(fix) try to fix search

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/299/head
androidacy-user 1 year ago
parent 3d92c5e0c5
commit 77cd9346f0

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="QueryAllPackagesPermission"
tools:targetApi="tiramisu">
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="QueryAllPackagesPermission"
tools:targetApi="tiramisu">
<uses-sdk tools:overrideLibrary="io.sentry.android" />

@ -139,6 +139,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
this.moduleListOnline = findViewById(R.id.module_list_online);
this.searchCard = findViewById(R.id.search_card);
this.searchView = findViewById(R.id.search_bar);
this.searchView.setIconified(true);
this.moduleViewAdapter = new ModuleViewAdapter();
this.moduleViewAdapterOnline = new ModuleViewAdapter();
this.moduleList.setAdapter(this.moduleViewAdapter);
@ -207,8 +208,8 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
MainActivity.this.moduleListOnline.setVisibility(View.GONE);
}
});
// set search view to be disabled
this.searchView.setEnabled(false);
// set search view to be enabled
this.searchView.setEnabled(true);
this.searchView.setVisibility(View.GONE);
}
// update the padding of blur_frame to match the new bottom nav height
@ -309,7 +310,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
runOnUiThread(() -> {
progressIndicator.setProgressCompat(PRECISION, true);
progressIndicator.setVisibility(View.GONE);
searchView.setEnabled(true);
searchView.setEnabled(false);
setActionBarBackground(null);
updateScreenInsets(getResources().getConfiguration());
});
@ -553,7 +554,18 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
this.searchView.clearFocus();
if (this.initMode) return false;
if (this.moduleViewListBuilder.setQueryChange(query)) {
new Thread(() -> this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter), "Query update thread").start();
// figure out if we are on online or offline list and apply to that
if (this.moduleList.getVisibility() == View.VISIBLE) {
Timber.i("Query submit: %s on offline list", query);
new Thread(() -> this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter), "Query update thread").start();
} else if (this.moduleListOnline.getVisibility() == View.VISIBLE) {
Timber.i("Query submit: %s on online list", query);
new Thread(() -> this.moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline), "Query update thread").start();
} else {
Timber.e("Query submit: %s on unknown list", query);
return false;
}
// sa
}
return true;
}

@ -6,7 +6,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingVertical="0dp"
app:fitsSystemWindowsInsets="start|end|bottom|top"
tools:context=".MainActivity">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
@ -53,17 +52,15 @@
<LinearLayout
android:id="@+id/search_container"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="8dp"
android:filterTouchesWhenObscured="true"
android:gravity="bottom|start"
android:visibility="gone"
android:gravity="bottom|end"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_fitsSystemWindowsInsets="bottom"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="RtlHardcoded">
<!--
setting high app:cardCornerRadius is not supported on some versions
@ -73,8 +70,7 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/search_card"
android:layout_width="wrap_content"
android:layout_height="65dp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:background="@null"
android:shape="ring"
android:visibility="visible"
@ -86,14 +82,12 @@
<androidx.appcompat.widget.SearchView
android:id="@+id/search_bar"
android:layout_width="300dp"
android:layout_height="24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:background="@null"
android:visibility="gone"
android:visibility="visible"
app:iconifiedByDefault="true"
app:layout_constraintBottom_toBottomOf="@id/bottom_navigation"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:useDrawerArrowDrawable="true" />
</com.google.android.material.card.MaterialCardView>
</LinearLayout>

Loading…
Cancel
Save