RTL - Step 3 (Fixes 2)

This commit is contained in:
Nazar-Kutz 2020-06-12 12:43:13 +03:00
parent 7ba03d94e4
commit 68336d36a7
3 changed files with 5 additions and 5 deletions

View file

@ -425,7 +425,7 @@ public class AndroidUtils {
: ctx.getResources().getColor(R.color.text_color_secondary_light));
}
public static int getPopupMenuWidth(Context ctx, float textSize, List<String> titles) {
public static int getTextWidth(Context ctx, float textSize, List<String> titles) {
int width = 0;
for (String title : titles) {
int titleWidth = getTextWidth(textSize, title);
@ -433,7 +433,7 @@ public class AndroidUtils {
width = titleWidth;
}
}
return width + dpToPx(ctx, 34);
return width;
}
public static int getTextWidth(float textSize, String text) {

View file

@ -3,7 +3,6 @@ package net.osmand.plus;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
@ -658,6 +657,7 @@ public class UiUtilities {
View v, int minWidth,
List<SimplePopUpMenuItem> items,
final AdapterView.OnItemClickListener listener) {
int contentPadding = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding);
int contentPaddingHalf = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
int defaultListTextSize = themedCtx.getResources().getDimensionPixelSize(R.dimen.default_list_text_size);
@ -665,7 +665,8 @@ public class UiUtilities {
for (SimplePopUpMenuItem item : items) {
titles.add(String.valueOf(item.getTitle()));
}
float itemWidth = AndroidUtils.getPopupMenuWidth(themedCtx, defaultListTextSize, titles);
float itemWidth =
AndroidUtils.getTextWidth(themedCtx, defaultListTextSize, titles) + contentPadding;
SimplePopUpMenuItemAdapter adapter =
new SimplePopUpMenuItemAdapter(themedCtx, R.layout.popup_menu_item, items);

View file

@ -1212,7 +1212,6 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
if (SearchUICore.isDebugMode()) {
LOG.info("UI >> Start loading categories");
}
final boolean nightMode = !app.getSettings().isLightContent();
SearchResultCollection res = searchUICore.shallowSearch(SearchAmenityTypesAPI.class, "", null);
if (res != null) {
List<QuickSearchListItem> rows = new ArrayList<>();