├── .gitignore ├── .travis.yml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── codepath │ │ └── android │ │ └── lollipopexercise │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── codepath │ │ └── android │ │ └── lollipopexercise │ │ ├── activities │ │ ├── ContactsActivity.java │ │ └── DetailsActivity.java │ │ ├── adapters │ │ └── ContactsAdapter.java │ │ └── models │ │ └── Contact.java │ └── res │ ├── drawable-hdpi │ ├── contact_eight.png │ ├── contact_eleven.png │ ├── contact_five.jpeg │ ├── contact_four.png │ ├── contact_fourteen.png │ ├── contact_nine.png │ ├── contact_one.png │ ├── contact_seven.png │ ├── contact_six.png │ ├── contact_ten.png │ ├── contact_thirteen.png │ ├── contact_three.png │ ├── contact_twelve.png │ ├── contact_two.png │ ├── ic_call.png │ └── ic_launcher.png │ ├── drawable-mdpi │ ├── ic_call.png │ └── ic_launcher.png │ ├── drawable-xhdpi │ ├── ic_call.png │ └── ic_launcher.png │ ├── drawable-xxhdpi │ ├── ic_call.png │ └── ic_launcher.png │ ├── layout │ ├── activity_contacts.xml │ ├── activity_details.xml │ └── item_contact.xml │ ├── menu │ └── menu_contacts.xml │ ├── values-v21 │ └── dimens.xml │ └── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Proguard folder generated by Eclipse 19 | proguard/ 20 | proguard-project.txt 21 | 22 | # Android Studio 23 | *.iml 24 | *.ipr 25 | *.iws 26 | .gradle/** 27 | build/** 28 | .idea/** 29 | import-summary.txt 30 | *.pydevproject 31 | .project 32 | .metadata 33 | .gradle 34 | bin/** 35 | tmp/** 36 | tmp/**/* 37 | *.tmp 38 | *.bak 39 | *.swp 40 | *~.nib 41 | .classpath 42 | .settings/ 43 | .loadpath 44 | 45 | # External tool builders 46 | .externalToolBuilders/ 47 | 48 | # Locally stored "Eclipse launch configurations" 49 | *.launch 50 | 51 | # CDT-specific 52 | .cproject 53 | 54 | # PDT-specific 55 | .buildpath -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: 3 | - oraclejdk8 4 | sudo: false 5 | android: 6 | components: 7 | - tools 8 | - platform-tools 9 | - tools 10 | - android-28 11 | before_install: 12 | - mkdir "$ANDROID_HOME/licenses" || true 13 | - echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" >> "$ANDROID_HOME/licenses/android-sdk-license" 14 | script: 15 | - "./gradlew build check --daemon" 16 | after_failure: "cat $TRAVIS_BUILD_DIR/app/build/outputs/lint-results-debug.xml" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Lollipop Exercise 2 | 3 | Android app to use as the base app for implementing the following material widgets and animations that were introduced in Android 5.0 (API level 21). 4 | 5 | * RecyclerView (the new ListView) 6 | * CardView (custom outline and shadow) 7 | * Ripple animation (touch feedback) 8 | * Palette (Incorporate dynamic color) 9 | * Shared Element Activity Transition 10 | * Floating Action Button 11 | 12 | The app is composed of two screens. The first screen displays a list of contacts, in which, each item is described by the contact's avatar and name. Once a contact is selected from the list, a second screen appears with additional details about the contact, including his contact no. and a floating action button to place a phone call to this contact. 13 | 14 | **Contact List** 15 | 16 | ![Screenie|300](http://i.imgur.com/VSbsd4Gl.png) 17 | 18 | **Contact Details** 19 | 20 | ![Screenie|300](http://i.imgur.com/NpKJJgdl.png) 21 | 22 | ## Overview 23 | 24 | The app does the following: 25 | 26 | 1. It uses a `RecyclerView` to display a list of contacts. 27 | 2. `CardView` is used to display each contact in the list. 28 | 29 | Suggested extensions: 30 | 31 | 1. Add ripple effect to `CardView` to provide touch feedback. 32 | 2. Use `Palette` to add dynamic color to contact item's background. Use the same color as the accent color for the views in details screen. 33 | 3. Add shared element activity transition to provide a seamless experience by emphasizing continuity between activity transitions. 34 | 4. Add a floating action button, clicking on which should enable you to directly place a call to your contact. 35 | 36 | ## Libraries 37 | 38 | This app leverages the following third-party library: 39 | 40 | * [Glide](https://github.com/bumptech/glide) - For image loading 41 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | 6 | defaultConfig { 7 | applicationId "com.codepath.android.lollipopexercise" 8 | minSdkVersion 21 9 | targetSdkVersion 29 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | ext { 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation "androidx.appcompat:appcompat:1.1.0" 27 | implementation "androidx.recyclerview:recyclerview:1.0.0" 28 | implementation "androidx.cardview:cardview:1.0.0" 29 | implementation "com.github.bumptech.glide:glide:4.11.0" 30 | implementation "androidx.palette:palette:1.0.0" 31 | implementation "androidx.percentlayout:percentlayout:1.0.0" 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/nidhi/Documents/Development/Android SDK/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/codepath/android/lollipopexercise/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.codepath.android.lollipopexercise; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/codepath/android/lollipopexercise/activities/ContactsActivity.java: -------------------------------------------------------------------------------- 1 | package com.codepath.android.lollipopexercise.activities; 2 | 3 | import android.os.Bundle; 4 | import android.view.Menu; 5 | import android.view.MenuItem; 6 | 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import androidx.recyclerview.widget.GridLayoutManager; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | 11 | import com.codepath.android.lollipopexercise.R; 12 | import com.codepath.android.lollipopexercise.adapters.ContactsAdapter; 13 | import com.codepath.android.lollipopexercise.models.Contact; 14 | 15 | import java.util.List; 16 | 17 | 18 | public class ContactsActivity extends AppCompatActivity { 19 | private RecyclerView rvContacts; 20 | private ContactsAdapter mAdapter; 21 | private List contacts; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_contacts); 27 | 28 | // Find RecyclerView and bind to adapter 29 | rvContacts = (RecyclerView) findViewById(R.id.rvContacts); 30 | 31 | // allows for optimizations 32 | rvContacts.setHasFixedSize(true); 33 | 34 | // Define 2 column grid layout 35 | final GridLayoutManager layout = new GridLayoutManager(ContactsActivity.this, 2); 36 | 37 | // Unlike ListView, you have to explicitly give a LayoutManager to the RecyclerView to position items on the screen. 38 | // There are three LayoutManager provided at the moment: GridLayoutManager, StaggeredGridLayoutManager and LinearLayoutManager. 39 | rvContacts.setLayoutManager(layout); 40 | 41 | // get data 42 | contacts = Contact.getContacts(); 43 | 44 | // Create an adapter 45 | mAdapter = new ContactsAdapter(ContactsActivity.this, contacts); 46 | 47 | // Bind adapter to list 48 | rvContacts.setAdapter(mAdapter); 49 | } 50 | 51 | @Override 52 | public boolean onCreateOptionsMenu(Menu menu) { 53 | // Inflate the menu; this adds items to the action bar if it is present. 54 | getMenuInflater().inflate(R.menu.menu_contacts, menu); 55 | return true; 56 | } 57 | 58 | @Override 59 | public boolean onOptionsItemSelected(MenuItem item) { 60 | // Handle action bar item clicks here. The action bar will 61 | // automatically handle clicks on the Home/Up button, so long 62 | // as you specify a parent activity in AndroidManifest.xml. 63 | int id = item.getItemId(); 64 | 65 | return super.onOptionsItemSelected(item); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/codepath/android/lollipopexercise/activities/DetailsActivity.java: -------------------------------------------------------------------------------- 1 | package com.codepath.android.lollipopexercise.activities; 2 | 3 | import android.os.Bundle; 4 | import android.view.MenuItem; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import androidx.appcompat.app.AppCompatActivity; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.codepath.android.lollipopexercise.R; 13 | import com.codepath.android.lollipopexercise.models.Contact; 14 | 15 | public class DetailsActivity extends AppCompatActivity { 16 | public static final String EXTRA_CONTACT = "EXTRA_CONTACT"; 17 | private Contact mContact; 18 | private ImageView ivProfile; 19 | private TextView tvName; 20 | private TextView tvPhone; 21 | private View vPalette; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_details); 27 | 28 | ivProfile = (ImageView) findViewById(R.id.ivProfile); 29 | tvName = (TextView) findViewById(R.id.tvName); 30 | tvPhone = (TextView) findViewById(R.id.tvPhone); 31 | vPalette = findViewById(R.id.vPalette); 32 | 33 | // Extract contact from bundle 34 | mContact = (Contact)getIntent().getExtras().getSerializable(EXTRA_CONTACT); 35 | 36 | // Fill views with data 37 | Glide.with(DetailsActivity.this).load(mContact.getThumbnailDrawable()).centerCrop().into(ivProfile); 38 | tvName.setText(mContact.getName()); 39 | tvPhone.setText(mContact.getNumber()); 40 | } 41 | 42 | @Override 43 | public boolean onOptionsItemSelected(MenuItem item) { 44 | return super.onOptionsItemSelected(item); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/codepath/android/lollipopexercise/adapters/ContactsAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codepath.android.lollipopexercise.adapters; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import androidx.recyclerview.widget.RecyclerView; 12 | 13 | import com.bumptech.glide.Glide; 14 | import com.codepath.android.lollipopexercise.R; 15 | import com.codepath.android.lollipopexercise.models.Contact; 16 | 17 | import java.util.List; 18 | 19 | // Provide the underlying view for an individual list item. 20 | public class ContactsAdapter extends RecyclerView.Adapter { 21 | private Activity mContext; 22 | private List mContacts; 23 | 24 | public ContactsAdapter(Activity context, List contacts) { 25 | mContext = context; 26 | if (contacts == null) { 27 | throw new IllegalArgumentException("contacts must not be null"); 28 | } 29 | mContacts = contacts; 30 | } 31 | 32 | // Inflate the view based on the viewType provided. 33 | @Override 34 | public VH onCreateViewHolder(ViewGroup parent, int viewType) { 35 | View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_contact, parent, false); 36 | return new VH(itemView, mContext); 37 | } 38 | 39 | // Display data at the specified position 40 | @Override 41 | public void onBindViewHolder(VH holder, int position) { 42 | Contact contact = mContacts.get(position); 43 | holder.rootView.setTag(contact); 44 | holder.tvName.setText(contact.getName()); 45 | Glide.with(mContext).load(contact.getThumbnailDrawable()).centerCrop().into(holder.ivProfile); 46 | } 47 | 48 | @Override 49 | public int getItemCount() { 50 | return mContacts.size(); 51 | } 52 | 53 | // Provide a reference to the views for each contact item 54 | public class VH extends RecyclerView.ViewHolder { 55 | final View rootView; 56 | final ImageView ivProfile; 57 | final TextView tvName; 58 | final View vPalette; 59 | 60 | public VH(View itemView, final Context context) { 61 | super(itemView); 62 | rootView = itemView; 63 | ivProfile = (ImageView)itemView.findViewById(R.id.ivProfile); 64 | tvName = (TextView)itemView.findViewById(R.id.tvName); 65 | vPalette = itemView.findViewById(R.id.vPalette); 66 | 67 | // Navigate to contact details activity on click of card view. 68 | itemView.setOnClickListener(new View.OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | final Contact contact = (Contact)v.getTag(); 72 | if (contact != null) { 73 | // Fire an intent when a contact is selected 74 | // Pass contact object in the bundle and populate details activity. 75 | } 76 | } 77 | }); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/codepath/android/lollipopexercise/models/Contact.java: -------------------------------------------------------------------------------- 1 | package com.codepath.android.lollipopexercise.models; 2 | 3 | import com.codepath.android.lollipopexercise.R; 4 | 5 | import android.content.Context; 6 | import android.content.res.Resources; 7 | import android.content.res.TypedArray; 8 | 9 | import java.io.Serializable; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | // Container class to hold Contact information. 14 | public class Contact implements Serializable { 15 | private String mName; 16 | private int mThumbnailDrawable; 17 | private String mNumber; 18 | 19 | public Contact(String name, int thumbnailDrawable, String number) { 20 | mName = name; 21 | mThumbnailDrawable = thumbnailDrawable; 22 | mNumber = number; 23 | } 24 | 25 | public String getName() { 26 | return mName; 27 | } 28 | 29 | public int getThumbnailDrawable() { 30 | return mThumbnailDrawable; 31 | } 32 | 33 | public String getNumber() { 34 | return mNumber; 35 | } 36 | 37 | // Returns a list of contacts 38 | public static List getContacts() { 39 | List contacts = new ArrayList<>(); 40 | contacts.add(new Contact("Juan", R.drawable.contact_fourteen, "4153525528")); 41 | contacts.add(new Contact("Caston", R.drawable.contact_thirteen, "4153139936")); 42 | contacts.add(new Contact("Eric", R.drawable.contact_eight, "4153508889")); 43 | contacts.add(new Contact("Rey", R.drawable.contact_one, "4153508890")); 44 | contacts.add(new Contact("Aldo", R.drawable.contact_twelve, "4153508885")); 45 | contacts.add(new Contact("Anthony", R.drawable.contact_seven, "4153508883")); 46 | contacts.add(new Contact("Nafis", R.drawable.contact_four, "4153508882")); 47 | contacts.add(new Contact("Josephine", R.drawable.contact_five, "4153508884")); 48 | contacts.add(new Contact("Tejen", R.drawable.contact_three, "4153508881")); 49 | contacts.add(new Contact("Mark", R.drawable.contact_six, "4153508226")); 50 | contacts.add(new Contact("Ellen", R.drawable.contact_two, "4153528880")); 51 | contacts.add(new Contact("Lance", R.drawable.contact_eleven, "4153508887")); 52 | contacts.add(new Contact("Daniel", R.drawable.contact_nine, "4153508888")); 53 | contacts.add(new Contact("Matthew", R.drawable.contact_ten, "4153508886")); 54 | return contacts; 55 | } 56 | 57 | // Returns a random contact 58 | public static Contact getRandomContact(Context context) { 59 | 60 | Resources resources = context.getResources(); 61 | 62 | TypedArray contactNames = resources.obtainTypedArray(R.array.contact_names); 63 | int name = (int) (Math.random() * contactNames.length()); 64 | 65 | TypedArray contactThumbnails = resources.obtainTypedArray(R.array.contact_thumbnails); 66 | int thumbnail = (int) (Math.random() * contactThumbnails.length()); 67 | 68 | TypedArray contactNumbers = resources.obtainTypedArray(R.array.contact_numbers); 69 | int number = (int) (Math.random() * contactNumbers.length()); 70 | 71 | return new Contact(contactNames.getString(name), contactThumbnails.getResourceId(thumbnail, R.drawable.contact_one), contactNumbers.getString(number)); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_eight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_eight.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_eleven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_eleven.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_five.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_five.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_four.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_fourteen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_fourteen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_nine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_nine.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_one.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_seven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_seven.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_six.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_six.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_ten.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_ten.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_thirteen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_thirteen.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_three.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_twelve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_twelve.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/contact_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/contact_two.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/ic_call.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-mdpi/ic_call.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-xhdpi/ic_call.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-xxhdpi/ic_call.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_contacts.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_details.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 18 | 19 | 23 | 24 | 31 | 32 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_contact.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 17 | 18 | 23 | 24 | 28 | 29 | 33 | 34 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_contacts.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8dp 4 | 8dp 5 | 4dp 6 | 16dp 7 | 160dp 8 | 48dp 9 | 16dp 10 | 16dp 11 | 380dp 12 | 18sp 13 | 8dp 14 | 8dp 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Alex 5 | Charlie 6 | Brooke 7 | Piper 8 | Skyler 9 | Max 10 | Toby 11 | Terry 12 | Bryce 13 | Mikko 14 | 15 | 16 | 17 | @drawable/contact_one 18 | @drawable/contact_two 19 | @drawable/contact_three 20 | @drawable/contact_four 21 | @drawable/contact_five 22 | @drawable/contact_six 23 | @drawable/contact_seven 24 | @drawable/contact_eight 25 | @drawable/contact_nine 26 | @drawable/contact_ten 27 | @drawable/contact_eleven 28 | 29 | 30 | 31 | 4153708881 32 | 4153708882 33 | 4153708883 34 | 4153708884 35 | 4153708885 36 | 4153708886 37 | 4153708887 38 | 4153708888 39 | 4153708889 40 | 4153708890 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #607D8B 4 | #455A64 5 | #CFD8DC 6 | #4CAF50 7 | #212121 8 | #727272 9 | #FFFFFF 10 | #B6B6B6 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 8dp 3 | 8dp 4 | 4dp 5 | 16dp 6 | 160dp 7 | 48dp 8 | 16dp 9 | 16dp 10 | 380dp 11 | 18sp 12 | 8dp 13 | 8dp 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Material Design Exercise 5 | DetailsActivity 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.6.2' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | android.useAndroidX=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codepath/android-lollipop-exercise/b68de8590293c09d16e45361ba8ae28fe54f44b9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 03 00:40:57 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------