Skip to content

Commit

Permalink
Merge pull request #48 from DirajHS/master
Browse files Browse the repository at this point in the history
Updated master branch code
  • Loading branch information
Mido055 authored Jun 29, 2024
2 parents 583d03a + 4bb4809 commit 4ebdd63
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 32 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Access all branches from this tab.

The branches are also accessible from the drop-down in the "Code" tab.

## Requirements

1. Android Studio (Jellyfish or above)
2. JDK 21 with `JAVA_HOME` environment variable set. If you don't have JDK 21 installed or `JAVA_HOME` is not set, consider using a tool like `sdkman` to simplify the process. Refer to the sdkman documentation for installation instructions: [sdkman installation](https://sdkman.io/install)

## Working with the Course Code

Expand Down
21 changes: 12 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'

android {
compileSdkVersion 30
compileSdk 34
defaultConfig {
applicationId "com.example.android.devbyteviewer"
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand All @@ -43,15 +43,18 @@ android {
dataBinding true
}

kotlinOptions {
jvmTarget = "1.8"
namespace = "com.example.android.devbyteviewer"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version_kotlin"

// Support libraries
implementation "androidx.appcompat:appcompat:$version_appcompat"
Expand All @@ -62,8 +65,8 @@ dependencies {
implementation "androidx.core:core-ktx:$version_core"

// Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$version_navigation"
implementation "android.arch.navigation:navigation-ui-ktx:$version_navigation"
implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation"
implementation "androidx.navigation:navigation-ui-ktx:$version_navigation"

// Coroutines for getting off the UI thread
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_kotlin_coroutines"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".ui.DevByteActivity">
<activity android:name=".ui.DevByteActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.example.android.devbyteviewer.repository

import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import com.example.android.devbyteviewer.database.VideosDatabase
import com.example.android.devbyteviewer.database.asDomainModel
import com.example.android.devbyteviewer.domain.Video
Expand All @@ -33,7 +33,7 @@ class VideosRepository(private val database: VideosDatabase) {
* A playlist of videos that can be shown on the screen.
*/
val videos: LiveData<List<Video>> =
Transformations.map(database.videoDao.getVideos()) {
database.videoDao.getVideos().map {
it.asDomainModel()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DevByteViewModel(application: Application) : AndroidViewModel(application)
* Factory for constructing DevByteViewModel with parameter
*/
class Factory(val app: Application) : ViewModelProvider.Factory {
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
if (modelClass.isAssignableFrom(DevByteViewModel::class.java)) {
@Suppress("UNCHECKED_CAST")
return DevByteViewModel(app) as T
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down
36 changes: 18 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,36 @@

buildscript {
ext {
version_core = "1.3.1"
version_core = "1.13.1"
version_coroutine = "1.3.7"
version_retrofit_coroutines_adapter = "0.9.2"
version_navigation = '1.0.0'
version_constraint_layout = "2.0.0"
version_gradle = '4.0.1'
version_kotlin = "1.3.72"
version_navigation = '2.7.7'
version_constraint_layout = "2.1.4"
version_gradle = '8.4.2'
version_kotlin = "1.9.24"
version_lifecycle_extensions = "2.2.0"
lifecycle_version = "2.2.0"
version_room = "2.2.5"
version_appcompat = "1.2.0"
version_fragment = "1.0.0"
version_retrofit = "2.5.0"
version_kotlin_coroutines = "1.1.0"
version_moshi = "1.8.0"
version_glide = "4.8.0"
lifecycle_version = "2.8.2"
version_room = "2.6.1"
version_appcompat = "1.7.0"
version_fragment = "1.8.0"
version_retrofit = "2.9.0"
version_kotlin_coroutines = "1.8.1"
version_moshi = "1.15.1"
version_glide = "4.16.0"
version_joda = "2.10"
version_work = "2.4.0"
version_timber = "4.7.1"
version_work = "2.9.0"
version_timber = "5.0.1"
}

repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:$version_gradle"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -58,7 +58,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down

0 comments on commit 4ebdd63

Please sign in to comment.