Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".MainActivity" >
- <FrameLayout
- android:id="@+id/content_frame"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- <LinearLayout
- android:id="@+id/drawer"
- android:layout_width="240dp"
- android:layout_height="match_parent"
- android:layout_gravity="end"
- android:background="@android:color/white"
- android:orientation="vertical" >
- <ListView
- android:id="@+id/drawer_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@android:color/black"
- android:choiceMode="singleChoice"
- android:divider="@android:color/darker_gray"
- android:dividerHeight="0.1dp"
- android:textColor="@android:color/white" />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/mainContent"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="00dp"
- android:layout_marginTop="0dp"
- android:orientation="vertical" >
- <!-- 1st Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp"
- android:background="@drawable/searchbar"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingLeft="20dip" >
- <EditText
- android:id="@+id/editText1"
- android:layout_width="wrap_content"
- android:layout_height="30dp"
- android:layout_alignParentTop="true"
- android:background="@drawable/searchbartxtcontainer"
- android:ems="10"
- android:hint=" Search Movies" >
- <requestFocus />
- </EditText>
- <Spinner
- android:id="@+id/spinner1"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_toRightOf="@+id/editText1"
- android:background="@drawable/searchbartxtcontainer"
- android:hint="Rating" />
- <Spinner
- android:id="@+id/spinner2"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/spinner1"
- android:layout_marginLeft="29dp"
- android:layout_toRightOf="@+id/spinner1"
- android:background="@drawable/searchbartxtcontainer" />
- <Button
- android:id="@+id/button1"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="wrap_content"
- android:layout_height="33dp"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Reset" />
- <Spinner
- android:id="@+id/spinner3"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/spinner1"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/spinner1"
- android:background="@drawable/searchbartxtcontainer" />
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/button1"
- android:text="Sort by:"
- android:textColor="#FFFFFF" />
- <Spinner
- android:id="@+id/spinner4"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/textView1"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/textView1"
- android:background="@drawable/searchbartxtcontainer"
- android:textColor="#FFFFFF" />
- </LinearLayout>
- <!-- 2nd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#000000"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingLeft="20dip" >
- <Button
- android:id="@+id/buttona"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="A" />
- <Button
- android:id="@+id/buttonb"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="B" />
- <Button
- android:id="@+id/buttonc"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="C" />
- <Button
- android:id="@+id/buttond"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="D" />
- <Button
- android:id="@+id/buttone"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="E" />
- <Button
- android:id="@+id/buttonf"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="F" />
- <Button
- android:id="@+id/buttong"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="G" />
- <Button
- android:id="@+id/buttonh"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="H" />
- <Button
- android:id="@+id/buttoni"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="I" />
- <Button
- android:id="@+id/buttonj"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="J" />
- <Button
- android:id="@+id/buttonk"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="K" />
- <Button
- android:id="@+id/buttonl"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="L" />
- <Button
- android:id="@+id/buttonm"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="M" />
- <Button
- android:id="@+id/buttonn"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="N" />
- <Button
- android:id="@+id/buttono"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="O" />
- <Button
- android:id="@+id/buttonp"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="P" />
- <Button
- android:id="@+id/buttonq"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Q" />
- <Button
- android:id="@+id/buttonr"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="R" />
- <Button
- android:id="@+id/buttons"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="S" />
- <Button
- android:id="@+id/buttont"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="T" />
- <Button
- android:id="@+id/buttonu"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="U" />
- <Button
- android:id="@+id/buttonv"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="V" />
- <Button
- android:id="@+id/buttonw"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="W" />
- <Button
- android:id="@+id/buttonx"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="X" />
- <Button
- android:id="@+id/buttony"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Y" />
- <Button
- android:id="@+id/buttonz"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Z" />
- </LinearLayout>
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_below="@+id/imageView1" >
- <!-- 3rd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="0dp"
- android:background="#000000"
- android:orientation="vertical" >
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel3"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel4"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel5"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <!-- Carousel items container - lays out items horizontally -->
- <LinearLayout
- android:id="@+id/carousel6"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/drawer_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".MainActivity" >
- <FrameLayout
- android:id="@+id/content_frame"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- <LinearLayout
- android:id="@+id/drawer"
- android:layout_width="240dp"
- android:layout_height="match_parent"
- android:layout_gravity="end"
- android:background="@android:color/white"
- android:orientation="vertical" >
- <ListView
- android:id="@+id/drawer_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@android:color/black"
- android:choiceMode="singleChoice"
- android:divider="@android:color/darker_gray"
- android:dividerHeight="0.1dp"
- android:textColor="@android:color/white" />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/mainContent"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="00dp"
- android:layout_marginTop="0dp"
- android:orientation="vertical" >
- <!-- 1st Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="15dp"
- android:layout_marginTop="15dp"
- android:background="@drawable/searchbar"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingLeft="20dip" >
- <EditText
- android:id="@+id/editText1"
- android:layout_width="wrap_content"
- android:layout_height="30dp"
- android:layout_alignParentTop="true"
- android:background="@drawable/searchbartxtcontainer"
- android:ems="10"
- android:hint=" Search Movies" >
- <requestFocus />
- </EditText>
- <Spinner
- android:id="@+id/spinner1"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_toRightOf="@+id/editText1"
- android:background="@drawable/searchbartxtcontainer"
- android:hint="Rating" />
- <Spinner
- android:id="@+id/spinner2"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/spinner1"
- android:layout_marginLeft="29dp"
- android:layout_toRightOf="@+id/spinner1"
- android:background="@drawable/searchbartxtcontainer" />
- <Button
- android:id="@+id/button1"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="wrap_content"
- android:layout_height="33dp"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Reset" />
- <Spinner
- android:id="@+id/spinner3"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/spinner1"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/spinner1"
- android:background="@drawable/searchbartxtcontainer" />
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/button1"
- android:text="Sort by:"
- android:textColor="#FFFFFF" />
- <Spinner
- android:id="@+id/spinner4"
- android:layout_width="100dp"
- android:layout_height="30dp"
- android:layout_alignTop="@+id/textView1"
- android:layout_marginLeft="20dp"
- android:layout_toRightOf="@+id/textView1"
- android:background="@drawable/searchbartxtcontainer"
- android:textColor="#FFFFFF" />
- </LinearLayout>
- <!-- 2nd Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#000000"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingLeft="20dip" >
- <Button
- android:id="@+id/buttona"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="A" />
- <Button
- android:id="@+id/buttonb"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="B" />
- <Button
- android:id="@+id/buttonc"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="C" />
- <Button
- android:id="@+id/buttond"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="D" />
- <Button
- android:id="@+id/buttone"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="E" />
- <Button
- android:id="@+id/buttonf"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="F" />
- <Button
- android:id="@+id/buttong"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="G" />
- <Button
- android:id="@+id/buttonh"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="H" />
- <Button
- android:id="@+id/buttoni"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="I" />
- <Button
- android:id="@+id/buttonj"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="J" />
- <Button
- android:id="@+id/buttonk"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="K" />
- <Button
- android:id="@+id/buttonl"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="L" />
- <Button
- android:id="@+id/buttonm"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="M" />
- <Button
- android:id="@+id/buttonn"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="N" />
- <Button
- android:id="@+id/buttono"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="O" />
- <Button
- android:id="@+id/buttonp"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="P" />
- <Button
- android:id="@+id/buttonq"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Q" />
- <Button
- android:id="@+id/buttonr"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="R" />
- <Button
- android:id="@+id/buttons"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="S" />
- <Button
- android:id="@+id/buttont"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="T" />
- <Button
- android:id="@+id/buttonu"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="U" />
- <Button
- android:id="@+id/buttonv"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="V" />
- <Button
- android:id="@+id/buttonw"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="W" />
- <Button
- android:id="@+id/buttonx"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="X" />
- <Button
- android:id="@+id/buttony"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Y" />
- <Button
- android:id="@+id/buttonz"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="35dp"
- android:layout_height="35dp"
- android:layout_toRightOf="@+id/spinner2"
- android:text="Z" />
- </LinearLayout>
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_below="@+id/imageView1" >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="0dp"
- android:background="#000000"
- android:orientation="vertical" >
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <!-- Container view to scroll horizontally which gives the carousel effect -->
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel3"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel4"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel5"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel6"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- <HorizontalScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="none" >
- <LinearLayout
- android:id="@+id/carousel7"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- </LinearLayout>
- </ScrollView>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/clear" />
- </LinearLayout>
- </LinearLayout>
- <ProgressBar
- android:id="@+id/progress_bar"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:indeterminateDrawable="@drawable/ic_launcher"
- android:visibility="gone" >
- </ProgressBar>
- <ListView
- android:id="@+id/navList"
- android:layout_width="280dp"
- android:layout_height="match_parent"
- android:layout_below="@+id/profileBox"
- android:layout_gravity="start"
- android:background="#ffffffff"
- android:choiceMode="singleChoice" />
- <ImageView
- android:id="@+id/drawer_item_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </android.support.v4.widget.DrawerLayout>
- <LinearLayout
- android:id="@+id/carousel7"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:orientation="horizontal" />
- </HorizontalScrollView>
- </LinearLayout>
- </ScrollView>
- <!-- 4th Child Layout (Nested In Parent Layout) with Horizontal Orientation -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/clear" />
- </LinearLayout>
- </LinearLayout>
- <ProgressBar
- android:id="@+id/progress_bar"
- style="?android:attr/progressBarStyleLarge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:indeterminateDrawable="@drawable/ic_launcher"
- android:visibility="gone" >
- </ProgressBar>
- <!-- List of Actions (pages) -->
- <ListView
- android:id="@+id/navList"
- android:layout_width="280dp"
- android:layout_height="match_parent"
- android:layout_below="@+id/profileBox"
- android:layout_gravity="start"
- android:background="#ffffffff"
- android:choiceMode="singleChoice" />
- <ImageView
- android:id="@+id/drawer_item_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </android.support.v4.widget.DrawerLayout>
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import org.json.JSONArray;
- import org.json.JSONException;
- import android.app.AlertDialog;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.content.res.Configuration;
- import android.content.res.TypedArray;
- import android.graphics.Typeface;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Message;
- import android.support.v4.app.FragmentManager;
- import android.support.v4.app.FragmentTransaction;
- import android.support.v4.widget.DrawerLayout;
- import android.support.v7.app.ActionBarActivity;
- import android.support.v7.app.ActionBarDrawerToggle;
- import android.widget.AdapterView.OnItemClickListener;
- import android.util.DisplayMetrics;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.ViewGroup;
- import android.view.inputmethod.InputMethodManager;
- import android.widget.AdapterView;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.ListView;
- import android.widget.SimpleAdapter;
- import android.widget.TextView;
- import android.widget.Toast;
- import com.squareup.picasso.Picasso;
- public class Home extends ActionBarActivity implements TaskCompleted {
- private String[] mPlanetTitles;
- int mPosition = -1;
- String mTitle = "";
- String[] mCountries ;
- // Array of integers points to images stored in /res/drawable-ldpi/
- int[] mFlags = new int[]{
- R.drawable.icon_share_top_right,
- R.drawable.icon_statsstar_top_right,
- R.drawable.icon_download_top_right,
- R.drawable.icon_alertsettings_top_right,
- R.drawable.icon_share_top_right,
- R.drawable.icon_statsstar_top_right,
- R.drawable.icon_download_top_right,
- R.drawable.icon_alertsettings_top_right,
- R.drawable.icon_alertsettings_top_right,
- R.drawable.icon_alertsettings_top_right,
- };
- // Array of strings to initial counts
- String[] mCount = new String[]{
- "", "", "", "", "",
- "", "", "", "", "" };
- private DrawerLayout mDrawerLayout;
- private ListView mDrawerList;
- private ActionBarDrawerToggle mDrawerToggle;
- private LinearLayout mDrawer ;
- private List<HashMap<String,String>> mList ;
- private SimpleAdapter mAdapter;
- final private String COUNTRY = "country";
- final private String FLAG = "flag";
- final private String COUNT = "count";
- private String TAG = "CUSTOMPLAY:";
- // Define the number of box art per row visible when the carousel is first
- // shown.
- private static final float INITIAL_ITEMS_COUNT = 8;
- // The Movie Database API Key
- private static String API_KEY = "2842da55488d33ac0b3b9f9f88759e18";
- // The Movie Database URL
- private static String URL = "https://api.themoviedb.org/3/";
- // Carousel container layouts
- private LinearLayout mCarouselContainer1;
- private LinearLayout mCarouselContainer2;
- private LinearLayout mCarouselContainer3;
- private LinearLayout mCarouselContainer4;
- private LinearLayout mCarouselContainer5;
- private LinearLayout mCarouselContainer6;
- private LinearLayout mCarouselContainer7;
- // contacts JSONArray
- JSONArray contacts = null;
- Boolean connected = false;
- public static Context mContext;
- Globals sharedData = Globals.getInstance();
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setTitle(R.string.AppTitle);
- setContentView(R.layout.ss_home);
- // Getting an array of country names
- mCountries = getResources().getStringArray(R.array.countries);
- // Title of the activity
- mTitle = (String)getTitle();
- // Getting a reference to the drawer listview
- mDrawerList = (ListView) findViewById(R.id.drawer_list);
- // Getting a reference to the sidebar drawer ( Title + ListView )
- mDrawer = ( LinearLayout) findViewById(R.id.drawer);
- // Each row in the list stores country name, count and flag
- mList = new ArrayList<HashMap<String,String>>();
- for(int i=0;i<8;i++){
- HashMap<String, String> hm = new HashMap<String,String>();
- hm.put(COUNTRY, mCountries[i]);
- hm.put(COUNT, mCount[i]);
- hm.put(FLAG, Integer.toString(mFlags[i]) );
- mList.add(hm);
- }
- // Keys used in Hashmap
- String[] from = { FLAG,COUNTRY,COUNT };
- // Ids of views in listview_layout
- int[] to = { R.id.flag , R.id.country , R.id.count};
- // Instantiating an adapter to store each items
- // R.layout.drawer_layout defines the layout of each item
- mAdapter = new SimpleAdapter(this, mList, R.layout.drawer_layout, from, to);
- // Getting reference to DrawerLayout
- mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
- // Creating a ToggleButton for NavigationDrawer with drawer event listener
- mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.icon_list_top_right , R.string.drawer_open){
- // left menu onClick
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Toast.makeText(getApplicationContext(), "MENU 1", Toast.LENGTH_LONG).show();
- if (item != null && item.getItemId() == android.R.id.home) {
- if (mDrawerLayout.isDrawerOpen(Gravity.END)) {
- mDrawerLayout.closeDrawer(Gravity.END);
- } else {
- mDrawerLayout.openDrawer(Gravity.END);
- }
- }
- return false;
- }
- /** Called when drawer is closed */
- public void onDrawerClosed(View view) {
- highlightSelectedCountry();
- supportInvalidateOptionsMenu();
- }
- /** Called when a drawer is opened */
- public void onDrawerOpened(View drawerView) {
- //getSupportActionBar().setTitle("Select a Country");
- supportInvalidateOptionsMenu();
- }
- };
- // Setting event listener for the drawer
- mDrawerLayout.setDrawerListener(mDrawerToggle);
- // ItemClick event handler for the drawer items
- // Come back and add onclick listener
- mDrawerList.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView<?> arg0, View arg1, int position,
- long arg3) {
- // Increment hit count of the drawer list item
- incrementHitCount(position);
- if(position < 5) { // Show fragment for countries : 0 to 4
- showFragment(position);
- }else{ // Show message box for countries : 5 to 9
- Toast.makeText(getApplicationContext(), mCountries[position], Toast.LENGTH_LONG).show();
- }
- // Closing the drawer
- mDrawerLayout.closeDrawer(mDrawer);
- }
- // @Override
- // public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
- // long arg3) {
- // // TODO Auto-generated method stub
- //
- // }
- });
- // Enabling Up navigation
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setDisplayShowHomeEnabled(true);
- // Setting the adapter to the listView
- mDrawerList.setAdapter(mAdapter);
- String url = "http://192.168.1.113/index.php";
- new MyAsyncTask(this).execute(url);
- String n = sharedData.getValue();
- Typeface defaultFont = Typeface.createFromAsset(getAssets(),
- "fonts/PN.otf");
- Button buttona = (Button) findViewById(R.id.buttona);
- buttona.setTypeface(defaultFont);
- Button buttonb = (Button) findViewById(R.id.buttonb);
- buttonb.setTypeface(defaultFont);
- Button buttonc = (Button) findViewById(R.id.buttonc);
- buttonc.setTypeface(defaultFont);
- Button buttond = (Button) findViewById(R.id.buttond);
- buttond.setTypeface(defaultFont);
- Button buttone = (Button) findViewById(R.id.buttone);
- buttone.setTypeface(defaultFont);
- Button buttonf = (Button) findViewById(R.id.buttonf);
- buttonf.setTypeface(defaultFont);
- Button buttong = (Button) findViewById(R.id.buttong);
- buttong.setTypeface(defaultFont);
- Button buttonh = (Button) findViewById(R.id.buttonh);
- buttonh.setTypeface(defaultFont);
- Button buttoni = (Button) findViewById(R.id.buttoni);
- buttoni.setTypeface(defaultFont);
- Button buttonj = (Button) findViewById(R.id.buttonj);
- buttonj.setTypeface(defaultFont);
- Button buttonk = (Button) findViewById(R.id.buttonk);
- buttonk.setTypeface(defaultFont);
- Button buttonl = (Button) findViewById(R.id.buttonl);
- buttonl.setTypeface(defaultFont);
- Button buttonm = (Button) findViewById(R.id.buttonm);
- buttonm.setTypeface(defaultFont);
- Button buttonn = (Button) findViewById(R.id.buttonn);
- buttonn.setTypeface(defaultFont);
- Button buttono = (Button) findViewById(R.id.buttono);
- buttono.setTypeface(defaultFont);
- Button buttonp = (Button) findViewById(R.id.buttonp);
- buttonp.setTypeface(defaultFont);
- Button buttonq = (Button) findViewById(R.id.buttonq);
- buttonq.setTypeface(defaultFont);
- Button buttonr = (Button) findViewById(R.id.buttonr);
- buttonr.setTypeface(defaultFont);
- Button buttons = (Button) findViewById(R.id.buttons);
- buttons.setTypeface(defaultFont);
- Button buttont = (Button) findViewById(R.id.buttont);
- buttont.setTypeface(defaultFont);
- Button buttonu = (Button) findViewById(R.id.buttonu);
- buttonu.setTypeface(defaultFont);
- Button buttonv = (Button) findViewById(R.id.buttonv);
- buttonv.setTypeface(defaultFont);
- Button buttonw = (Button) findViewById(R.id.buttonw);
- buttonw.setTypeface(defaultFont);
- Button buttonx = (Button) findViewById(R.id.buttonx);
- buttonx.setTypeface(defaultFont);
- Button buttony = (Button) findViewById(R.id.buttony);
- buttony.setTypeface(defaultFont);
- Button buttonz = (Button) findViewById(R.id.buttonz);
- buttonz.setTypeface(defaultFont);
- Button button1 = (Button) findViewById(R.id.button1);
- button1.setTypeface(defaultFont);
- TextView textView1 = (TextView) findViewById(R.id.textView1);
- textView1.setTypeface(defaultFont);
- // Check the users internet connection
- // checkConnection();
- // //Hide The Keyboard
- EditText myEditText = (EditText) findViewById(R.id.editText1);
- myEditText.setTypeface(defaultFont);
- InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
- // Create Carousel's to contain the movie titles
- mCarouselContainer1 = (LinearLayout) findViewById(R.id.carousel1);
- mCarouselContainer2 = (LinearLayout) findViewById(R.id.carousel2);
- mCarouselContainer3 = (LinearLayout) findViewById(R.id.carousel3);
- mCarouselContainer4 = (LinearLayout) findViewById(R.id.carousel4);
- mCarouselContainer5 = (LinearLayout) findViewById(R.id.carousel5);
- mCarouselContainer6 = (LinearLayout) findViewById(R.id.carousel6);
- mCarouselContainer7 = (LinearLayout) findViewById(R.id.carousel7);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
- public void incrementHitCount(int position){
- HashMap<String, String> item = mList.get(position);
- String count = item.get(COUNT);
- item.remove(COUNT);
- if(count.equals("")){
- count = " 1 ";
- }else{
- int cnt = Integer.parseInt(count.trim());
- cnt ++;
- count = " " + cnt + " ";
- }
- item.put(COUNT, count);
- mAdapter.notifyDataSetChanged();
- }
- public void showFragment(int position){
- //Currently selected country
- mTitle = mCountries[position];
- // Creating a fragment object
- CountryFragment cFragment = new CountryFragment();
- // Creating a Bundle object
- Bundle data = new Bundle();
- // Setting the index of the currently selected item of mDrawerList
- data.putInt("position", position);
- // Setting the position to the fragment
- cFragment.setArguments(data);
- // Getting reference to the FragmentManager
- FragmentManager fragmentManager = getSupportFragmentManager();
- // Creating a fragment transaction
- FragmentTransaction ft = fragmentManager.beginTransaction();
- // Adding a fragment to the fragment transaction
- ft.replace(R.id.content_frame, cFragment);
- // Committing the transaction
- ft.commit();
- }
- // Highlight the selected country : 0 to 4
- public void highlightSelectedCountry(){
- int selectedItem = mDrawerList.getCheckedItemPosition();
- if(selectedItem > 4)
- mDrawerList.setItemChecked(mPosition, true);
- else
- mPosition = selectedItem;
- if(mPosition!=-1)
- getSupportActionBar().setTitle(mCountries[mPosition]);
- }
- // CHECK NETWORK STATUS //CHECK CONNECTION METHOD CALLED IN ONCREATE
- public void checkConnection() {
- connected = WebData.getStatus(mContext);
- if (connected) {
- Log.i(TAG + "NETWORK CONNECTED - INTERNET DETECTED",
- WebData.getType(mContext));
- } else {
- // Add notation to the logs to ensure the error is documented
- Log.i(TAG + "NETWORK CONNECTION FAILED - NO INTERNET DETECTED",
- WebData.getType(mContext));
- // Display dialog box for no connection
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage(
- "No Internet Connection Detected. Check your connection and try again.")
- .setCancelable(false)
- .setPositiveButton("OK",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog,
- int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- alert.show();
- }
- }
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
- mDrawerToggle.syncState();
- //mDrawerToggle.syncState();
- // Compute the width of a carousel item based on the screen width and
- // number of initial items.
- final DisplayMetrics displayMetrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
- // Get the array of box art
- final TypedArray titleResourcesTypedArray = getResources()
- .obtainTypedArray(R.array.title_array1);
- final TypedArray titleResourcesTypedArray2 = getResources()
- .obtainTypedArray(R.array.title_array2);
- final TypedArray titleResourcesTypedArray3 = getResources()
- .obtainTypedArray(R.array.title_array3);
- final TypedArray titleResourcesTypedArray4 = getResources()
- .obtainTypedArray(R.array.title_array4);
- final TypedArray titleResourcesTypedArray5 = getResources()
- .obtainTypedArray(R.array.title_array5);
- final TypedArray titleResourcesTypedArray6 = getResources()
- .obtainTypedArray(R.array.title_array6);
- final TypedArray titleResourcesTypedArray7 = getResources()
- .obtainTypedArray(R.array.title_array7);
- }
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- // mDrawerToggle.onConfigurationChanged(newConfig);
- }
- //
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Pass the event to ActionBarDrawerToggle, if it returns
- // true, then it has handled the app icon touch event
- Toast.makeText(getApplicationContext(), "MENU 2", Toast.LENGTH_LONG).show();
- if (mDrawerToggle.onOptionsItemSelected(item)) {
- return true;
- }
- // Handle your other action bar items...
- return super.onOptionsItemSelected(item);
- }
- /**
- * Swaps fragments in the main content view
- */
- private void selectItem(int position) {
- Toast.makeText(this, R.string.app_name, Toast.LENGTH_SHORT).show();
- // Highlight the selected item, update the title, and close the drawer
- mDrawerList.setItemChecked(position, true);
- setTitle(mPlanetTitles[position]);
- mDrawerLayout.closeDrawer(mDrawerList);
- }
- @Override
- public void setTitle(CharSequence title) {
- // mTitle = title;
- getSupportActionBar().setTitle(mTitle);
- }
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- // When the window loses focus (e.g. the action overflow is shown),
- // cancel any pending hide action. When the window gains focus,
- // hide the system UI.
- if (hasFocus) {
- delayedHide(300);
- } else {
- mHideHandler.removeMessages(0);
- }
- }
- private void hideSystemUI() {
- // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- // | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- // | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- // | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- // | View.SYSTEM_UI_FLAG_FULLSCREEN
- // | View.SYSTEM_UI_FLAG_LOW_PROFILE
- // | View.SYSTEM_UI_FLAG_IMMERSIVE);
- }
- private void showSystemUI() {
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
- }
- private final Handler mHideHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- hideSystemUI();
- }
- };
- private void delayedHide(int delayMillis) {
- mHideHandler.removeMessages(0);
- mHideHandler.sendEmptyMessageDelayed(0, delayMillis);
- }
- public void onTaskComplete(String content) {
- // Toast.makeText(this, "The result is " + content, Toast.LENGTH_LONG)
- // .show();
- if (content != null) {
- try {
- JSONArray jArrayObject;
- try {
- jArrayObject = new JSONArray(content);
- // for (int i = 0; i < jArrayObject.length(); i++) {
- for (int i = 0; i < 8; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem;
- imageItem = new ImageView(this);
- // Set the shadow background
- imageItem.setTag(R.drawable.shadow);
- // Set the ID tag
- imageItem.setTag(i);
- final DisplayMetrics displayMetrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- final int imageWidth = (int) (displayMetrics.widthPixels / INITIAL_ITEMS_COUNT);
- // Set the image view resource
- // Set the size of the image view to the previously
- // computed value
- imageItem
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem.setTag(i);
- // / Add image to the carousel
- mCarouselContainer1.addView(imageItem);
- // Pull BoxArt Photo
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- // Compute the width of a carousel item based on the screen
- // width and
- // number of initial items.
- final DisplayMetrics displayMetrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- final int imageWidth = (int) (displayMetrics.widthPixels / INITIAL_ITEMS_COUNT);
- // Get the array of box art
- final TypedArray titleResourcesTypedArray = getResources()
- .obtainTypedArray(R.array.title_array1);
- final TypedArray titleResourcesTypedArray2 = getResources()
- .obtainTypedArray(R.array.title_array2);
- final TypedArray titleResourcesTypedArray3 = getResources()
- .obtainTypedArray(R.array.title_array3);
- final TypedArray titleResourcesTypedArray4 = getResources()
- .obtainTypedArray(R.array.title_array4);
- final TypedArray titleResourcesTypedArray5 = getResources()
- .obtainTypedArray(R.array.title_array5);
- for (int i = 8; i < 16; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem2;
- imageItem2 = new ImageView(this);
- imageItem2.setTag(R.drawable.shadow);
- imageItem2.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem2
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem2.setTag(i);
- mCarouselContainer2.addView(imageItem2);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem2);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem2
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- for (int i = 16; i < 24; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem3;
- imageItem3 = new ImageView(this);
- imageItem3.setTag(R.drawable.shadow);
- imageItem3.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem3
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem3.setTag(i);
- mCarouselContainer3.addView(imageItem3);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem3);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem3
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- for (int i = 24; i < 36; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem4;
- imageItem4 = new ImageView(this);
- imageItem4.setTag(R.drawable.shadow);
- imageItem4.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem4
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem4.setTag(i);
- mCarouselContainer4.addView(imageItem4);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem4);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem4
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- for (int i = 36; i < 48; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem5;
- imageItem5 = new ImageView(this);
- imageItem5.setTag(R.drawable.shadow);
- imageItem5.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem5
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem5.setTag(i);
- mCarouselContainer5.addView(imageItem5);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem5);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem5
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- for (int i = 35; i < 42; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem6;
- imageItem6 = new ImageView(this);
- imageItem6.setTag(R.drawable.shadow);
- imageItem6.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem6
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem6.setTag(i);
- mCarouselContainer6.addView(imageItem6);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem6);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem6
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- for (int i = 42; i < 49; i++) {
- Log.d("id==",
- jArrayObject.getJSONObject(i).getString("id")
- .toString());
- Log.d("title==", jArrayObject.getJSONObject(i)
- .getString("title").toString());
- Log.d("year==", jArrayObject.getJSONObject(i)
- .getString("year").toString());
- Log.d("rating==", jArrayObject.getJSONObject(i)
- .getString("rating").toString());
- Log.d("genres==", jArrayObject.getJSONObject(i)
- .getString("genres").toString());
- ImageView imageItem7;
- imageItem7 = new ImageView(this);
- imageItem7.setTag(R.drawable.shadow);
- imageItem7.setTag(i);
- getWindowManager().getDefaultDisplay().getMetrics(
- displayMetrics);
- imageItem7
- .setLayoutParams(new LinearLayout.LayoutParams(
- imageWidth, imageWidth));
- imageItem7.setTag(i);
- mCarouselContainer7.addView(imageItem7);
- // Pull BoxArt Photo from URL obtained from JSON Data
- Picasso.with(this)
- .load(jArrayObject.getJSONObject(i)
- .getString("boxart").toString())
- .into(imageItem7);
- final String boxart = jArrayObject.getJSONObject(i)
- .getString("boxart").toString();
- Log.d("mapdate==", jArrayObject.getJSONObject(i)
- .getString("mapdate").toString());
- imageItem7
- .setOnClickListener(new View.OnClickListener() {
- // create an onClick Listener
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Home.this,
- Download.class);
- intent.putExtra("boxart", boxart);
- startActivity(intent);
- // v.getTag();
- }
- });
- }
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } finally {
- }
- }
- }
- private void getBoxart() {
- // TODO Auto-generated method stub
- new DownloadImageTask((ImageView) findViewById(R.id.imageView1))
- .execute("http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png");
- }
- @Override
- protected void onDestroy() {
- super.onDestroy();
- // Perform Bitmap Scaling to Conserve Memory
- // unbindDrawables(findViewById(R.id.drawer_layout));
- System.gc();
- }
- // Perform Bitmap Scaling to Conserve Memory
- private void unbindDrawables(View view) {
- if (view.getBackground() != null) {
- view.getBackground().setCallback(null);
- }
- if (view instanceof ViewGroup) {
- for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
- unbindDrawables(((ViewGroup) view).getChildAt(i));
- }
- ((ViewGroup) view).removeAllViews();
- }
- }
- // Called when invalidateOptionsMenu() is invoked
- // right menu
- public boolean onPrepareOptionsMenu(Menu menu) {
- return super.onPrepareOptionsMenu(menu);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment