[android] Open guide description block. Add decorators in collecrion recycler view.

This commit is contained in:
velichkomarija 2020-09-28 16:18:16 +03:00 committed by Aleksandr Zatsepin
parent 705874d1d1
commit bf8e6c8656
3 changed files with 52 additions and 7 deletions

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="60dp"
android:height="30dp"
android:viewportWidth="60"
android:viewportHeight="30">
<path
android:pathData="M29.8992,1.7154C35.6016,1.7154 40.4384,5.3745 42.2368,10.5754L42.9872,10.3141L43.7329,10.0484C41.7696,4.1631 36.3221,0 29.8949,0C23.5052,0 18.0494,4.206 16.0551,10.0253L17.5444,10.5975C19.3544,5.4327 24.2139,1.7154 29.8992,1.7154ZM19.7227,16.5103L17.9268,16.2366C17.0181,16.9322 15.9813,16.5714 15.6524,15.6473H20.0158V18.5182H22.1843V17.0427C22.5435,18.5044 24.328,19.0012 25.3422,17.9083C25.3422,18.2296 25.309,18.6058 25.21,18.9146C24.8853,19.7046 23.7986,19.7046 23.2357,19.1756L21.9567,20.8461C22.7723,21.4965 23.5983,21.8107 24.6528,21.7112C25.5225,21.6236 26.0745,21.4681 26.7369,20.8653C27.2404,20.2957 27.4801,19.7046 27.5119,18.9411V11.8122H25.381V15.8888C25.381,16.627 24.3121,16.6338 24.3121,15.8888V11.8122H22.1843V9.1955H20.0158V13.9178C19.3184,12.4083 18.0001,11.63 16.3482,11.8647C15.1597,12.1332 14.3165,12.7972 13.8593,13.9178C13.4479,12.5892 12.4785,11.886 11.1259,11.8122C9.6924,11.8122 8.6242,12.5224 8.1938,13.9178C7.4697,12.3082 6.0238,11.5296 4.2999,11.9253C3.2644,12.2533 2.6398,12.8042 2.169,13.7764V9.1955H0V18.5182H2.169V16.4258C2.7861,17.6739 3.8154,18.3635 5.194,18.3913C6.6607,18.304 7.6021,17.5998 8.1938,16.2849V18.5182H10.2828V14.496C10.363,13.6173 11.6837,13.5908 11.7642,14.496V18.5182H13.8593V16.4121C14.3425,17.4916 15.099,18.1428 16.2353,18.4379C18.7232,18.6755 19.7088,16.9463 19.7227,16.5103ZM5.1076,16.4724C4.3506,16.4724 3.7352,15.8474 3.7352,15.0827C3.7352,14.3179 4.3506,13.6937 5.1076,13.6937C5.8649,13.6937 6.4812,14.3176 6.4812,15.0827C6.4815,15.8472 5.8651,16.4724 5.1076,16.4724ZM18.2721,14.8022H15.6051C16.0188,13.4312 17.843,13.4073 18.2721,14.8022ZM29.8882,28.3163C24.1866,28.3163 19.3495,24.7225 17.5521,19.6175L16.801,19.8736L16.0548,20.1338C18.0183,25.9123 23.4682,30 29.892,30C36.2822,30 41.738,25.8701 43.7329,20.1569L42.2443,19.5947C40.4325,24.6658 35.5728,28.3163 29.8882,28.3163ZM59.9193,15.9L59.8219,15.987C59.4372,16.3031 58.8656,16.2059 58.6653,15.77C58.4598,15.1461 58.5663,14.4754 58.5663,13.8112H59.8941V11.8491H58.5663V10.5109H56.4706V13.9178C56.0928,12.9986 55.5222,12.4691 54.6258,12.0529C52.8284,11.4088 51.1107,12.1665 50.3193,13.9178C50.0079,12.9986 49.5368,12.4353 48.662,12.0189C46.9242,11.4018 45.2513,12.133 44.6478,13.9178C44.1708,12.7969 43.4801,12.2076 42.2934,11.8785C40.6942,11.61 39.3342,12.3142 38.6312,13.7764V9.1955H36.4607V13.7764C36.1894,13.2266 35.8968,12.8372 35.4272,12.4486C33.2032,10.8182 30.277,12.4426 30.2235,15.1848V20.994H32.3871C32.3871,20.4096 32.3202,18.1355 32.3202,18.1355L32.5594,18.2372C34.1786,18.6526 35.831,17.827 36.4607,16.5472V18.5184H38.6312V16.5472C39.2545,17.8873 40.4482,18.6588 41.9267,18.5512C42.6107,18.5962 43.1818,16.7674 43.1839,17.2754L43.1849,18.5512H44.0211H44.6349L46.7442,18.5184V14.4889C46.7442,13.6511 48.1043,13.5788 48.175,14.4364C48.1914,15.7541 48.1881,17.2247 48.1881,18.5184H50.3195V16.4123C50.7122,17.3123 51.236,17.8337 52.1054,18.2634C53.8246,18.8296 55.6179,18.553 56.2885,16.4334L54.4754,16.1362C54.0591,16.7679 52.57,16.9026 52.0984,15.6475H56.4708C56.4708,16.6881 56.4909,17.4771 57.4199,18.1605C58.3495,18.8452 60.0194,18.1878 59.9998,17.7446L59.9193,15.9ZM33.5771,16.509C32.8198,16.509 32.2022,15.8844 32.2022,15.1198C32.2022,14.3551 32.8198,13.7309 33.5771,13.7309C34.3329,13.7309 34.9497,14.3548 34.9497,15.1198C34.9495,15.8844 34.3329,16.509 33.5771,16.509ZM41.5912,16.509C40.8329,16.509 40.2175,15.8844 40.2175,15.1198C40.2175,14.3551 40.8329,13.7309 41.5912,13.7309C42.3471,13.7309 42.9638,14.3548 42.9638,15.1198C42.9638,15.8844 42.3469,16.509 41.5912,16.509ZM52.084,14.692C52.4417,13.3904 54.2983,13.3342 54.7128,14.692H52.084Z"
android:fillColor="#004990"
android:fillType="evenOdd"/>
</vector>

View file

@ -54,6 +54,7 @@
android:layout_height="match_parent"
android:paddingTop="@dimen/margin_half_plus"
android:paddingBottom="@dimen/margin_half_plus"
android:layout_marginEnd="@dimen/margin_base"
android:scaleType="fitCenter"
tools:src="@drawable/bg_ads" />
<TextView
@ -61,7 +62,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingStart="@dimen/margin_base"
android:textAppearance="?fontCaption"
tools:text="@string/about_menu_title" />
</LinearLayout>

View file

@ -11,6 +11,8 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
@ -25,6 +27,7 @@ import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
import com.mapswithme.maps.bookmarks.data.AbstractCategoriesSnapshot;
import com.mapswithme.maps.bookmarks.data.Bookmark;
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
import com.mapswithme.maps.bookmarks.data.BookmarkInfo;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
@ -60,6 +63,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
{
public static final String TAG = BookmarksListFragment.class.getSimpleName();
public static final String EXTRA_CATEGORY = "bookmark_category";
public static final String AUTHOR_LONELY_PLANET_ID = "28035594-6457-466d-8f6f-8499607df570";
@SuppressWarnings("NullableProblems")
@NonNull
@ -158,6 +162,8 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
configureFab(view);
configureGuidesInfoLayout(view);
setHasOptionsMenu(true);
ActionBar bar = ((AppCompatActivity) requireActivity()).getSupportActionBar();
@ -168,9 +174,6 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
mSearchContainer = toolbar.findViewById(R.id.search_container);
UiUtils.hide(mSearchContainer, R.id.back);
//TODO: (@velichkomarija) : Delete hide function where core will provide description
UiUtils.hide(view.findViewById(R.id.guide_info));
mToolbarController = new BookmarksToolbarController(toolbar, requireActivity(), this);
mToolbarController.setHint(R.string.search_in_the_list);
configureRecycler();
@ -217,6 +220,31 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
BookmarkManager.INSTANCE.removeCatalogListener(mCatalogListener);
}
private void configureGuidesInfoLayout(View view)
{
//TODO: (@velichkomarija) : Add image.
ImageView imageView = view.findViewById(R.id.guide_image);
TextView title = view.findViewById(R.id.guide_title);
title.setText(mCategoryDataSource.getData().getName());
BookmarkCategory.Author author = mCategoryDataSource.getData().getAuthor();
ImageView imageViewLogo = view.findViewById(R.id.logo);
TextView authorTextView = view.findViewById(R.id.content_by);
if (author != null)
{
if (author.getId().equals(AUTHOR_LONELY_PLANET_ID))
imageViewLogo.setImageDrawable(requireContext().getDrawable(R.drawable.ic_lp_logo));
else
imageViewLogo.setVisibility(View.GONE);
//TODO: (@velichkomarija) : Replace with "Content by ".
CharSequence authorName = BookmarkCategory.Author.getRepresentation(requireContext(), author);
authorTextView.setText(authorName);
}
}
private void configureAdapter()
{
BookmarkListAdapter adapter = getAdapter();
@ -240,7 +268,9 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
LinearLayoutManager manager = new LinearLayoutManager(view.getContext());
manager.setSmoothScrollbarEnabled(true);
recyclerViewForCollection.setLayoutManager(manager);
recyclerViewForCollection.setAdapter(mBookmarkCollectionAdapter);
configureRecyclerDividers(recyclerViewForCollection);
}
private void configureFab(@NonNull View view)
@ -258,12 +288,17 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
private void configureRecycler()
{
RecyclerView.ItemDecoration decor = ItemDecoratorFactory
.createDefaultDecorator(requireContext(), LinearLayoutManager.VERTICAL);
getRecyclerView().addItemDecoration(decor);
configureRecyclerDividers(getRecyclerView());
getRecyclerView().addOnScrollListener(mRecyclerListener);
}
private void configureRecyclerDividers(@NonNull RecyclerView recyclerView)
{
RecyclerView.ItemDecoration decorWithPadding = ItemDecoratorFactory
.createVerticalDefaultDecorator(requireContext());
recyclerView.addItemDecoration(decorWithPadding);
}
private void updateRecyclerVisibility()
{
if (isEmptySearchResults())