[android] Review notes

This commit is contained in:
Dmitry Donskoy 2018-12-10 12:15:27 +03:00 committed by Arsentiy Milchakov
parent ef5b62331e
commit 588cab25ec
9 changed files with 23 additions and 30 deletions

View file

@ -460,8 +460,9 @@
<activity
android:name="com.mapswithme.maps.ugc.routes.UgcRoutePropertiesActivity"
android:label="@string/select_properties"/>
<activity android:name="com.mapswithme.maps.bookmarks.PlaceDescriptionActivity"
android:label="@string/place_description_title"/>
<activity
android:name="com.mapswithme.maps.bookmarks.PlaceDescriptionActivity"
android:label="@string/place_description_title"/>
<service
android:name="com.mapswithme.maps.background.WorkerService"
android:permission="android.permission.BIND_JOB_SERVICE"

View file

@ -159,7 +159,7 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
// @Nullable HotelsFilter.HotelType hotelType,
// @PriceFilterView.PriceDef int priceRate,
// @NotNull com.mapswithme.maps.search.Popularity entity
// @NotNull String desc)
// @NotNull String description)
static jmethodID const ctorId =
jni::GetConstructorID(env, g_bookmarkClazz,
"(Lcom/mapswithme/maps/bookmarks/data/FeatureId;JJLjava/lang/String;"

View file

@ -19,7 +19,7 @@
android:layout_marginStart="@dimen/margin_base"
android:layout_marginTop="@dimen/margin_base"
android:maxLength="2000"
android:textAppearance="@style/MwmTextAppearance.Body1"/>
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/more_btn"
@ -30,7 +30,7 @@
android:layout_marginLeft="@dimen/margin_base"
android:layout_marginRight="@dimen/margin_base"
android:layout_marginStart="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="start|top"
android:textColor="?attr/colorAccent"
android:text="@string/category_desc_more"

View file

@ -32,7 +32,7 @@
tools:visibility="gone"/>
<include
layout="@layout/place_page_poi_details"
layout="@layout/place_page_description_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_half"

View file

@ -45,7 +45,6 @@ import com.mapswithme.maps.base.OnBackPressListener;
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
import com.mapswithme.maps.bookmarks.BookmarksPageFactory;
import com.mapswithme.maps.bookmarks.PlaceDescriptionActivity;
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty;

View file

@ -17,19 +17,16 @@ import java.util.Objects;
public class PlaceDescriptionFragment extends BaseMwmFragment
{
public static final String EXTRA_DESCRIPTION = "description";
@SuppressWarnings("NullableProblems")
@NonNull
private WebView mWebView;
@SuppressWarnings("NullableProblems")
@NonNull
private String mDesc;
private String mDescription;
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mDesc = Objects.requireNonNull(getArguments().getString(EXTRA_DESCRIPTION));
mDescription = Objects.requireNonNull(getArguments().getString(EXTRA_DESCRIPTION));
}
@Nullable
@ -38,9 +35,9 @@ public class PlaceDescriptionFragment extends BaseMwmFragment
@Nullable Bundle savedInstanceState)
{
View root = inflater.inflate(R.layout.fragment_place_description, container, false);
mWebView = root.findViewById(R.id.webview);
mWebView.loadData(mDesc, Utils.TEXT_HTML_CHARSET_UTF_8, null);
mWebView.setVerticalScrollBarEnabled(true);
WebView webView = root.findViewById(R.id.webview);
webView.loadData(mDescription, Utils.TEXT_HTML, Utils.UTF_8);
webView.setVerticalScrollBarEnabled(true);
return root;
}

View file

@ -462,12 +462,12 @@ public class MapObject implements Parcelable, PopularityProvider
dest.writeParcelable(mHotelType, 0);
dest.writeInt(mPriceRate);
dest.writeParcelable(mPopularity, 0);
dest.writeString(mDescription);
// All collections are deserialized AFTER non-collection and primitive type objects,
// so collections must be always serialized at the end.
dest.writeTypedList(mBanners);
dest.writeList(mReachableByTaxiTypes);
dest.writeTypedList(mRatings);
dest.writeString(mDescription);
}
@Override

View file

@ -708,15 +708,15 @@ public class PlacePageView extends RelativeLayout
mPlaceDescriptionContainer = findViewById(R.id.poi_description_container);
mPlaceDescriptionView = findViewById(R.id.poi_description);
mPlaceDescriptionMoreBtn = findViewById(R.id.more_btn);
mPlaceDescriptionMoreBtn.setOnClickListener(v -> showDescScreen());
mPlaceDescriptionMoreBtn.setOnClickListener(v -> showDescriptionScreen());
}
private void showDescScreen()
private void showDescriptionScreen()
{
Context context = mPlaceDescriptionContainer.getContext();
String descArgs = Objects.requireNonNull(mMapObject).getDescription();
String description = Objects.requireNonNull(mMapObject).getDescription();
Intent intent = new Intent(context, PlaceDescriptionActivity.class)
.putExtra(PlaceDescriptionFragment.EXTRA_DESCRIPTION, descArgs);
.putExtra(PlaceDescriptionFragment.EXTRA_DESCRIPTION, description);
context.startActivity(intent);
}
@ -1366,7 +1366,6 @@ public class PlacePageView extends RelativeLayout
refreshDetails(mapObject);
final Location loc = LocationHelper.INSTANCE.getSavedLocation();
hidePlaceDescription();
switch (mapObject.getMapObjectType())
{
case MapObject.BOOKMARK:
@ -1405,15 +1404,10 @@ public class PlacePageView extends RelativeLayout
});
}
private void hidePlaceDescription()
{
mPlaceDescriptionContainer.setVisibility(GONE);
}
private void setPlaceDescription(@NonNull MapObject mapObject)
{
boolean hasDesc = !TextUtils.isEmpty(mapObject.getDescription());
mPlaceDescriptionContainer.setVisibility(hasDesc ? VISIBLE : GONE);
boolean isDescriptionAbsent = TextUtils.isEmpty(mapObject.getDescription());
UiUtils.hideIf(isDescriptionAbsent, mPlaceDescriptionContainer);
mPlaceDescriptionView.setText(Html.fromHtml(mapObject.getDescription()));
}
@ -1545,6 +1539,7 @@ public class PlacePageView extends RelativeLayout
|| UiUtils.isVisible(mAddPlace), mEditTopSpace);
refreshLocalAdInfo(mapObject);
}
setPlaceDescription(mapObject);
}
private void refreshHotelDetailViews()
@ -1727,7 +1722,7 @@ public class PlacePageView extends RelativeLayout
if (StringUtils.nativeIsHtml(notes))
{
mWvBookmarkNote.loadData(notes, Utils.TEXT_HTML_CHARSET_UTF_8, null);
mWvBookmarkNote.loadData(notes, "text/html; charset=utf-8", null);
UiUtils.show(mWvBookmarkNote);
UiUtils.hide(mTvBookmarkNote);
}

View file

@ -57,7 +57,8 @@ public class Utils
{
@StringRes
public static final int INVALID_ID = 0;
public static final String TEXT_HTML_CHARSET_UTF_8 = "text/html; charset=utf-8";
public static final String UTF_8 = "utf-8";
public static final String TEXT_HTML = "text/html;";
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = "Utils";