From 89186bd2b32b72e9e3409e03a916871ac98b2efe Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 10 Sep 2015 16:50:47 +0300 Subject: [PATCH] Resources fix --- .../bg_contextmenu_dots_light.png | Bin 1819 -> 0 bytes .../bg_contextmenu_dots_light.png | Bin 1540 -> 0 bytes .../bg_contextmenu_dots_light.png | Bin 2205 -> 0 bytes .../bg_contextmenu_dots_light.png | Bin 2875 -> 0 bytes .../res/drawable/bg_map_context_menu_dark.xml | 2 +- .../drawable/bg_map_context_menu_light.xml | 2 +- .../res/layout/map_context_menu_fragment.xml | 288 +++++++++--------- .../MapContextMenuFragment.java | 53 +++- .../sections/AmenityInfoMenuBuilder.java | 31 +- 9 files changed, 211 insertions(+), 165 deletions(-) delete mode 100644 OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_light.png delete mode 100644 OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_light.png delete mode 100644 OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_light.png delete mode 100644 OsmAnd/res/drawable-xxhdpi/bg_contextmenu_dots_light.png diff --git a/OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_light.png b/OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_light.png deleted file mode 100644 index d60203624a83975bf74d5083adcd6b13e08f266e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1819 zcmbVNX;2eq7)}vHQLII40WDn?2Ms03Ca_615ab95NDxDSh>C8K4FpIwCW{G|O7SRy zR=hx&TCh4?j-_}YQl*TDqksbyhzF>EQ;?CXwxCt88wA@Qjz79HyZgQ0_dM_Y?q-FB zuC}(ax1vxe)$G_wx$g`!e2s!;|fBLYB7qB9G7B1kP3~(L>MYh z-g*o3q)=vUQ;H>oL>R)8;VL?6!q5#W4aufZJXaYss4M{^04Wx$RP({%npzN0%K2av zEQEv_KP*len4-nPQ$oeElmrDC!8n4@@E8oeUQgG%(Q$1ogNYyr17a~)EE5|n1YM`lgPBR(=m`s9R z$|$8;j_Y+)Q<>gHEx@$OZJ0bji>rXCJoA(v@PWfYWo$&orIE2>Gz@WvX;KzS_7>vK zWkT*;h$F?oX}Xtd=>qNq3@Ip$VNkVw%GWI?R2783zsI!{EXItNmfR9Y3hjA6<6=N zS?>0>gN^2Ev78IK#okFLpB%J+5?@S|<+-jwtt^Bng*fBceW(Spn9G}Y`eE8jhRv!q zn3e74GP>1YHRagXhMlv~(Y9|@NAwY8vQIoLoy^96-e6GYxtN=wqYWN$JHw7<$5cX+ zXyL+p_4#*^{H444l1ssW$sX#KmgL~%ds5@3)4y>GofqZLwGJNv5}zI!HvhCGBn-6c z9eo*nF*@CLe}LPey>rFWmbsSKhXD6jw{pdWRG z9LgM_duLTm%~BruMOa{NHXc>F$$o#p<9#=Je6Gg4ElTI#eN)xFs4)0Oys`Z_^Vj=S zp`{|Frps%=ZeNe`dkG8nUjM0}pulqWWjD&fJ^G^Goti5A4rK1jd=+xGJwCPEYQF@s z?Q~@3Q}^C(ukfwtqz$(1S*f|wb76B35a$>1$LN4fmL@u*DeF|p zX2t-*v9zn+I0R?4HaAe_ZHcT)a9&f{8@NB9w{>i6EOp3!!}b8tH9uK)@ zv9G2jNJ3Q)T&@}0<&idS*}ESuD=t6xaB%yv<<#ab;4oJ0kbT2J0#DRW b&VeY272>G8Q}SBV?<&YYRB+CB%Qyc3@{h%s diff --git a/OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_light.png b/OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_light.png deleted file mode 100644 index 30c1b4078fc64cfb72acfdf0dbea680db2f07802..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1540 zcmbVMZA=qq96!Lo#=A1H9n73pbuzeK@7im7C$(S;wuu#o7)r7aT<@O3S$bEmCoRk< z>Qn?bHrYf+#Mfw|3$a@?x{-kr7-l56`7&d&IHQbYbD0j!e1%<+x_vNy*d=$*^M9WI z@ArSd9V=HXOG|z;8G@iRr^8;ZtOn(s`C6j#-KB05ltnFjVPaqDeiiBjD)=QLIUv zmoB%LPTNu>3sNh~0UEDECi<$rKAiCGXV_O>M*}Q8rPI|P%a1my75x&U`0a! zVC5hvu9H}$9$rlhtmN+1hN6m!H*}fAD@9@I>>|6)4+Pn1w;;-mmg6~^F#^(SHj}8C zWQ{0kG*Bo7a3kvF2ror=j1=L;V>~azmzYh2$&441CLM|6C1kNpZ?Y@pup5gB8%dEd ztWyZejKG4JZChPjUUf{$~FfUrB z=TX~%#Mc9^R1*F0RGw-6B|cCr%a}N`0X1-x2i0>16G{Jw`9<>cllnn(7W)yDOx%a@HnXO6us9H6VG%&+5u(VIV z+_6XfVQCw_W+BeCJuNxRs7@SnH{VT7xtvwtsH^KbRDY+hFz)=u1FAu9-)LSoQrO?J zjhV|H+H~ww7Ays;WL~YHFIDpMPSJrRB_x-i^Hz zcW?Gby1TniZ%vuA#Flc#THBE9dw00`)1IO(CdreYlaq6B^!pC6x~8U5)%^A7*vS42 zM59UgD3|&xedt--tj&Yj1?uybZFlC~9?tkXH8a??IMiKSTDq_i&L4ietgC<|h&2$= zd$=L_>`7?xTx##Z@6u~*wk_T5?W?jh8qKAm#^#QW%FgZE$Dquff%2V`%gUsoNPpsZ zs$zWPl<%kP@q72wSzq40a-uR-yzwo_%+B^^W@R02$)z7Yymw2zdi51IJf3ejS`@jT zLhasj@wZuATjYzXuLe6*BTapsCQ&u<>`796?y1`s$yK(-qoL2B*dRht2}kCdH2R&ww@bko#R`uV1Yi7 zZGHS`d`y4;!Gq4o?DT8I<4OL~(L9I4F+c69Hh#ztn>@b9I#1rsYjdp|da~VP=Cofo rWSkVPqxtzciRc^E4}P#VK?%_Kxu4UI{NBGc`d@aItgv@4t={|(v(qXC diff --git a/OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_light.png b/OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_light.png deleted file mode 100644 index 39172fcc3c4e381eb89c9e632d6eea917d782abe..0000000000000000000000000000000000000000 GIT binary patch literal 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U3 zj(C0P_A8!R{^ijJBO~8!Ba_LI3D(Tu;qqmHZ|^!q1dp)U`U#QG>pc-l^xR97;Wb)zX7q{0;)3bv=?}*HA1Rpqc77t)CBrwi z6`a^Kdi(9*kZf@D+KVUAlE#jf08%W%7NdegE04y1ti;@_A`p-EtX`yCmLmveDMBYF zrz#is>(VnXmmamEQxEnC-(27xP{yLsuN+Kvdal+dA;2kZ_p`IJ*%Rwo@<-Jd*KFx@ zx{jiFNv;>xi`*_ECV!PJ-(S9vnwlEq;LsZDvhR9p&vGDcq-nCszstw?&jUt=hSsJq z*n;=otuZ~ly(&W^BQa8KGZTKk#+i>VewWsup4M(dDeXvWs?*igt>m?y`l-eJ{N+aB z{BWAAtSqP0Ys$?84*w`-4itykzI~pm@L|29QCbOf( - + diff --git a/OsmAnd/res/drawable/bg_map_context_menu_light.xml b/OsmAnd/res/drawable/bg_map_context_menu_light.xml index f980150e47..dd3d7d2a98 100644 --- a/OsmAnd/res/drawable/bg_map_context_menu_light.xml +++ b/OsmAnd/res/drawable/bg_map_context_menu_light.xml @@ -1,7 +1,7 @@ - + diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml index de57a3aefc..e3d7f07cea 100644 --- a/OsmAnd/res/layout/map_context_menu_fragment.xml +++ b/OsmAnd/res/layout/map_context_menu_fragment.xml @@ -1,10 +1,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="?attr/bg_map_context_menu" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:baselineAligned="false" + android:orientation="horizontal"> + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + @@ -169,14 +185,8 @@ android:id="@+id/context_menu_bottom_view" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:background="?attr/ctx_menu_info_view_bg"> - - - + android:background="?attr/ctx_menu_info_view_bg" + android:orientation="vertical"> diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index a1e91534c0..3e1682094a 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -25,6 +25,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.sections.MenuController; +import net.osmand.plus.views.OsmandMapTileView; import org.apache.commons.logging.Log; @@ -45,6 +46,7 @@ public class MapContextMenuFragment extends Fragment { MenuController menuController; private int menuTopHeight; + private int menuTopShadowHeight; private int menuButtonsHeight; private int menuBottomViewHeight; private int menuFullHeight; @@ -97,6 +99,7 @@ public class MapContextMenuFragment extends Fragment { public void onGlobalLayout() { menuTopHeight = view.findViewById(R.id.context_menu_top_view).getHeight(); + menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight(); menuButtonsHeight = view.findViewById(R.id.context_menu_buttons).getHeight(); menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight(); menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight(); @@ -130,11 +133,9 @@ public class MapContextMenuFragment extends Fragment { } }); - View topView = view.findViewById(R.id.context_menu_top_view); mainView = view.findViewById(R.id.context_menu_main); - topView.setOnTouchListener(new View.OnTouchListener() { - + View.OnTouchListener slideTouchListener = new View.OnTouchListener() { private float dy; private float dyMain; private int destinationState; @@ -144,11 +145,29 @@ public class MapContextMenuFragment extends Fragment { private float velocityY; + private float startX; + private float startY; + private long lastTouchDown; + private final int CLICK_ACTION_THRESHHOLD = 200; + + private boolean isClick(float endX, float endY) { + float differenceX = Math.abs(startX - endX); + float differenceY = Math.abs(startY - endY); + if (differenceX > 3 || differenceY > 3 || System.currentTimeMillis() - lastTouchDown > CLICK_ACTION_THRESHHOLD) { + return false; + } + return true; + } + @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: + startX = event.getX(); + startY = event.getY(); + lastTouchDown = System.currentTimeMillis(); + dy = event.getY(); dyMain = mainView.getY(); velocity = VelocityTracker.obtain(); @@ -177,6 +196,8 @@ public class MapContextMenuFragment extends Fragment { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: + float endX = event.getX(); + float endY = event.getY(); slidingUp = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) < -50; slidingDown = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) > 50; @@ -203,7 +224,7 @@ public class MapContextMenuFragment extends Fragment { posY = view.getHeight() - menuFullHeight; break; case MenuController.MenuState.FULL_SCREEN: - posY = 0; + posY = -menuTopShadowHeight; break; default: break; @@ -222,20 +243,24 @@ public class MapContextMenuFragment extends Fragment { bottomBorder.animate().y(posY + menuFullHeight).setDuration(200).setInterpolator(new DecelerateInterpolator()).start(); } - - /* - lp = shadowView.getLayoutParams(); - lp.height = view.getHeight() - (int)posY; - shadowView.setLayoutParams(lp); - shadowView.requestLayout(); - */ + // OnClick event + if (isClick(endX, endY)) { + OsmandMapTileView mapView = getMapActivity().getMapView(); + mapView.getAnimatedDraggingThread().startMoving(getCtxMenu().getPointDescription().getLat(), getCtxMenu().getPointDescription().getLon(), + mapView.getZoom(), true); + } break; } return true; } - }); + }; + + View topView = view.findViewById(R.id.context_menu_top_view); + topView.setOnTouchListener(slideTouchListener); + View topShadowView = view.findViewById(R.id.context_menu_top_shadow); + topShadowView.setOnTouchListener(slideTouchListener); // Left icon IconsCache iconsCache = getMyApplication().getIconsCache(); @@ -357,7 +382,7 @@ public class MapContextMenuFragment extends Fragment { break; case MenuController.MenuState.FULL_SCREEN: shadowViewHeight = 0; - bottomBorderHeight = view.getHeight() - menuFullHeight; + bottomBorderHeight = view.getHeight() - menuFullHeight + menuTopShadowHeight; break; default: break; @@ -376,6 +401,8 @@ public class MapContextMenuFragment extends Fragment { lp.height = menuFullHeight; mainView.setLayoutParams(lp); + mainView.bringToFront(); + } public void dismissMenu() { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/sections/AmenityInfoMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/sections/AmenityInfoMenuBuilder.java index 0d2e04e57b..1ee0b9044e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/sections/AmenityInfoMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/sections/AmenityInfoMenuBuilder.java @@ -26,6 +26,8 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP; public class AmenityInfoMenuBuilder extends MenuBuilder { + private static float SHADOW_HEIGHT = 6f; // in dp + private final Amenity amenity; public AmenityInfoMenuBuilder(OsmandApplication app, final Amenity amenity) { @@ -33,7 +35,7 @@ public class AmenityInfoMenuBuilder extends MenuBuilder { this.amenity = amenity; } - private void buildRow(View view, int iconId, String text) { + private void buildRow(View view, int iconId, String text, boolean firstRow) { boolean light = app.getSettings().isLightContent(); LinearLayout ll = new LinearLayout(view.getContext()); @@ -45,13 +47,13 @@ public class AmenityInfoMenuBuilder extends MenuBuilder { // Icon LinearLayout llIcon = new LinearLayout(view.getContext()); llIcon.setOrientation(LinearLayout.HORIZONTAL); - llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f))); + llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), firstRow ? dpToPx(48f) - dpToPx(SHADOW_HEIGHT) : dpToPx(48f))); llIcon.setGravity(Gravity.CENTER_VERTICAL); ll.addView(llIcon); ImageView icon = new ImageView(view.getContext()); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) ; - llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); + llIconParams.setMargins(dpToPx(16f), firstRow ? dpToPx(12f) - dpToPx(SHADOW_HEIGHT) : dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.gravity = Gravity.CENTER_VERTICAL; icon.setLayoutParams(llIconParams); icon.setScaleType(ImageView.ScaleType.CENTER); @@ -65,18 +67,22 @@ public class AmenityInfoMenuBuilder extends MenuBuilder { TextView textView = new TextView(view.getContext()); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f)); + llTextParams.setMargins(0, firstRow ? dpToPx(8f) - dpToPx(SHADOW_HEIGHT) : dpToPx(8f), 0, dpToPx(8f)); textView.setLayoutParams(llTextParams); - textView.setTextSize(18); // todo: create constant + textView.setTextSize(16); // todo: create constant textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); - SpannableString spannable = new SpannableString(text); - Linkify.addLinks(spannable, Linkify.ALL); - textView.setClickable(true); - textView.setMovementMethod(LinkMovementMethod.getInstance()); + //text = "http://ru.wikipedia.org/wiki/Храм Святого Розария (Владимир)"; + + //SpannableString spannable = new SpannableString(text); + //Linkify.addLinks(spannable, Linkify.ALL); + //textView.setClickable(true); + //textView.setMovementMethod(LinkMovementMethod.getInstance()); + textView.setAutoLinkMask(Linkify.ALL); + //textView.setSingleLine(); textView.setLinksClickable(true); - textView.setText(spannable); + textView.setText(text); //textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs "); LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); @@ -109,6 +115,8 @@ public class AmenityInfoMenuBuilder extends MenuBuilder { @Override public void build(View view) { + boolean firstRow = true; + MapPoiTypes poiTypes = app.getPoiTypes(); for(Map.Entry e : amenity.getAdditionalInfo().entrySet()) { int iconId; @@ -141,7 +149,8 @@ public class AmenityInfoMenuBuilder extends MenuBuilder { } } - buildRow(view, iconId, vl); + buildRow(view, iconId, vl, firstRow); + firstRow = false; } } }