|
@@ -87,91 +87,7 @@ |
87 |
87 |
|
private Fragment full; |
88 |
88 |
|
private int typelocale = -1; |
89 |
89 |
|
private boolean isInFront; |
90 |
|
- |
|
91 |
|
- |
public static void expand(final LinearLayout v) { |
92 |
|
- |
|
93 |
|
- |
v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
94 |
|
- |
|
95 |
|
- |
|
96 |
|
- |
final int targetHeight = v.getMeasuredHeight() + a.findViewById(R.id.map).getHeight() - 88; |
97 |
|
- |
|
98 |
|
- |
a.findViewById(R.id.map).setLayoutParams(new android.widget.LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, a.findViewById(R.id.map).getHeight())); |
99 |
|
- |
|
100 |
|
- |
v.setVisibility(View.VISIBLE); |
101 |
|
- |
Animation a = new Animation() { |
102 |
|
- |
float h = 0; |
103 |
|
- |
|
104 |
|
- |
@Override |
105 |
|
- |
protected void applyTransformation(float interpolatedTime, Transformation t) { |
106 |
|
- |
if (h == 0) { |
107 |
|
- |
h = v.getLayoutParams().height; |
108 |
|
- |
} |
109 |
|
- |
float sottrae = (h - targetHeight) * interpolatedTime; |
110 |
|
- |
v.getLayoutParams().height = (int) (h - sottrae); |
111 |
|
- |
if (interpolatedTime == 1f) { |
112 |
|
- |
v.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); |
113 |
|
- |
} |
114 |
|
- |
v.requestLayout(); |
115 |
|
- |
Log.e("h", String.valueOf(v.getHeight())); |
116 |
|
- |
} |
117 |
|
- |
|
118 |
|
- |
@Override |
119 |
|
- |
public boolean willChangeBounds() { |
120 |
|
- |
return true; |
121 |
|
- |
} |
122 |
|
- |
}; |
123 |
|
- |
|
124 |
|
- |
// 1dp/ms |
125 |
|
- |
a.setDuration((int) ((v.getLayoutParams().height - targetHeight) / v.getContext().getResources().getDisplayMetrics().density) * 4); |
126 |
|
- |
v.startAnimation(a); |
127 |
|
- |
} |
128 |
|
- |
|
129 |
|
- |
public static void collapse(final View v) { |
130 |
|
- |
|
131 |
|
- |
|
132 |
|
- |
final int targetHeight = a.getWindowManager().getDefaultDisplay().getHeight() - 100; |
133 |
|
- |
final int h = v.getHeight(); |
134 |
|
- |
final float coef = targetHeight - h; |
135 |
|
- |
|
136 |
|
- |
v.setVisibility(View.VISIBLE); |
137 |
|
- |
Animation a1 = new Animation() { |
138 |
|
- |
|
139 |
|
- |
@Override |
140 |
|
- |
protected void applyTransformation(float interpolatedTime, Transformation t) { |
141 |
|
- |
|
142 |
|
- |
v.getLayoutParams().height = (int) (h + (coef * interpolatedTime)); |
143 |
|
- |
if (interpolatedTime == 1f) { |
144 |
|
- |
v.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, a.getWindowManager().getDefaultDisplay().getHeight() - 100)); |
145 |
|
- |
} |
146 |
|
- |
v.requestLayout(); |
147 |
|
- |
|
148 |
|
- |
} |
149 |
|
- |
|
150 |
|
- |
@Override |
151 |
|
- |
public boolean willChangeBounds() { |
152 |
|
- |
return true; |
153 |
|
- |
} |
154 |
|
- |
}; |
155 |
|
- |
|
156 |
|
- |
// 1dp/ms |
157 |
|
- |
a1.setDuration((int) ((targetHeight - h) / v.getContext().getResources().getDisplayMetrics().density) * 4); |
158 |
|
- |
v.startAnimation(a1); |
159 |
|
- |
} |
160 |
|
- |
|
161 |
|
- |
public static float distFrom(double lat1, double lng1, double lat2, double lng2) { |
162 |
|
- |
double earthRadius = 3958.75; |
163 |
|
- |
double dLat = Math.toRadians(lat2 - lat1); |
164 |
|
- |
double dLng = Math.toRadians(lng2 - lng1); |
165 |
|
- |
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + |
166 |
|
- |
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * |
167 |
|
- |
Math.sin(dLng / 2) * Math.sin(dLng / 2); |
168 |
|
- |
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); |
169 |
|
- |
double dist = earthRadius * c; |
170 |
|
- |
|
171 |
|
- |
int meterConversion = 1609; |
172 |
|
- |
|
173 |
|
- |
return new Float(dist * meterConversion).floatValue(); |
174 |
|
- |
} |
|
90 |
+ |
private LinearLayout localeContainer; |
175 |
91 |
|
|
176 |
92 |
|
@Override |
177 |
93 |
|
public void onResume() { |
|
@@ -190,7 +106,10 @@ |
190 |
106 |
|
super.onCreate(savedInstanceState); |
191 |
107 |
|
setContentView(R.layout.activity_map); |
192 |
108 |
|
|
193 |
|
- |
(findViewById(R.id.smallinfo)).setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, getWindowManager().getDefaultDisplay().getHeight() - 100)); |
|
109 |
+ |
localeContainer = (LinearLayout) findViewById(R.id.locale_container); |
|
110 |
+ |
localeContainer.setVisibility(View.GONE); |
|
111 |
+ |
|
|
112 |
+ |
findViewById(R.id.smallinfo).setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, getWindowManager().getDefaultDisplay().getHeight() - 100)); |
194 |
113 |
|
findViewById(R.id.map).setLayoutParams(new android.widget.LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (getWindowManager().getDefaultDisplay().getHeight() - 100 - findViewById(R.id.button12).getHeight()) / 2)); |
195 |
114 |
|
|
196 |
115 |
|
final EditText addressView = (EditText) findViewById(R.id.editText6); |
|
@@ -200,8 +119,6 @@ |
200 |
119 |
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |
201 |
120 |
|
String input; |
202 |
121 |
|
if (actionId == EditorInfo.IME_ACTION_DONE) { |
203 |
|
- |
|
204 |
|
- |
|
205 |
122 |
|
new Thread(new Runnable() { |
206 |
123 |
|
public void run() { |
207 |
124 |
|
JSONObject obj = new JSONObject(); |
|
@@ -347,6 +264,91 @@ |
347 |
264 |
|
Log.e("sdsdsdsdsdsds", "end"); |
348 |
265 |
|
} |
349 |
266 |
|
|
|
267 |
+ |
public static void expand(final LinearLayout v) { |
|
268 |
+ |
|
|
269 |
+ |
v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
|
270 |
+ |
|
|
271 |
+ |
|
|
272 |
+ |
final int targetHeight = v.getMeasuredHeight() + a.findViewById(R.id.map).getHeight() - 88; |
|
273 |
+ |
|
|
274 |
+ |
a.findViewById(R.id.map).setLayoutParams(new android.widget.LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, a.findViewById(R.id.map).getHeight())); |
|
275 |
+ |
|
|
276 |
+ |
v.setVisibility(View.VISIBLE); |
|
277 |
+ |
Animation a = new Animation() { |
|
278 |
+ |
float h = 0; |
|
279 |
+ |
|
|
280 |
+ |
@Override |
|
281 |
+ |
protected void applyTransformation(float interpolatedTime, Transformation t) { |
|
282 |
+ |
if (h == 0) { |
|
283 |
+ |
h = v.getLayoutParams().height; |
|
284 |
+ |
} |
|
285 |
+ |
float sottrae = (h - targetHeight) * interpolatedTime; |
|
286 |
+ |
v.getLayoutParams().height = (int) (h - sottrae); |
|
287 |
+ |
if (interpolatedTime == 1f) { |
|
288 |
+ |
v.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); |
|
289 |
+ |
} |
|
290 |
+ |
v.requestLayout(); |
|
291 |
+ |
Log.e("h", String.valueOf(v.getHeight())); |
|
292 |
+ |
} |
|
293 |
+ |
|
|
294 |
+ |
@Override |
|
295 |
+ |
public boolean willChangeBounds() { |
|
296 |
+ |
return true; |
|
297 |
+ |
} |
|
298 |
+ |
}; |
|
299 |
+ |
|
|
300 |
+ |
// 1dp/ms |
|
301 |
+ |
a.setDuration((int) ((v.getLayoutParams().height - targetHeight) / v.getContext().getResources().getDisplayMetrics().density) * 4); |
|
302 |
+ |
v.startAnimation(a); |
|
303 |
+ |
} |
|
304 |
+ |
|
|
305 |
+ |
public static void collapse(final View v) { |
|
306 |
+ |
|
|
307 |
+ |
|
|
308 |
+ |
final int targetHeight = a.getWindowManager().getDefaultDisplay().getHeight() - 100; |
|
309 |
+ |
final int h = v.getHeight(); |
|
310 |
+ |
final float coef = targetHeight - h; |
|
311 |
+ |
|
|
312 |
+ |
v.setVisibility(View.VISIBLE); |
|
313 |
+ |
Animation a1 = new Animation() { |
|
314 |
+ |
|
|
315 |
+ |
@Override |
|
316 |
+ |
protected void applyTransformation(float interpolatedTime, Transformation t) { |
|
317 |
+ |
|
|
318 |
+ |
v.getLayoutParams().height = (int) (h + (coef * interpolatedTime)); |
|
319 |
+ |
if (interpolatedTime == 1f) { |
|
320 |
+ |
v.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, a.getWindowManager().getDefaultDisplay().getHeight() - 100)); |
|
321 |
+ |
} |
|
322 |
+ |
v.requestLayout(); |
|
323 |
+ |
|
|
324 |
+ |
} |
|
325 |
+ |
|
|
326 |
+ |
@Override |
|
327 |
+ |
public boolean willChangeBounds() { |
|
328 |
+ |
return true; |
|
329 |
+ |
} |
|
330 |
+ |
}; |
|
331 |
+ |
|
|
332 |
+ |
// 1dp/ms |
|
333 |
+ |
a1.setDuration((int) ((targetHeight - h) / v.getContext().getResources().getDisplayMetrics().density) * 4); |
|
334 |
+ |
v.startAnimation(a1); |
|
335 |
+ |
} |
|
336 |
+ |
|
|
337 |
+ |
public static float distFrom(double lat1, double lng1, double lat2, double lng2) { |
|
338 |
+ |
double earthRadius = 3958.75; |
|
339 |
+ |
double dLat = Math.toRadians(lat2 - lat1); |
|
340 |
+ |
double dLng = Math.toRadians(lng2 - lng1); |
|
341 |
+ |
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + |
|
342 |
+ |
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * |
|
343 |
+ |
Math.sin(dLng / 2) * Math.sin(dLng / 2); |
|
344 |
+ |
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); |
|
345 |
+ |
double dist = earthRadius * c; |
|
346 |
+ |
|
|
347 |
+ |
int meterConversion = 1609; |
|
348 |
+ |
|
|
349 |
+ |
return new Float(dist * meterConversion).floatValue(); |
|
350 |
+ |
} |
|
351 |
+ |
|
350 |
352 |
|
private void putLocalsOnMap() { |
351 |
353 |
|
new Thread(new Runnable() { |
352 |
354 |
|
|