mars885 / persistent-search-view Goto Github PK
View Code? Open in Web Editor NEWAn Android library designed to simplify the process of implementing search-related functionality.
License: Apache License 2.0
An Android library designed to simplify the process of implementing search-related functionality.
License: Apache License 2.0
When I try to add this library to my app I'm greeted with the following error:
Failed to resolve: com.arthurivanets.adapster:adapster:1.0.13
Show in Project Structure dialog
Affected Modules: app
I am using mars885 Persistent Search View. I dont know how to extract the SuggestionItem title from its object. I want to extract the title in a string and use it to show some results. i encountered this problem while using setOnSuggestionChangeListener -> onSuggestionPicked().
I am a Java Programmer
I want to use OnSuggestionChangeListener, but itemModel not resolved. I'm getting following error.
Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.paulrybitskyi.persistentsearchview.adapters.model.SuggestionItem, unresolved supertypes: com.arthurivanets.adapster.model.BaseItem, com.arthurivanets.adapster.model.markers.Trackable
Hello, since jcenter will be deprecated soon enough, any plans to release this via mavencentral?
When I tried to implement library, at the beginning get this error. Is there anyone know the reason?
Hi your library does not loading a class as shared below. Please resolve this asap.
The following classes could not be instantiated:
- com.paulrybitskyi.persistentsearchview.PersistentSearchView (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.ClassNotFoundException: com.arthurivanets.adapster.listeners.OnItemClickListener
java.lang.ClassNotFoundException: com.arthurivanets.adapster.listeners.OnItemClickListener
at com.android.tools.idea.rendering.classloading.loaders.DelegatingClassLoader.findClass(DelegatingClassLoader.kt:81)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at com.android.tools.idea.rendering.classloading.loaders.DelegatingClassLoader.loadClass(DelegatingClassLoader.kt:65)
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getConstructor0(Class.java:3342)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:282)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
at android.view.LayoutInflater.inflate(LayoutInflater.java:505)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873)
at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Target sdk 32
Min sdk 21
AndroidX
Java - Android Studio
While building a project it says,
*** What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebugAndroidTest'.
Could not resolve all files for configuration ':app:debugAndroidTestCompileClasspath'.
Could not find com.arthurivanets.adapster:adapster:1.0.13.
Required by:
project :app > com.paulrybitskyi.persistentsearchview:persistentsearchview:1.1.4**
I have a couple of fragments in a viewPager2. Two of the fragments have persistent search views. When I toggle back & forth between the fragments, tapping to activate the search query does not work.
I was thinking it's related to the Lifecycle of the fragments which toggles between pause & resume depending on which fragment is active. Do we need to do anything special when multiple instances of the persistent search views are active at a time?
How to change query, hint and suggested text appearances? I don't see any textappearances attributes.
Hi,
Currently it run only on API 21, I used tools:overrideLibrary="com.paulrybitskyi.persistentsearchview"
to make it run on API 19.. Will it run smoothly on API 19 devices .. without error ?
Can you provide a sample application in Java for the usage inside of Fragment instead of Activity?
Hi. Thank you for your awesome library. Can you add a feature to force the Voice Recognition Language from Default Locale to a Specific language?
hi, i'm facing weird issue when placing searchivew on fragment, suggestion work as i expected but unable to scroll. i've also confirmed with the same code, sugestion can be scrolled flawlesly
public class MainActivity extends AppCompatActivity {
private int page = 1;
PersistentSearchView persistentSearchView;
RecyclerView recyclerView;
PhotosAdapter adapter;
PhotosAdapter.OnPhotoClickedListener photoClickListener;
UnsplashInterface dataService;
private Merlin merlin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_img_picker);
merlin = new Merlin.Builder().withConnectableCallbacks().build(getApplicationContext ());
recyclerView = findViewById(R.id.recyclerView);
persistentSearchView = findViewById (R.id.persistentSearchView);
dataService = UnsplashClient.getUnsplashClient().create(UnsplashInterface.class);
photoClickListener = new PhotosAdapter.OnPhotoClickedListener() {
@Override
public void photoClicked(Photo photo, ImageView imageView) {
Intent intent = new Intent();
intent.putExtra("image", photo);
setResult(RESULT_OK, intent);
finish();
}
};
persistentSearchView.setOnLeftBtnClickListener(new View.OnClickListener () {
@Override
public void onClick(View view) {
finish ();
}
});
persistentSearchView.setVoiceRecognitionDelegate(new VoiceRecognitionDelegate (this));
persistentSearchView.setOnSearchConfirmedListener(new OnSearchConfirmedListener () {
@Override
public void onSearchConfirmed(PersistentSearchView searchView, String query) {
// Handle a search confirmation. This is the place where you'd
// want to perform a search against your data provider.
search (query);
Toast.makeText (MainActivity.this, "search is confirmed", Toast.LENGTH_SHORT).show ();
}
});
persistentSearchView.setOnSuggestionChangeListener(new OnSuggestionChangeListener () {
@Override
public void onSuggestionPicked(SuggestionItem suggestion) {
// Handle a suggestion pick event. This is the place where you'd
// want to perform a search against your data provider.
}
@Override
public void onSuggestionRemoved(SuggestionItem suggestion) {
// Handle a suggestion remove event. This is the place where
// you'd want to remove the suggestion from your data provider.
}
});
GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
recyclerView.setLayoutManager(layoutManager);
adapter = new PhotosAdapter(new ArrayList<Photo> (), this, photoClickListener);
recyclerView.setAdapter(adapter);
recyclerView.addOnScrollListener(new EndlessRecyclerViewScrollListener(layoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
loadPhotos();
Toast.makeText (MainActivity.this, " endless scroll view is called ", Toast.LENGTH_LONG).show ();
}
});
loadPhotos();
merlin.registerConnectable(new Connectable () {
@Override
public void onConnect() {
Toast.makeText (MainActivity.this, "connected with internet", Toast.LENGTH_SHORT).show ();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult (requestCode, resultCode, data);
VoiceRecognitionDelegate.handleResult(persistentSearchView, requestCode, resultCode, data);
}
private void loadPhotos() {
dataService.getPhotos(page,null,"latest")
.enqueue (new Callback<List<Photo>> () {
@Override
public void onResponse(Call<List<Photo>> call, Response<List<Photo>> response) {
List<Photo> photos = response.body();
Log.i("Photos", "Photos Fetched " + photos.size());
//add to adapter
page++;
adapter.addPhotos(photos);
recyclerView.setAdapter(adapter);
}
@Override
public void onFailure(Call<List<Photo>> call, Throwable t) {
}
});
}
public void search(String query){
if(query != null && !query.equals("")) {
dataService.searchPhotos(query,1,null,null)
.enqueue (new Callback<SearchResults> () {
@Override
public void onResponse(Call<SearchResults> call, Response<SearchResults> response) {
SearchResults results = response.body();
Log.d("Photos", "Total Results Found " + results.getTotal());
List<Photo> photos = results.getResults();
adapter = new PhotosAdapter(photos, MainActivity.this, photoClickListener);
recyclerView.setAdapter(adapter);
}
@Override
public void onFailure(Call<SearchResults> call, Throwable t) {
}
});
}
else {
loadPhotos();
}
}
@Override
protected void onResume() {
super.onResume();
merlin.bind();
}
@Override
protected void onPause() {
merlin.unbind();
super.onPause();
}
}
Please use github releases (by tagging your code) and add demo APK to it as well.
Hello author. I'm intergrating this search view to my app and it's an amazing search view.
I would like to suggest to have this button at the right of Regular Suggestion view. It will set the suggestion text as the query and also call the OnSearchQueryChangeListener.
Below is an image of Google app as example
Thank you.
I have got 'Could not find com.arthurivanets.adapster:adapster:1.0.13.' error message while removing jcenter in build.gradle as suggested in android studio.
Hello,
I'm having difficulties using the fork through jitpack.io (1.1.4 does not build successfully). I'm getting this: "
Is it possible to add this statement to the project, so on pressing ENTER, the listener would trigger correctly?
private final TextView.OnEditorActionListener mInternalEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
if((actionId == EditorInfo.IME_ACTION_SEARCH) && (onSearchConfirmedListener != null)) {
onSearchConfirmedListener.onSearchConfirmed(PersistentSearchView.this, getInputQuery());
} else if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
onSearchConfirmedListener.onSearchConfirmed(PersistentSearchView.this, getInputQuery());
}
return true;
}
};
https://github.com/svrzii/persistent-search-view/commit/23cccd82d10ec9f2fee04884d9b455eeae8f5684
im trying to get text from suggestion, from sample the sample you provided, i think OnSuggestionChangeListener in java should be like this :
private final OnSuggestionChangeListener onSuggestionChangeListener = new OnSuggestionChangeListener() {
@OverRide
public void onSuggestionPicked(SuggestionItem suggestion) {
String query = suggestion.getItemModel().getText();
startSearch(query);
}
@Override
public void onSuggestionRemoved(SuggestionItem suggestion) {
}
};
but when i try this code, getItemModel() either not available or missing,somehow the only available method for 'getter' was geTrackeyKey() or getLayout() which obfiusly not for picking up the suggestion text
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.