Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 3e09228

Browse files
committedMar 22, 2022
Add Repository starter code
1 parent 00739f8 commit 3e09228

Some content is hidden

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

45 files changed

+2037
-0
lines changed
 

‎RepositoryPattern-Starter/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
DevByteRepository - Solution Code
2+
==================================
3+
4+
Solution code for the Repository codelab.
5+
6+
Introduction
7+
------------
8+
9+
DevByteRepository app displays a list of DevByte videos. DevByte videos are
10+
short videos made by the Google Android developer relations team to introduce
11+
new developer features on Android. This app demonstrates the Repository pattern,
12+
the recommended best practice for code separation and architecture. Using
13+
repository pattern the data layer is abstracted from the rest of the app.
14+
Repositories act as mediators between different data sources, such as persistent
15+
models, web services, and caches and the rest of the app.
16+
17+
Pre-requisites
18+
--------------
19+
20+
You need to know:
21+
- How to open, build, and run Android apps with Android Studio.
22+
- The basic Android Architecture Components, ViewModel, and LiveData.
23+
- The data persistence library, Room.
24+
- Building and launching a coroutine.
25+
- Read the logs using the Logcat.
26+
- Binding adapters in data binding.
27+
- Using the Retrofit networking library.
28+
29+
30+
Getting Started
31+
---------------
32+
33+
1. Download and run the app.
34+
2. You need Android Studio 3.4 or higher to build this project.
35+
36+
License
37+
-------
38+
39+
Copyright 2019 Google, Inc.
40+
41+
Licensed to the Apache Software Foundation (ASF) under one or more contributor
42+
license agreements. See the NOTICE file distributed with this work for
43+
additional information regarding copyright ownership. The ASF licenses this
44+
file to you under the Apache License, Version 2.0 (the "License"); you may not
45+
use this file except in compliance with the License. You may obtain a copy of
46+
the License at
47+
48+
http://www.apache.org/licenses/LICENSE-2.0
49+
50+
Unless required by applicable law or agreed to in writing, software
51+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
52+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
53+
License for the specific language governing permissions and limitations under
54+
the License.
+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright (C) 2019 Google Inc.
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+
* http://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+
apply plugin: 'com.android.application'
18+
apply plugin: 'kotlin-android'
19+
apply plugin: 'kotlin-kapt'
20+
apply plugin: "androidx.navigation.safeargs"
21+
apply plugin: 'kotlin-android-extensions'
22+
23+
android {
24+
compileSdkVersion 32
25+
defaultConfig {
26+
applicationId "com.example.android.devbyteviewer"
27+
minSdkVersion 19
28+
targetSdkVersion 32
29+
versionCode 1
30+
versionName "1.0"
31+
vectorDrawables.useSupportLibrary = true
32+
multiDexEnabled true
33+
}
34+
buildTypes {
35+
release {
36+
minifyEnabled true
37+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
38+
}
39+
}
40+
41+
buildFeatures {
42+
dataBinding true
43+
}
44+
compileOptions {
45+
sourceCompatibility JavaVersion.VERSION_1_8
46+
targetCompatibility JavaVersion.VERSION_1_8
47+
}
48+
49+
kotlinOptions {
50+
jvmTarget = JavaVersion.VERSION_1_8.toString()
51+
}
52+
}
53+
54+
dependencies {
55+
implementation fileTree(dir: 'libs', include: ['*.jar'])
56+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
57+
58+
// support libraries
59+
implementation 'androidx.appcompat:appcompat:1.4.1'
60+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
61+
implementation 'com.google.android.material:material:1.5.0'
62+
63+
// Android KTX
64+
implementation 'androidx.core:core-ktx:1.7.0'
65+
66+
// constraint layout
67+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
68+
69+
// navigation
70+
def nav_version = "1.0.0"
71+
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
72+
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
73+
74+
// coroutines for getting off the UI thread
75+
def coroutines = "1.6.0"
76+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines"
77+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
78+
79+
// retrofit for networking
80+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
81+
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
82+
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
83+
84+
// moshi for parsing the JSON format
85+
def moshi_version = "1.13.0"
86+
implementation "com.squareup.moshi:moshi:$moshi_version"
87+
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
88+
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
89+
90+
// joda time library for dealing with time
91+
implementation 'joda-time:joda-time:2.10'
92+
93+
// arch components
94+
// ViewModel and LiveData
95+
def lifecycle_version = "2.4.1"
96+
// implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
97+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
98+
99+
// logging
100+
implementation 'com.jakewharton.timber:timber:4.7.1'
101+
102+
// glide for images
103+
implementation 'com.github.bumptech.glide:glide:4.8.0'
104+
kapt 'com.github.bumptech.glide:compiler:4.7.1'
105+
106+
// Room dependency
107+
def room_version = "2.4.1"
108+
implementation "androidx.room:room-runtime:$room_version"
109+
kapt "androidx.room:room-compiler:$room_version"
110+
111+
}

0 commit comments

Comments
 (0)