Poi dialog design. Work in progress

This commit is contained in:
GaidamakUA 2015-08-14 14:12:59 +03:00
parent c9c3dc706c
commit 28385c95c8
25 changed files with 929 additions and 274 deletions

View file

@ -8,7 +8,6 @@ apply plugin: 'com.android.application'
// APP_EDITION - date stamp of builds // APP_EDITION - date stamp of builds
// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon // APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
// 1. To be done Filter fonts // 1. To be done Filter fonts
// <unzip src="OsmAndCore_android.aar" dest="."> // <unzip src="OsmAndCore_android.aar" dest=".">
// <patternset> // <patternset>
@ -39,7 +38,7 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion 9 minSdkVersion 14
targetSdkVersion 21 targetSdkVersion 21
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
@ -303,6 +302,7 @@ dependencies {
compile project(path: ":OsmAnd-java", configuration: "android") compile project(path: ":OsmAnd-java", configuration: "android")
compile project(":eclipse-compile:design") compile project(":eclipse-compile:design")
compile project(":cardview") compile project(":cardview")
compile project(":recyclerview")
compile fileTree( compile fileTree(
dir: "libs", dir: "libs",
include: ["*.jar"], include: ["*.jar"],

View file

@ -10,7 +10,7 @@
<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.DakrActionbar"> android:theme="@style/OsmandLightTheme.DarkActionbar">
<!-- TODO change theme --> <!-- TODO change theme -->
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
@ -19,15 +19,19 @@
android:layout_height="@dimen/dashboard_map_toolbar" android:layout_height="@dimen/dashboard_map_toolbar"
app:contentInsetLeft="72dp" app:contentInsetLeft="72dp"
app:contentInsetStart="72dp" app:contentInsetStart="72dp"
android:theme="@style/OsmandLightTheme.DakrActionbar"/> app:layout_scrollFlags="scroll"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="72dp" android:layout_marginLeft="72dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp">
app:layout_scrollFlags="scroll">
<EditText <EditText
android:layout_width="match_parent" android:layout_width="match_parent"
@ -36,35 +40,37 @@
android:text="@string/lorem_ipsum"/> android:text="@string/lorem_ipsum"/>
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginLeft="72dp"
app:layout_scrollFlags="scroll"> app:layout_scrollFlags="scroll">
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginTop="16dp"
android:layout_marginTop="16dp"> android:layout_weight="1">
<EditText <EditText
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableRight="@drawable/quickaction_arrow_down" android:drawableRight="@drawable/ic_action_arrow_drop_down"
android:hint="POI Type" android:hint="POI Type"
android:text="@string/lorem_ipsum"/> android:text="@string/lorem_ipsum"/>
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<ImageButton <ImageButton
android:id="@+id/onlineDocumentationButton"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@null" android:background="@null"
android:src="@android:drawable/ic_menu_help"/> android:src="@drawable/ic_action_help"/>
</LinearLayout> </LinearLayout>
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
@ -72,7 +78,9 @@
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="@color/color_white"
app:tabIndicatorColor="@color/osmand_orange"/> app:tabIndicatorColor="@color/osmand_orange"
app:tabSelectedTextColor="@color/osmand_orange"
app:tabTextColor="@android:color/darker_gray"/>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager

View file

@ -1,7 +1,49 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#00F"> android:background="@color/dashboard_background">
</LinearLayout> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/editTagsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:saveEnabled="false"/>
<include layout="@layout/poi_tag_list_item"/>
<Button
android:id="@+id/addTagButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add tag"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Added tags"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/added_tags_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

View file

@ -1,7 +1,124 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
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="#0F0"> android:background="@color/dashboard_background">
</LinearLayout> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/openHoursTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="Open hours"
android:textColor="@color/color_black"/>
<TextView
android:id="@+id/contactInfoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/openHoursTextView"
android:layout_marginLeft="16dp"
android:text="Contact info"
android:textColor="@color/color_black"/>
<ImageView
android:id="@+id/streetImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/contactInfoTextView"
tools:src="@drawable/ic_action_street_name"/>
<EditText
android:id="@+id/streetEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/contactInfoTextView"
android:hint="Street"
android:inputType="text"/>
<ImageView
android:id="@+id/houseNumberImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/streetEditText"
tools:src="@drawable/ic_action_building_number"/>
<EditText
android:id="@+id/houseNumberEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/streetEditText"
android:hint="35"
android:inputType="text"/>
<ImageView
android:id="@+id/phoneImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/houseNumberEditText"
tools:src="@drawable/ic_action_call_dark"/>
<EditText
android:id="@+id/phoneEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/houseNumberEditText"
android:hint="Phone"
android:inputType="phone"/>
<ImageView
android:id="@+id/webSiteImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/phoneEditText"
tools:src="@drawable/ic_world_globe_dark"/>
<EditText
android:id="@+id/webSiteEditText"
style="@style/create_poi_text_field"
android:layout_below="@id/phoneEditText"
android:hint="Web site"
android:inputType="textUri"/>
<ImageView
android:id="@+id/descriptionImageView"
style="@style/edit_poi_imageview_style"
android:layout_below="@id/webSiteEditText"
tools:src="@drawable/ic_action_description"/>
<EditText
android:id="@+id/descriptionEditText"
style="@style/create_poi_text_field"
android:layout_width="match_parent"
android:layout_below="@id/webSiteEditText"
android:hint="Description"
android:inputType="textMultiLine"/>
<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/descriptionEditText"
android:background="@color/divider_color"/>
<Button
android:id="@+id/saveButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/buttonDivider"
tools:text="Save"
android:textColor="@color/dashboard_general_button_text_light"/>
<Button
android:id="@+id/cancelButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/buttonDivider"
android:layout_toLeftOf="@id/saveButton"
android:text="Cancel"
android:textColor="@color/dashboard_general_button_text_light"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

View file

@ -46,6 +46,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
layout="@layout/dashboard_over_map" /> layout="@layout/dashboard_over_map" />
<FrameLayout <FrameLayout
android:id="@+id/fragmentContainer" android:id="@+id/fragmentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/tagEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Tag"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/valueEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Value"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/deleteItemImageButton"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:src="@drawable/ic_action_close_dark"/>
</LinearLayout>
<View
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/descriptionEditText"
android:background="@color/divider_color"/>
</LinearLayout>

View file

@ -151,4 +151,7 @@
<color name="spinner_list_background_light">#eeeeee</color> <color name="spinner_list_background_light">#eeeeee</color>
<color name="spinner_list_background_dark">#303030</color> <color name="spinner_list_background_dark">#303030</color>
<color name="inactive_iteme_orange">#ffc87f</color>
<color name="osmand_orange_dark">#e68200</color>
<color name="divider_color">#ccc</color>
</resources> </resources>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Dialog_Fullscreen" parent="android:Theme"> <style name="Dialog_Fullscreen" parent="android:Theme">
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
@ -74,20 +75,30 @@
<item name="switch_ex_background">@drawable/switch_ex_background_light</item> <item name="switch_ex_background">@drawable/switch_ex_background_light</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_light</item> <item name="switch_ex_text_color">@color/switch_ex_button_text_light</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_light</item> <item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_light</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item> <item name="plugin_details_install_header_bg">
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_light</item> @color/plugin_details_install_header_bg_light
</item>
<item name="expandable_list_item_background">
@drawable/expandable_list_item_background_light
</item>
<item name="expandable_list_background">@color/list_item_light</item> <item name="expandable_list_background">@color/list_item_light</item>
<item name="size_progress_bar">@drawable/size_progressbar_light</item> <item name="size_progress_bar">@drawable/size_progressbar_light</item>
<item name="dash_parking_bg">@drawable/dash_parking_light</item> <item name="dash_parking_bg">@drawable/dash_parking_light</item>
<item name="osmo_header_background">@color/osmo_header_light</item> <item name="osmo_header_background">@color/osmo_header_light</item>
<item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_light</item> <item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_light</item>
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_light</item> <item name="dashboard_general_button_text_color">
@color/dashboard_general_button_text_light
</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item> <item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
<item name="android:textColorPrimary">@color/color_black</item> <item name="android:textColorPrimary">@color/color_black</item>
<item name="spinnerItemTextColor">@color/color_black</item> <item name="spinnerItemTextColor">@color/color_black</item>
<item name="spinnerListBackground">@color/spinner_list_background_light</item> <item name="spinnerListBackground">@color/spinner_list_background_light</item>
<item name="colorButtonNormal">@color/color_white</item> <item name="colorButtonNormal">@color/color_white</item>
<item name="colorPrimary">@color/osmand_orange</item>
<item name="colorPrimaryDark">@color/osmand_orange_dark</item>
<!--<item name="colorAccent">@color/</item>-->
<item name="android:actionModeBackground">@color/actionbar_light_color</item> <item name="android:actionModeBackground">@color/actionbar_light_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item> <item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:actionModeCloseDrawable">@drawable/ic_action_mode_back</item> <item name="android:actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
@ -115,14 +126,18 @@
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item> <item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item> <item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_dark</item> <item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_dark</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item> <item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_dark</item> </item>
<item name="expandable_list_item_background">
@drawable/expandable_list_item_background_dark
</item>
<item name="expandable_list_background">@color/list_item_dark</item> <item name="expandable_list_background">@color/list_item_dark</item>
<item name="size_progress_bar">@drawable/size_progressbar_dark</item> <item name="size_progress_bar">@drawable/size_progressbar_dark</item>
<item name="dash_parking_bg">@drawable/dash_parking_dark</item> <item name="dash_parking_bg">@drawable/dash_parking_dark</item>
<item name="osmo_header_background">@color/osmo_header_dark</item> <item name="osmo_header_background">@color/osmo_header_dark</item>
<item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_dark</item> <item name="dashboard_subheader_text_color">@color/dashboard_subheader_text_dark</item>
<item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_dark</item> <item name="dashboard_general_button_text_color">@color/dashboard_general_button_text_dark
</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item> <item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
<item name="android:textColorPrimary">@color/color_white</item> <item name="android:textColorPrimary">@color/color_white</item>
<item name="spinnerItemTextColor">@color/color_white</item> <item name="spinnerItemTextColor">@color/color_white</item>
@ -134,7 +149,6 @@
</style> </style>
<!-- Standard action bar override --> <!-- Standard action bar override -->
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/actionbar_dark_color</item> <item name="background">@color/actionbar_dark_color</item>
@ -166,10 +180,17 @@
<item name="android:textColor">@color/color_white</item> <item name="android:textColor">@color/color_white</item>
</style> </style>
<style name="OsmandLightTheme.DarkActionbar">
<item name="android:textColorPrimary">@color/color_white</item>
<item name="android:textColorSecondary">@color/inactive_iteme_orange</item>
<item name="android:textColorHint">@color/inactive_iteme_orange</item>
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
</style>
<!-- Dialog popup --> <!-- Dialog popup -->
<style name="Animations" /> <style name="Animations"/>
<!-- PopDownMenu --> <!-- PopDownMenu -->
<style name="Animations.PopDownMenu" /> <style name="Animations.PopDownMenu"/>
<style name="Animations.PopDownMenu.Left"> <style name="Animations.PopDownMenu.Left">
<item name="@android:windowEnterAnimation">@anim/grow_from_topleft_to_bottomright</item> <item name="@android:windowEnterAnimation">@anim/grow_from_topleft_to_bottomright</item>
@ -187,7 +208,7 @@
</style> </style>
<!-- PopUpMenu --> <!-- PopUpMenu -->
<style name="Animations.PopUpMenu" /> <style name="Animations.PopUpMenu"/>
<style name="Animations.PopUpMenu.Left"> <style name="Animations.PopUpMenu.Left">
<item name="@android:windowEnterAnimation">@anim/grow_from_bottomleft_to_topright</item> <item name="@android:windowEnterAnimation">@anim/grow_from_bottomleft_to_topright</item>
@ -203,4 +224,20 @@
<item name="@android:windowEnterAnimation">@anim/grow_from_bottom</item> <item name="@android:windowEnterAnimation">@anim/grow_from_bottom</item>
<item name="@android:windowExitAnimation">@anim/shrink_from_top</item> <item name="@android:windowExitAnimation">@anim/shrink_from_top</item>
</style> </style>
<style name="create_poi_text_field">
<item name="android:layout_marginTop">8dp</item>
<item name="android:layout_marginRight">16dp</item>
<item name="android:layout_marginLeft">72dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
</style>
<style name="edit_poi_imageview_style">
<item name="android:layout_marginTop">16dp</item>
<item name="android:layout_marginLeft">16dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources> </resources>

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -215,6 +216,7 @@ public class GeoIntentActivity extends OsmandListActivity {
* @return * @return
*/ */
private MyService extract(final Uri uri) { private MyService extract(final Uri uri) {
Log.v(this.getClass().toString(), "extract(" + "uri=" + uri + ")");
GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString()); GeoPointParserUtil.GeoParsedPoint p = GeoPointParserUtil.parse(uri.toString());
if (p.isGeoPoint()) { if (p.isGeoPoint()) {
if (p.getLabel() != null) { if (p.getLabel() != null) {

View file

@ -0,0 +1,160 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import net.osmand.plus.R;
import net.osmand.plus.osmedit.EditPoiFragment.Tag;
public class AdvancedDataFragment extends Fragment {
private static final String TAG = "AdvancedDataFragment";
private TagAdapterLinearLayoutHack mAdapter;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
final EditText tagEditText = (EditText) view.findViewById(R.id.tagEditText);
final EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
ImageButton deleteItemImageButton =
(ImageButton) view.findViewById(R.id.deleteItemImageButton);
deleteItemImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tagEditText.setText(null);
tagEditText.clearFocus();
valueEditText.setText(null);
valueEditText.clearFocus();
}
});
LinearLayout editTagsLineaLayout =
(LinearLayout) view.findViewById(R.id.editTagsList);
Log.v(TAG, "arguments=" + savedInstanceState + "; ll=" + editTagsLineaLayout);
Log.v(TAG, "not restored");
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
// setListViewHeightBasedOnChildren(editTagsLineaLayout);
Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
addTagButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String tag = String.valueOf(tagEditText.getText());
String value = String.valueOf(valueEditText.getText());
if (!TextUtils.isEmpty(tag) && !TextUtils.isEmpty(value)) {
mAdapter.addTag(new Tag(tag, value));
// setListViewHeightBasedOnChildren(editTagsLineaLayout);
tagEditText.setText(null);
tagEditText.clearFocus();
valueEditText.setText(null);
valueEditText.clearFocus();
}
}
});
return view;
}
@Override
public void onResume() {
super.onResume();
// TODO read more about lifecycle
mAdapter.updateViews();
getEditPoiFragment().addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int i) {
if (i == 1) mAdapter.updateViews();
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
}
@Override
public void onSaveInstanceState(Bundle outState) {
Log.v(TAG, "onSaveInstanceState(" + "outState=" + outState + ")");
super.onSaveInstanceState(outState);
}
public static class TagAdapterLinearLayoutHack {
private final LinearLayout linearLayout;
private final EditPoiFragment.EditPoiData editPoiData;
public TagAdapterLinearLayoutHack(LinearLayout linearLayout,
EditPoiFragment.EditPoiData editPoiData) {
this.linearLayout = linearLayout;
this.editPoiData = editPoiData;
}
public void addTag(Tag tag) {
View view = getView(tag);
editPoiData.tags.add(tag);
EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
Log.v(TAG, "valueEditText text=" + valueEditText.getText());
linearLayout.addView(view);
}
public void updateViews() {
linearLayout.removeAllViews();
Log.v(TAG, "editPoiData.tags=" + editPoiData.tags);
for (Tag tag : editPoiData.tags) {
Log.v(TAG, "tag=" + tag);
View view = getView(tag);
EditText valueEditText = (EditText) view.findViewById(R.id.valueEditText);
Log.v(TAG, "valueEditText text=" + valueEditText.getText());
linearLayout.addView(view);
}
}
private View getView(final Tag tag) {
Log.v(TAG, "getView(" + "tag=" + tag + ")");
final View convertView = LayoutInflater.from(linearLayout.getContext())
.inflate(R.layout.poi_tag_list_item, null, false);
EditText tagEditText = (EditText) convertView.findViewById(R.id.tagEditText);
EditText valueEditText = (EditText) convertView.findViewById(R.id.valueEditText);
ImageButton deleteItemImageButton =
(ImageButton) convertView.findViewById(R.id.deleteItemImageButton);
tagEditText.setText(tag.tag);
valueEditText.setText(tag.value);
deleteItemImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
linearLayout.removeView((View) v.getParent());
editPoiData.tags.remove(tag);
}
});
Log.v(TAG, "convertView=" + convertView);
return convertView;
}
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
}
private EditPoiFragment.EditPoiData getData() {
return getEditPoiFragment().getEditPoiData();
}
}

View file

@ -1,10 +1,11 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.graphics.Color; import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -15,18 +16,60 @@ import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageButton;
import net.osmand.data.Amenity;
import net.osmand.osm.edit.Node;
import net.osmand.plus.R; import net.osmand.plus.R;
import java.io.Serializable;
import java.util.LinkedHashSet;
public class EditPoiFragment extends Fragment { public class EditPoiFragment extends Fragment {
public static final String TAG = "EditPoiFragment"; public static final String TAG = "EditPoiFragment";
// XXX this fragment wont work on older devices private static final String KEY_AMENITY_NODE = "amenity_node";
private static final String KEY_AMENITY = "amenity";
private static final String TAGS_LIST = "tags_list";
private final EditPoiData editPoiData = new EditPoiData();
private ViewPager viewPager;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// poiTypes = ((OsmandApplication) activity.getApplication()).getPoiTypes();
// allTranslatedSubTypes = poiTypes.getAllTranslatedNames();
// OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
// editPoiData.isLocalEdit = true;
// if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) {
// openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
// openstreetmapUtilToLoad = openstreetmapUtil;
// } else if(!settings.isInternetConnectionAvailable(true)) {
// openstreetmapUtil = new OpenstreetmapLocalUtil(plugin, activity);
// openstreetmapUtilToLoad = new OpenstreetmapRemoteUtil(activity);
// } else {
// editPoiData.isLocalEdit = false;
// openstreetmapUtil = new OpenstreetmapRemoteUtil(activity);
// openstreetmapUtilToLoad = openstreetmapUtil;
// }
// editPoiData.node = (Node) getArguments().getSerializable(KEY_AMENITY_NODE);
// editPoiData.tags = new LinkedHashSet<>();
}
@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,
Bundle savedInstanceState) { Bundle savedInstanceState) {
if (savedInstanceState != null) {
editPoiData.tags = (LinkedHashSet<Tag>) savedInstanceState.getSerializable(TAGS_LIST);
} else {
editPoiData.tags = new LinkedHashSet<>();
}
View view = inflater.inflate(R.layout.fragment_edit_poi, container, false); View view = inflater.inflate(R.layout.fragment_edit_poi, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(R.string.poi_create_title); toolbar.setTitle(R.string.poi_create_title);
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
@ -38,14 +81,15 @@ public class EditPoiFragment extends Fragment {
fragmentManager.popBackStack(); fragmentManager.popBackStack();
} }
}); });
final ViewPager viewPager = (ViewPager) view.findViewById(R.id.viewpager);
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager()); MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager());
viewPager.setAdapter(pagerAdapter); viewPager.setAdapter(pagerAdapter);
final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout); final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
// Hack due to problems with design support library v22.2.1 // Hack due to bug in design support library v22.2.1
// https://code.google.com/p/android/issues/detail?id=180462 // https://code.google.com/p/android/issues/detail?id=180462
// TODO remove in new version // TODO remove in new version
if (ViewCompat.isLaidOut(tabLayout)) { if (ViewCompat.isLaidOut(tabLayout)) {
@ -60,13 +104,47 @@ public class EditPoiFragment extends Fragment {
} }
}); });
} }
int orangeColor = getResources().getColor(R.color.osmand_orange);
int grayColor = getResources().getColor(android.R.color.darker_gray); ImageButton onlineDocumentationButton =
tabLayout.setTabTextColors(grayColor, orangeColor); (ImageButton) view.findViewById(R.id.onlineDocumentationButton);
onlineDocumentationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://wiki.openstreetmap.org/wiki/Map_Features")));
}
});
return view; return view;
} }
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putSerializable(TAGS_LIST, editPoiData.tags);
super.onSaveInstanceState(outState);
}
public void addOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
viewPager.addOnPageChangeListener(listener);
}
public EditPoiFragment createInstance(Node node, Amenity amenity) {
EditPoiFragment editPoiFragment = new EditPoiFragment();
Bundle args = new Bundle();
args.putSerializable(KEY_AMENITY_NODE, node);
args.putSerializable(KEY_AMENITY, amenity);
editPoiFragment.setArguments(args);
return editPoiFragment;
}
public EditPoiData getEditPoiData() {
return editPoiData;
}
public void send() {
// TODO implement saving
}
public static class MyAdapter extends FragmentPagerAdapter { public static class MyAdapter extends FragmentPagerAdapter {
public MyAdapter(FragmentManager fm) { public MyAdapter(FragmentManager fm) {
super(fm); super(fm);
@ -101,19 +179,43 @@ public class EditPoiFragment extends Fragment {
} }
} }
public static class NormalDataFragment extends Fragment { public static class EditPoiData {
@Nullable // public boolean isLocalEdit;
@Override // public Node node;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public LinkedHashSet<Tag> tags;
return inflater.inflate(R.layout.fragment_edit_poi_normal, container, false); }
}
public static class Tag implements Serializable {
public String tag;
public String value;
public Tag(String tag, String value) {
this.tag = tag;
this.value = value;
} }
public static class AdvancedDataFragment extends Fragment {
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public boolean equals(Object o) {
return inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false); if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tag tag1 = (Tag) o;
return tag.equals(tag1.tag);
}
@Override
public int hashCode() {
return tag.hashCode();
}
@Override
public String toString() {
return "Tag{" +
"tag='" + tag + '\'' +
", value='" + value + '\'' +
'}';
} }
} }
} }

View file

@ -0,0 +1,101 @@
package net.osmand.plus.osmedit;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.IconsCache;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.osmedit.EditPoiFragment.Tag;
public class NormalDataFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
IconsCache iconsCache = ((MapActivity) getActivity()).getMyApplication().getIconsCache();
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
streetImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_street_name));
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
houseNumberImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_building_number));
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
phoneImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_call_dark));
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
webSiteImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_world_globe_dark));
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
descriptionImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_description));
// TODO replace with constants
final TextView streetEditText = (TextView) view.findViewById(R.id.streetEditText);
streetEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "addr:street"));
final TextView houseNumberEditText = (TextView) view.findViewById(R.id.houseNumberEditText);
houseNumberEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "addr:housenumber"));
final TextView phoneEditText = (TextView) view.findViewById(R.id.phoneEditText);
phoneEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "phone"));
final TextView webSiteEditText = (TextView) view.findViewById(R.id.webSiteEditText);
webSiteEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "website"));
final TextView descriptionEditText = (TextView) view.findViewById(R.id.descriptionEditText);
descriptionEditText.setOnFocusChangeListener(new MyOnFocusChangeListener(getData(), "description"));
Button saveButton = (Button) view.findViewById(R.id.saveButton);
int saveButtonTextId = //getData().isLocalEdit ? R.string.shared_string_save :
R.string.default_buttons_commit;
saveButton.setText(saveButtonTextId);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getEditPoiFragment().send();
}
});
Button cancelButton = (Button) view.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
Fragment editPoiFragment = getParentFragment();
fragmentManager.beginTransaction().remove(editPoiFragment).commit();
fragmentManager.popBackStack();
}
});
return view;
}
private EditPoiFragment getEditPoiFragment() {
return (EditPoiFragment) getParentFragment();
}
private EditPoiFragment.EditPoiData getData() {
return getEditPoiFragment().getEditPoiData();
}
private static class MyOnFocusChangeListener implements View.OnFocusChangeListener {
private EditPoiFragment.EditPoiData data;
private String tagName;
public MyOnFocusChangeListener(EditPoiFragment.EditPoiData data, String tagName) {
this.data = data;
this.tagName = tagName;
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
String string = ((EditText) v).getText().toString();
if (!TextUtils.isEmpty(string)) {
Tag tag = new Tag(tagName, string);
data.tags.remove(tag);
data.tags.add(tag);
}
}
}
}

View file

@ -7,16 +7,13 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
public class OsmBugsRemoteUtil implements OsmBugsUtil { public class OsmBugsRemoteUtil implements OsmBugsUtil {

View file

@ -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.access.AccessibleToast; import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
@ -19,28 +32,16 @@ import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import android.app.Activity;
import android.app.AlertDialog; import java.util.List;
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 {
private static final String ID = "osm.editing"; private static final String ID = "osm.editing";
private OsmandSettings settings; private OsmandSettings settings;
private OsmandApplication app; private OsmandApplication app;
OpenstreetmapsDbHelper dbpoi ; OpenstreetmapsDbHelper dbpoi;
OsmBugsDbHelper dbbug ; OsmBugsDbHelper dbbug;
@Override @Override
public String getId() { public String getId() {
@ -48,14 +49,14 @@ public class OsmEditingPlugin extends OsmandPlugin {
} }
public OpenstreetmapsDbHelper getDBPOI() { public OpenstreetmapsDbHelper getDBPOI() {
if(dbpoi == null) { if (dbpoi == null) {
dbpoi = new OpenstreetmapsDbHelper(app); dbpoi = new OpenstreetmapsDbHelper(app);
} }
return dbpoi; return dbpoi;
} }
public OsmBugsDbHelper getDBBug() { public OsmBugsDbHelper getDBBug() {
if(dbbug == null) { if (dbbug == null) {
dbbug = new OsmBugsDbHelper(app); dbbug = new OsmBugsDbHelper(app);
} }
return dbbug; return dbbug;
@ -87,30 +88,30 @@ public class OsmEditingPlugin extends OsmandPlugin {
} }
} }
} else { } else {
if(osmBugsLayer != null) { if (osmBugsLayer != null) {
mapView.removeLayer(osmBugsLayer); mapView.removeLayer(osmBugsLayer);
} }
if(osmEditsLayer != null) { if (osmEditsLayer != null) {
mapView.removeLayer(osmEditsLayer); mapView.removeLayer(osmEditsLayer);
} }
} }
} }
@Override @Override
public void registerLayers(MapActivity activity){ public void registerLayers(MapActivity activity) {
osmBugsLayer = new OsmBugsLayer(activity, this); osmBugsLayer = new OsmBugsLayer(activity, this);
osmEditsLayer = new OsmEditsLayer(activity, this); osmEditsLayer = new OsmEditsLayer(activity, this);
} }
public OsmEditsLayer getOsmEditsLayer(MapActivity activity){ public OsmEditsLayer getOsmEditsLayer(MapActivity activity) {
if(osmEditsLayer == null) { if (osmEditsLayer == null) {
registerLayers(activity); registerLayers(activity);
} }
return osmEditsLayer; return osmEditsLayer;
} }
public OsmBugsLayer getBugsLayer(MapActivity activity) { public OsmBugsLayer getBugsLayer(MapActivity activity) {
if(osmBugsLayer == null) { if (osmBugsLayer == null) {
registerLayers(activity); registerLayers(activity);
} }
return osmBugsLayer; return osmBugsLayer;
@ -144,9 +145,13 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) { public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
if (resId == R.string.context_menu_item_create_poi) { if (resId == R.string.context_menu_item_create_poi) {
getPoiActions(mapActivity).showCreateDialog(latitude, longitude); //getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
mapActivity.getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, new EditPoiFragment(), 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);
} }
osmBugsLayer.openBug(latitude, longitude); osmBugsLayer.openBug(latitude, longitude);
@ -158,7 +163,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return true; return true;
} }
}; };
if(selectedObj instanceof Amenity) { if (selectedObj instanceof Amenity) {
adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg(); adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg();
adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg(); adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg();
} else { } else {
@ -169,7 +174,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override @Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) { public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0){ if (getDBPOI().getOpenstreetmapPoints().size() > 0 || getDBBug().getOsmbugsPoints().size() > 0) {
mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class)); mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class));
if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) { if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) {
app.getSettings().FAVORITES_TAB.set(R.string.osm_edits); app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
@ -241,7 +246,6 @@ public class OsmEditingPlugin extends OsmandPlugin {
} }
public enum UploadVisibility implements IEnumWithResource { public enum UploadVisibility implements IEnumWithResource {
Public(R.string.gpxup_public), Public(R.string.gpxup_public),
Identifiable(R.string.gpxup_identifiable), Identifiable(R.string.gpxup_identifiable),
@ -252,32 +256,34 @@ public class OsmEditingPlugin extends OsmandPlugin {
private UploadVisibility(int resourceId) { private UploadVisibility(int resourceId) {
this.resourceId = resourceId; this.resourceId = resourceId;
} }
public String asURLparam() { public String asURLparam() {
return name().toLowerCase(); return name().toLowerCase();
} }
@Override @Override
public int stringResource() { public int stringResource() {
return resourceId; return resourceId;
} }
} }
public boolean sendGPXFiles(final Activity la, AvailableGPXFragment f, final GpxInfo... info){ public boolean sendGPXFiles(final Activity la, AvailableGPXFragment f, final GpxInfo... info) {
String name = settings.USER_NAME.get(); String name = settings.USER_NAME.get();
String pwd = settings.USER_PASSWORD.get(); String pwd = settings.USER_PASSWORD.get();
if(Algorithms.isEmpty(name) || Algorithms.isEmpty(pwd)){ if (Algorithms.isEmpty(name) || Algorithms.isEmpty(pwd)) {
AccessibleToast.makeText(la, R.string.validate_gpx_upload_name_pwd, Toast.LENGTH_LONG).show(); AccessibleToast.makeText(la, R.string.validate_gpx_upload_name_pwd, Toast.LENGTH_LONG).show();
return false; return false;
} }
Builder bldr = new AlertDialog.Builder(la); Builder bldr = new AlertDialog.Builder(la);
LayoutInflater inflater = (LayoutInflater)la.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) la.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(R.layout.send_gpx_osm, null); final View view = inflater.inflate(R.layout.send_gpx_osm, null);
final EditText descr = (EditText) view.findViewById(R.id.memory_size); final EditText descr = (EditText) view.findViewById(R.id.memory_size);
if(info.length > 0 && info[0].getFileName() != null) { if (info.length > 0 && info[0].getFileName() != null) {
int dt = info[0].getFileName().indexOf('.'); int dt = info[0].getFileName().indexOf('.');
descr.setText(info[0].getFileName().substring(0, dt)); descr.setText(info[0].getFileName().substring(0, dt));
} }
final EditText tags = (EditText) view.findViewById(R.id.TagsText); final EditText tags = (EditText) view.findViewById(R.id.TagsText);
final Spinner visibility = ((Spinner)view.findViewById(R.id.Visibility)); final Spinner visibility = ((Spinner) view.findViewById(R.id.Visibility));
EnumAdapter<UploadVisibility> adapter = new EnumAdapter<UploadVisibility>(la, android.R.layout.simple_spinner_item, UploadVisibility.values()); EnumAdapter<UploadVisibility> adapter = new EnumAdapter<UploadVisibility>(la, android.R.layout.simple_spinner_item, UploadVisibility.values());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
visibility.setAdapter(adapter); visibility.setAdapter(adapter);
@ -314,7 +320,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
return R.drawable.osm_editing; return R.drawable.osm_editing;
} }
public static String getEditName(OsmPoint point){ public static String getEditName(OsmPoint point) {
String prefix = getPrefix(point); String prefix = getPrefix(point);
if (point.getGroup() == OsmPoint.Group.POI) { if (point.getGroup() == OsmPoint.Group.POI) {
return prefix + " (" + ((OpenstreetmapPoint) point).getSubtype() + ") " + ((OpenstreetmapPoint) point).getName(); return prefix + " (" + ((OpenstreetmapPoint) point).getSubtype() + ") " + ((OpenstreetmapPoint) point).getName();

0
cardview/build.gradle Normal file → Executable file
View file

0
cardview/libs/android-support-v7-cardview.jar Normal file → Executable file
View file

0
cardview/src/main/AndroidManifest.xml Normal file → Executable file
View file

0
cardview/src/main/res/values/attrs.xml Normal file → Executable file
View file

0
cardview/src/main/res/values/colors.xml Normal file → Executable file
View file

0
cardview/src/main/res/values/dimens.xml Normal file → Executable file
View file

0
cardview/src/main/res/values/styles.xml Normal file → Executable file
View file

0
cardview/src/main/resources/.readme Normal file → Executable file
View file

1
recyclerview/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

23
recyclerview/build.gradle Normal file
View file

@ -0,0 +1,23 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 7
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":eclipse-compile:appcompat")
}

View file

@ -1,8 +1,7 @@
include ':OsmAnd-java', ':eclipse-compile:design', ':cardview' include ':OsmAnd-java', ':eclipse-compile:design', ':recyclerview', ":cardview"
include ':OsmAnd' include ':OsmAnd'
include ':eclipse-compile:appcompat' include ':eclipse-compile:appcompat'
include ':plugins:OsmAnd-AddressPlugin' include ':plugins:OsmAnd-AddressPlugin'
include ':plugins:Osmand-ParkingPlugin' include ':plugins:Osmand-ParkingPlugin'
include ':plugins:Osmand-Sherpafy' include ':plugins:Osmand-Sherpafy'
include ':plugins:Osmand-SRTMPlugin' include ':plugins:Osmand-SRTMPlugin'
include ':cardview'