Review
This commit is contained in:
parent
a4291472ad
commit
d2e36e0783
5 changed files with 14 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/scroll_container"
|
||||
android:id="@+id/scroll_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
|
|
|
@ -2246,10 +2246,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return getFragment(TripRecordingBottomSheet.TAG);
|
||||
}
|
||||
|
||||
public SelectFavoriteCategoryBottomSheet getSelectFavoriteCategoryBottomSheet() {
|
||||
return getFragment(SelectFavoriteCategoryBottomSheet.TAG);
|
||||
}
|
||||
|
||||
public ChooseRouteFragment getChooseRouteFragment() {
|
||||
return getFragment(ChooseRouteFragment.TAG);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
public boolean onTouch(final View v, MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
SelectFavoriteCategoryBottomSheet dialogFragment = createSelectCategoryDialog();
|
||||
DialogFragment dialogFragment = createSelectCategoryDialog();
|
||||
if (fragmentManager != null && dialogFragment != null) {
|
||||
dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName());
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
SelectFavoriteCategoryBottomSheet dialogFragment = createSelectCategoryDialog();
|
||||
DialogFragment dialogFragment = createSelectCategoryDialog();
|
||||
if (fragmentManager != null && dialogFragment != null) {
|
||||
dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName());
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
AddNewFavoriteCategoryBottomSheet dialogFragment = createAddCategoryDialog();
|
||||
DialogFragment dialogFragment = createAddCategoryDialog();
|
||||
if (fragmentManager != null && dialogFragment != null) {
|
||||
dialogFragment.show(fragmentManager, SelectFavoriteCategoryBottomSheet.class.getSimpleName());
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
|||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -102,9 +103,8 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
|
|||
View addNewCategoryView = UiUtilities.getInflater(app, nightMode).inflate(R.layout.bottom_sheet_item_with_descr_64dp, null);
|
||||
addNewCategoryView.setMinimumHeight(getResources().getDimensionPixelSize(R.dimen.bottom_sheet_list_item_height));
|
||||
TextView title = addNewCategoryView.findViewById(R.id.title);
|
||||
Typeface face = Typeface.createFromAsset(app.getAssets(),
|
||||
"fonts/Roboto-Medium.ttf");
|
||||
title.setTypeface(face);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getContext());
|
||||
title.setTypeface(typeface);
|
||||
AndroidUiHelper.updateVisibility(addNewCategoryView.findViewById(R.id.description), false);
|
||||
BaseBottomSheetItem addNewFolderItem = new SimpleBottomSheetItem.Builder()
|
||||
.setTitle(getString(R.string.favorite_category_add_new))
|
||||
|
@ -114,10 +114,12 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
|
|||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = (MapActivity) activity;
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
Set<String> categories = gpxCategories != null ? gpxCategories.keySet() : null;
|
||||
AddNewFavoriteCategoryBottomSheet fragment = AddNewFavoriteCategoryBottomSheet.createInstance(editorTag, categories, gpxFile != null);
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), AddNewTrackFolderBottomSheet.class.getName());
|
||||
if (mapActivity != null) {
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), AddNewTrackFolderBottomSheet.class.getName());
|
||||
}
|
||||
fragment.setSelectionListener(selectionListener);
|
||||
dismiss();
|
||||
}
|
||||
|
@ -142,7 +144,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
|
|||
for (Map.Entry<String, Integer> e : gpxCategories.entrySet()) {
|
||||
String categoryName = e.getKey();
|
||||
int favoriteCategoryCount = e.getKey().length();
|
||||
favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue(), favoriteCategoryCount, false, true));
|
||||
favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue(), favoriteCategoryCount, false));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -150,7 +152,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
|
|||
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
|
||||
int favoriteCategoryCount = category.getPoints().size();
|
||||
favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
|
||||
category.getColor(), favoriteCategoryCount, !category.isVisible(), true));
|
||||
category.getColor(), favoriteCategoryCount, !category.isVisible()));
|
||||
}
|
||||
|
||||
items.add(new BaseBottomSheetItem.Builder()
|
||||
|
@ -159,7 +161,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
|
|||
}
|
||||
}
|
||||
|
||||
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor, int categoryPointCount, boolean isHidden, final boolean selected) {
|
||||
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor, int categoryPointCount, boolean isHidden) {
|
||||
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.bottom_sheet_item_with_descr_and_radio_btn, null);
|
||||
final AppCompatImageView button = (AppCompatImageView) itemView.findViewById(R.id.icon);
|
||||
final int dp8 = AndroidUtils.dpToPx(app, 8f);
|
||||
|
|
Loading…
Reference in a new issue