Guest User

Untitled

a guest
Jul 13th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.66 KB | None | 0 0
  1. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. android:id="@+id/drawer_layout"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. tools:context=".MainActivity" >
  7.  
  8. <FrameLayout
  9. android:id="@+id/content_frame"
  10. android:layout_width="match_parent"
  11. android:layout_height="match_parent" />
  12.  
  13. <LinearLayout
  14. android:id="@+id/drawer"
  15. android:layout_width="240dp"
  16. android:layout_height="match_parent"
  17. android:layout_gravity="end"
  18. android:background="@android:color/white"
  19. android:orientation="vertical" >
  20.  
  21. <ListView
  22. android:id="@+id/drawer_list"
  23. android:layout_width="match_parent"
  24. android:layout_height="match_parent"
  25. android:background="@android:color/black"
  26. android:choiceMode="singleChoice"
  27. android:divider="@android:color/darker_gray"
  28. android:dividerHeight="0.1dp"
  29. android:textColor="@android:color/white" />
  30. </LinearLayout>
  31.  
  32.  
  33.  
  34. <LinearLayout
  35. android:id="@+id/mainContent"
  36. android:layout_width="match_parent"
  37. android:layout_height="wrap_content"
  38. android:layout_marginBottom="00dp"
  39. android:layout_marginTop="0dp"
  40. android:orientation="vertical" >
  41.  
  42. <!-- 1st Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  43.  
  44. <LinearLayout
  45. android:layout_width="match_parent"
  46. android:layout_height="wrap_content"
  47. android:layout_marginBottom="15dp"
  48. android:layout_marginTop="15dp"
  49. android:background="@drawable/searchbar"
  50. android:gravity="center_vertical"
  51. android:orientation="horizontal"
  52. android:paddingLeft="20dip" >
  53.  
  54. <EditText
  55. android:id="@+id/editText1"
  56. android:layout_width="wrap_content"
  57. android:layout_height="30dp"
  58. android:layout_alignParentTop="true"
  59. android:background="@drawable/searchbartxtcontainer"
  60. android:ems="10"
  61. android:hint=" Search Movies" >
  62.  
  63. <requestFocus />
  64. </EditText>
  65.  
  66. <Spinner
  67. android:id="@+id/spinner1"
  68. android:layout_width="100dp"
  69. android:layout_height="30dp"
  70. android:layout_toRightOf="@+id/editText1"
  71. android:background="@drawable/searchbartxtcontainer"
  72. android:hint="Rating" />
  73.  
  74. <Spinner
  75. android:id="@+id/spinner2"
  76. android:layout_width="100dp"
  77. android:layout_height="30dp"
  78. android:layout_alignTop="@+id/spinner1"
  79. android:layout_marginLeft="29dp"
  80. android:layout_toRightOf="@+id/spinner1"
  81. android:background="@drawable/searchbartxtcontainer" />
  82.  
  83. <Button
  84. android:id="@+id/button1"
  85. style="?android:attr/buttonStyleSmall"
  86. android:layout_width="wrap_content"
  87. android:layout_height="33dp"
  88. android:layout_marginLeft="20dp"
  89. android:layout_toRightOf="@+id/spinner2"
  90. android:text="Reset" />
  91.  
  92. <Spinner
  93. android:id="@+id/spinner3"
  94. android:layout_width="100dp"
  95. android:layout_height="30dp"
  96. android:layout_alignTop="@+id/spinner1"
  97. android:layout_marginLeft="20dp"
  98. android:layout_toRightOf="@+id/spinner1"
  99. android:background="@drawable/searchbartxtcontainer" />
  100.  
  101. <TextView
  102. android:id="@+id/textView1"
  103. android:layout_width="wrap_content"
  104. android:layout_height="wrap_content"
  105. android:layout_marginLeft="20dp"
  106. android:layout_toRightOf="@+id/button1"
  107. android:text="Sort by:"
  108. android:textColor="#FFFFFF" />
  109.  
  110. <Spinner
  111. android:id="@+id/spinner4"
  112. android:layout_width="100dp"
  113. android:layout_height="30dp"
  114. android:layout_alignTop="@+id/textView1"
  115. android:layout_marginLeft="20dp"
  116. android:layout_toRightOf="@+id/textView1"
  117. android:background="@drawable/searchbartxtcontainer"
  118. android:textColor="#FFFFFF" />
  119. </LinearLayout>
  120.  
  121. <!-- 2nd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  122.  
  123. <LinearLayout
  124. android:layout_width="match_parent"
  125. android:layout_height="wrap_content"
  126. android:background="#000000"
  127. android:gravity="center_vertical"
  128. android:orientation="horizontal"
  129. android:paddingLeft="20dip" >
  130.  
  131. <Button
  132. android:id="@+id/buttona"
  133. style="?android:attr/buttonStyleSmall"
  134. android:layout_width="35dp"
  135. android:layout_height="35dp"
  136. android:layout_toRightOf="@+id/spinner2"
  137. android:text="A" />
  138.  
  139. <Button
  140. android:id="@+id/buttonb"
  141. style="?android:attr/buttonStyleSmall"
  142. android:layout_width="35dp"
  143. android:layout_height="35dp"
  144. android:layout_toRightOf="@+id/spinner2"
  145. android:text="B" />
  146.  
  147. <Button
  148. android:id="@+id/buttonc"
  149. style="?android:attr/buttonStyleSmall"
  150. android:layout_width="35dp"
  151. android:layout_height="35dp"
  152. android:layout_toRightOf="@+id/spinner2"
  153. android:text="C" />
  154.  
  155. <Button
  156. android:id="@+id/buttond"
  157. style="?android:attr/buttonStyleSmall"
  158. android:layout_width="35dp"
  159. android:layout_height="35dp"
  160. android:layout_toRightOf="@+id/spinner2"
  161. android:text="D" />
  162.  
  163. <Button
  164. android:id="@+id/buttone"
  165. style="?android:attr/buttonStyleSmall"
  166. android:layout_width="35dp"
  167. android:layout_height="35dp"
  168. android:layout_toRightOf="@+id/spinner2"
  169. android:text="E" />
  170.  
  171. <Button
  172. android:id="@+id/buttonf"
  173. style="?android:attr/buttonStyleSmall"
  174. android:layout_width="35dp"
  175. android:layout_height="35dp"
  176. android:layout_toRightOf="@+id/spinner2"
  177. android:text="F" />
  178.  
  179. <Button
  180. android:id="@+id/buttong"
  181. style="?android:attr/buttonStyleSmall"
  182. android:layout_width="35dp"
  183. android:layout_height="35dp"
  184. android:layout_toRightOf="@+id/spinner2"
  185. android:text="G" />
  186.  
  187. <Button
  188. android:id="@+id/buttonh"
  189. style="?android:attr/buttonStyleSmall"
  190. android:layout_width="35dp"
  191. android:layout_height="35dp"
  192. android:layout_toRightOf="@+id/spinner2"
  193. android:text="H" />
  194.  
  195. <Button
  196. android:id="@+id/buttoni"
  197. style="?android:attr/buttonStyleSmall"
  198. android:layout_width="35dp"
  199. android:layout_height="35dp"
  200. android:layout_toRightOf="@+id/spinner2"
  201. android:text="I" />
  202.  
  203. <Button
  204. android:id="@+id/buttonj"
  205. style="?android:attr/buttonStyleSmall"
  206. android:layout_width="35dp"
  207. android:layout_height="35dp"
  208. android:layout_toRightOf="@+id/spinner2"
  209. android:text="J" />
  210.  
  211. <Button
  212. android:id="@+id/buttonk"
  213. style="?android:attr/buttonStyleSmall"
  214. android:layout_width="35dp"
  215. android:layout_height="35dp"
  216. android:layout_toRightOf="@+id/spinner2"
  217. android:text="K" />
  218.  
  219. <Button
  220. android:id="@+id/buttonl"
  221. style="?android:attr/buttonStyleSmall"
  222. android:layout_width="35dp"
  223. android:layout_height="35dp"
  224. android:layout_toRightOf="@+id/spinner2"
  225. android:text="L" />
  226.  
  227. <Button
  228. android:id="@+id/buttonm"
  229. style="?android:attr/buttonStyleSmall"
  230. android:layout_width="35dp"
  231. android:layout_height="35dp"
  232. android:layout_toRightOf="@+id/spinner2"
  233. android:text="M" />
  234.  
  235. <Button
  236. android:id="@+id/buttonn"
  237. style="?android:attr/buttonStyleSmall"
  238. android:layout_width="35dp"
  239. android:layout_height="35dp"
  240. android:layout_toRightOf="@+id/spinner2"
  241. android:text="N" />
  242.  
  243. <Button
  244. android:id="@+id/buttono"
  245. style="?android:attr/buttonStyleSmall"
  246. android:layout_width="35dp"
  247. android:layout_height="35dp"
  248. android:layout_toRightOf="@+id/spinner2"
  249. android:text="O" />
  250.  
  251. <Button
  252. android:id="@+id/buttonp"
  253. style="?android:attr/buttonStyleSmall"
  254. android:layout_width="35dp"
  255. android:layout_height="35dp"
  256. android:layout_toRightOf="@+id/spinner2"
  257. android:text="P" />
  258.  
  259. <Button
  260. android:id="@+id/buttonq"
  261. style="?android:attr/buttonStyleSmall"
  262. android:layout_width="35dp"
  263. android:layout_height="35dp"
  264. android:layout_toRightOf="@+id/spinner2"
  265. android:text="Q" />
  266.  
  267. <Button
  268. android:id="@+id/buttonr"
  269. style="?android:attr/buttonStyleSmall"
  270. android:layout_width="35dp"
  271. android:layout_height="35dp"
  272. android:layout_toRightOf="@+id/spinner2"
  273. android:text="R" />
  274.  
  275. <Button
  276. android:id="@+id/buttons"
  277. style="?android:attr/buttonStyleSmall"
  278. android:layout_width="35dp"
  279. android:layout_height="35dp"
  280. android:layout_toRightOf="@+id/spinner2"
  281. android:text="S" />
  282.  
  283. <Button
  284. android:id="@+id/buttont"
  285. style="?android:attr/buttonStyleSmall"
  286. android:layout_width="35dp"
  287. android:layout_height="35dp"
  288. android:layout_toRightOf="@+id/spinner2"
  289. android:text="T" />
  290.  
  291. <Button
  292. android:id="@+id/buttonu"
  293. style="?android:attr/buttonStyleSmall"
  294. android:layout_width="35dp"
  295. android:layout_height="35dp"
  296. android:layout_toRightOf="@+id/spinner2"
  297. android:text="U" />
  298.  
  299. <Button
  300. android:id="@+id/buttonv"
  301. style="?android:attr/buttonStyleSmall"
  302. android:layout_width="35dp"
  303. android:layout_height="35dp"
  304. android:layout_toRightOf="@+id/spinner2"
  305. android:text="V" />
  306.  
  307. <Button
  308. android:id="@+id/buttonw"
  309. style="?android:attr/buttonStyleSmall"
  310. android:layout_width="35dp"
  311. android:layout_height="35dp"
  312. android:layout_toRightOf="@+id/spinner2"
  313. android:text="W" />
  314.  
  315. <Button
  316. android:id="@+id/buttonx"
  317. style="?android:attr/buttonStyleSmall"
  318. android:layout_width="35dp"
  319. android:layout_height="35dp"
  320. android:layout_toRightOf="@+id/spinner2"
  321. android:text="X" />
  322.  
  323. <Button
  324. android:id="@+id/buttony"
  325. style="?android:attr/buttonStyleSmall"
  326. android:layout_width="35dp"
  327. android:layout_height="35dp"
  328. android:layout_toRightOf="@+id/spinner2"
  329. android:text="Y" />
  330.  
  331. <Button
  332. android:id="@+id/buttonz"
  333. style="?android:attr/buttonStyleSmall"
  334. android:layout_width="35dp"
  335. android:layout_height="35dp"
  336. android:layout_toRightOf="@+id/spinner2"
  337. android:text="Z" />
  338. </LinearLayout>
  339.  
  340. <ScrollView
  341. android:layout_width="fill_parent"
  342. android:layout_height="fill_parent"
  343. android:layout_below="@+id/imageView1" >
  344.  
  345. <!-- 3rd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  346.  
  347. <LinearLayout
  348. android:layout_width="match_parent"
  349. android:layout_height="wrap_content"
  350. android:layout_marginTop="0dp"
  351. android:background="#000000"
  352. android:orientation="vertical" >
  353.  
  354. <!-- Container view to scroll horizontally which gives the carousel effect -->
  355.  
  356. <HorizontalScrollView
  357. android:layout_width="match_parent"
  358. android:layout_height="wrap_content"
  359. android:scrollbars="none" >
  360.  
  361. <!-- Carousel items container - lays out items horizontally -->
  362.  
  363. <LinearLayout
  364. android:id="@+id/carousel1"
  365. android:layout_width="match_parent"
  366. android:layout_height="wrap_content"
  367. android:orientation="horizontal" />
  368. </HorizontalScrollView>
  369.  
  370. <!-- Container view to scroll horizontally which gives the carousel effect -->
  371.  
  372. <HorizontalScrollView
  373. android:layout_width="match_parent"
  374. android:layout_height="wrap_content"
  375. android:scrollbars="none" >
  376.  
  377. <!-- Carousel items container - lays out items horizontally -->
  378.  
  379. <LinearLayout
  380. android:id="@+id/carousel2"
  381. android:layout_width="match_parent"
  382. android:layout_height="wrap_content"
  383. android:layout_marginTop="5dp"
  384. android:orientation="horizontal" />
  385. </HorizontalScrollView>
  386.  
  387. <!-- Container view to scroll horizontally which gives the carousel effect -->
  388.  
  389. <HorizontalScrollView
  390. android:layout_width="match_parent"
  391. android:layout_height="wrap_content"
  392. android:scrollbars="none" >
  393.  
  394. <!-- Carousel items container - lays out items horizontally -->
  395.  
  396. <LinearLayout
  397. android:id="@+id/carousel3"
  398. android:layout_width="match_parent"
  399. android:layout_height="wrap_content"
  400. android:layout_marginTop="5dp"
  401. android:orientation="horizontal" />
  402. </HorizontalScrollView>
  403.  
  404. <!-- Container view to scroll horizontally which gives the carousel effect -->
  405.  
  406. <HorizontalScrollView
  407. android:layout_width="match_parent"
  408. android:layout_height="wrap_content"
  409. android:scrollbars="none" >
  410.  
  411. <!-- Carousel items container - lays out items horizontally -->
  412.  
  413. <LinearLayout
  414. android:id="@+id/carousel4"
  415. android:layout_width="match_parent"
  416. android:layout_height="wrap_content"
  417. android:layout_marginTop="5dp"
  418. android:orientation="horizontal" />
  419. </HorizontalScrollView>
  420.  
  421. <!-- Container view to scroll horizontally which gives the carousel effect -->
  422.  
  423. <HorizontalScrollView
  424. android:layout_width="match_parent"
  425. android:layout_height="wrap_content"
  426. android:scrollbars="none" >
  427.  
  428. <!-- Carousel items container - lays out items horizontally -->
  429.  
  430. <LinearLayout
  431. android:id="@+id/carousel5"
  432. android:layout_width="match_parent"
  433. android:layout_height="wrap_content"
  434. android:layout_marginTop="5dp"
  435. android:orientation="horizontal" />
  436. </HorizontalScrollView>
  437.  
  438. <HorizontalScrollView
  439. android:layout_width="match_parent"
  440. android:layout_height="wrap_content"
  441. android:scrollbars="none" >
  442.  
  443. <!-- Carousel items container - lays out items horizontally -->
  444.  
  445. <LinearLayout
  446. android:id="@+id/carousel6"
  447. android:layout_width="match_parent"
  448. android:layout_height="wrap_content"
  449. android:layout_marginTop="5dp"
  450. android:orientation="horizontal" />
  451. </HorizontalScrollView>
  452.  
  453. <HorizontalScrollView
  454. android:layout_width="match_parent"
  455. android:layout_height="wrap_content"
  456. android:scrollbars="none" >
  457.  
  458. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  459. xmlns:tools="http://schemas.android.com/tools"
  460. android:id="@+id/drawer_layout"
  461. android:layout_width="match_parent"
  462. android:layout_height="match_parent"
  463. tools:context=".MainActivity" >
  464.  
  465. <FrameLayout
  466. android:id="@+id/content_frame"
  467. android:layout_width="match_parent"
  468. android:layout_height="match_parent" />
  469.  
  470. <LinearLayout
  471. android:id="@+id/drawer"
  472. android:layout_width="240dp"
  473. android:layout_height="match_parent"
  474. android:layout_gravity="end"
  475. android:background="@android:color/white"
  476. android:orientation="vertical" >
  477.  
  478. <ListView
  479. android:id="@+id/drawer_list"
  480. android:layout_width="match_parent"
  481. android:layout_height="match_parent"
  482. android:background="@android:color/black"
  483. android:choiceMode="singleChoice"
  484. android:divider="@android:color/darker_gray"
  485. android:dividerHeight="0.1dp"
  486. android:textColor="@android:color/white" />
  487. </LinearLayout>
  488.  
  489.  
  490.  
  491. <LinearLayout
  492. android:id="@+id/mainContent"
  493. android:layout_width="match_parent"
  494. android:layout_height="wrap_content"
  495. android:layout_marginBottom="00dp"
  496. android:layout_marginTop="0dp"
  497. android:orientation="vertical" >
  498.  
  499. <!-- 1st Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  500.  
  501. <LinearLayout
  502. android:layout_width="match_parent"
  503. android:layout_height="wrap_content"
  504. android:layout_marginBottom="15dp"
  505. android:layout_marginTop="15dp"
  506. android:background="@drawable/searchbar"
  507. android:gravity="center_vertical"
  508. android:orientation="horizontal"
  509. android:paddingLeft="20dip" >
  510.  
  511. <EditText
  512. android:id="@+id/editText1"
  513. android:layout_width="wrap_content"
  514. android:layout_height="30dp"
  515. android:layout_alignParentTop="true"
  516. android:background="@drawable/searchbartxtcontainer"
  517. android:ems="10"
  518. android:hint=" Search Movies" >
  519.  
  520. <requestFocus />
  521. </EditText>
  522.  
  523. <Spinner
  524. android:id="@+id/spinner1"
  525. android:layout_width="100dp"
  526. android:layout_height="30dp"
  527. android:layout_toRightOf="@+id/editText1"
  528. android:background="@drawable/searchbartxtcontainer"
  529. android:hint="Rating" />
  530.  
  531. <Spinner
  532. android:id="@+id/spinner2"
  533. android:layout_width="100dp"
  534. android:layout_height="30dp"
  535. android:layout_alignTop="@+id/spinner1"
  536. android:layout_marginLeft="29dp"
  537. android:layout_toRightOf="@+id/spinner1"
  538. android:background="@drawable/searchbartxtcontainer" />
  539.  
  540. <Button
  541. android:id="@+id/button1"
  542. style="?android:attr/buttonStyleSmall"
  543. android:layout_width="wrap_content"
  544. android:layout_height="33dp"
  545. android:layout_marginLeft="20dp"
  546. android:layout_toRightOf="@+id/spinner2"
  547. android:text="Reset" />
  548.  
  549. <Spinner
  550. android:id="@+id/spinner3"
  551. android:layout_width="100dp"
  552. android:layout_height="30dp"
  553. android:layout_alignTop="@+id/spinner1"
  554. android:layout_marginLeft="20dp"
  555. android:layout_toRightOf="@+id/spinner1"
  556. android:background="@drawable/searchbartxtcontainer" />
  557.  
  558. <TextView
  559. android:id="@+id/textView1"
  560. android:layout_width="wrap_content"
  561. android:layout_height="wrap_content"
  562. android:layout_marginLeft="20dp"
  563. android:layout_toRightOf="@+id/button1"
  564. android:text="Sort by:"
  565. android:textColor="#FFFFFF" />
  566.  
  567. <Spinner
  568. android:id="@+id/spinner4"
  569. android:layout_width="100dp"
  570. android:layout_height="30dp"
  571. android:layout_alignTop="@+id/textView1"
  572. android:layout_marginLeft="20dp"
  573. android:layout_toRightOf="@+id/textView1"
  574. android:background="@drawable/searchbartxtcontainer"
  575. android:textColor="#FFFFFF" />
  576. </LinearLayout>
  577.  
  578. <!-- 2nd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  579.  
  580. <LinearLayout
  581. android:layout_width="match_parent"
  582. android:layout_height="wrap_content"
  583. android:background="#000000"
  584. android:gravity="center_vertical"
  585. android:orientation="horizontal"
  586. android:paddingLeft="20dip" >
  587.  
  588. <Button
  589. android:id="@+id/buttona"
  590. style="?android:attr/buttonStyleSmall"
  591. android:layout_width="35dp"
  592. android:layout_height="35dp"
  593. android:layout_toRightOf="@+id/spinner2"
  594. android:text="A" />
  595.  
  596. <Button
  597. android:id="@+id/buttonb"
  598. style="?android:attr/buttonStyleSmall"
  599. android:layout_width="35dp"
  600. android:layout_height="35dp"
  601. android:layout_toRightOf="@+id/spinner2"
  602. android:text="B" />
  603.  
  604. <Button
  605. android:id="@+id/buttonc"
  606. style="?android:attr/buttonStyleSmall"
  607. android:layout_width="35dp"
  608. android:layout_height="35dp"
  609. android:layout_toRightOf="@+id/spinner2"
  610. android:text="C" />
  611.  
  612. <Button
  613. android:id="@+id/buttond"
  614. style="?android:attr/buttonStyleSmall"
  615. android:layout_width="35dp"
  616. android:layout_height="35dp"
  617. android:layout_toRightOf="@+id/spinner2"
  618. android:text="D" />
  619.  
  620. <Button
  621. android:id="@+id/buttone"
  622. style="?android:attr/buttonStyleSmall"
  623. android:layout_width="35dp"
  624. android:layout_height="35dp"
  625. android:layout_toRightOf="@+id/spinner2"
  626. android:text="E" />
  627.  
  628. <Button
  629. android:id="@+id/buttonf"
  630. style="?android:attr/buttonStyleSmall"
  631. android:layout_width="35dp"
  632. android:layout_height="35dp"
  633. android:layout_toRightOf="@+id/spinner2"
  634. android:text="F" />
  635.  
  636. <Button
  637. android:id="@+id/buttong"
  638. style="?android:attr/buttonStyleSmall"
  639. android:layout_width="35dp"
  640. android:layout_height="35dp"
  641. android:layout_toRightOf="@+id/spinner2"
  642. android:text="G" />
  643.  
  644. <Button
  645. android:id="@+id/buttonh"
  646. style="?android:attr/buttonStyleSmall"
  647. android:layout_width="35dp"
  648. android:layout_height="35dp"
  649. android:layout_toRightOf="@+id/spinner2"
  650. android:text="H" />
  651.  
  652. <Button
  653. android:id="@+id/buttoni"
  654. style="?android:attr/buttonStyleSmall"
  655. android:layout_width="35dp"
  656. android:layout_height="35dp"
  657. android:layout_toRightOf="@+id/spinner2"
  658. android:text="I" />
  659.  
  660. <Button
  661. android:id="@+id/buttonj"
  662. style="?android:attr/buttonStyleSmall"
  663. android:layout_width="35dp"
  664. android:layout_height="35dp"
  665. android:layout_toRightOf="@+id/spinner2"
  666. android:text="J" />
  667.  
  668. <Button
  669. android:id="@+id/buttonk"
  670. style="?android:attr/buttonStyleSmall"
  671. android:layout_width="35dp"
  672. android:layout_height="35dp"
  673. android:layout_toRightOf="@+id/spinner2"
  674. android:text="K" />
  675.  
  676. <Button
  677. android:id="@+id/buttonl"
  678. style="?android:attr/buttonStyleSmall"
  679. android:layout_width="35dp"
  680. android:layout_height="35dp"
  681. android:layout_toRightOf="@+id/spinner2"
  682. android:text="L" />
  683.  
  684. <Button
  685. android:id="@+id/buttonm"
  686. style="?android:attr/buttonStyleSmall"
  687. android:layout_width="35dp"
  688. android:layout_height="35dp"
  689. android:layout_toRightOf="@+id/spinner2"
  690. android:text="M" />
  691.  
  692. <Button
  693. android:id="@+id/buttonn"
  694. style="?android:attr/buttonStyleSmall"
  695. android:layout_width="35dp"
  696. android:layout_height="35dp"
  697. android:layout_toRightOf="@+id/spinner2"
  698. android:text="N" />
  699.  
  700. <Button
  701. android:id="@+id/buttono"
  702. style="?android:attr/buttonStyleSmall"
  703. android:layout_width="35dp"
  704. android:layout_height="35dp"
  705. android:layout_toRightOf="@+id/spinner2"
  706. android:text="O" />
  707.  
  708. <Button
  709. android:id="@+id/buttonp"
  710. style="?android:attr/buttonStyleSmall"
  711. android:layout_width="35dp"
  712. android:layout_height="35dp"
  713. android:layout_toRightOf="@+id/spinner2"
  714. android:text="P" />
  715.  
  716. <Button
  717. android:id="@+id/buttonq"
  718. style="?android:attr/buttonStyleSmall"
  719. android:layout_width="35dp"
  720. android:layout_height="35dp"
  721. android:layout_toRightOf="@+id/spinner2"
  722. android:text="Q" />
  723.  
  724. <Button
  725. android:id="@+id/buttonr"
  726. style="?android:attr/buttonStyleSmall"
  727. android:layout_width="35dp"
  728. android:layout_height="35dp"
  729. android:layout_toRightOf="@+id/spinner2"
  730. android:text="R" />
  731.  
  732. <Button
  733. android:id="@+id/buttons"
  734. style="?android:attr/buttonStyleSmall"
  735. android:layout_width="35dp"
  736. android:layout_height="35dp"
  737. android:layout_toRightOf="@+id/spinner2"
  738. android:text="S" />
  739.  
  740. <Button
  741. android:id="@+id/buttont"
  742. style="?android:attr/buttonStyleSmall"
  743. android:layout_width="35dp"
  744. android:layout_height="35dp"
  745. android:layout_toRightOf="@+id/spinner2"
  746. android:text="T" />
  747.  
  748. <Button
  749. android:id="@+id/buttonu"
  750. style="?android:attr/buttonStyleSmall"
  751. android:layout_width="35dp"
  752. android:layout_height="35dp"
  753. android:layout_toRightOf="@+id/spinner2"
  754. android:text="U" />
  755.  
  756. <Button
  757. android:id="@+id/buttonv"
  758. style="?android:attr/buttonStyleSmall"
  759. android:layout_width="35dp"
  760. android:layout_height="35dp"
  761. android:layout_toRightOf="@+id/spinner2"
  762. android:text="V" />
  763.  
  764. <Button
  765. android:id="@+id/buttonw"
  766. style="?android:attr/buttonStyleSmall"
  767. android:layout_width="35dp"
  768. android:layout_height="35dp"
  769. android:layout_toRightOf="@+id/spinner2"
  770. android:text="W" />
  771.  
  772. <Button
  773. android:id="@+id/buttonx"
  774. style="?android:attr/buttonStyleSmall"
  775. android:layout_width="35dp"
  776. android:layout_height="35dp"
  777. android:layout_toRightOf="@+id/spinner2"
  778. android:text="X" />
  779.  
  780. <Button
  781. android:id="@+id/buttony"
  782. style="?android:attr/buttonStyleSmall"
  783. android:layout_width="35dp"
  784. android:layout_height="35dp"
  785. android:layout_toRightOf="@+id/spinner2"
  786. android:text="Y" />
  787.  
  788. <Button
  789. android:id="@+id/buttonz"
  790. style="?android:attr/buttonStyleSmall"
  791. android:layout_width="35dp"
  792. android:layout_height="35dp"
  793. android:layout_toRightOf="@+id/spinner2"
  794. android:text="Z" />
  795. </LinearLayout>
  796.  
  797. <ScrollView
  798. android:layout_width="fill_parent"
  799. android:layout_height="fill_parent"
  800. android:layout_below="@+id/imageView1" >
  801.  
  802. <LinearLayout
  803. android:layout_width="match_parent"
  804. android:layout_height="wrap_content"
  805. android:layout_marginTop="0dp"
  806. android:background="#000000"
  807. android:orientation="vertical" >
  808.  
  809. <HorizontalScrollView
  810. android:layout_width="match_parent"
  811. android:layout_height="wrap_content"
  812. android:scrollbars="none" >
  813.  
  814.  
  815. <LinearLayout
  816. android:id="@+id/carousel1"
  817. android:layout_width="match_parent"
  818. android:layout_height="wrap_content"
  819. android:orientation="horizontal" />
  820. </HorizontalScrollView>
  821.  
  822. <!-- Container view to scroll horizontally which gives the carousel effect -->
  823.  
  824. <HorizontalScrollView
  825. android:layout_width="match_parent"
  826. android:layout_height="wrap_content"
  827. android:scrollbars="none" >
  828.  
  829.  
  830.  
  831. <LinearLayout
  832. android:id="@+id/carousel2"
  833. android:layout_width="match_parent"
  834. android:layout_height="wrap_content"
  835. android:layout_marginTop="5dp"
  836. android:orientation="horizontal" />
  837. </HorizontalScrollView>
  838.  
  839.  
  840.  
  841. <HorizontalScrollView
  842. android:layout_width="match_parent"
  843. android:layout_height="wrap_content"
  844. android:scrollbars="none" >
  845.  
  846.  
  847.  
  848. <LinearLayout
  849. android:id="@+id/carousel3"
  850. android:layout_width="match_parent"
  851. android:layout_height="wrap_content"
  852. android:layout_marginTop="5dp"
  853. android:orientation="horizontal" />
  854. </HorizontalScrollView>
  855.  
  856.  
  857.  
  858. <HorizontalScrollView
  859. android:layout_width="match_parent"
  860. android:layout_height="wrap_content"
  861. android:scrollbars="none" >
  862.  
  863.  
  864.  
  865. <LinearLayout
  866. android:id="@+id/carousel4"
  867. android:layout_width="match_parent"
  868. android:layout_height="wrap_content"
  869. android:layout_marginTop="5dp"
  870. android:orientation="horizontal" />
  871. </HorizontalScrollView>
  872.  
  873.  
  874.  
  875. <HorizontalScrollView
  876. android:layout_width="match_parent"
  877. android:layout_height="wrap_content"
  878. android:scrollbars="none" >
  879.  
  880.  
  881.  
  882. <LinearLayout
  883. android:id="@+id/carousel5"
  884. android:layout_width="match_parent"
  885. android:layout_height="wrap_content"
  886. android:layout_marginTop="5dp"
  887. android:orientation="horizontal" />
  888. </HorizontalScrollView>
  889.  
  890. <HorizontalScrollView
  891. android:layout_width="match_parent"
  892. android:layout_height="wrap_content"
  893. android:scrollbars="none" >
  894.  
  895.  
  896.  
  897. <LinearLayout
  898. android:id="@+id/carousel6"
  899. android:layout_width="match_parent"
  900. android:layout_height="wrap_content"
  901. android:layout_marginTop="5dp"
  902. android:orientation="horizontal" />
  903. </HorizontalScrollView>
  904.  
  905. <HorizontalScrollView
  906. android:layout_width="match_parent"
  907. android:layout_height="wrap_content"
  908. android:scrollbars="none" >
  909.  
  910.  
  911.  
  912. <LinearLayout
  913. android:id="@+id/carousel7"
  914. android:layout_width="match_parent"
  915. android:layout_height="wrap_content"
  916. android:layout_marginTop="5dp"
  917. android:orientation="horizontal" />
  918. </HorizontalScrollView>
  919. </LinearLayout>
  920. </ScrollView>
  921.  
  922.  
  923. <LinearLayout
  924. android:layout_width="match_parent"
  925. android:layout_height="wrap_content"
  926. android:orientation="horizontal" >
  927.  
  928. <ImageView
  929. android:id="@+id/imageView1"
  930. android:layout_width="wrap_content"
  931. android:layout_height="wrap_content"
  932. android:src="@drawable/clear" />
  933. </LinearLayout>
  934. </LinearLayout>
  935.  
  936. <ProgressBar
  937. android:id="@+id/progress_bar"
  938. style="?android:attr/progressBarStyleLarge"
  939. android:layout_width="wrap_content"
  940. android:layout_height="wrap_content"
  941. android:layout_centerHorizontal="true"
  942. android:layout_centerVertical="true"
  943. android:indeterminateDrawable="@drawable/ic_launcher"
  944. android:visibility="gone" >
  945. </ProgressBar>
  946.  
  947.  
  948. <ListView
  949. android:id="@+id/navList"
  950. android:layout_width="280dp"
  951. android:layout_height="match_parent"
  952. android:layout_below="@+id/profileBox"
  953. android:layout_gravity="start"
  954. android:background="#ffffffff"
  955. android:choiceMode="singleChoice" />
  956.  
  957. <ImageView
  958. android:id="@+id/drawer_item_icon"
  959. android:layout_width="wrap_content"
  960. android:layout_height="wrap_content" />
  961.  
  962. </android.support.v4.widget.DrawerLayout>
  963. <LinearLayout
  964. android:id="@+id/carousel7"
  965. android:layout_width="match_parent"
  966. android:layout_height="wrap_content"
  967. android:layout_marginTop="5dp"
  968. android:orientation="horizontal" />
  969. </HorizontalScrollView>
  970. </LinearLayout>
  971. </ScrollView>
  972. <!-- 4th Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
  973.  
  974. <LinearLayout
  975. android:layout_width="match_parent"
  976. android:layout_height="wrap_content"
  977. android:orientation="horizontal" >
  978.  
  979. <ImageView
  980. android:id="@+id/imageView1"
  981. android:layout_width="wrap_content"
  982. android:layout_height="wrap_content"
  983. android:src="@drawable/clear" />
  984. </LinearLayout>
  985. </LinearLayout>
  986.  
  987. <ProgressBar
  988. android:id="@+id/progress_bar"
  989. style="?android:attr/progressBarStyleLarge"
  990. android:layout_width="wrap_content"
  991. android:layout_height="wrap_content"
  992. android:layout_centerHorizontal="true"
  993. android:layout_centerVertical="true"
  994. android:indeterminateDrawable="@drawable/ic_launcher"
  995. android:visibility="gone" >
  996. </ProgressBar>
  997. <!-- List of Actions (pages) -->
  998.  
  999. <ListView
  1000. android:id="@+id/navList"
  1001. android:layout_width="280dp"
  1002. android:layout_height="match_parent"
  1003. android:layout_below="@+id/profileBox"
  1004. android:layout_gravity="start"
  1005. android:background="#ffffffff"
  1006. android:choiceMode="singleChoice" />
  1007.  
  1008. <ImageView
  1009. android:id="@+id/drawer_item_icon"
  1010. android:layout_width="wrap_content"
  1011. android:layout_height="wrap_content" />
  1012.  
  1013. </android.support.v4.widget.DrawerLayout>
  1014.  
  1015.  
  1016.  
  1017. import java.util.ArrayList;
  1018. import java.util.HashMap;
  1019. import java.util.List;
  1020.  
  1021. import org.json.JSONArray;
  1022. import org.json.JSONException;
  1023.  
  1024. import android.app.AlertDialog;
  1025. import android.content.Context;
  1026. import android.content.DialogInterface;
  1027. import android.content.Intent;
  1028. import android.content.res.Configuration;
  1029. import android.content.res.TypedArray;
  1030. import android.graphics.Typeface;
  1031. import android.os.Bundle;
  1032. import android.os.Handler;
  1033. import android.os.Message;
  1034. import android.support.v4.app.FragmentManager;
  1035. import android.support.v4.app.FragmentTransaction;
  1036. import android.support.v4.widget.DrawerLayout;
  1037. import android.support.v7.app.ActionBarActivity;
  1038. import android.support.v7.app.ActionBarDrawerToggle;
  1039. import android.widget.AdapterView.OnItemClickListener;
  1040. import android.util.DisplayMetrics;
  1041. import android.util.Log;
  1042. import android.view.Gravity;
  1043. import android.view.Menu;
  1044. import android.view.MenuItem;
  1045. import android.view.View;
  1046. import android.view.ViewGroup;
  1047. import android.view.inputmethod.InputMethodManager;
  1048. import android.widget.AdapterView;
  1049. import android.widget.Button;
  1050. import android.widget.EditText;
  1051. import android.widget.ImageView;
  1052. import android.widget.LinearLayout;
  1053. import android.widget.ListView;
  1054. import android.widget.SimpleAdapter;
  1055. import android.widget.TextView;
  1056. import android.widget.Toast;
  1057.  
  1058. import com.squareup.picasso.Picasso;
  1059.  
  1060. public class Home extends ActionBarActivity implements TaskCompleted {
  1061.  
  1062.  
  1063. private String[] mPlanetTitles;
  1064.  
  1065. int mPosition = -1;
  1066. String mTitle = "";
  1067. String[] mCountries ;
  1068.  
  1069. // Array of integers points to images stored in /res/drawable-ldpi/
  1070. int[] mFlags = new int[]{
  1071. R.drawable.icon_share_top_right,
  1072. R.drawable.icon_statsstar_top_right,
  1073. R.drawable.icon_download_top_right,
  1074. R.drawable.icon_alertsettings_top_right,
  1075. R.drawable.icon_share_top_right,
  1076. R.drawable.icon_statsstar_top_right,
  1077. R.drawable.icon_download_top_right,
  1078. R.drawable.icon_alertsettings_top_right,
  1079. R.drawable.icon_alertsettings_top_right,
  1080. R.drawable.icon_alertsettings_top_right,
  1081. };
  1082.  
  1083. // Array of strings to initial counts
  1084. String[] mCount = new String[]{
  1085. "", "", "", "", "",
  1086. "", "", "", "", "" };
  1087.  
  1088. private DrawerLayout mDrawerLayout;
  1089. private ListView mDrawerList;
  1090. private ActionBarDrawerToggle mDrawerToggle;
  1091. private LinearLayout mDrawer ;
  1092. private List<HashMap<String,String>> mList ;
  1093. private SimpleAdapter mAdapter;
  1094. final private String COUNTRY = "country";
  1095. final private String FLAG = "flag";
  1096. final private String COUNT = "count";
  1097.  
  1098. private String TAG = "CUSTOMPLAY:";
  1099.  
  1100. // Define the number of box art per row visible when the carousel is first
  1101. // shown.
  1102.  
  1103. private static final float INITIAL_ITEMS_COUNT = 8;
  1104.  
  1105. // The Movie Database API Key
  1106.  
  1107. private static String API_KEY = "2842da55488d33ac0b3b9f9f88759e18";
  1108.  
  1109. // The Movie Database URL
  1110.  
  1111. private static String URL = "https://api.themoviedb.org/3/";
  1112.  
  1113. // Carousel container layouts
  1114.  
  1115. private LinearLayout mCarouselContainer1;
  1116. private LinearLayout mCarouselContainer2;
  1117. private LinearLayout mCarouselContainer3;
  1118. private LinearLayout mCarouselContainer4;
  1119. private LinearLayout mCarouselContainer5;
  1120. private LinearLayout mCarouselContainer6;
  1121. private LinearLayout mCarouselContainer7;
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127. // contacts JSONArray
  1128. JSONArray contacts = null;
  1129.  
  1130. Boolean connected = false;
  1131. public static Context mContext;
  1132. Globals sharedData = Globals.getInstance();
  1133.  
  1134. @Override
  1135. protected void onCreate(Bundle savedInstanceState) {
  1136. super.onCreate(savedInstanceState);
  1137. setTitle(R.string.AppTitle);
  1138.  
  1139. setContentView(R.layout.ss_home);
  1140.  
  1141. // Getting an array of country names
  1142. mCountries = getResources().getStringArray(R.array.countries);
  1143.  
  1144. // Title of the activity
  1145. mTitle = (String)getTitle();
  1146.  
  1147. // Getting a reference to the drawer listview
  1148. mDrawerList = (ListView) findViewById(R.id.drawer_list);
  1149.  
  1150. // Getting a reference to the sidebar drawer ( Title + ListView )
  1151. mDrawer = ( LinearLayout) findViewById(R.id.drawer);
  1152.  
  1153. // Each row in the list stores country name, count and flag
  1154. mList = new ArrayList<HashMap<String,String>>();
  1155. for(int i=0;i<8;i++){
  1156. HashMap<String, String> hm = new HashMap<String,String>();
  1157. hm.put(COUNTRY, mCountries[i]);
  1158. hm.put(COUNT, mCount[i]);
  1159. hm.put(FLAG, Integer.toString(mFlags[i]) );
  1160. mList.add(hm);
  1161. }
  1162.  
  1163. // Keys used in Hashmap
  1164. String[] from = { FLAG,COUNTRY,COUNT };
  1165.  
  1166. // Ids of views in listview_layout
  1167. int[] to = { R.id.flag , R.id.country , R.id.count};
  1168.  
  1169. // Instantiating an adapter to store each items
  1170. // R.layout.drawer_layout defines the layout of each item
  1171. mAdapter = new SimpleAdapter(this, mList, R.layout.drawer_layout, from, to);
  1172.  
  1173. // Getting reference to DrawerLayout
  1174. mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
  1175.  
  1176. // Creating a ToggleButton for NavigationDrawer with drawer event listener
  1177. mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.icon_list_top_right , R.string.drawer_open){
  1178. // left menu onClick
  1179. @Override
  1180. public boolean onOptionsItemSelected(MenuItem item) {
  1181. Toast.makeText(getApplicationContext(), "MENU 1", Toast.LENGTH_LONG).show();
  1182. if (item != null && item.getItemId() == android.R.id.home) {
  1183. if (mDrawerLayout.isDrawerOpen(Gravity.END)) {
  1184. mDrawerLayout.closeDrawer(Gravity.END);
  1185. } else {
  1186. mDrawerLayout.openDrawer(Gravity.END);
  1187. }
  1188.  
  1189. }
  1190. return false;
  1191. }
  1192.  
  1193. /** Called when drawer is closed */
  1194. public void onDrawerClosed(View view) {
  1195. highlightSelectedCountry();
  1196. supportInvalidateOptionsMenu();
  1197. }
  1198.  
  1199. /** Called when a drawer is opened */
  1200. public void onDrawerOpened(View drawerView) {
  1201. //getSupportActionBar().setTitle("Select a Country");
  1202. supportInvalidateOptionsMenu();
  1203. }
  1204. };
  1205.  
  1206. // Setting event listener for the drawer
  1207. mDrawerLayout.setDrawerListener(mDrawerToggle);
  1208.  
  1209. // ItemClick event handler for the drawer items
  1210.  
  1211. // Come back and add onclick listener
  1212. mDrawerList.setOnItemClickListener(new OnItemClickListener() {
  1213.  
  1214. public void onItemClick(AdapterView<?> arg0, View arg1, int position,
  1215. long arg3) {
  1216.  
  1217. // Increment hit count of the drawer list item
  1218. incrementHitCount(position);
  1219.  
  1220. if(position < 5) { // Show fragment for countries : 0 to 4
  1221. showFragment(position);
  1222. }else{ // Show message box for countries : 5 to 9
  1223. Toast.makeText(getApplicationContext(), mCountries[position], Toast.LENGTH_LONG).show();
  1224. }
  1225.  
  1226. // Closing the drawer
  1227. mDrawerLayout.closeDrawer(mDrawer);
  1228. }
  1229.  
  1230. // @Override
  1231. // public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
  1232. // long arg3) {
  1233. // // TODO Auto-generated method stub
  1234. //
  1235. // }
  1236. });
  1237.  
  1238. // Enabling Up navigation
  1239. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  1240.  
  1241. getSupportActionBar().setDisplayShowHomeEnabled(true);
  1242.  
  1243. // Setting the adapter to the listView
  1244. mDrawerList.setAdapter(mAdapter);
  1245.  
  1246.  
  1247. String url = "http://192.168.1.113/index.php";
  1248. new MyAsyncTask(this).execute(url);
  1249.  
  1250. String n = sharedData.getValue();
  1251.  
  1252. Typeface defaultFont = Typeface.createFromAsset(getAssets(),
  1253. "fonts/PN.otf");
  1254. Button buttona = (Button) findViewById(R.id.buttona);
  1255. buttona.setTypeface(defaultFont);
  1256. Button buttonb = (Button) findViewById(R.id.buttonb);
  1257. buttonb.setTypeface(defaultFont);
  1258. Button buttonc = (Button) findViewById(R.id.buttonc);
  1259. buttonc.setTypeface(defaultFont);
  1260. Button buttond = (Button) findViewById(R.id.buttond);
  1261. buttond.setTypeface(defaultFont);
  1262. Button buttone = (Button) findViewById(R.id.buttone);
  1263. buttone.setTypeface(defaultFont);
  1264. Button buttonf = (Button) findViewById(R.id.buttonf);
  1265. buttonf.setTypeface(defaultFont);
  1266. Button buttong = (Button) findViewById(R.id.buttong);
  1267. buttong.setTypeface(defaultFont);
  1268. Button buttonh = (Button) findViewById(R.id.buttonh);
  1269. buttonh.setTypeface(defaultFont);
  1270. Button buttoni = (Button) findViewById(R.id.buttoni);
  1271. buttoni.setTypeface(defaultFont);
  1272. Button buttonj = (Button) findViewById(R.id.buttonj);
  1273. buttonj.setTypeface(defaultFont);
  1274. Button buttonk = (Button) findViewById(R.id.buttonk);
  1275. buttonk.setTypeface(defaultFont);
  1276. Button buttonl = (Button) findViewById(R.id.buttonl);
  1277. buttonl.setTypeface(defaultFont);
  1278. Button buttonm = (Button) findViewById(R.id.buttonm);
  1279. buttonm.setTypeface(defaultFont);
  1280. Button buttonn = (Button) findViewById(R.id.buttonn);
  1281. buttonn.setTypeface(defaultFont);
  1282. Button buttono = (Button) findViewById(R.id.buttono);
  1283. buttono.setTypeface(defaultFont);
  1284. Button buttonp = (Button) findViewById(R.id.buttonp);
  1285. buttonp.setTypeface(defaultFont);
  1286. Button buttonq = (Button) findViewById(R.id.buttonq);
  1287. buttonq.setTypeface(defaultFont);
  1288. Button buttonr = (Button) findViewById(R.id.buttonr);
  1289. buttonr.setTypeface(defaultFont);
  1290. Button buttons = (Button) findViewById(R.id.buttons);
  1291. buttons.setTypeface(defaultFont);
  1292. Button buttont = (Button) findViewById(R.id.buttont);
  1293. buttont.setTypeface(defaultFont);
  1294. Button buttonu = (Button) findViewById(R.id.buttonu);
  1295. buttonu.setTypeface(defaultFont);
  1296. Button buttonv = (Button) findViewById(R.id.buttonv);
  1297. buttonv.setTypeface(defaultFont);
  1298. Button buttonw = (Button) findViewById(R.id.buttonw);
  1299. buttonw.setTypeface(defaultFont);
  1300. Button buttonx = (Button) findViewById(R.id.buttonx);
  1301. buttonx.setTypeface(defaultFont);
  1302. Button buttony = (Button) findViewById(R.id.buttony);
  1303. buttony.setTypeface(defaultFont);
  1304. Button buttonz = (Button) findViewById(R.id.buttonz);
  1305. buttonz.setTypeface(defaultFont);
  1306. Button button1 = (Button) findViewById(R.id.button1);
  1307. button1.setTypeface(defaultFont);
  1308. TextView textView1 = (TextView) findViewById(R.id.textView1);
  1309. textView1.setTypeface(defaultFont);
  1310.  
  1311. // Check the users internet connection
  1312. // checkConnection();
  1313.  
  1314. // //Hide The Keyboard
  1315. EditText myEditText = (EditText) findViewById(R.id.editText1);
  1316. myEditText.setTypeface(defaultFont);
  1317. InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  1318. imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
  1319.  
  1320. // Create Carousel's to contain the movie titles
  1321. mCarouselContainer1 = (LinearLayout) findViewById(R.id.carousel1);
  1322. mCarouselContainer2 = (LinearLayout) findViewById(R.id.carousel2);
  1323. mCarouselContainer3 = (LinearLayout) findViewById(R.id.carousel3);
  1324. mCarouselContainer4 = (LinearLayout) findViewById(R.id.carousel4);
  1325. mCarouselContainer5 = (LinearLayout) findViewById(R.id.carousel5);
  1326. mCarouselContainer6 = (LinearLayout) findViewById(R.id.carousel6);
  1327. mCarouselContainer7 = (LinearLayout) findViewById(R.id.carousel7);
  1328. }
  1329.  
  1330.  
  1331.  
  1332. @Override
  1333. public boolean onCreateOptionsMenu(Menu menu) {
  1334. // Inflate the menu; this adds items to the action bar if it is present.
  1335.  
  1336. getMenuInflater().inflate(R.menu.main, menu);
  1337. return true;
  1338. }
  1339.  
  1340. public void incrementHitCount(int position){
  1341. HashMap<String, String> item = mList.get(position);
  1342. String count = item.get(COUNT);
  1343. item.remove(COUNT);
  1344. if(count.equals("")){
  1345. count = " 1 ";
  1346. }else{
  1347. int cnt = Integer.parseInt(count.trim());
  1348. cnt ++;
  1349. count = " " + cnt + " ";
  1350. }
  1351. item.put(COUNT, count);
  1352. mAdapter.notifyDataSetChanged();
  1353. }
  1354.  
  1355. public void showFragment(int position){
  1356.  
  1357. //Currently selected country
  1358. mTitle = mCountries[position];
  1359.  
  1360. // Creating a fragment object
  1361. CountryFragment cFragment = new CountryFragment();
  1362.  
  1363. // Creating a Bundle object
  1364. Bundle data = new Bundle();
  1365.  
  1366. // Setting the index of the currently selected item of mDrawerList
  1367. data.putInt("position", position);
  1368.  
  1369. // Setting the position to the fragment
  1370. cFragment.setArguments(data);
  1371.  
  1372. // Getting reference to the FragmentManager
  1373. FragmentManager fragmentManager = getSupportFragmentManager();
  1374.  
  1375. // Creating a fragment transaction
  1376. FragmentTransaction ft = fragmentManager.beginTransaction();
  1377.  
  1378. // Adding a fragment to the fragment transaction
  1379. ft.replace(R.id.content_frame, cFragment);
  1380.  
  1381. // Committing the transaction
  1382. ft.commit();
  1383. }
  1384.  
  1385. // Highlight the selected country : 0 to 4
  1386. public void highlightSelectedCountry(){
  1387. int selectedItem = mDrawerList.getCheckedItemPosition();
  1388.  
  1389. if(selectedItem > 4)
  1390. mDrawerList.setItemChecked(mPosition, true);
  1391. else
  1392. mPosition = selectedItem;
  1393.  
  1394. if(mPosition!=-1)
  1395. getSupportActionBar().setTitle(mCountries[mPosition]);
  1396.  
  1397.  
  1398.  
  1399. }
  1400.  
  1401.  
  1402. // CHECK NETWORK STATUS //CHECK CONNECTION METHOD CALLED IN ONCREATE
  1403. public void checkConnection() {
  1404.  
  1405. connected = WebData.getStatus(mContext);
  1406. if (connected) {
  1407. Log.i(TAG + "NETWORK CONNECTED - INTERNET DETECTED",
  1408. WebData.getType(mContext));
  1409.  
  1410. } else {
  1411. // Add notation to the logs to ensure the error is documented
  1412. Log.i(TAG + "NETWORK CONNECTION FAILED - NO INTERNET DETECTED",
  1413. WebData.getType(mContext));
  1414. // Display dialog box for no connection
  1415. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  1416. builder.setMessage(
  1417. "No Internet Connection Detected. Check your connection and try again.")
  1418. .setCancelable(false)
  1419. .setPositiveButton("OK",
  1420. new DialogInterface.OnClickListener() {
  1421. @Override
  1422. public void onClick(DialogInterface dialog,
  1423. int id) {
  1424. dialog.cancel();
  1425. }
  1426. });
  1427. AlertDialog alert = builder.create();
  1428. alert.show();
  1429.  
  1430. }
  1431. }
  1432.  
  1433. @Override
  1434. protected void onPostCreate(Bundle savedInstanceState) {
  1435. super.onPostCreate(savedInstanceState);
  1436. mDrawerToggle.syncState();
  1437. //mDrawerToggle.syncState();
  1438. // Compute the width of a carousel item based on the screen width and
  1439. // number of initial items.
  1440. final DisplayMetrics displayMetrics = new DisplayMetrics();
  1441. getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
  1442.  
  1443. // Get the array of box art
  1444. final TypedArray titleResourcesTypedArray = getResources()
  1445. .obtainTypedArray(R.array.title_array1);
  1446. final TypedArray titleResourcesTypedArray2 = getResources()
  1447. .obtainTypedArray(R.array.title_array2);
  1448.  
  1449. final TypedArray titleResourcesTypedArray3 = getResources()
  1450. .obtainTypedArray(R.array.title_array3);
  1451. final TypedArray titleResourcesTypedArray4 = getResources()
  1452. .obtainTypedArray(R.array.title_array4);
  1453. final TypedArray titleResourcesTypedArray5 = getResources()
  1454. .obtainTypedArray(R.array.title_array5);
  1455. final TypedArray titleResourcesTypedArray6 = getResources()
  1456. .obtainTypedArray(R.array.title_array6);
  1457. final TypedArray titleResourcesTypedArray7 = getResources()
  1458. .obtainTypedArray(R.array.title_array7);
  1459.  
  1460. }
  1461.  
  1462.  
  1463.  
  1464. @Override
  1465. public void onConfigurationChanged(Configuration newConfig) {
  1466. super.onConfigurationChanged(newConfig);
  1467. // mDrawerToggle.onConfigurationChanged(newConfig);
  1468. }
  1469. //
  1470. @Override
  1471. public boolean onOptionsItemSelected(MenuItem item) {
  1472. // Pass the event to ActionBarDrawerToggle, if it returns
  1473. // true, then it has handled the app icon touch event
  1474. Toast.makeText(getApplicationContext(), "MENU 2", Toast.LENGTH_LONG).show();
  1475. if (mDrawerToggle.onOptionsItemSelected(item)) {
  1476. return true;
  1477. }
  1478. // Handle your other action bar items...
  1479.  
  1480. return super.onOptionsItemSelected(item);
  1481. }
  1482.  
  1483. /**
  1484. * Swaps fragments in the main content view
  1485. */
  1486. private void selectItem(int position) {
  1487. Toast.makeText(this, R.string.app_name, Toast.LENGTH_SHORT).show();
  1488.  
  1489. // Highlight the selected item, update the title, and close the drawer
  1490. mDrawerList.setItemChecked(position, true);
  1491. setTitle(mPlanetTitles[position]);
  1492. mDrawerLayout.closeDrawer(mDrawerList);
  1493. }
  1494.  
  1495. @Override
  1496. public void setTitle(CharSequence title) {
  1497. // mTitle = title;
  1498. getSupportActionBar().setTitle(mTitle);
  1499. }
  1500.  
  1501.  
  1502.  
  1503.  
  1504. @Override
  1505. public void onWindowFocusChanged(boolean hasFocus) {
  1506. super.onWindowFocusChanged(hasFocus);
  1507. // When the window loses focus (e.g. the action overflow is shown),
  1508. // cancel any pending hide action. When the window gains focus,
  1509. // hide the system UI.
  1510. if (hasFocus) {
  1511. delayedHide(300);
  1512. } else {
  1513. mHideHandler.removeMessages(0);
  1514. }
  1515. }
  1516.  
  1517. private void hideSystemUI() {
  1518. // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
  1519. // | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
  1520. // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  1521. // | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
  1522. // | View.SYSTEM_UI_FLAG_FULLSCREEN
  1523. // | View.SYSTEM_UI_FLAG_LOW_PROFILE
  1524. // | View.SYSTEM_UI_FLAG_IMMERSIVE);
  1525. }
  1526.  
  1527. private void showSystemUI() {
  1528. getWindow().getDecorView().setSystemUiVisibility(
  1529. View.SYSTEM_UI_FLAG_LAYOUT_STABLE
  1530. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
  1531. | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  1532. }
  1533.  
  1534. private final Handler mHideHandler = new Handler() {
  1535. @Override
  1536. public void handleMessage(Message msg) {
  1537. hideSystemUI();
  1538. }
  1539. };
  1540.  
  1541. private void delayedHide(int delayMillis) {
  1542. mHideHandler.removeMessages(0);
  1543. mHideHandler.sendEmptyMessageDelayed(0, delayMillis);
  1544. }
  1545.  
  1546. public void onTaskComplete(String content) {
  1547. // Toast.makeText(this, "The result is " + content, Toast.LENGTH_LONG)
  1548. // .show();
  1549.  
  1550. if (content != null) {
  1551. try {
  1552.  
  1553. JSONArray jArrayObject;
  1554. try {
  1555. jArrayObject = new JSONArray(content);
  1556. // for (int i = 0; i < jArrayObject.length(); i++) {
  1557. for (int i = 0; i < 8; i++) {
  1558. Log.d("id==",
  1559. jArrayObject.getJSONObject(i).getString("id")
  1560. .toString());
  1561. Log.d("title==", jArrayObject.getJSONObject(i)
  1562. .getString("title").toString());
  1563. Log.d("year==", jArrayObject.getJSONObject(i)
  1564. .getString("year").toString());
  1565. Log.d("rating==", jArrayObject.getJSONObject(i)
  1566. .getString("rating").toString());
  1567. Log.d("genres==", jArrayObject.getJSONObject(i)
  1568. .getString("genres").toString());
  1569.  
  1570. ImageView imageItem;
  1571.  
  1572. imageItem = new ImageView(this);
  1573.  
  1574. // Set the shadow background
  1575. imageItem.setTag(R.drawable.shadow);
  1576. // Set the ID tag
  1577. imageItem.setTag(i);
  1578. final DisplayMetrics displayMetrics = new DisplayMetrics();
  1579. getWindowManager().getDefaultDisplay().getMetrics(
  1580. displayMetrics);
  1581. final int imageWidth = (int) (displayMetrics.widthPixels / INITIAL_ITEMS_COUNT);
  1582.  
  1583. // Set the image view resource
  1584.  
  1585. // Set the size of the image view to the previously
  1586. // computed value
  1587. imageItem
  1588. .setLayoutParams(new LinearLayout.LayoutParams(
  1589. imageWidth, imageWidth));
  1590.  
  1591. imageItem.setTag(i);
  1592.  
  1593. // / Add image to the carousel
  1594. mCarouselContainer1.addView(imageItem);
  1595.  
  1596. // Pull BoxArt Photo
  1597. Picasso.with(this)
  1598. .load(jArrayObject.getJSONObject(i)
  1599. .getString("boxart").toString())
  1600.  
  1601. .into(imageItem);
  1602.  
  1603. final String boxart = jArrayObject.getJSONObject(i)
  1604. .getString("boxart").toString();
  1605. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1606. .getString("mapdate").toString());
  1607.  
  1608. imageItem
  1609. .setOnClickListener(new View.OnClickListener() {
  1610.  
  1611. // create an onClick Listener
  1612. @Override
  1613. public void onClick(View v) {
  1614.  
  1615. Intent intent = new Intent(Home.this,
  1616. Download.class);
  1617. intent.putExtra("boxart", boxart);
  1618. startActivity(intent);
  1619. // v.getTag();
  1620.  
  1621. }
  1622. });
  1623.  
  1624. }
  1625.  
  1626.  
  1627. // Compute the width of a carousel item based on the screen
  1628. // width and
  1629. // number of initial items.
  1630. final DisplayMetrics displayMetrics = new DisplayMetrics();
  1631. getWindowManager().getDefaultDisplay().getMetrics(
  1632. displayMetrics);
  1633. final int imageWidth = (int) (displayMetrics.widthPixels / INITIAL_ITEMS_COUNT);
  1634.  
  1635. // Get the array of box art
  1636. final TypedArray titleResourcesTypedArray = getResources()
  1637. .obtainTypedArray(R.array.title_array1);
  1638. final TypedArray titleResourcesTypedArray2 = getResources()
  1639. .obtainTypedArray(R.array.title_array2);
  1640.  
  1641. final TypedArray titleResourcesTypedArray3 = getResources()
  1642. .obtainTypedArray(R.array.title_array3);
  1643. final TypedArray titleResourcesTypedArray4 = getResources()
  1644. .obtainTypedArray(R.array.title_array4);
  1645. final TypedArray titleResourcesTypedArray5 = getResources()
  1646. .obtainTypedArray(R.array.title_array5);
  1647.  
  1648. for (int i = 8; i < 16; i++) {
  1649. Log.d("id==",
  1650. jArrayObject.getJSONObject(i).getString("id")
  1651. .toString());
  1652. Log.d("title==", jArrayObject.getJSONObject(i)
  1653. .getString("title").toString());
  1654. Log.d("year==", jArrayObject.getJSONObject(i)
  1655. .getString("year").toString());
  1656. Log.d("rating==", jArrayObject.getJSONObject(i)
  1657. .getString("rating").toString());
  1658. Log.d("genres==", jArrayObject.getJSONObject(i)
  1659. .getString("genres").toString());
  1660. ImageView imageItem2;
  1661. imageItem2 = new ImageView(this);
  1662. imageItem2.setTag(R.drawable.shadow);
  1663. imageItem2.setTag(i);
  1664. getWindowManager().getDefaultDisplay().getMetrics(
  1665. displayMetrics);
  1666. imageItem2
  1667. .setLayoutParams(new LinearLayout.LayoutParams(
  1668. imageWidth, imageWidth));
  1669. imageItem2.setTag(i);
  1670. mCarouselContainer2.addView(imageItem2);
  1671.  
  1672. // Pull BoxArt Photo from URL obtained from JSON Data
  1673. Picasso.with(this)
  1674. .load(jArrayObject.getJSONObject(i)
  1675. .getString("boxart").toString())
  1676. .into(imageItem2);
  1677.  
  1678. final String boxart = jArrayObject.getJSONObject(i)
  1679. .getString("boxart").toString();
  1680. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1681. .getString("mapdate").toString());
  1682.  
  1683. imageItem2
  1684. .setOnClickListener(new View.OnClickListener() {
  1685.  
  1686. // create an onClick Listener
  1687. @Override
  1688. public void onClick(View v) {
  1689.  
  1690. Intent intent = new Intent(Home.this,
  1691. Download.class);
  1692. intent.putExtra("boxart", boxart);
  1693. startActivity(intent);
  1694. // v.getTag();
  1695.  
  1696. }
  1697. });
  1698.  
  1699. }
  1700. for (int i = 16; i < 24; i++) {
  1701. Log.d("id==",
  1702. jArrayObject.getJSONObject(i).getString("id")
  1703. .toString());
  1704. Log.d("title==", jArrayObject.getJSONObject(i)
  1705. .getString("title").toString());
  1706. Log.d("year==", jArrayObject.getJSONObject(i)
  1707. .getString("year").toString());
  1708. Log.d("rating==", jArrayObject.getJSONObject(i)
  1709. .getString("rating").toString());
  1710. Log.d("genres==", jArrayObject.getJSONObject(i)
  1711. .getString("genres").toString());
  1712. ImageView imageItem3;
  1713. imageItem3 = new ImageView(this);
  1714. imageItem3.setTag(R.drawable.shadow);
  1715. imageItem3.setTag(i);
  1716. getWindowManager().getDefaultDisplay().getMetrics(
  1717. displayMetrics);
  1718. imageItem3
  1719. .setLayoutParams(new LinearLayout.LayoutParams(
  1720. imageWidth, imageWidth));
  1721. imageItem3.setTag(i);
  1722. mCarouselContainer3.addView(imageItem3);
  1723.  
  1724. // Pull BoxArt Photo from URL obtained from JSON Data
  1725. Picasso.with(this)
  1726. .load(jArrayObject.getJSONObject(i)
  1727. .getString("boxart").toString())
  1728. .into(imageItem3);
  1729.  
  1730. final String boxart = jArrayObject.getJSONObject(i)
  1731. .getString("boxart").toString();
  1732. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1733. .getString("mapdate").toString());
  1734.  
  1735. imageItem3
  1736. .setOnClickListener(new View.OnClickListener() {
  1737.  
  1738. // create an onClick Listener
  1739. @Override
  1740. public void onClick(View v) {
  1741.  
  1742. Intent intent = new Intent(Home.this,
  1743. Download.class);
  1744. intent.putExtra("boxart", boxart);
  1745. startActivity(intent);
  1746. // v.getTag();
  1747.  
  1748. }
  1749. });
  1750.  
  1751. }
  1752. for (int i = 24; i < 36; i++) {
  1753. Log.d("id==",
  1754. jArrayObject.getJSONObject(i).getString("id")
  1755. .toString());
  1756. Log.d("title==", jArrayObject.getJSONObject(i)
  1757. .getString("title").toString());
  1758. Log.d("year==", jArrayObject.getJSONObject(i)
  1759. .getString("year").toString());
  1760. Log.d("rating==", jArrayObject.getJSONObject(i)
  1761. .getString("rating").toString());
  1762. Log.d("genres==", jArrayObject.getJSONObject(i)
  1763. .getString("genres").toString());
  1764. ImageView imageItem4;
  1765. imageItem4 = new ImageView(this);
  1766. imageItem4.setTag(R.drawable.shadow);
  1767. imageItem4.setTag(i);
  1768. getWindowManager().getDefaultDisplay().getMetrics(
  1769. displayMetrics);
  1770. imageItem4
  1771. .setLayoutParams(new LinearLayout.LayoutParams(
  1772. imageWidth, imageWidth));
  1773. imageItem4.setTag(i);
  1774. mCarouselContainer4.addView(imageItem4);
  1775.  
  1776. // Pull BoxArt Photo from URL obtained from JSON Data
  1777. Picasso.with(this)
  1778. .load(jArrayObject.getJSONObject(i)
  1779. .getString("boxart").toString())
  1780. .into(imageItem4);
  1781.  
  1782. final String boxart = jArrayObject.getJSONObject(i)
  1783. .getString("boxart").toString();
  1784. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1785. .getString("mapdate").toString());
  1786.  
  1787. imageItem4
  1788. .setOnClickListener(new View.OnClickListener() {
  1789.  
  1790. // create an onClick Listener
  1791. @Override
  1792. public void onClick(View v) {
  1793.  
  1794. Intent intent = new Intent(Home.this,
  1795. Download.class);
  1796. intent.putExtra("boxart", boxart);
  1797. startActivity(intent);
  1798. // v.getTag();
  1799.  
  1800. }
  1801. });
  1802.  
  1803. }
  1804.  
  1805. for (int i = 36; i < 48; i++) {
  1806. Log.d("id==",
  1807. jArrayObject.getJSONObject(i).getString("id")
  1808. .toString());
  1809. Log.d("title==", jArrayObject.getJSONObject(i)
  1810. .getString("title").toString());
  1811. Log.d("year==", jArrayObject.getJSONObject(i)
  1812. .getString("year").toString());
  1813. Log.d("rating==", jArrayObject.getJSONObject(i)
  1814. .getString("rating").toString());
  1815. Log.d("genres==", jArrayObject.getJSONObject(i)
  1816. .getString("genres").toString());
  1817. ImageView imageItem5;
  1818. imageItem5 = new ImageView(this);
  1819. imageItem5.setTag(R.drawable.shadow);
  1820. imageItem5.setTag(i);
  1821. getWindowManager().getDefaultDisplay().getMetrics(
  1822. displayMetrics);
  1823. imageItem5
  1824. .setLayoutParams(new LinearLayout.LayoutParams(
  1825. imageWidth, imageWidth));
  1826. imageItem5.setTag(i);
  1827. mCarouselContainer5.addView(imageItem5);
  1828.  
  1829. // Pull BoxArt Photo from URL obtained from JSON Data
  1830. Picasso.with(this)
  1831. .load(jArrayObject.getJSONObject(i)
  1832. .getString("boxart").toString())
  1833. .into(imageItem5);
  1834.  
  1835. final String boxart = jArrayObject.getJSONObject(i)
  1836. .getString("boxart").toString();
  1837. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1838. .getString("mapdate").toString());
  1839.  
  1840. imageItem5
  1841. .setOnClickListener(new View.OnClickListener() {
  1842.  
  1843. // create an onClick Listener
  1844. @Override
  1845. public void onClick(View v) {
  1846.  
  1847. Intent intent = new Intent(Home.this,
  1848. Download.class);
  1849. intent.putExtra("boxart", boxart);
  1850. startActivity(intent);
  1851. // v.getTag();
  1852.  
  1853. }
  1854. });
  1855.  
  1856. }
  1857.  
  1858. for (int i = 35; i < 42; i++) {
  1859. Log.d("id==",
  1860. jArrayObject.getJSONObject(i).getString("id")
  1861. .toString());
  1862. Log.d("title==", jArrayObject.getJSONObject(i)
  1863. .getString("title").toString());
  1864. Log.d("year==", jArrayObject.getJSONObject(i)
  1865. .getString("year").toString());
  1866. Log.d("rating==", jArrayObject.getJSONObject(i)
  1867. .getString("rating").toString());
  1868. Log.d("genres==", jArrayObject.getJSONObject(i)
  1869. .getString("genres").toString());
  1870. ImageView imageItem6;
  1871. imageItem6 = new ImageView(this);
  1872. imageItem6.setTag(R.drawable.shadow);
  1873. imageItem6.setTag(i);
  1874. getWindowManager().getDefaultDisplay().getMetrics(
  1875. displayMetrics);
  1876. imageItem6
  1877. .setLayoutParams(new LinearLayout.LayoutParams(
  1878. imageWidth, imageWidth));
  1879. imageItem6.setTag(i);
  1880. mCarouselContainer6.addView(imageItem6);
  1881.  
  1882. // Pull BoxArt Photo from URL obtained from JSON Data
  1883. Picasso.with(this)
  1884. .load(jArrayObject.getJSONObject(i)
  1885. .getString("boxart").toString())
  1886. .into(imageItem6);
  1887.  
  1888. final String boxart = jArrayObject.getJSONObject(i)
  1889. .getString("boxart").toString();
  1890. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1891. .getString("mapdate").toString());
  1892.  
  1893. imageItem6
  1894. .setOnClickListener(new View.OnClickListener() {
  1895.  
  1896. // create an onClick Listener
  1897. @Override
  1898. public void onClick(View v) {
  1899.  
  1900. Intent intent = new Intent(Home.this,
  1901. Download.class);
  1902. intent.putExtra("boxart", boxart);
  1903. startActivity(intent);
  1904. // v.getTag();
  1905.  
  1906. }
  1907. });
  1908.  
  1909. }
  1910.  
  1911. for (int i = 42; i < 49; i++) {
  1912. Log.d("id==",
  1913. jArrayObject.getJSONObject(i).getString("id")
  1914. .toString());
  1915. Log.d("title==", jArrayObject.getJSONObject(i)
  1916. .getString("title").toString());
  1917. Log.d("year==", jArrayObject.getJSONObject(i)
  1918. .getString("year").toString());
  1919. Log.d("rating==", jArrayObject.getJSONObject(i)
  1920. .getString("rating").toString());
  1921. Log.d("genres==", jArrayObject.getJSONObject(i)
  1922. .getString("genres").toString());
  1923. ImageView imageItem7;
  1924. imageItem7 = new ImageView(this);
  1925. imageItem7.setTag(R.drawable.shadow);
  1926. imageItem7.setTag(i);
  1927. getWindowManager().getDefaultDisplay().getMetrics(
  1928. displayMetrics);
  1929. imageItem7
  1930. .setLayoutParams(new LinearLayout.LayoutParams(
  1931. imageWidth, imageWidth));
  1932. imageItem7.setTag(i);
  1933. mCarouselContainer7.addView(imageItem7);
  1934.  
  1935. // Pull BoxArt Photo from URL obtained from JSON Data
  1936. Picasso.with(this)
  1937. .load(jArrayObject.getJSONObject(i)
  1938. .getString("boxart").toString())
  1939. .into(imageItem7);
  1940.  
  1941. final String boxart = jArrayObject.getJSONObject(i)
  1942. .getString("boxart").toString();
  1943. Log.d("mapdate==", jArrayObject.getJSONObject(i)
  1944. .getString("mapdate").toString());
  1945.  
  1946. imageItem7
  1947. .setOnClickListener(new View.OnClickListener() {
  1948.  
  1949. // create an onClick Listener
  1950. @Override
  1951. public void onClick(View v) {
  1952.  
  1953. Intent intent = new Intent(Home.this,
  1954. Download.class);
  1955. intent.putExtra("boxart", boxart);
  1956. startActivity(intent);
  1957. // v.getTag();
  1958.  
  1959. }
  1960. });
  1961.  
  1962. }
  1963.  
  1964. } catch (JSONException e) {
  1965. // TODO Auto-generated catch block
  1966. e.printStackTrace();
  1967. }
  1968.  
  1969. } finally {
  1970. }
  1971. }
  1972. }
  1973.  
  1974. private void getBoxart() {
  1975. // TODO Auto-generated method stub
  1976. new DownloadImageTask((ImageView) findViewById(R.id.imageView1))
  1977. .execute("http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png");
  1978. }
  1979.  
  1980. @Override
  1981. protected void onDestroy() {
  1982. super.onDestroy();
  1983. // Perform Bitmap Scaling to Conserve Memory
  1984. // unbindDrawables(findViewById(R.id.drawer_layout));
  1985. System.gc();
  1986. }
  1987.  
  1988. // Perform Bitmap Scaling to Conserve Memory
  1989. private void unbindDrawables(View view) {
  1990. if (view.getBackground() != null) {
  1991. view.getBackground().setCallback(null);
  1992. }
  1993. if (view instanceof ViewGroup) {
  1994. for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
  1995. unbindDrawables(((ViewGroup) view).getChildAt(i));
  1996. }
  1997. ((ViewGroup) view).removeAllViews();
  1998. }
  1999. }
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005. // Called when invalidateOptionsMenu() is invoked
  2006.  
  2007. // right menu
  2008. public boolean onPrepareOptionsMenu(Menu menu) {
  2009.  
  2010. return super.onPrepareOptionsMenu(menu);
  2011. }
  2012.  
  2013. }
Advertisement
Add Comment
Please, Sign In to add comment