Skip to content

Commit

Permalink
adding custom SearchResultsFragmentUI
Browse files Browse the repository at this point in the history
  • Loading branch information
KnollFrank committed Dec 2, 2024
1 parent efaeb83 commit e8f48ee
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OsmAnd/build-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ dependencies {
implementation "androidx.car.app:app-projected:1.4.0"

implementation 'com.google.android.gms:play-services-location:21.3.0'
implementation 'com.github.KnollFrank:SettingsSearch:5af8ba9bae'
implementation 'com.github.KnollFrank:SettingsSearch:8bf5afa4dc'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation 'com.google.guava:guava:33.3.1-android'

Expand Down
26 changes: 26 additions & 0 deletions OsmAnd/res/layout/custom_searchresults_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/searchResultsCustom"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/searchResultsHeading"/>

<TextView
android:id="@+id/searchResultsHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search Results"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/searchResultsCustom" />
</androidx.constraintlayout.widget.ConstraintLayout>

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.osmand.plus.settings.fragments.search;

import android.view.View;

import androidx.annotation.LayoutRes;
import androidx.recyclerview.widget.RecyclerView;

import net.osmand.plus.R;

class SearchResultsFragmentUI implements de.KnollFrank.lib.settingssearch.search.ui.SearchResultsFragmentUI {

@Override
public @LayoutRes int getRootViewId() {
return R.layout.custom_searchresults_fragment;
}

@Override
public RecyclerView getSearchResultsView(final View rootView) {
return rootView.findViewById(R.id.searchResultsCustom);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static SearchPreferenceFragments createSearchPreferenceFragments(
fragmentActivity.getSupportFragmentManager(),
fragmentActivity)
.withSearchPreferenceFragmentUI(new SearchPreferenceFragmentUI())
.withSearchResultsFragmentUI(new SearchResultsFragmentUI())
.withCreateSearchDatabaseTaskSupplier(createSearchDatabaseTaskSupplier)
.withFragmentFactory(new FragmentFactory())
.withPreferenceConnected2PreferenceFragmentProvider(new PreferenceConnected2PreferenceFragmentProvider())
Expand Down

0 comments on commit e8f48ee

Please sign in to comment.