PP UI changes. Added some temporary icons, changed backgrounds, moved color chooser option to PP.

This commit is contained in:
Dmitry Yunitsky 2014-07-08 10:13:56 +02:00 committed by Alex Zolotarev
parent 75a63eac2f
commit 8988a6b2b1
41 changed files with 457 additions and 438 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@color/pp_bg_preview_end"
android:startColor="@color/pp_bg_start"/>
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@color/pp_bg_end"
android:startColor="@color/pp_bg_preview_end"/>
</shape>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="3dp" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
<solid android:color="@android:color/transparent" />
</shape>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="3dp" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
<solid android:color="@android:color/transparent" />
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_stroke_white_rounded_active" android:state_pressed="true"/>
<item android:drawable="@drawable/bg_stroke_white_rounded"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,75 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
android:id="@+id/info_box_root"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null" >
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/preview"
<LinearLayout
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_page_preview"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/info_title"
style="@style/Holo.TextAppearance.Large.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@string/robotoLight"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/info_subtitle"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/info_title"
android:fontFamily="@string/robotoRegular"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="@android:color/white"/>
<ImageButton
android:id="@+id/btn_edit_title"
android:layout_width="wrap_content"
android:background="@android:color/transparent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/info_title"
android:src="@drawable/placepageeditbutton"/>
</RelativeLayout>
<CheckBox
android:id="@+id/info_box_is_bookmarked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:button="@drawable/placepagebookmarkbutton"
android:padding="8dp"/>
</LinearLayout>
<!-- Will have dynamic height -->
<LinearLayout
android:id="@+id/place_page"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/preview"
android:background="@drawable/bg_place_page"
android:orientation="vertical"
android:visibility="gone">
<View
style="@style/drawerSeparator"
android:layout_weight="0"/>
<ScrollView
android:id="@+id/place_page_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ui_20_background_grey"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp"
android:visibility="gone" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/info_title"
style="@style/Holo.TextAppearance.Large.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@string/robotoLight" />
<TextView
android:id="@+id/info_subtitle"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/ui_20_green"
android:fontFamily="@string/robotoRegular"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="@android:color/white" />
</LinearLayout>
<CheckBox
android:id="@+id/info_box_is_bookmarked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:button="@drawable/info_box_add_to_bookmarks_btn_selector"
android:padding="8dp" />
</LinearLayout>
<!-- Will have dynamic height -->
<LinearLayout
android:id="@+id/place_page"
android:layout_width="match_parent"
android:layout_height="500dp"
android:background="@color/ui_20_background_grey"
android:orientation="vertical"
android:layout_below="@id/preview"
android:visibility="gone" >
<View
style="@style/drawerSeparator"
android:layout_weight="0" />
<ScrollView
android:id="@+id/place_page_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</ScrollView>
</LinearLayout>
android:layout_weight="1">
</ScrollView>
</LinearLayout>
</RelativeLayout>

View file

@ -1,42 +1,32 @@
<?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" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/info_box_share"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginBottom="10dp"
android:background="@drawable/ui_20_green_selector"
android:fontFamily="@string/robotoLight"
android:gravity="center"
android:text="@string/share"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/info_box_share"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_weight="1"
android:background="@drawable/bg_stroke_white_selector"
android:fontFamily="@string/robotoLight"
android:gravity="center"
android:text="@string/share"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/info_box_edit"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginBottom="10dp"
android:background="@drawable/ui_20_green_stroke_selector"
android:fontFamily="@string/robotoRegular"
android:gravity="center"
android:text="@string/edit"
android:textColor="@color/ui_20_green" />
<TextView
android:id="@+id/info_box_back_to_caller"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@drawable/ui_20_green_stroke_selector"
android:fontFamily="@string/robotoRegular"
android:gravity="center"
android:text="@string/more_info"
android:textColor="@color/ui_20_green" />
<TextView
android:id="@+id/info_box_back_to_caller"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_weight="1"
android:background="@drawable/bg_stroke_white_selector"
android:fontFamily="@string/robotoRegular"
android:gravity="center"
android:text="@string/more_info"
android:textColor="@android:color/white"/>
</LinearLayout>

View file

@ -1,66 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
android:id="@+id/info_box_geo"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/white_rounded_background"
android:orientation="vertical"
android:padding="10dp" >
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/info_box_geo_container_dist"
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/info_box_geo_container_dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="horizontal">
<TextView
android:id="@+id/info_box_geo_distance"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="horizontal" >
android:layout_weight="1"
android:fontFamily="@string/robotoRegular"
android:textColor="@android:color/white"/>
</LinearLayout>
<TextView
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:fontFamily="@string/robotoLight"
android:gravity="left"
android:text="@string/placepage_distance"
android:textColor="@color/ui_20_text_dark" />
<TextView
android:id="@+id/info_box_geo_location"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/info_box_geo_container_dist"
android:fontFamily="@string/robotoRegular"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/info_box_geo_distance"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@string/robotoRegular"
android:gravity="right"
android:textColor="@color/ui_20_text_green" />
</LinearLayout>
<ImageButton
android:id="@+id/color_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:layout_below="@id/info_box_geo_container_dist"/>
<LinearLayout
android:id="@+id/info_box_geo_container_coord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="horizontal" >
<TextView
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:fontFamily="@string/robotoLight"
android:gravity="left"
android:text="@string/placepage_coordinates"
android:textColor="@color/ui_20_text_dark" />
<TextView
android:id="@+id/info_box_geo_location"
style="@style/Holo.TextAppearance.Medium.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@string/robotoRegular"
android:gravity="right"
android:textColor="@color/ui_20_text_green" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,46 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom|left"
android:orientation="horizontal"
android:padding="0dp" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom|left"
android:orientation="horizontal"
android:padding="0dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_panel_height">
<ImageButton
android:id="@+id/map_button_myposition"
style="@style/Widget.MapButtonBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:layout_marginLeft="@dimen/map_controls_margin"
android:contentDescription="@string/my_position"
android:onClick="onMyPositionClicked"
android:paddingBottom="0dp"
android:src="@drawable/btn_map_controls_location_normal" />
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/ic_my_position_normal"
android:onClick="onMyPositionClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search"
<ImageButton
android:layout_width="0dp"
style="@style/Widget.MapButtonBottom"
android:layout_height="match_parent"
android:src="@drawable/ic_search"
android:layout_weight="1"
android:onClick="onSearchClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bookmarks"
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
style="@style/Widget.MapButtonBottom"
android:src="@drawable/ic_bookmarks"
android:layout_weight="1"
android:onClick="onBookmarksClicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="More"
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/ic_menu"
style="@style/Widget.MapButtonBottom"
android:layout_weight="1"
android:onClick="onMoreClicked"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -1,48 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="background_placepage">#ECECEC</color>
<color name="base_green">#4CD950</color>
<color name="text_primary">#333333</color>
<color name="text_seconadary">#999999</color>
<color name="drawer_green">#4CD964</color>
<color name="drawer_text_active">#FFF</color>
<color name="drawer_text_inacative">#FFF</color>
<color name="drawer_text_disabled">#999999</color>
<color name="background_placepage">#ECECEC</color>
<color name="base_green">#4CD950</color>
<color name="text_primary">#333333</color>
<color name="text_seconadary">#999999</color>
<color name="drawer_green">#4CD964</color>
<color name="drawer_text_active">#FFF</color>
<color name="drawer_text_inacative">#FFF</color>
<color name="drawer_text_disabled">#999999</color>
<drawable name="semitransparent_white">#30FFFFFF</drawable>
<drawable name="semitransparent_white">#30FFFFFF</drawable>
<color name="semitransparent_white">#30FFFFFF</color>
<color name="semitransparent_white">#30FFFFFF</color>
<drawable name="semitransparent_black">#30000000</drawable>
<drawable name="semitransparent_black">#30000000</drawable>
<color name="semitransparent_black">#60000000</color>
<color name="semitransparent_black">#60000000</color>
<drawable name="white">#FFF</drawable>
<drawable name="white">#FFF</drawable>
<color name="ui_20_gray">#EFEFF4</color>
<color name="ui_20_gray">#EFEFF4</color>
<color name="ui_20_text_dark">#333333</color>
<drawable name="ui_20_text_dark">#333333</drawable>
<color name="ui_20_text_dark">#333333</color>
<drawable name="ui_20_text_dark">#333333</drawable>
<color name="ui_20_text_green">#53d769</color>
<color name="ui_20_text_green">#53d769</color>
<color name="ui_20_background_grey">#efeff4</color>
<color name="ui_20_background_grey">#efeff4</color>
<color name="ui_20_green">#3dca6a</color>
<drawable name="ui_20_green">#3dca6a</drawable>
<color name="ui_20_green">#3dca6a</color>
<drawable name="ui_20_green">#3dca6a</drawable>
<color name="ui_20_green_darker">#5aae74</color>
<drawable name="ui_20_green_darker">#5aae74</drawable>
<color name="ui_20_green_darker">#5aae74</color>
<drawable name="ui_20_green_darker">#5aae74</drawable>
<color name="ui_20_green_darker_tr">#505aae74</color>
<drawable name="ui_20_green_darker_tr">#505aae74</drawable>
<color name="ui_20_search_dark_gray">#666666</color>
<color name="ui_20_search_light_gray">#979797</color>
<color name="ui_20_green_darker_tr">#505aae74</color>
<drawable name="ui_20_green_darker_tr">#505aae74</drawable>
<color name="red">#F00</color>
<color name="green">#0F0</color>
<color name="blue">#00F</color>
<color name="ui_20_search_dark_gray">#666666</color>
<color name="ui_20_search_light_gray">#979797</color>
<color name="red">#F00</color>
<color name="green">#0F0</color>
<color name="blue">#00F</color>
<color name="pp_bg_start">#15c783</color>
<color name="pp_bg_preview_end">#15ca82</color>
<color name="pp_bg_end">#15d080</color>
<color name="bg_menu">#e6414451</color>
</resources>

View file

@ -38,4 +38,6 @@
<dimen name="map_controls_margin">7dp</dimen>
<dimen name="bottom_panel_height">56dp</dimen>
</resources>

View file

@ -15,7 +15,7 @@
</style>
<style name="Widget.MapButtonBottom" parent="android:Widget.Holo.ImageButton">
<item name="android:background">@drawable/btn_map_control_bg_selector</item>
<item name="android:background">@color/bg_menu</item>
</style>
<style name="tagGreenText" parent="@style/Holo.TextAppearance.Medium.Light">
@ -101,7 +101,7 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_marginRight">@dimen/dp_x_2</item>
<item name="android:layout_marginLeft">@dimen/dp_x_2</item>
<item name="android:background">@color/drawer_text_disabled</item>
<item name="android:background">@color/semitransparent_white</item>
</style>
<style name="Widget.MapButtonDrawer">

View file

@ -1,12 +1,12 @@
package com.mapswithme.maps;
import java.util.HashMap;
import java.util.Map;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.widget.ImageButton;
import java.util.HashMap;
import java.util.Map;
public class LocationButtonImageSetter
{
public enum ButtonState
@ -20,10 +20,10 @@ public class LocationButtonImageSetter
private final static Map<ButtonState, Integer> STATE_TO_RES = new HashMap<ButtonState, Integer>();
static
{
STATE_TO_RES.put(ButtonState.NO_LOCATION, R.drawable.btn_location_normal);
STATE_TO_RES.put(ButtonState.HAS_LOCATION, R.drawable.btn_location_pressed);
STATE_TO_RES.put(ButtonState.FOLLOW_MODE, R.drawable.btn_location_rotation);
STATE_TO_RES.put(ButtonState.WAITING_LOCATION, R.drawable.btn_map_location_search_anim);
STATE_TO_RES.put(ButtonState.NO_LOCATION, R.drawable.ic_my_position_normal);
STATE_TO_RES.put(ButtonState.HAS_LOCATION, R.drawable.ic_my_position_pressed);
STATE_TO_RES.put(ButtonState.FOLLOW_MODE, R.drawable.ic_my_position_auto_follow);
STATE_TO_RES.put(ButtonState.WAITING_LOCATION, R.drawable.btn_location_rotation);
}
public static void setButtonViewFromState(ButtonState state, ImageButton button)

View file

@ -1131,7 +1131,7 @@ public class MWMActivity extends NvEventQueueActivity
final String poiType = ParsedMmwRequest.getCurrentRequest().getCallerName(mApplication).toString();
final ApiPoint apiPoint = new ApiPoint(name, id, poiType, lat, lon);
if (!mInfoView.hasThatObject(apiPoint))
if (!mInfoView.hasMapObject(apiPoint))
{
mInfoView.setMapObject(apiPoint);
mInfoView.setState(State.PREVIEW_ONLY);
@ -1155,7 +1155,7 @@ public class MWMActivity extends NvEventQueueActivity
@Override
public void run()
{
if (!mInfoView.hasThatObject(poi))
if (!mInfoView.hasMapObject(poi))
{
mInfoView.setMapObject(poi);
mInfoView.setState(State.PREVIEW_ONLY);
@ -1177,7 +1177,7 @@ public class MWMActivity extends NvEventQueueActivity
public void run()
{
final Bookmark b = BookmarkManager.getBookmarkManager().getBookmark(category, bookmarkIndex);
if (!mInfoView.hasThatObject(b))
if (!mInfoView.hasMapObject(b))
{
mInfoView.setMapObject(b);
mInfoView.setState(State.PREVIEW_ONLY);
@ -1202,7 +1202,7 @@ public class MWMActivity extends NvEventQueueActivity
public void run()
{
final MapObject sr = new MapObject.SearchResult(index);
if (!mInfoView.hasThatObject(sr))
if (!mInfoView.hasMapObject(sr))
{
mInfoView.setMapObject(sr);
mInfoView.setState(State.PREVIEW_ONLY);
@ -1226,7 +1226,7 @@ public class MWMActivity extends NvEventQueueActivity
@Override
public void onDismiss()
{
if (!mInfoView.hasThatObject(null))
if (!mInfoView.hasMapObject(null))
{
runOnUiThread(new Runnable()
{

View file

@ -1,30 +1,18 @@
package com.mapswithme.maps.bookmarks;
import java.util.List;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import com.mapswithme.maps.R;
@ -39,8 +27,6 @@ import com.mapswithme.util.statistics.Statistics;
public class BookmarkActivity extends MapsWithMeBaseActivity
{
private static final int BOOKMARK_COLOR_DIALOG = 11002;
public static final String BOOKMARK_POSITION = "bookmark_position";
public static final String PIN = "pin";
public static final String PIN_ICON_ID = "pin";
@ -54,13 +40,10 @@ public class BookmarkActivity extends MapsWithMeBaseActivity
private View mClearName;
private EditText mDescr;
private TextView mSet;
private ImageView mPinImage;
private int mCurrentCategoryId = -1;
private Icon mIcon = null;
private List<Icon> mIcons;
public static void startWithBookmark(Context context, int category, int bookmark)
{
@ -119,24 +102,8 @@ public class BookmarkActivity extends MapsWithMeBaseActivity
}
}
private void updateColorChooser(Icon icon)
{
if (mIcon != null)
{
final String from = mIcon.getName();
final String to = icon.getName();
if (!TextUtils.equals(from, to))
Statistics.INSTANCE.trackColorChanged(this, from, to);
}
mIcon = icon;
mPinImage.setImageDrawable(UiUtils
.drawCircleForPin(mIcon.getName(), (int) getResources().getDimension(R.dimen.dp_x_6), getResources()));
}
private void refreshValuesInViews()
{
updateColorChooser(mPin.getIcon());
Utils.setStringAndCursorToEnd(mName, mPin.getName());
mSet.setText(mPin.getCategoryName(this));
@ -147,9 +114,7 @@ public class BookmarkActivity extends MapsWithMeBaseActivity
private void setUpViews()
{
mIcons = mManager.getIcons();
mSet = (TextView) findViewById(R.id.pin_set_chooser);
mPinImage = (ImageView)findViewById(R.id.color_image);
mName = (EditText) findViewById(R.id.pin_name);
mClearName = findViewById(R.id.bookmark_name_clear);
@ -163,16 +128,6 @@ public class BookmarkActivity extends MapsWithMeBaseActivity
});
mDescr = (EditText)findViewById(R.id.pin_description);
mPinImage.setOnClickListener(new OnClickListener()
{
@SuppressWarnings("deprecation")
@Override
public void onClick(View v)
{
showDialog(BOOKMARK_COLOR_DIALOG);
}
});
mSet.setOnClickListener(new OnClickListener()
{
@Override
@ -231,52 +186,6 @@ public class BookmarkActivity extends MapsWithMeBaseActivity
super.onPause();
}
@Override
@Deprecated
protected Dialog onCreateDialog(int id)
{
if (id == BOOKMARK_COLOR_DIALOG)
return createColorChooser();
else
return super.onCreateDialog(id);
}
private Dialog createColorChooser()
{
final IconsAdapter adapter = new IconsAdapter(this, mIcons);
adapter.chooseItem(mIcons.indexOf(mPin.getIcon()));
final LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
final int padSide = (int) getResources().getDimension(R.dimen.dp_x_8);
final int padTopB = (int) getResources().getDimension(R.dimen.dp_x_6);
final GridView gView = new GridView(this);
gView.setAdapter(adapter);
gView.setNumColumns(4);
gView.setGravity(Gravity.CENTER);
gView.setPadding(padSide, padTopB, padSide, padTopB);
gView.setLayoutParams(params);
gView.setSelector(new ColorDrawable(Color.TRANSPARENT));
final Dialog d = new AlertDialog.Builder(this)
.setTitle(R.string.bookmark_color)
.setView(gView)
.create();
gView.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View who, int pos, long id)
{
updateColorChooser(mIcons.get(pos));
adapter.chooseItem(pos);
adapter.notifyDataSetChanged();
d.dismiss();
}});
return d;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{

View file

@ -1,10 +1,15 @@
package com.mapswithme.maps.widget;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Build;
import android.support.v4.view.GestureDetectorCompat;
import android.text.Spannable;
import android.text.SpannableString;
@ -12,6 +17,7 @@ import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
@ -21,9 +27,14 @@ import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.TextView.BufferType;
@ -33,8 +44,10 @@ import com.mapswithme.maps.MWMApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.api.ParsedMmwRequest;
import com.mapswithme.maps.bookmarks.BookmarkActivity;
import com.mapswithme.maps.bookmarks.IconsAdapter;
import com.mapswithme.maps.bookmarks.data.Bookmark;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.bookmarks.data.Icon;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.bookmarks.data.MapObject.MapObjectType;
import com.mapswithme.maps.bookmarks.data.MapObject.Poi;
@ -43,12 +56,17 @@ import com.mapswithme.util.ShareAction;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.UiUtils.SimpleAnimationListener;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.Statistics;
public class MapInfoView extends LinearLayout
import java.util.List;
public class MapInfoView extends LinearLayout implements View.OnClickListener
{
private static final int SHORT_ANIM_DURATION = 200;
private static final int LONG_ANIM_DURATION = 400;
private static final float SPAN_SIZE = 25;
private static final int COLOR_CHOOSER_COLUMN_NUM = 4;
private final ViewGroup mPreviewGroup;
private final ViewGroup mPlacePageGroup;
@ -58,13 +76,15 @@ public class MapInfoView extends LinearLayout
private final TextView mTitle;
private final TextView mSubtitle;
private final CheckBox mIsBookmarked;
private final ImageButton mEditBtn;
private final LayoutInflater mInflater;
// Gestures
private final GestureDetectorCompat mGestureDetector;
private GestureDetectorCompat mGestureDetector;
// Place page
private LinearLayout mGeoLayout;
private RelativeLayout mGeoLayout;
private View mDistanceView;
private TextView mDistanceText;
private ImageView mColorImage;
// Data
private MapObject mMapObject;
private OnVisibilityChangedListener mVisibilityChangedListener;
@ -72,6 +92,8 @@ public class MapInfoView extends LinearLayout
private boolean mIsPlacePageVisible = true;
private State mCurrentState = State.HIDDEN;
private int mMaxPlacePageHeight = 0;
private BookmarkManager mBookmarkManager;
private List<Icon> mIcons;
public MapInfoView(Context context, AttributeSet attrs, int defStyleAttr)
{
@ -91,35 +113,33 @@ public class MapInfoView extends LinearLayout
mTitle = (TextView) mPreviewGroup.findViewById(R.id.info_title);
mSubtitle = (TextView) mPreviewGroup.findViewById(R.id.info_subtitle);
mIsBookmarked = (CheckBox) mPreviewGroup.findViewById(R.id.info_box_is_bookmarked);
// We don't want to use OnCheckedChangedListener because it gets called
// if someone calls setCheched() from code. We need only user interaction.
mIsBookmarked.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
final BookmarkManager bm = BookmarkManager.getBookmarkManager();
if (mMapObject.getType() == MapObjectType.BOOKMARK)
{
final MapObject p = new Poi(mMapObject.getName(), mMapObject.getLat(), mMapObject.getLon(), null);
bm.deleteBookmark((Bookmark) mMapObject);
setMapObject(p);
}
else
{
final Bookmark newbmk = bm.getBookmark(bm.addNewBookmark(
mMapObject.getName(), mMapObject.getLat(), mMapObject.getLon()));
setMapObject(newbmk);
}
Framework.invalidate();
}
});
// if someone calls setChecked() from code. We need only user interaction.
mIsBookmarked.setOnClickListener(this);
mEditBtn = (ImageButton) mPreviewGroup.findViewById(R.id.btn_edit_title);
// Place Page
mPlacePageContainer = (ScrollView) mPlacePageGroup.findViewById(R.id.place_page_container);
mBookmarkManager = BookmarkManager.getBookmarkManager();
mIcons = mBookmarkManager.getIcons();
initGestureDetector();
mView.setOnClickListener(this);
}
public MapInfoView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
public MapInfoView(Context context)
{
this(context, null, 0);
}
private void initGestureDetector()
{
// Gestures
mGestureDetector = new GestureDetectorCompat(getContext(), new GestureDetector.SimpleOnGestureListener()
{
@ -156,22 +176,6 @@ public class MapInfoView extends LinearLayout
return true;
}
});
mView.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) { /* Friggin system does not work without this stub.*/ }
});
}
public MapInfoView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
public MapInfoView(Context context)
{
this(context, null, 0);
}
@Override
@ -237,7 +241,6 @@ public class MapInfoView extends LinearLayout
if (show)
{
slide = generateSlideAnimation(0, 0, -1, 0);
slide.setDuration(SHORT_ANIM_DURATION);
UiUtils.show(mPreviewGroup);
slide.setAnimationListener(new SimpleAnimationListener()
{
@ -252,8 +255,6 @@ public class MapInfoView extends LinearLayout
else
{
slide = generateSlideAnimation(0, 0, 0, -1);
slide.setDuration(SHORT_ANIM_DURATION);
slide.setAnimationListener(new SimpleAnimationListener()
{
@Override
@ -265,11 +266,12 @@ public class MapInfoView extends LinearLayout
}
});
}
slide.setDuration(SHORT_ANIM_DURATION);
mPreviewGroup.startAnimation(slide);
mIsPreviewVisible = show;
}
private void slideEverytingOut()
private void hideEverything()
{
final TranslateAnimation slideDown = generateSlideAnimation(0, 0, 0, -1);
slideDown.setDuration(LONG_ANIM_DURATION);
@ -295,14 +297,6 @@ public class MapInfoView extends LinearLayout
mView.startAnimation(slideDown);
}
private void setTextAndShow(final CharSequence title, final CharSequence subtitle)
{
mTitle.setText(title);
mSubtitle.setText(subtitle);
showPreview(true);
}
public State getState()
{
return mCurrentState;
@ -322,7 +316,7 @@ public class MapInfoView extends LinearLayout
else if (mCurrentState == State.FULL_PLACEPAGE && state == State.PREVIEW_ONLY)
showPlacePage(false);
else if (mCurrentState == State.FULL_PLACEPAGE && state == State.HIDDEN)
slideEverytingOut();
hideEverything();
else
throw new IllegalStateException(String.format("Invalid transition %s - > %s", mCurrentState, state));
@ -330,7 +324,7 @@ public class MapInfoView extends LinearLayout
}
}
public boolean hasThatObject(MapObject mo)
public boolean hasMapObject(MapObject mo)
{
if (mo == null && mMapObject == null)
return true;
@ -342,27 +336,25 @@ public class MapInfoView extends LinearLayout
public void setMapObject(MapObject mo)
{
if (!hasThatObject(mo))
if (!hasMapObject(mo))
{
mMapObject = mo;
if (mo != null)
if (mMapObject != null)
{
mo.setDefaultIfEmpty(getResources());
setTextAndShow(mo.getName(), mo.getPoiTypeName());
mMapObject.setDefaultIfEmpty(getResources());
boolean isChecked = false;
switch (mo.getType())
switch (mMapObject.getType())
{
case POI:
fillPlacePagePoi(mo);
fillPlacePagePoi(mMapObject);
break;
case BOOKMARK:
isChecked = true;
fillPlacePageBookmark((Bookmark) mo);
fillPlacePageBookmark((Bookmark) mMapObject);
break;
case ADDITIONAL_LAYER:
fillPlacePageLayer((SearchResult) mo);
fillPlacePageLayer((SearchResult) mMapObject);
break;
case API_POINT:
fillPlacePageApi(mo);
@ -373,6 +365,7 @@ public class MapInfoView extends LinearLayout
mIsBookmarked.setChecked(isChecked);
setUpPreview();
setUpAddressBox();
setUpGeoInformation();
setUpBottomButtons();
@ -384,38 +377,32 @@ public class MapInfoView extends LinearLayout
requestLayout();
}
private void setUpBottomButtons()
private void setUpPreview()
{
mPlacePageGroup.findViewById(R.id.info_box_share).setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
ShareAction.getAnyShare().shareMapObject((Activity) getContext(), mMapObject);
}
});
final View editBtn = mPlacePageGroup.findViewById(R.id.info_box_edit);
final TextView returnToCallerTv = (TextView) mPlacePageGroup.findViewById(R.id.info_box_back_to_caller);
UiUtils.hide(editBtn);
UiUtils.hide(returnToCallerTv);
mTitle.setText(mMapObject.getName());
mSubtitle.setText(mMapObject.getPoiTypeName());
if (mMapObject.getType() == MapObjectType.BOOKMARK)
{
// BOOKMARK
final Bookmark bmk = (Bookmark) mMapObject;
editBtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
BookmarkActivity.startWithBookmark(getContext(), bmk.getCategoryId(), bmk.getBookmarkId());
}
});
UiUtils.show(editBtn);
mEditBtn.setOnClickListener(this);
UiUtils.show(mEditBtn);
}
else if (mMapObject.getType() == MapObjectType.API_POINT)
else
{
UiUtils.hide(mEditBtn);
}
showPreview(true);
}
private void setUpBottomButtons()
{
mPlacePageGroup.findViewById(R.id.info_box_share).setOnClickListener(this);
final TextView returnToCallerTv = (TextView) mPlacePageGroup.findViewById(R.id.info_box_back_to_caller);
UiUtils.hide(returnToCallerTv);
if (mMapObject.getType() == MapObjectType.API_POINT)
{
// API
final ParsedMmwRequest r = ParsedMmwRequest.getCurrentRequest();
@ -437,20 +424,13 @@ public class MapInfoView extends LinearLayout
UiUtils.show(returnToCallerTv);
returnToCallerTv.setText(ss, BufferType.SPANNABLE);
returnToCallerTv.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
ParsedMmwRequest.getCurrentRequest().sendResponseAndFinish((Activity) getContext(), true);
}
});
returnToCallerTv.setOnClickListener(this);
}
}
private void setUpGeoInformation()
{
mGeoLayout = (LinearLayout) mPlacePageContainer.findViewById(R.id.info_box_geo_ref);
mGeoLayout = (RelativeLayout) mPlacePageContainer.findViewById(R.id.info_box_geo_ref);
mDistanceView = mGeoLayout.findViewById(R.id.info_box_geo_container_dist);
mDistanceText = (TextView) mGeoLayout.findViewById(R.id.info_box_geo_distance);
@ -458,16 +438,16 @@ public class MapInfoView extends LinearLayout
updateDistance(lastKnown);
final TextView coord = (TextView) mGeoLayout.findViewById(R.id.info_box_geo_location);
final double lat = mMapObject.getLat();
final double lon = mMapObject.getLon();
coord.setText(UiUtils.formatLatLon(lat, lon));
// Context menu for the coordinates copying.
if (Utils.apiEqualOrGreaterThan(11))
if (Utils.apiEqualOrGreaterThan(Build.VERSION_CODES.HONEYCOMB))
{
coord.setOnLongClickListener(new OnLongClickListener()
{
@SuppressLint("NewApi")
@Override
public boolean onLongClick(View v)
{
@ -538,6 +518,7 @@ public class MapInfoView extends LinearLayout
{
mPlacePageContainer.removeAllViews();
final View bmkView = mInflater.inflate(R.layout.info_box_bookmark, null);
bmkView.setOnClickListener(this);
// Description of BMK
final WebView descritionWv = (WebView) bmkView.findViewById(R.id.info_box_bookmark_descr);
@ -552,6 +533,11 @@ public class MapInfoView extends LinearLayout
UiUtils.show(descritionWv);
}
mColorImage = (ImageView) bmkView.findViewById(R.id.color_image);
mColorImage.setOnClickListener(this);
mColorImage.setVisibility(View.VISIBLE);
updateColorChooser(bmk.getIcon());
mPlacePageContainer.addView(bmkView);
}
@ -624,16 +610,13 @@ public class MapInfoView extends LinearLayout
if (mMapObject.getType() == MapObjectType.BOOKMARK)
{
final Bookmark bmk = (Bookmark) mMapObject;
final BookmarkManager bm = BookmarkManager.getBookmarkManager();
// Was bookmark deleted?
boolean deleted = false;
if (bm.getCategoriesCount() <= bmk.getCategoryId())
if (mBookmarkManager.getCategoriesCount() <= bmk.getCategoryId())
deleted = true;
else if (bm.getCategoryById(bmk.getCategoryId()).getBookmarksCount() <= bmk.getBookmarkId())
else if (mBookmarkManager.getCategoryById(bmk.getCategoryId()).getBookmarksCount() <= bmk.getBookmarkId())
deleted = true;
else if (bm.getBookmark(bmk.getCategoryId(), bmk.getBookmarkId()).getLat() != bmk.getLat())
else if (mBookmarkManager.getBookmark(bmk.getCategoryId(), bmk.getBookmarkId()).getLat() != bmk.getLat())
deleted = true;
// We can do check above, because lat/lon cannot be changed from edit screen.
@ -647,13 +630,67 @@ public class MapInfoView extends LinearLayout
else
{
// Update data for current bookmark
final Bookmark updatedBmk = bm.getBookmark(bmk.getCategoryId(), bmk.getBookmarkId());
final Bookmark updatedBmk = mBookmarkManager.getBookmark(bmk.getCategoryId(), bmk.getBookmarkId());
setMapObject(null);
setMapObject(updatedBmk);
}
}
}
private void showColorChooser()
{
final IconsAdapter adapter = new IconsAdapter(getContext(), mIcons);
final Icon icon = ((Bookmark) mMapObject).getIcon();
adapter.chooseItem(mIcons.indexOf(icon));
final ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
final int padSide = (int) getResources().getDimension(R.dimen.dp_x_8);
final int padTopB = (int) getResources().getDimension(R.dimen.dp_x_6);
final GridView gView = new GridView(getContext());
gView.setAdapter(adapter);
gView.setNumColumns(COLOR_CHOOSER_COLUMN_NUM);
gView.setGravity(Gravity.CENTER);
gView.setPadding(padSide, padTopB, padSide, padTopB);
gView.setLayoutParams(params);
gView.setSelector(new ColorDrawable(Color.TRANSPARENT));
final Dialog dialog = new AlertDialog.Builder(getContext())
.setTitle(R.string.bookmark_color)
.setView(gView)
.create();
gView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View who, int pos, long id)
{
Icon icon = mIcons.get(pos);
Bookmark bmk = (Bookmark) mMapObject;
bmk.setParams(bmk.getName(), icon, bmk.getBookmarkDescription());
bmk = mBookmarkManager.getBookmark(bmk.getCategoryId(), bmk.getBookmarkId());
setMapObject(bmk);
dialog.dismiss();
}
});
dialog.show();
}
private void updateColorChooser(Icon icon)
{
final Icon oldIcon = ((Bookmark) mMapObject).getIcon();
final String from = oldIcon.getName();
final String to = icon.getName();
if (!TextUtils.equals(from, to))
{
Statistics.INSTANCE.trackColorChanged(getContext(), from, to);
}
mColorImage.setImageDrawable(UiUtils
.drawCircleForPin(to, (int) getResources().getDimension(R.dimen.dp_x_6), getResources()));
}
private TranslateAnimation generateSlideAnimation(float fromX, float toX, float fromY, float toY)
{
return new TranslateAnimation(
@ -663,6 +700,45 @@ public class MapInfoView extends LinearLayout
Animation.RELATIVE_TO_SELF, toY);
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.color_image:
showColorChooser();
break;
case R.id.info_box_is_bookmarked:
if (mMapObject.getType() == MapObjectType.BOOKMARK)
{
final MapObject p = new Poi(mMapObject.getName(), mMapObject.getLat(), mMapObject.getLon(), null);
mBookmarkManager.deleteBookmark((Bookmark) mMapObject);
setMapObject(p);
}
else
{
final Bookmark newBmk = mBookmarkManager.getBookmark(mBookmarkManager.addNewBookmark(
mMapObject.getName(), mMapObject.getLat(), mMapObject.getLon()));
setMapObject(newBmk);
}
Framework.invalidate();
break;
case R.id.info_box:
/* Friggin system does not work without this stub.*/
break;
case R.id.info_box_share:
ShareAction.getAnyShare().shareMapObject((Activity) getContext(), mMapObject);
break;
case R.id.info_box_back_to_caller:
ParsedMmwRequest.getCurrentRequest().sendResponseAndFinish((Activity) getContext(), true);
case R.id.btn_edit_title:
Bookmark bmk = (Bookmark) mMapObject;
BookmarkActivity.startWithBookmark(getContext(), bmk.getCategoryId(), bmk.getBookmarkId());
default:
break;
}
}
public static enum State
{
HIDDEN,