forked from organicmaps/organicmaps
[android] Refactored BaseMwmRecyclerFragment, added Adapter generic parametrization
This commit is contained in:
parent
b51f2046c0
commit
17a56b2120
14 changed files with 84 additions and 132 deletions
|
@ -20,25 +20,33 @@ import com.mapswithme.maps.widget.recycler.ItemDecoratorFactory;
|
|||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
|
||||
public abstract class BaseMwmRecyclerFragment extends Fragment
|
||||
public abstract class BaseMwmRecyclerFragment<T extends RecyclerView.Adapter> extends Fragment
|
||||
{
|
||||
private Toolbar mToolbar;
|
||||
@Nullable
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private RecyclerView mRecycler;
|
||||
|
||||
@Nullable
|
||||
private PlaceholderView mPlaceholder;
|
||||
|
||||
protected abstract RecyclerView.Adapter createAdapter();
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private T mAdapter;
|
||||
|
||||
protected @LayoutRes int getLayoutRes()
|
||||
protected abstract T createAdapter();
|
||||
|
||||
@LayoutRes
|
||||
protected int getLayoutRes()
|
||||
{
|
||||
return R.layout.fragment_recycler;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected RecyclerView.Adapter getAdapter()
|
||||
@NonNull
|
||||
protected T getAdapter()
|
||||
{
|
||||
return mRecycler != null ? mRecycler.getAdapter() : null;
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,21 +68,14 @@ public abstract class BaseMwmRecyclerFragment extends Fragment
|
|||
{
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
mToolbar = view.findViewById(R.id.toolbar);
|
||||
if (mToolbar != null)
|
||||
{
|
||||
UiUtils.showHomeUpButton(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
Utils.navigateToParent(getActivity());
|
||||
}
|
||||
});
|
||||
mToolbar.setNavigationOnClickListener(v -> Utils.navigateToParent(getActivity()));
|
||||
}
|
||||
|
||||
mRecycler = (RecyclerView) view.findViewById(R.id.recycler);
|
||||
mRecycler = view.findViewById(R.id.recycler);
|
||||
if (mRecycler == null)
|
||||
throw new IllegalStateException("RecyclerView not found in layout");
|
||||
|
||||
|
@ -84,7 +85,8 @@ public abstract class BaseMwmRecyclerFragment extends Fragment
|
|||
RecyclerView.ItemDecoration decor = ItemDecoratorFactory
|
||||
.createDefaultDecorator(getContext(), LinearLayoutManager.VERTICAL);
|
||||
mRecycler.addItemDecoration(decor);
|
||||
mRecycler.setAdapter(createAdapter());
|
||||
mAdapter = createAdapter();
|
||||
mRecycler.setAdapter(mAdapter);
|
||||
|
||||
mPlaceholder = view.findViewById(R.id.placeholder);
|
||||
setupPlaceholder(mPlaceholder);
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.mapswithme.util.BottomSheetHelper;
|
|||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.sharing.SharingHelper;
|
||||
|
||||
public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFragment
|
||||
public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFragment<BookmarkCategoriesAdapter>
|
||||
implements EditTextDialogFragment.EditTextDialogInterface,
|
||||
MenuItem.OnMenuItemClickListener,
|
||||
BookmarkManager.BookmarksLoadingListener,
|
||||
|
@ -53,19 +53,11 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected BookmarkCategoriesAdapter createAdapter()
|
||||
{
|
||||
return new BookmarkCategoriesAdapter(getActivity());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected BookmarkCategoriesAdapter getAdapter()
|
||||
{
|
||||
RecyclerView.Adapter adapter = super.getAdapter();
|
||||
return adapter != null ? (BookmarkCategoriesAdapter) adapter : null;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
|
||||
|
@ -73,12 +65,9 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
onPrepareControllers(view);
|
||||
if (getAdapter() != null)
|
||||
{
|
||||
getAdapter().setOnClickListener(this);
|
||||
getAdapter().setOnLongClickListener(this);
|
||||
getAdapter().setCategoryListCallback(this);
|
||||
}
|
||||
getAdapter().setOnClickListener(this);
|
||||
getAdapter().setOnLongClickListener(this);
|
||||
getAdapter().setCategoryListCallback(this);
|
||||
|
||||
RecyclerView rw = getRecyclerView();
|
||||
if (rw == null) return;
|
||||
|
@ -130,8 +119,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
{
|
||||
super.onResume();
|
||||
updateLoadingPlaceholder();
|
||||
if (getAdapter() != null)
|
||||
getAdapter().notifyDataSetChanged();
|
||||
getAdapter().notifyDataSetChanged();
|
||||
if (!BookmarkManager.INSTANCE.isAsyncBookmarksLoadingInProgress())
|
||||
mImportKmlTask.run();
|
||||
}
|
||||
|
@ -206,8 +194,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
public void onBookmarksLoadingFinished()
|
||||
{
|
||||
updateLoadingPlaceholder();
|
||||
if (getAdapter() != null)
|
||||
getAdapter().notifyDataSetChanged();
|
||||
getAdapter().notifyDataSetChanged();
|
||||
mImportKmlTask.run();
|
||||
}
|
||||
|
||||
|
@ -244,20 +231,14 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
@Override
|
||||
public void onFinishKmlImport()
|
||||
{
|
||||
if (getAdapter() != null) getAdapter().notifyDataSetChanged();
|
||||
getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public EditTextDialogFragment.OnTextSaveListener getSaveTextListener()
|
||||
{
|
||||
return text -> {
|
||||
if (mCategoryEditor != null)
|
||||
mCategoryEditor.commit(text);
|
||||
|
||||
if (getAdapter() != null)
|
||||
getAdapter().notifyDataSetChanged();
|
||||
};
|
||||
return this::onSaveText;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -297,6 +278,14 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
return R.id.set_delete;
|
||||
}
|
||||
|
||||
private void onSaveText(String text)
|
||||
{
|
||||
if (mCategoryEditor != null)
|
||||
mCategoryEditor.commit(text);
|
||||
|
||||
getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
|
||||
interface CategoryEditor
|
||||
{
|
||||
void commit(@NonNull String newName);
|
||||
|
@ -388,8 +377,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
@NonNull BookmarkCategory category)
|
||||
{
|
||||
BookmarkManager.INSTANCE.toggleCategoryVisibility(category.getId());
|
||||
if (frag.getAdapter() != null)
|
||||
frag.getAdapter().notifyDataSetChanged();
|
||||
frag.getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,8 +398,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag
|
|||
@NonNull BookmarkCategory category)
|
||||
{
|
||||
BookmarkManager.INSTANCE.deleteCategory(category.getId());
|
||||
if (frag.getAdapter() != null)
|
||||
frag.getAdapter().notifyDataSetChanged();
|
||||
frag.getAdapter().notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
|
|||
}
|
||||
}
|
||||
|
||||
private static class ImportCategoryListener implements BookmarkManager.BookmarksCatalogListener
|
||||
private static class ImportCategoryListener extends BookmarkManager.DefaultBookmarksCatalogListener
|
||||
{
|
||||
@NonNull
|
||||
private final Context mContext;
|
||||
|
@ -210,20 +210,11 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
|
|||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImportStarted(@NonNull String serverId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImportFinished(@NonNull String serverId, boolean successful)
|
||||
{
|
||||
if (successful)
|
||||
{
|
||||
Toast.makeText(mContext,
|
||||
R.string.bookmarks_webview_success_toast , Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Toast.makeText(mContext, R.string.bookmarks_webview_success_toast, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.mapswithme.util.UiUtils;
|
|||
import com.mapswithme.util.sharing.ShareOption;
|
||||
import com.mapswithme.util.sharing.SharingHelper;
|
||||
|
||||
public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
||||
public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListAdapter>
|
||||
implements RecyclerLongClickListener, RecyclerClickListener,
|
||||
MenuItem.OnMenuItemClickListener,
|
||||
BookmarkManager.BookmarksSharingListener
|
||||
|
@ -52,7 +52,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected BookmarkListAdapter createAdapter()
|
||||
{
|
||||
return new BookmarkListAdapter(mCategory);
|
||||
}
|
||||
|
@ -89,9 +89,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
if (adapter == null)
|
||||
return;
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
|
||||
adapter.startLocationUpdate();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
@ -102,9 +100,8 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
{
|
||||
super.onPause();
|
||||
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
if (adapter != null)
|
||||
adapter.stopLocationUpdate();
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
adapter.stopLocationUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,9 +113,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
|
||||
private void configureAdapter()
|
||||
{
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
if (adapter == null)
|
||||
return;
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
|
||||
adapter.startLocationUpdate();
|
||||
adapter.setOnClickListener(this);
|
||||
|
@ -130,26 +125,23 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
{
|
||||
final Intent i = new Intent(getActivity(), MwmActivity.class);
|
||||
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
|
||||
if (adapter != null)
|
||||
switch (adapter.getItemViewType(position))
|
||||
{
|
||||
switch (adapter.getItemViewType(position))
|
||||
{
|
||||
case BookmarkListAdapter.TYPE_SECTION:
|
||||
case BookmarkListAdapter.TYPE_DESC:
|
||||
return;
|
||||
case BookmarkListAdapter.TYPE_BOOKMARK:
|
||||
final Bookmark bookmark = (Bookmark) adapter.getItem(position);
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowBookmarkTask(bookmark.getCategoryId(), bookmark.getBookmarkId()));
|
||||
break;
|
||||
case BookmarkListAdapter.TYPE_TRACK:
|
||||
final Track track = (Track) adapter.getItem(position);
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowTrackTask(track.getCategoryId(), track.getTrackId()));
|
||||
break;
|
||||
}
|
||||
case BookmarkListAdapter.TYPE_SECTION:
|
||||
case BookmarkListAdapter.TYPE_DESC:
|
||||
return;
|
||||
case BookmarkListAdapter.TYPE_BOOKMARK:
|
||||
final Bookmark bookmark = (Bookmark) adapter.getItem(position);
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowBookmarkTask(bookmark.getCategoryId(), bookmark.getBookmarkId()));
|
||||
break;
|
||||
case BookmarkListAdapter.TYPE_TRACK:
|
||||
final Track track = (Track) adapter.getItem(position);
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowTrackTask(track.getCategoryId(), track.getTrackId()));
|
||||
break;
|
||||
}
|
||||
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
@ -159,9 +151,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
@Override
|
||||
public void onLongItemClick(View v, int position)
|
||||
{
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
if (adapter == null)
|
||||
return;
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
|
||||
mSelectedPosition = position;
|
||||
int type = adapter.getItemViewType(mSelectedPosition);
|
||||
|
@ -215,9 +205,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment
|
|||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem)
|
||||
{
|
||||
BookmarkListAdapter adapter = (BookmarkListAdapter) getAdapter();
|
||||
if (adapter == null)
|
||||
return false;
|
||||
BookmarkListAdapter adapter = getAdapter();
|
||||
|
||||
Bookmark item = (Bookmark) adapter.getItem(mSelectedPosition);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CachedBookmarkCategoriesFragment extends BaseBookmarkCategoriesFrag
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected CatalogBookmarkCategoriesAdapter createAdapter()
|
||||
{
|
||||
return new CatalogBookmarkCategoriesAdapter(getContext());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.mapswithme.maps.widget.PlaceholderView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DownloaderFragment extends BaseMwmRecyclerFragment
|
||||
public class DownloaderFragment extends BaseMwmRecyclerFragment<DownloaderAdapter>
|
||||
implements OnBackPressListener
|
||||
{
|
||||
private DownloaderToolbarController mToolbarController;
|
||||
|
@ -191,7 +191,7 @@ public class DownloaderFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected DownloaderAdapter createAdapter()
|
||||
{
|
||||
if (mAdapter == null)
|
||||
mAdapter = new DownloaderAdapter(this);
|
||||
|
@ -206,8 +206,8 @@ public class DownloaderFragment extends BaseMwmRecyclerFragment
|
|||
mToolbarController.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@Nullable
|
||||
public DownloaderAdapter getAdapter()
|
||||
{
|
||||
return mAdapter;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.mapswithme.maps.downloader;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
||||
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
||||
|
||||
public class SelectMigrationFragment extends BaseMwmRecyclerFragment
|
||||
{
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
{
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -5,12 +5,12 @@ import android.support.v7.widget.RecyclerView;
|
|||
|
||||
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
||||
|
||||
public class CuisineFragment extends BaseMwmRecyclerFragment
|
||||
public class CuisineFragment extends BaseMwmRecyclerFragment<CuisineAdapter>
|
||||
{
|
||||
private CuisineAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected CuisineAdapter createAdapter()
|
||||
{
|
||||
mAdapter = new CuisineAdapter();
|
||||
return mAdapter;
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.mapswithme.maps.widget.SearchToolbarController;
|
|||
import com.mapswithme.maps.widget.ToolbarController;
|
||||
import com.mapswithme.util.Language;
|
||||
|
||||
public class FeatureCategoryFragment extends BaseMwmRecyclerFragment
|
||||
public class FeatureCategoryFragment extends BaseMwmRecyclerFragment<FeatureCategoryAdapter>
|
||||
{
|
||||
private FeatureCategory mSelectedCategory;
|
||||
protected ToolbarController mToolbarController;
|
||||
|
@ -52,12 +52,12 @@ public class FeatureCategoryFragment extends BaseMwmRecyclerFragment
|
|||
|
||||
private void setFilter(String query)
|
||||
{
|
||||
((FeatureCategoryAdapter) getAdapter()).setCategories(query.isEmpty() ? Editor.nativeGetAllFeatureCategories(Language.getKeyboardLocale())
|
||||
: Editor.nativeSearchFeatureCategories(query, Language.getKeyboardLocale()));
|
||||
getAdapter().setCategories(query.isEmpty() ? Editor.nativeGetAllFeatureCategories(Language.getKeyboardLocale())
|
||||
: Editor.nativeSearchFeatureCategories(query, Language.getKeyboardLocale()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected FeatureCategoryAdapter createAdapter()
|
||||
{
|
||||
return new FeatureCategoryAdapter(this, Editor.nativeGetAllFeatureCategories(Language.getKeyboardLocale()), mSelectedCategory);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
|||
import com.mapswithme.maps.editor.data.Language;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
|
@ -15,7 +14,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
|
||||
public class LanguagesFragment extends BaseMwmRecyclerFragment
|
||||
public class LanguagesFragment extends BaseMwmRecyclerFragment<LanguagesAdapter>
|
||||
{
|
||||
final static String EXISTING_LOCALIZED_NAMES = "ExistingLocalizedNames";
|
||||
|
||||
|
@ -25,7 +24,7 @@ public class LanguagesFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected LanguagesAdapter createAdapter()
|
||||
{
|
||||
Bundle args = getArguments();
|
||||
Set<String> existingLanguages = new HashSet<>(args.getStringArrayList(EXISTING_LOCALIZED_NAMES));
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
|||
import com.mapswithme.maps.editor.data.HoursMinutes;
|
||||
import com.mapswithme.maps.editor.data.Timetable;
|
||||
|
||||
public class SimpleTimetableFragment extends BaseMwmRecyclerFragment
|
||||
public class SimpleTimetableFragment extends BaseMwmRecyclerFragment<SimpleTimetableAdapter>
|
||||
implements TimetableFragment.TimetableProvider,
|
||||
HoursMinutesPickerFragment.OnPickListener
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ public class SimpleTimetableFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected SimpleTimetableAdapter createAdapter()
|
||||
{
|
||||
mAdapter = new SimpleTimetableAdapter(this);
|
||||
if (mInitTts != null)
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
|||
import com.mapswithme.maps.dialog.EditTextDialogFragment;
|
||||
import com.mapswithme.maps.editor.data.LocalizedStreet;
|
||||
|
||||
public class StreetFragment extends BaseMwmRecyclerFragment
|
||||
public class StreetFragment extends BaseMwmRecyclerFragment<StreetAdapter>
|
||||
implements EditTextDialogFragment.EditTextDialogInterface
|
||||
{
|
||||
private LocalizedStreet mSelectedString;
|
||||
|
@ -41,7 +41,7 @@ public class StreetFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected StreetAdapter createAdapter()
|
||||
{
|
||||
return new StreetAdapter(this, Editor.nativeGetNearbyStreets(), mSelectedString);
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ import android.support.v7.widget.RecyclerView;
|
|||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
|
||||
|
||||
public class SearchCategoriesFragment extends BaseMwmRecyclerFragment
|
||||
public class SearchCategoriesFragment extends BaseMwmRecyclerFragment<CategoriesAdapter>
|
||||
implements CategoriesAdapter.OnCategorySelectedListener
|
||||
{
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected CategoriesAdapter createAdapter()
|
||||
{
|
||||
return new CategoriesAdapter(this);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.mapswithme.maps.widget.PlaceholderView;
|
|||
import com.mapswithme.maps.widget.SearchToolbarController;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
public class SearchHistoryFragment extends BaseMwmRecyclerFragment
|
||||
public class SearchHistoryFragment extends BaseMwmRecyclerFragment<SearchHistoryAdapter>
|
||||
{
|
||||
private PlaceholderView mPlaceHolder;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class SearchHistoryFragment extends BaseMwmRecyclerFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter createAdapter()
|
||||
protected SearchHistoryAdapter createAdapter()
|
||||
{
|
||||
return new SearchHistoryAdapter(((SearchToolbarController.Container) getParentFragment()).getController());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue