From 3005cb45859b5551de17a7f18d75b9e4f4193797 Mon Sep 17 00:00:00 2001 From: Rohan-52 Date: Wed, 1 Feb 2017 01:19:27 +0530 Subject: [PATCH] Added cardview and movies class --- app/build.gradle | 1 + .../hareshkh/lectureassignment/Utils.java | 13 +++++++ .../hareshkh/lectureassignment/movies.java | 38 +++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 12 ++---- app/src/main/res/layout/row_layout.xml | 9 +++++ 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/Utils.java create mode 100644 app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/movies.java create mode 100644 app/src/main/res/layout/row_layout.xml diff --git a/app/build.gradle b/app/build.gradle index c34c81a..56a9523 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,4 +28,5 @@ dependencies { compile 'com.android.support:support-v4:25.1.1' compile 'com.android.support:recyclerview-v7:25.1.1' testCompile 'junit:junit:4.12' + compile 'com.android.support:cardview-v7:25.1.1' } diff --git a/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/Utils.java b/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/Utils.java new file mode 100644 index 0000000..b5dd071 --- /dev/null +++ b/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/Utils.java @@ -0,0 +1,13 @@ +package com.sdsmdg.hareshkh.lectureassignment; + +import android.graphics.Bitmap; + +public class Utils { + + public static Bitmap scaleToFitWidth(Bitmap b, int width) + { + float factor = width / (float) b.getWidth(); + return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), true); + } + +} diff --git a/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/movies.java b/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/movies.java new file mode 100644 index 0000000..3ee671a --- /dev/null +++ b/app/src/main/java/com/sdsmdg/hareshkh/lectureassignment/movies.java @@ -0,0 +1,38 @@ +package com.sdsmdg.hareshkh.lectureassignment; + +public class movies { + + String title; + String year; + String imageResId; + + public movies(String title, String year, String imageResId) { + this.title = title; + this.year = year; + this.imageResId = imageResId; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getImageResId() { + return imageResId; + } + + public void setImageResId(String imageResId) { + this.imageResId = imageResId; + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 809dd02..35b54a9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -4,14 +4,10 @@ android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.sdsmdg.hareshkh.lectureassignment.MainActivity"> - + diff --git a/app/src/main/res/layout/row_layout.xml b/app/src/main/res/layout/row_layout.xml new file mode 100644 index 0000000..716ef1e --- /dev/null +++ b/app/src/main/res/layout/row_layout.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file