-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
TrackMySleepQuality with RecyclerView - Starter Code for 7.1 | ||
============================================================ | ||
|
||
Starter code for Android Kotlin Fundamentals Codelab 7.1 RecyclerView Fundamentals | ||
|
||
Introduction | ||
------------ | ||
|
||
TrackMySleepQuality is an app for recording sleep data for each night. | ||
You can record a start and stop time, assign a quality rating, and clear the database. | ||
|
||
In this codelab you will learn how to use a RecyclerView in your Android Kotlin app | ||
to efficiently display lists of items. | ||
|
||
|
||
Pre-requisites | ||
-------------- | ||
|
||
You should be familiar with: | ||
|
||
* Building a basic user interface (UI) using an activity, fragments, and views. | ||
* Navigating between fragments, and using safeArgs to pass data between fragments. | ||
* Using view models, view model factories, transformations, and LiveData and their observers. | ||
* Creating a Room database, creating a DAO, and defining entities. | ||
* Using coroutines for database tasks and other long-running tasks. | ||
|
||
|
||
|
||
Getting Started | ||
--------------- | ||
|
||
1. Download and run the app. | ||
|
||
License | ||
------- | ||
|
||
Copyright 2019 Google, Inc. | ||
|
||
Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
license agreements. See the NOTICE file distributed with this work for | ||
additional information regarding copyright ownership. The ASF licenses this | ||
file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
use this file except in compliance with the License. You may obtain a copy of | ||
the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations under | ||
the License. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2019, The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
apply plugin: 'androidx.navigation.safeargs' | ||
|
||
android { | ||
compileSdkVersion 30 | ||
defaultConfig { | ||
applicationId "com.example.android.trackmysleepquality" | ||
minSdkVersion 19 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables.useSupportLibrary = true | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
// Enables data binding. | ||
buildFeatures { | ||
dataBinding true | ||
} | ||
|
||
} | ||
|
||
dependencies { | ||
|
||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
|
||
// Support libraries | ||
implementation "androidx.appcompat:appcompat:1.2.0" | ||
implementation "androidx.fragment:fragment-ktx:1.2.5" | ||
implementation "androidx.constraintlayout:constraintlayout:2.0.2" | ||
|
||
// Android KTX | ||
implementation 'androidx.core:core-ktx:1.3.2' | ||
|
||
// Room and Lifecycle dependencies | ||
implementation "androidx.room:room-runtime:$room_version" | ||
implementation 'androidx.legacy:legacy-support-v4:1.0.0' | ||
kapt "androidx.room:room-compiler:$room_version" | ||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" | ||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0" | ||
|
||
// Kotlin Extensions and Coroutines support for Room | ||
implementation "androidx.room:room-ktx:$room_version" | ||
|
||
// Coroutines | ||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version" | ||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version" | ||
|
||
// Navigation | ||
implementation "android.arch.navigation:navigation-fragment-ktx:$navigationVersion" | ||
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion" | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.android.trackmysleepquality"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher_sleep_tracker" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_sleep_tracker_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<meta-data | ||
android:name="preloaded_fonts" | ||
android:resource="@array/preloaded_fonts" /> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2019, The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.example.android.trackmysleepquality | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
setContentView(R.layout.activity_main) | ||
} | ||
} |