(fix) fix search for good

still need to fix custom repos and work on showing updates in new UI

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

@ -194,9 +194,8 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
MainActivity.this.moduleList.setVisibility(View.GONE);
}
});
// set search view to be enabled
this.searchView.setEnabled(true);
this.searchView.setVisibility(View.VISIBLE);
// clear search view
this.searchView.setQuery("", false);
} else if (item.getItemId() == R.id.installed_menu_item) {
// set module_list_online as gone and module_list as visible. fade in/out
this.moduleList.setAlpha(0F);
@ -208,9 +207,8 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
MainActivity.this.moduleListOnline.setVisibility(View.GONE);
}
});
// set search view to be enabled
this.searchView.setEnabled(true);
this.searchView.setVisibility(View.GONE);
// set search view to cleared
this.searchView.setQuery("", false);
}
// update the padding of blur_frame to match the new bottom nav height
View blurFrame = findViewById(R.id.blur_frame);
@ -554,18 +552,13 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
this.searchView.clearFocus();
if (this.initMode) return false;
if (this.moduleViewListBuilder.setQueryChange(query)) {
// 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
Timber.i("Query submit: %s on offline list", query);
new Thread(() -> this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter), "Query update thread").start();
}
// same for online list
if (this.moduleViewListBuilderOnline.setQueryChange(query)) {
Timber.i("Query submit: %s on online list", query);
new Thread(() -> this.moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline), "Query update thread").start();
}
return true;
}
@ -574,8 +567,14 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
public boolean onQueryTextChange(String query) {
if (this.initMode) return false;
if (this.moduleViewListBuilder.setQueryChange(query)) {
Timber.i("Query submit: %s on offline list", query);
new Thread(() -> this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter), "Query update thread").start();
}
// same for online list
if (this.moduleViewListBuilderOnline.setQueryChange(query)) {
Timber.i("Query submit: %s on online list", query);
new Thread(() -> this.moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline), "Query update thread").start();
}
return false;
}
@ -585,6 +584,10 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
if (this.moduleViewListBuilder.setQueryChange(null)) {
new Thread(() -> this.moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter), "Query update thread").start();
}
// same for online list
if (this.moduleViewListBuilderOnline.setQueryChange(null)) {
new Thread(() -> this.moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline), "Query update thread").start();
}
return false;
}
@ -747,7 +750,8 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
/**
* Shows a snackbar offering to take users to Weblate if their language is not available.
* @param language The language code.
*
* @param language The language code.
* @param languageName The language name.
*/
@SuppressLint("RestrictedApi")

Loading…
Cancel
Save