forked from organicmaps/organicmaps
Merge pull request #5200 from goblinr/MAPSME-110-ext-bookmark-selection-in-one-place
[android] Fixed multiple bookmark selection in one place.
This commit is contained in:
commit
333cd43b44
3 changed files with 65 additions and 14 deletions
|
@ -37,6 +37,7 @@ import com.mapswithme.maps.base.BaseMwmFragmentActivity;
|
|||
import com.mapswithme.maps.base.OnBackPressListener;
|
||||
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
|
||||
import com.mapswithme.maps.bookmarks.data.Banner;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
import com.mapswithme.maps.downloader.DownloaderActivity;
|
||||
import com.mapswithme.maps.downloader.DownloaderFragment;
|
||||
|
@ -1400,17 +1401,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
}
|
||||
}
|
||||
|
||||
public static class ShowAuthorizationTask implements MapTask
|
||||
{
|
||||
@Override
|
||||
public boolean run(MwmActivity target)
|
||||
{
|
||||
final DialogFragment fragment = (DialogFragment) Fragment.instantiate(target, AuthDialogFragment.class.getName());
|
||||
fragment.show(target.getSupportFragmentManager(), AuthDialogFragment.class.getName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void adjustCompass(int offsetY)
|
||||
{
|
||||
if (mMapFragment == null || !mMapFragment.isAdded())
|
||||
|
@ -1865,4 +1855,59 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
return mMapFragment != null && !mMapFragment.isFirstStart();
|
||||
}
|
||||
|
||||
public static class ShowAuthorizationTask implements MapTask
|
||||
{
|
||||
@Override
|
||||
public boolean run(MwmActivity target)
|
||||
{
|
||||
final DialogFragment fragment = (DialogFragment) Fragment.instantiate(target, AuthDialogFragment.class.getName());
|
||||
fragment.show(target.getSupportFragmentManager(), AuthDialogFragment.class.getName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class BaseUserMarkTask implements MapTask
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
final int mCategoryId;
|
||||
final int mId;
|
||||
|
||||
BaseUserMarkTask(int categoryId, int id)
|
||||
{
|
||||
mCategoryId = categoryId;
|
||||
mId = id;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ShowBookmarkTask extends BaseUserMarkTask
|
||||
{
|
||||
public ShowBookmarkTask(int categoryId, int bookmarkId)
|
||||
{
|
||||
super(categoryId, bookmarkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(MwmActivity target)
|
||||
{
|
||||
BookmarkManager.INSTANCE.nativeShowBookmarkOnMap(mCategoryId, mId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ShowTrackTask extends BaseUserMarkTask
|
||||
{
|
||||
public ShowTrackTask(int categoryId, int trackId)
|
||||
{
|
||||
super(categoryId, trackId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(MwmActivity target)
|
||||
{
|
||||
Framework.nativeShowTrackRect(mCategoryId, mId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,21 +90,24 @@ public class BookmarksListFragment extends BaseMwmListFragment
|
|||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id)
|
||||
{
|
||||
final Intent i = new Intent(getActivity(), MwmActivity.class);
|
||||
|
||||
switch (mAdapter.getItemViewType(position))
|
||||
{
|
||||
case BookmarkListAdapter.TYPE_SECTION:
|
||||
return;
|
||||
case BookmarkListAdapter.TYPE_BOOKMARK:
|
||||
final Bookmark bookmark = (Bookmark) mAdapter.getItem(position);
|
||||
BookmarkManager.INSTANCE.nativeShowBookmarkOnMap(mCategoryIndex, bookmark.getBookmarkId());
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowBookmarkTask(mCategoryIndex, bookmark.getBookmarkId()));
|
||||
break;
|
||||
case BookmarkListAdapter.TYPE_TRACK:
|
||||
final Track track = (Track) mAdapter.getItem(position);
|
||||
Framework.nativeShowTrackRect(track.getCategoryId(), track.getTrackId());
|
||||
i.putExtra(MwmActivity.EXTRA_TASK,
|
||||
new MwmActivity.ShowTrackTask(track.getCategoryId(), track.getTrackId()));
|
||||
break;
|
||||
}
|
||||
|
||||
final Intent i = new Intent(getActivity(), MwmActivity.class);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(i);
|
||||
}
|
||||
|
|
|
@ -914,6 +914,9 @@ void Framework::ShowBookmark(BookmarkAndCategory const & bnc)
|
|||
place_page::Info info;
|
||||
FillBookmarkInfo(*mark, bnc, info);
|
||||
ActivateMapSelection(true, df::SelectionShape::OBJECT_USER_MARK, info);
|
||||
//TODO
|
||||
//We need to preserve bookmark id in the m_lastTapEvent.
|
||||
//Because in one feature can be several bokmarks.
|
||||
m_lastTapEvent = MakeTapEvent(info.GetMercator(), info.GetID(), TapEvent::Source::Other);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue