Skip to content

Commit b444295

Browse files
committed
Add Reply to material-components-android-examples
2 parents b44bace + d51e2db commit b444295

File tree

174 files changed

+8493
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+8493
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build
2+
captures
3+
*.iml
4+
out
5+
.idea
6+
prebuilts
7+
.DS_Store
8+
local.properties
9+
.gradle

CONTRIBUTING.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to Contribute
2+
3+
We'd love to accept your patches and contributions to this project. There are
4+
just a few small guidelines you need to follow.
5+
6+
## Contributor License Agreement
7+
8+
Contributions to this project must be accompanied by a Contributor License
9+
Agreement. You (or your employer) retain the copyright to your contribution;
10+
this simply gives us permission to use and redistribute your contributions as
11+
part of the project. Head over to <https://cla.developers.google.com/> to see
12+
your current agreements on file or to sign a new one.
13+
14+
You generally only need to submit a CLA once, so if you've already submitted one
15+
(even if it was for a different project), you probably don't need to do it
16+
again.
17+
18+
## Code reviews
19+
20+
All submissions, including submissions by project members, require review. We
21+
use GitHub pull requests for this purpose. Consult
22+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23+
information on using pull requests.
24+
25+
## Community Guidelines
26+
27+
This project follows
28+
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).

Reply/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Reply
2+
3+
<img src="screenshots/collage_header.png" alt="Reply collage"/>
4+
5+
### Introduction
6+
Reply is an email app that uses Material Design components and Material Theming to create an on-brand communication experience.
7+
This project is the Android implementation of [Reply](https://material.io/design/material-studies/reply.html), a Material Study meant to showcase componentry and Theming using the Material Components for Android library.
8+
9+
### Screenshots
10+
11+
<img src="screenshots/1_home_screen.png" height="400" alt="Home screen"/>
12+
13+
<img src="screenshots/2_navigation_drawer.png" height="400" alt="Navigation drawer open"/>
14+
15+
<img src="screenshots/3_account_sandwich.png" height="400" alt="Account picker sandwich open"/>
16+
17+
<img src="screenshots/4_star_email_action.png" height="400" alt="Star an email action"/>
18+
19+
<img src="screenshots/5_email_details.png" height="400" alt="Email details screen"/>
20+
21+
<img src="screenshots/6_email_compose.png" height="400" alt="Compose email screen"/>
22+

Reply/app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

Reply/app/build.gradle

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright (c) 2019 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License
9+
*
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
15+
apply plugin: 'com.android.application'
16+
apply plugin: 'kotlin-android'
17+
apply plugin: 'kotlin-kapt'
18+
apply plugin: "androidx.navigation.safeargs.kotlin"
19+
20+
android {
21+
compileSdkVersion 29
22+
defaultConfig {
23+
applicationId "com.materialstudies.reply"
24+
minSdkVersion 23
25+
targetSdkVersion 29
26+
versionCode 1
27+
versionName "1.0"
28+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29+
}
30+
dataBinding {
31+
enabled true
32+
}
33+
buildTypes {
34+
release {
35+
minifyEnabled false
36+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37+
}
38+
}
39+
compileOptions {
40+
sourceCompatibility = 1.8
41+
targetCompatibility = 1.8
42+
}
43+
kotlinOptions {
44+
jvmTarget = "1.8"
45+
}
46+
}
47+
48+
dependencies {
49+
implementation fileTree(dir: 'libs', include: ['*.jar'])
50+
51+
// Kotlin
52+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
53+
54+
// AndroidX
55+
implementation 'androidx.appcompat:appcompat:1.1.0'
56+
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
57+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
58+
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
59+
implementation 'androidx.core:core-ktx:1.1.0'
60+
implementation 'androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0-beta01'
61+
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
62+
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
63+
64+
// Glide
65+
implementation "com.github.bumptech.glide:glide:4.9.0"
66+
67+
// Material Components
68+
implementation 'com.google.android.material:material:1.1.0-beta01'
69+
70+
// Testing
71+
testImplementation 'junit:junit:4.12'
72+
androidTestImplementation 'androidx.test:runner:1.2.0'
73+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
74+
}

Reply/app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.materialstudies.reply">
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/Theme.Reply.DayNight"
13+
tools:ignore="AllowBackup">
14+
<activity android:name=".ui.MainActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
<meta-data
21+
android:name="preloaded_fonts"
22+
android:resource="@array/preloaded_fonts" />
23+
</application>
24+
25+
</manifest>
33 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.materialstudies.reply.data
18+
19+
import androidx.annotation.DrawableRes
20+
import androidx.recyclerview.widget.DiffUtil
21+
import com.materialstudies.reply.R
22+
23+
/**
24+
* An object which represents an account which can belong to a user. A single user can have
25+
* multiple accounts.
26+
*/
27+
data class Account(
28+
val id: Long,
29+
val uid: Long,
30+
val firstName: String,
31+
val lastName: String,
32+
val email: String,
33+
@DrawableRes val avatar: Int,
34+
var isCurrentAccount: Boolean = false
35+
) {
36+
val fullName: String = "$firstName $lastName"
37+
@DrawableRes val checkedIcon: Int = if (isCurrentAccount) R.drawable.ic_done else 0
38+
}
39+
40+
object AccountDiffCallback : DiffUtil.ItemCallback<Account>() {
41+
override fun areItemsTheSame(oldItem: Account, newItem: Account) =
42+
oldItem.email == newItem.email
43+
override fun areContentsTheSame(oldItem: Account, newItem: Account) =
44+
oldItem.firstName == newItem.firstName
45+
&& oldItem.lastName == newItem.lastName
46+
&& oldItem.avatar == newItem.avatar
47+
&& oldItem.isCurrentAccount == newItem.isCurrentAccount
48+
}

0 commit comments

Comments
 (0)