From c364f24b280620cfedbc928d4c602db2d08bd1cc Mon Sep 17 00:00:00 2001 From: Alexander Marchuk Date: Tue, 8 Dec 2015 13:06:51 +0300 Subject: [PATCH] [android] add: Editor host activity/fragment. --- android/AndroidManifest.xml | 11 +++++++ .../src/com/mapswithme/maps/MwmActivity.java | 17 +++++++++- .../maps/editor/EditorActivity.java | 31 +++++++++++++++++++ .../maps/editor/EditorFragment.java | 16 ++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 android/src/com/mapswithme/maps/editor/EditorActivity.java create mode 100644 android/src/com/mapswithme/maps/editor/EditorFragment.java diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 26596cbb91..f601dd5fdd 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -228,6 +228,17 @@ android:value="com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity"/> + + + + + getFragmentClass() + { + return EditorFragment.class; + } + + @Override + public void onBackPressed() + { + final EditorFragment fragment = (EditorFragment)getSupportFragmentManager().findFragmentByTag(getFragmentClass().getName()); + if ((fragment == null) || !fragment.isAdded() || !fragment.onBackPressed()) + super.onBackPressed(); + } + + public static void start(Activity activity, MapObject point) + { + activity.startActivity(new Intent(activity, EditorActivity.class) + .putExtra(EditorFragment.EXTRA_POINT, point)); + } +} diff --git a/android/src/com/mapswithme/maps/editor/EditorFragment.java b/android/src/com/mapswithme/maps/editor/EditorFragment.java new file mode 100644 index 0000000000..cced87d375 --- /dev/null +++ b/android/src/com/mapswithme/maps/editor/EditorFragment.java @@ -0,0 +1,16 @@ +package com.mapswithme.maps.editor; + +import com.mapswithme.maps.base.BaseMwmFragment; +import com.mapswithme.maps.base.OnBackPressListener; + +public class EditorFragment extends BaseMwmFragment + implements OnBackPressListener +{ + public static final String EXTRA_POINT = "point"; + + @Override + public boolean onBackPressed() + { + return false; + } +}