mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[android] Add back the Edit Bookmark button
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
committed by
Harry Bond
parent
622b97e84c
commit
7d82c6ffae
@@ -16,18 +16,22 @@ import android.widget.LinearLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.sdk.bookmarks.data.Bookmark;
|
||||
import app.organicmaps.sdk.bookmarks.data.BookmarkManager;
|
||||
import app.organicmaps.sdk.bookmarks.data.MapObject;
|
||||
import app.organicmaps.sdk.util.StringUtils;
|
||||
import app.organicmaps.util.UiUtils;
|
||||
import app.organicmaps.util.Utils;
|
||||
import app.organicmaps.widget.placepage.EditBookmarkFragment;
|
||||
import app.organicmaps.widget.placepage.PlacePageViewModel;
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
public class PlacePageBookmarkFragment extends Fragment implements View.OnLongClickListener, Observer<MapObject>
|
||||
public class PlacePageBookmarkFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener,
|
||||
Observer<MapObject>, EditBookmarkFragment.EditBookmarkListener
|
||||
{
|
||||
private View mFrame;
|
||||
private MaterialTextView mTvBookmarkNote;
|
||||
@@ -55,6 +59,8 @@ public class PlacePageBookmarkFragment extends Fragment implements View.OnLongCl
|
||||
mFrame = view;
|
||||
mTvBookmarkNote = mFrame.findViewById(R.id.tv__bookmark_notes);
|
||||
mTvBookmarkNote.setOnLongClickListener(this);
|
||||
final View editBookmarkBtn = mFrame.findViewById(R.id.tv__bookmark_edit);
|
||||
editBookmarkBtn.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void initWebView()
|
||||
@@ -112,6 +118,14 @@ public class PlacePageBookmarkFragment extends Fragment implements View.OnLongCl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
final FragmentActivity activity = requireActivity();
|
||||
EditBookmarkFragment.editBookmark(currentBookmark.getCategoryId(), currentBookmark.getBookmarkId(), activity,
|
||||
getChildFragmentManager(), PlacePageBookmarkFragment.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
@@ -141,4 +155,13 @@ public class PlacePageBookmarkFragment extends Fragment implements View.OnLongCl
|
||||
updateBookmarkDetails();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBookmarkSaved(long bookmarkId, boolean movedFromCategory)
|
||||
{
|
||||
Bookmark updatedBookmark = BookmarkManager.INSTANCE.updateBookmarkPlacePage(bookmarkId);
|
||||
if (updatedBookmark == null)
|
||||
return;
|
||||
mViewModel.setMapObject(updatedBookmark);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,23 @@
|
||||
android:id="@+id/tv__bookmark_notes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
tools:text="Long, long text Long, long text Long, long text Long, long text Long, long text Long, long text "/>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tv__bookmark_edit"
|
||||
style="@style/PlacePageMetadataText.Button"
|
||||
android:gravity="center"
|
||||
android:layout_height="@dimen/height_block_base"
|
||||
android:background="?clickableBackground"
|
||||
android:paddingEnd="@dimen/margin_base"
|
||||
android:paddingStart="@dimen/margin_base"
|
||||
android:text="@string/placepage_edit_bookmark_button"/>
|
||||
|
||||
<include
|
||||
layout="@layout/divider_horizontal"/>
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user