Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7e546333a5
15 changed files with 159 additions and 60 deletions
|
@ -4,19 +4,20 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/dashboard_background"
|
android:background="?attr/bg_color"
|
||||||
|
android:clickable="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context="net.osmand.plus.osmedit.EditPoiFragment"
|
tools:context="net.osmand.plus.osmedit.EditPoiFragment">
|
||||||
android:clickable="true">
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
|
android:background="?attr/pstsTabBackground"
|
||||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||||
|
android:theme="?attr/toolbar_theme"
|
||||||
app:contentInsetLeft="72dp"
|
app:contentInsetLeft="72dp"
|
||||||
app:contentInsetStart="72dp"
|
app:contentInsetStart="72dp"/>
|
||||||
android:theme="@style/OsmandLightTheme.Toolbar"
|
|
||||||
android:background="@color/osmand_orange"/>
|
|
||||||
|
|
||||||
<android.support.design.widget.CoordinatorLayout
|
<android.support.design.widget.CoordinatorLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -27,7 +28,8 @@
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/OsmandLightTheme.DarkActionbar">
|
android:background="?attr/pstsTabBackground"
|
||||||
|
android:theme="?attr/appbar_layout_theme">
|
||||||
<!-- TODO change theme -->
|
<!-- TODO change theme -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -75,9 +77,9 @@
|
||||||
android:id="@+id/poiTypeEditText"
|
android:id="@+id/poiTypeEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:completionThreshold="1"
|
||||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||||
android:hint="@string/poi_dialog_poi_type"
|
android:hint="@string/poi_dialog_poi_type"
|
||||||
android:completionThreshold="1"
|
|
||||||
tools:text="@string/lorem_ipsum"/>
|
tools:text="@string/lorem_ipsum"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
@ -95,11 +97,11 @@
|
||||||
android:id="@+id/tab_layout"
|
android:id="@+id/tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/color_white"
|
android:background="?attr/pstsTabBackground"
|
||||||
app:tabIndicatorColor="@color/osmand_orange"
|
app:layout_scrollFlags="scroll"
|
||||||
app:tabSelectedTextColor="@color/osmand_orange"
|
app:tabIndicatorColor="?attr/pstsIndicatorColor"
|
||||||
app:tabTextColor="@android:color/darker_gray"
|
app:tabSelectedTextColor="?attr/pstsIndicatorColor"
|
||||||
app:layout_scrollFlags="scroll"/>
|
app:tabTextColor="@android:color/darker_gray"/>
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,17 +128,19 @@
|
||||||
<net.osmand.plus.widgets.ButtonEx
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
android:id="@+id/cancelButton"
|
android:id="@+id/cancelButton"
|
||||||
style="@style/DashboardGeneralButton"
|
style="@style/DashboardGeneralButton"
|
||||||
android:text="@string/shared_string_cancel"
|
android:height="48dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:text="@string/shared_string_cancel"
|
||||||
android:textColor="@color/dashboard_general_button_text_light"
|
android:textColor="@color/dashboard_general_button_text_light"
|
||||||
app:textAllCapsCompat="true"/>
|
app:textAllCapsCompat="true"/>
|
||||||
|
|
||||||
<net.osmand.plus.widgets.ButtonEx
|
<net.osmand.plus.widgets.ButtonEx
|
||||||
android:id="@+id/saveButton"
|
android:id="@+id/saveButton"
|
||||||
style="@style/DashboardGeneralButton"
|
style="@style/DashboardGeneralButton"
|
||||||
android:textColor="@color/dashboard_general_button_text_light"
|
android:height="48dp"
|
||||||
tools:text="Save"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
app:textAllCapsCompat="true"/>
|
android:textColor="@color/dashboard_general_button_text_light"
|
||||||
|
app:textAllCapsCompat="true"
|
||||||
|
tools:text="Save"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:theme="@style/OsmandLightTheme.NewAppTheme">
|
android:theme="?attr/new_app_theme">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/OsmandLightTheme.NewAppTheme">
|
android:theme="@attr/new_app_theme">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/contactInfoTextView"
|
android:id="@+id/contactInfoTextView"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="18dp"
|
||||||
android:text="@string/contact_info"
|
android:text="@string/contact_info"
|
||||||
android:textColor="@color/color_black"
|
android:textColor="?android:textColorPrimary"
|
||||||
osmand:typeface="@string/font_roboto_medium"/>
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="18dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:text="@string/opening_hours"
|
android:text="@string/opening_hours"
|
||||||
android:textColor="@color/color_black"
|
android:textColor="?android:textColorPrimary"
|
||||||
osmand:typeface="@string/font_roboto_medium"/>
|
osmand:typeface="@string/font_roboto_medium"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
android:id="@+id/daysTextView"
|
android:id="@+id/daysTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/dashboard_black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
tools:text="Mo-We"/>
|
tools:text="Mo-We"/>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
android:id="@+id/openingTextView"
|
android:id="@+id/openingTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/dashboard_black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
tools:text="08:00"/>
|
tools:text="08:00"/>
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
android:id="@+id/closingTextView"
|
android:id="@+id/closingTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/dashboard_black"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
tools:text="20:00"/>
|
tools:text="20:00"/>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="16dp">
|
android:paddingTop="16dp">
|
||||||
|
|
||||||
|
@ -18,7 +19,8 @@
|
||||||
android:id="@+id/tagEditText"
|
android:id="@+id/tagEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="Tag"/>
|
android:hint="Tag"
|
||||||
|
tools:text="asdf"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
<attr name="dashboard_general_button_text_color" format="color"/>
|
<attr name="dashboard_general_button_text_color" format="color"/>
|
||||||
|
|
||||||
<attr name="dialog_inactive_text_color" format="reference"/>
|
<attr name="dialog_inactive_text_color" format="reference"/>
|
||||||
|
<attr name="appbar_layout_theme" format="reference"/>
|
||||||
|
<attr name="toolbar_theme" format="reference"/>
|
||||||
|
<attr name="new_app_theme" format="reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="PagerSlidingTabStrip">
|
<declare-styleable name="PagerSlidingTabStrip">
|
||||||
|
|
|
@ -105,6 +105,9 @@
|
||||||
<item name="android:actionMenuTextColor">@color/color_white</item>
|
<item name="android:actionMenuTextColor">@color/color_white</item>
|
||||||
|
|
||||||
<item name="dialog_inactive_text_color">@color/icon_color_light</item>
|
<item name="dialog_inactive_text_color">@color/icon_color_light</item>
|
||||||
|
<item name="appbar_layout_theme">@style/OsmandLightTheme.DarkActionbar</item>
|
||||||
|
<item name="toolbar_theme">@style/OsmandLightTheme.Toolbar</item>
|
||||||
|
<item name="new_app_theme">@style/OsmandLightTheme.NewAppTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="OsmandLightTheme.DarkActionbar">
|
<style name="OsmandLightTheme.DarkActionbar">
|
||||||
|
@ -125,6 +128,24 @@
|
||||||
<item name="android:textColorSecondary">@color/divider_color</item>
|
<item name="android:textColorSecondary">@color/divider_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="OsmandDarkTheme.DarkActionbar">
|
||||||
|
<item name="android:textColorPrimary">@color/color_white</item>
|
||||||
|
<item name="android:textColorSecondary">@color/inactive_item_orange</item>
|
||||||
|
<item name="android:textColorHint">@color/inactive_item_orange</item>
|
||||||
|
<item name="colorAccent">@color/color_white</item>
|
||||||
|
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="OsmandDarkTheme.Toolbar">
|
||||||
|
<item name="android:textColorPrimary">@color/color_white</item>
|
||||||
|
<item name="android:textColorSecondary">@color/color_white</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="OsmandDarkTheme.NewAppTheme">
|
||||||
|
<item name="colorAccent">@color/osmand_orange</item>
|
||||||
|
<item name="android:textColorSecondary">@color/divider_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||||
<item name="list_divider">@color/list_divider_light</item>
|
<item name="list_divider">@color/list_divider_light</item>
|
||||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||||
|
@ -167,6 +188,9 @@
|
||||||
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
|
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
|
||||||
|
|
||||||
<item name="dialog_inactive_text_color">@color/dialog_inactive_text_color_dark</item>
|
<item name="dialog_inactive_text_color">@color/dialog_inactive_text_color_dark</item>
|
||||||
|
<item name="appbar_layout_theme">@style/OsmandDarkTheme.DarkActionbar</item>
|
||||||
|
<item name="toolbar_theme">@style/OsmandDarkTheme.Toolbar</item>
|
||||||
|
<item name="new_app_theme">@style/OsmandDarkTheme.NewAppTheme</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,6 +270,7 @@
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_weight">1</item>
|
<item name="android:layout_weight">1</item>
|
||||||
|
<item name="android:textColor">?android:textColorPrimary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="edit_poi_imageview_style">
|
<style name="edit_poi_imageview_style">
|
||||||
|
|
|
@ -64,6 +64,8 @@ import net.osmand.plus.base.FailSafeFuntions;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
import net.osmand.plus.helpers.GpxImportHelper;
|
import net.osmand.plus.helpers.GpxImportHelper;
|
||||||
|
import net.osmand.plus.helpers.OnBackPressedListener;
|
||||||
|
import net.osmand.plus.helpers.OnBackPressedProvider;
|
||||||
import net.osmand.plus.helpers.WakeLockHelper;
|
import net.osmand.plus.helpers.WakeLockHelper;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.resources.ResourceManager;
|
import net.osmand.plus.resources.ResourceManager;
|
||||||
|
@ -87,7 +89,7 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class MapActivity extends AccessibleActivity {
|
public class MapActivity extends AccessibleActivity implements OnBackPressedProvider {
|
||||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||||
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||||
|
@ -128,6 +130,8 @@ public class MapActivity extends AccessibleActivity {
|
||||||
private IMapDownloaderCallback downloaderCallback;
|
private IMapDownloaderCallback downloaderCallback;
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
|
|
||||||
|
private OnBackPressedListener mOnBackPressedListener;
|
||||||
|
|
||||||
public static final String SHOULD_SHOW_DASHBOARD_ON_START = "should_show_dashboard_on_start";
|
public static final String SHOULD_SHOW_DASHBOARD_ON_START = "should_show_dashboard_on_start";
|
||||||
|
|
||||||
private Notification getNotification() {
|
private Notification getNotification() {
|
||||||
|
@ -374,6 +378,10 @@ public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
if (mOnBackPressedListener != null) {
|
||||||
|
mOnBackPressedListener.onBackPressed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (dashboardOnMap.onBackPressed()) {
|
if (dashboardOnMap.onBackPressed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -993,4 +1001,9 @@ public class MapActivity extends AccessibleActivity {
|
||||||
openDrawer();
|
openDrawer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setmOnBackPressedListener(OnBackPressedListener listener) {
|
||||||
|
mOnBackPressedListener = listener;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,9 +113,6 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
items = new ArrayList<>(plugin.getAllRecordings());
|
items = new ArrayList<>(plugin.getAllRecordings());
|
||||||
listAdapter = new NotesAdapter(items);
|
listAdapter = new NotesAdapter(items);
|
||||||
getListView().setAdapter(listAdapter);
|
getListView().setAdapter(listAdapter);
|
||||||
if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
|
||||||
((ActionBarProgressActivity) getActivity()).getClearToolbar(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package net.osmand.plus.helpers;
|
||||||
|
|
||||||
|
public interface OnBackPressedListener {
|
||||||
|
void onBackPressed();
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package net.osmand.plus.helpers;
|
||||||
|
|
||||||
|
public interface OnBackPressedProvider {
|
||||||
|
void setmOnBackPressedListener(OnBackPressedListener listener);
|
||||||
|
}
|
|
@ -4,9 +4,7 @@ import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -27,13 +25,11 @@ import net.osmand.osm.PoiType;
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.osmedit.data.EditPoiData;
|
import net.osmand.plus.osmedit.data.EditPoiData;
|
||||||
import net.osmand.plus.osmedit.data.Tag;
|
import net.osmand.plus.osmedit.data.Tag;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -58,7 +54,7 @@ public class AdvancedDataFragment extends Fragment {
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
|
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
|
||||||
|
|
||||||
deleteDrawable = ((MapActivity)getActivity()).getMyApplication().getIconsCache()
|
deleteDrawable = ((OsmandApplication) getActivity().getApplication()).getIconsCache()
|
||||||
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
||||||
getActivity().getResources().getColor(R.color.icon_color_light));
|
getActivity().getResources().getColor(R.color.icon_color_light));
|
||||||
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
||||||
|
|
|
@ -20,8 +20,8 @@ import android.widget.TextView;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.osmedit.data.EditPoiData;
|
import net.osmand.plus.osmedit.data.EditPoiData;
|
||||||
import net.osmand.plus.osmedit.data.Tag;
|
import net.osmand.plus.osmedit.data.Tag;
|
||||||
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
|
||||||
|
@ -52,7 +52,7 @@ public class BasicDataFragment extends Fragment {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
IconsCache iconsCache = ((MapActivity) getActivity()).getMyApplication().getIconsCache();
|
IconsCache iconsCache = ((OsmandApplication) getActivity().getApplication()).getIconsCache();
|
||||||
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
|
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
|
||||||
|
|
||||||
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
|
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
|
||||||
|
|
|
@ -2,12 +2,15 @@ package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.design.widget.TextInputLayout;
|
import android.support.design.widget.TextInputLayout;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
@ -16,6 +19,7 @@ import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -44,6 +48,8 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.OnBackPressedListener;
|
||||||
|
import net.osmand.plus.helpers.OnBackPressedProvider;
|
||||||
import net.osmand.plus.osmedit.data.EditPoiData;
|
import net.osmand.plus.osmedit.data.EditPoiData;
|
||||||
import net.osmand.plus.osmedit.data.Tag;
|
import net.osmand.plus.osmedit.data.Tag;
|
||||||
import net.osmand.plus.osmedit.dialogs.DeletePoiDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.DeletePoiDialogFragment;
|
||||||
|
@ -58,7 +64,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class EditPoiFragment extends Fragment {
|
public class EditPoiFragment extends DialogFragment implements OnBackPressedListener {
|
||||||
public static final String TAG = "EditPoiFragment";
|
public static final String TAG = "EditPoiFragment";
|
||||||
private static final Log LOG = PlatformUtil.getLog(EditPoiFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(EditPoiFragment.class);
|
||||||
|
|
||||||
|
@ -99,6 +105,15 @@ public class EditPoiFragment extends Fragment {
|
||||||
editPoiData.amenity = (Amenity) getArguments().getSerializable(KEY_AMENITY);
|
editPoiData.amenity = (Amenity) getArguments().getSerializable(KEY_AMENITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
boolean isLightTheme = ((OsmandApplication) getActivity().getApplication())
|
||||||
|
.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||||
|
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||||
|
setStyle(STYLE_NO_FRAME, themeId);
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -334,10 +349,17 @@ public class EditPoiFragment extends Fragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryAddTag(String key, String value) {
|
@Override
|
||||||
if (!Algorithms.isEmpty(value)) {
|
public void onResume() {
|
||||||
editPoiData.tags.add(new Tag(key, value));
|
super.onResume();
|
||||||
}
|
// Do not forget to unregister
|
||||||
|
((OnBackPressedProvider) getActivity()).setmOnBackPressedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
((OnBackPressedProvider) getActivity()).setmOnBackPressedListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -346,6 +368,17 @@ public class EditPoiFragment extends Fragment {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
new AreYouSureDialogFrgament().show(getChildFragmentManager(), "AreYouSureDialogFrgament");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tryAddTag(String key, String value) {
|
||||||
|
if (!Algorithms.isEmpty(value)) {
|
||||||
|
editPoiData.tags.add(new Tag(key, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static EditPoiFragment createAddPoiInstance(double latitude, double longitude,
|
public static EditPoiFragment createAddPoiInstance(double latitude, double longitude,
|
||||||
OsmandApplication application) {
|
OsmandApplication application) {
|
||||||
Node node = new Node(latitude, longitude, -1);
|
Node node = new Node(latitude, longitude, -1);
|
||||||
|
@ -556,4 +589,22 @@ public class EditPoiFragment extends Fragment {
|
||||||
"DeletePoiDialogFragment");
|
"DeletePoiDialogFragment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class AreYouSureDialogFrgament extends DialogFragment {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
builder.setTitle("Are you sure?")
|
||||||
|
.setMessage("Any unsaved changes will be lost. Continue?")
|
||||||
|
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
((DialogFragment) getParentFragment()).dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
|
return super.onCreateDialog(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,19 @@
|
||||||
package net.osmand.plus.osmedit;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
import java.util.List;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
|
@ -24,20 +37,7 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.app.Activity;
|
import java.util.List;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.AlertDialog.Builder;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.DialogInterface.OnClickListener;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
|
|
||||||
public class OsmEditingPlugin extends OsmandPlugin {
|
public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
|
@ -158,10 +158,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
EditPoiFragment editPoiFragment =
|
EditPoiFragment editPoiFragment =
|
||||||
EditPoiFragment.createAddPoiInstance(latitude, longitude,
|
EditPoiFragment.createAddPoiInstance(latitude, longitude,
|
||||||
mapActivity.getMyApplication());
|
mapActivity.getMyApplication());
|
||||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
editPoiFragment.show(mapActivity.getSupportFragmentManager(),
|
||||||
.add(R.id.fragmentContainer, editPoiFragment, EditPoiFragment.TAG)
|
EditPoiFragment.TAG);
|
||||||
.addToBackStack(null)
|
|
||||||
.commit();
|
|
||||||
} else if (resId == R.string.context_menu_item_open_bug) {
|
} else if (resId == R.string.context_menu_item_open_bug) {
|
||||||
if (osmBugsLayer == null) {
|
if (osmBugsLayer == null) {
|
||||||
registerLayers(mapActivity);
|
registerLayers(mapActivity);
|
||||||
|
|
Loading…
Reference in a new issue