Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.22 KB | None | 0 0
  1. Animation animation = new TranslateAnimation(
  2. MapLayout.getX(), MapLayout.getY(),MapLayout.getY(), text.getHeight()+edit.getHeight());
  3.  
  4. protected Animation animation;
  5. protected LinearLayout MapLayout;
  6. protected EditText edit;
  7. protected TextView text;
  8.  
  9. MapLayout = (LinearLayout)findViewById(R.id.MapLayout);
  10. edit = (EditText)findViewById(R.id.Recherche);
  11. text = (TextView)findViewById(R.id.CaptionRecherche);
  12. Toast.makeText(context, "Height: "+(edit.getHeight()+text.getHeight()), 1000).show();
  13. animation = new TranslateAnimation(MapLayout.getX(), MapLayout.getY(), MapLayout.getY(), text.getHeight()+edit.getHeight());
  14. animation.setDuration(1000);
  15. animation.setFillAfter(true);
  16. MapLayout.startAnimation(animation);
  17.  
  18. <android.support.v4.widget.DrawerLayout
  19. xmlns:android="http://schemas.android.com/apk/res/android"
  20. android:id="@+id/DrawerLayout"
  21. android:layout_width="match_parent"
  22. android:layout_height="match_parent"
  23. >
  24.  
  25. <include
  26. android:id="@+id/ContenuPrincipal"
  27. android:layout_width="fill_parent"
  28. android:layout_height="wrap_content"
  29. layout="@layout/activity_main_relative"
  30. />
  31. <!-- ListView... La liste des options du menu -->
  32. <ListView
  33. android:id="@+id/Menu"
  34. android:layout_width="250dp"
  35. android:layout_height="fill_parent"
  36. android:choiceMode="singleChoice"
  37. android:layout_gravity="start"
  38. android:background="#333"
  39. android:divider="#666"
  40. android:dividerHeight="1dp"
  41. android:paddingLeft="15dp"
  42. android:paddingRight="15dp"
  43. />
  44.  
  45. </android.support.v4.widget.DrawerLayout>
  46.  
  47. <?xml version="1.0" encoding="utf-8"?>
  48. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  49. android:layout_width="match_parent"
  50. android:layout_height="match_parent"
  51. android:background="#E8E8E8">
  52.  
  53. <!-- Champs de saisie pour effectuer la recherche: -->
  54.  
  55. <TextView
  56. android:id="@+id/CaptionRecherche"
  57. android:layout_width="wrap_content"
  58. android:layout_height="wrap_content"
  59. android:text="Entrer l'emplacement que vous cherchez: "
  60. android:textSize="20sp"
  61. android:layout_marginTop="7dp"
  62. android:layout_marginLeft="20dp"
  63. />
  64. <EditText
  65. android:id="@+id/Recherche"
  66. android:layout_width="250dp"
  67. android:layout_height="40dp"
  68. android:layout_alignParentLeft="true"
  69. android:layout_marginTop="10dp"
  70. android:hint="Salle, Deparetement..."
  71. android:layout_marginLeft="20dp"
  72. android:layout_marginBottom="20dp"
  73. android:maxLength="100"
  74. android:maxLines="1"
  75. android:layout_below="@id/CaptionRecherche"/>
  76.  
  77. <!-- La map: -->
  78. <LinearLayout
  79. android:id="@+id/MapLayout"
  80. android:layout_width="fill_parent"
  81. android:layout_height="fill_parent"
  82. >
  83.  
  84. <fragment
  85. android:id="@+id/map"
  86. android:name="com.google.android.gms.maps.MapFragment"
  87. android:layout_width="match_parent"
  88. android:layout_height="fill_parent"
  89. />
  90.  
  91. </LinearLayout>
  92. </RelativeLayout>
  93.  
  94. private int hiddenStatusHeight;
  95. private int currentStatusBarHeight;
  96.  
  97. private void getStatusBarHeight() {
  98. final ViewTreeObserver observer = hiddenStatus.getViewTreeObserver();
  99. observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
  100.  
  101. @SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override public void onGlobalLayout() {
  102.  
  103. hiddenStatus.measure(MeasureSpec.UNSPECIFIED,
  104. MeasureSpec.UNSPECIFIED);
  105. hiddenStatusHeight = hiddenStatus.getMeasuredHeight();
  106.  
  107. currentStatusBarHeight = statusBar.getHeight();
  108.  
  109. ViewTreeObserver obs = hiddenStatus.getViewTreeObserver();
  110.  
  111. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
  112. obs.removeOnGlobalLayoutListener(this);
  113. } else {
  114. obs.removeGlobalOnLayoutListener(this);
  115. }
  116. }
  117. });
  118. }
  119.  
  120. private OnClickListener ExpandClickListener = new OnClickListener() {
  121.  
  122. @Override public void onClick(View v) {
  123. boolean isExpanded = (Boolean) expandButton
  124. .getTag(R.id.TAG_EXPANDED);
  125. int originalHeight = (Integer) expandButton
  126. .getTag(R.id.TAG_ORIGINAL_HEIGHT);
  127.  
  128. if (isExpanded) {
  129. expandButton.setTag(R.id.TAG_EXPANDED, false);
  130. expandButton.setImageResource(R.drawable.ic_action_down);
  131. // statusBar.setLayoutParams(new FrameLayout.LayoutParams(
  132. // LayoutParams.MATCH_PARENT, originalHeight));
  133. Log.d(TAG, "Collapsing to " + originalHeight);
  134. ValueAnimator va = ValueAnimator.ofInt(currentStatusBarHeight,
  135. originalHeight);
  136. va.setDuration(500);
  137. va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  138. public void onAnimationUpdate(ValueAnimator animation) {
  139. Integer value = (Integer) animation.getAnimatedValue();
  140. statusBar.getLayoutParams().height = value.intValue();
  141. statusBar.requestLayout();
  142. }
  143. });
  144. va.start();
  145. } else {
  146. expandButton.setTag(R.id.TAG_EXPANDED, true);
  147. expandButton.setImageResource(R.drawable.ic_action_collapse);
  148. currentStatusBarHeight = originalHeight + hiddenStatusHeight;
  149. // statusBar.setLayoutParams(new FrameLayout.LayoutParams(
  150. // LayoutParams.MATCH_PARENT, currentStatusBarHeight + 15));
  151. Log.d(TAG, "Expanding to " + originalHeight + "+"
  152. + hiddenStatusHeight + "=" + currentStatusBarHeight);
  153. ValueAnimator va = ValueAnimator.ofInt(originalHeight,
  154. currentStatusBarHeight);
  155. va.setDuration(500);
  156. va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  157. public void onAnimationUpdate(ValueAnimator animation) {
  158. Integer value = (Integer) animation.getAnimatedValue();
  159. statusBar.getLayoutParams().height = value.intValue();
  160. statusBar.requestLayout();
  161. }
  162. });
  163. va.start();
  164. }
  165.  
  166. }
  167. };
  168.  
  169. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  170. android:id="@+id/frame"
  171. android:layout_width="match_parent"
  172. android:layout_height="match_parent" >
  173.  
  174. <ScrollView
  175. android:id="@+id/scrollview"
  176. android:layout_width="match_parent"
  177. android:layout_height="match_parent"
  178. android:layout_marginTop="70dp" >
  179.  
  180. <LinearLayout
  181. android:id="@+id/container"
  182. android:layout_width="match_parent"
  183. android:layout_height="wrap_content"
  184. android:animateLayoutChanges="true"
  185. android:orientation="vertical"
  186. android:paddingLeft="16dp"
  187. android:paddingRight="16dp"
  188. android:paddingTop="8dp"
  189. android:showDividers="middle" >
  190. </LinearLayout>
  191. </ScrollView>
  192.  
  193. <RelativeLayout
  194. android:id="@+id/displayStatusBar"
  195. style="@style/DisplayStatusBar"
  196. android:layout_width="match_parent"
  197. android:layout_height="65dp" >
  198.  
  199. <RelativeLayout
  200. android:id="@+id/status_always_visible"
  201. style="@style/StatusBar"
  202. android:layout_width="match_parent"
  203. android:layout_height="20dp" >
  204.  
  205. <TextView
  206. android:id="@+id/status_received"
  207. style="@style/StatusBarText"
  208. android:layout_width="wrap_content"
  209. android:layout_height="wrap_content"
  210. android:layout_alignParentLeft="true"
  211. android:layout_alignParentTop="true"
  212. android:text="@string/received" />
  213.  
  214. <TextView
  215. android:id="@+id/status_time_received"
  216. style="@style/StatusBarText"
  217. android:layout_width="wrap_content"
  218. android:layout_height="wrap_content"
  219. android:layout_toRightOf="@+id/status_received" />
  220.  
  221. <TextView
  222. android:id="@+id/status_time_delete_relative_text"
  223. style="@style/StatusBarText"
  224. android:layout_width="wrap_content"
  225. android:layout_height="wrap_content"
  226. android:layout_toLeftOf="@+id/status_time_delete_relative"
  227. android:text="@string/is_deleted" />
  228.  
  229. <TextView
  230. android:id="@+id/status_time_delete_relative"
  231. style="@style/StatusBarText"
  232. android:layout_width="wrap_content"
  233. android:layout_height="wrap_content"
  234. android:layout_alignParentRight="true"
  235. android:layout_alignParentTop="true"
  236. android:text="@string/minutes" />
  237. </RelativeLayout>
  238.  
  239. <RelativeLayout
  240. android:id="@+id/status_hidden"
  241. style="@style/StatusHidden"
  242. android:layout_width="match_parent"
  243. android:layout_height="wrap_content"
  244. android:layout_below="@+id/status_always_visible" >
  245.  
  246. <LinearLayout
  247. android:id="@+id/status_hydrants_near_address_container"
  248. style="@style/StatusHiddenText"
  249. android:layout_width="match_parent"
  250. android:layout_height="wrap_content"
  251. android:layout_alignParentTop="true"
  252. android:layout_alignParentLeft="true"
  253. android:divider="@android:drawable/divider_horizontal_bright"
  254. android:orientation="vertical"
  255. android:paddingLeft="10dp"
  256. android:showDividers="middle" >
  257.  
  258. <TextView
  259. style="@style/StatusHiddenText"
  260. android:layout_width="wrap_content"
  261. android:layout_height="wrap_content"
  262. android:text="@string/no_information" />
  263. </LinearLayout>
  264. </RelativeLayout>
  265.  
  266. <LinearLayout
  267. android:id="@+id/optionsBar"
  268. android:layout_width="match_parent"
  269. android:layout_height="45dp"
  270. android:layout_alignParentBottom="true"
  271. android:layout_alignParentLeft="true"
  272. android:background="#999"
  273. android:orientation="horizontal"
  274. android:paddingTop="5dp" >
  275.  
  276. <ImageButton
  277. android:id="@+id/button_hydrants"
  278. style="@style/android:Widget.ImageButton"
  279. android:layout_width="100dp"
  280. android:layout_height="wrap_content"
  281. android:alpha="50"
  282. android:contentDescription="@string/module_hydrants"
  283. android:src="@drawable/ic_action_place" />
  284.  
  285. <ImageButton
  286. android:id="@+id/button_route"
  287. style="@style/android:Widget.ImageButton"
  288. android:layout_width="100dp"
  289. android:layout_height="wrap_content"
  290. android:contentDescription="@string/module_directions"
  291. android:src="@drawable/ic_action_directions" />
  292.  
  293. <ImageButton
  294. android:id="@+id/button_pdf"
  295. style="@style/android:Widget.ImageButton"
  296. android:layout_width="100dp"
  297. android:layout_height="wrap_content"
  298. android:clickable="false"
  299. android:contentDescription="@string/module_accessplan"
  300. android:src="@drawable/ic_action_attachment" />
  301.  
  302. <RelativeLayout
  303. android:layout_width="match_parent"
  304. android:layout_height="match_parent" >
  305.  
  306. <ImageButton
  307. android:id="@+id/button_more"
  308. style="@style/android:Widget.ImageButton"
  309. android:layout_width="wrap_content"
  310. android:layout_height="wrap_content"
  311. android:layout_alignParentRight="true"
  312. android:layout_alignParentTop="true"
  313. android:src="@drawable/ic_action_down" />
  314.  
  315. </RelativeLayout>
  316. </LinearLayout>
  317. </RelativeLayout>
  318.  
  319. <!-- The "empty" view to show when there are no items in the "list" view defined above. -->
  320.  
  321. <TextView
  322. android:id="@android:id/empty"
  323. style="?android:textAppearanceSmall"
  324. android:layout_width="wrap_content"
  325. android:layout_height="wrap_content"
  326. android:layout_gravity="center"
  327. android:padding="32dp"
  328. android:text="@string/no_information"
  329. android:textColor="?android:textColorSecondary" />
  330.  
  331. </FrameLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement