mirror of
https://github.com/reactivedroid/TvFlix.git
synced 2025-08-06 14:22:22 +08:00
Merge pull request #16 from reactivedroid/update-kotlin
Update to Kotlin 1.4.21
This commit is contained in:
@ -2,7 +2,7 @@ plugins {
|
||||
id("com.android.application")
|
||||
kotlin("android")
|
||||
kotlin("kapt")
|
||||
kotlin("android.extensions")
|
||||
kotlin("plugin.parcelize")
|
||||
id("dagger.hilt.android.plugin")
|
||||
}
|
||||
|
||||
|
@ -14,19 +14,19 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.android.tvmaze.R
|
||||
import com.android.tvmaze.databinding.ActivityFavoriteShowsBinding
|
||||
import com.android.tvmaze.db.favouriteshow.FavoriteShow
|
||||
import com.android.tvmaze.utils.GridItemDecoration
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.android.synthetic.main.activity_favorite_shows.*
|
||||
import kotlinx.android.synthetic.main.toolbar.view.*
|
||||
|
||||
@AndroidEntryPoint
|
||||
class FavoriteShowsActivity : AppCompatActivity(), FavoriteShowsAdapter.Callback {
|
||||
private val favoriteShowsViewModel: FavoriteShowsViewModel by viewModels()
|
||||
private val binding by lazy { ActivityFavoriteShowsBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_favorite_shows)
|
||||
setContentView(binding.root)
|
||||
setToolbar()
|
||||
favoriteShowsViewModel.loadFavoriteShows()
|
||||
favoriteShowsViewModel.getFavoriteShowsLiveData()
|
||||
@ -34,7 +34,7 @@ class FavoriteShowsActivity : AppCompatActivity(), FavoriteShowsAdapter.Callback
|
||||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
val toolbar = toolbar.toolbar
|
||||
val toolbar = binding.toolbar.toolbar
|
||||
setSupportActionBar(toolbar)
|
||||
toolbar.setTitleTextColor(ContextCompat.getColor(this, android.R.color.white))
|
||||
toolbar.setSubtitleTextColor(ContextCompat.getColor(this, android.R.color.white))
|
||||
@ -43,15 +43,15 @@ class FavoriteShowsActivity : AppCompatActivity(), FavoriteShowsAdapter.Callback
|
||||
}
|
||||
|
||||
private fun showFavorites(favoriteShows: List<FavoriteShow>) {
|
||||
progress.visibility = View.GONE
|
||||
binding.progress.visibility = View.GONE
|
||||
if (favoriteShows.isNotEmpty()) {
|
||||
val layoutManager = GridLayoutManager(this, COLUMNS_COUNT)
|
||||
shows.layoutManager = layoutManager
|
||||
binding.shows.layoutManager = layoutManager
|
||||
val favoriteShowsAdapter = FavoriteShowsAdapter(favoriteShows.toMutableList(), this)
|
||||
shows.adapter = favoriteShowsAdapter
|
||||
binding.shows.adapter = favoriteShowsAdapter
|
||||
val spacing = resources.getDimensionPixelSize(R.dimen.show_grid_spacing)
|
||||
shows.addItemDecoration(GridItemDecoration(spacing, COLUMNS_COUNT))
|
||||
shows.visibility = View.VISIBLE
|
||||
binding.shows.addItemDecoration(GridItemDecoration(spacing, COLUMNS_COUNT))
|
||||
binding.shows.visibility = View.VISIBLE
|
||||
} else {
|
||||
val bookmarkSpan = ImageSpan(this, R.drawable.favorite_border)
|
||||
val spannableString = SpannableString(getString(R.string.favorite_hint_msg))
|
||||
@ -59,8 +59,8 @@ class FavoriteShowsActivity : AppCompatActivity(), FavoriteShowsAdapter.Callback
|
||||
bookmarkSpan, FAVORITE_ICON_START_OFFSET,
|
||||
FAVORITE_ICON_END_OFFSET, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
favorite_hint.text = spannableString
|
||||
favorite_hint.visibility = View.VISIBLE
|
||||
binding.favoriteHint.text = spannableString
|
||||
binding.favoriteHint.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,25 +10,25 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.android.tvmaze.R
|
||||
import com.android.tvmaze.databinding.ActivityHomeBinding
|
||||
import com.android.tvmaze.favorite.FavoriteShowsActivity
|
||||
import com.android.tvmaze.shows.AllShowsActivity
|
||||
import com.android.tvmaze.utils.GridItemDecoration
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
import kotlinx.android.synthetic.main.toolbar.view.*
|
||||
|
||||
@AndroidEntryPoint
|
||||
class HomeActivity : AppCompatActivity(), ShowsAdapter.Callback {
|
||||
private val homeViewModel: HomeViewModel by viewModels()
|
||||
private lateinit var showsAdapter: ShowsAdapter
|
||||
private val binding by lazy { ActivityHomeBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_home)
|
||||
setContentView(binding.root)
|
||||
setToolbar()
|
||||
homeViewModel.onScreenCreated()
|
||||
homeViewModel.getHomeViewState().observe(this, { setViewState(it) })
|
||||
popular_show_header.text = String.format(
|
||||
binding.popularShowHeader.text = String.format(
|
||||
getString(R.string.popular_shows_airing_today),
|
||||
homeViewModel.country
|
||||
)
|
||||
@ -49,7 +49,7 @@ class HomeActivity : AppCompatActivity(), ShowsAdapter.Callback {
|
||||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
val toolbar = toolbar.toolbar
|
||||
val toolbar = binding.toolbar.toolbar
|
||||
setSupportActionBar(toolbar)
|
||||
toolbar.setTitleTextColor(ContextCompat.getColor(this, android.R.color.white))
|
||||
toolbar.setSubtitleTextColor(ContextCompat.getColor(this, android.R.color.white))
|
||||
@ -68,7 +68,7 @@ class HomeActivity : AppCompatActivity(), ShowsAdapter.Callback {
|
||||
val gridLayoutManager = GridLayoutManager(this, NO_OF_COLUMNS)
|
||||
showsAdapter = ShowsAdapter(this)
|
||||
showsAdapter.updateList(homeViewData.episodes.toMutableList())
|
||||
popular_shows.apply {
|
||||
binding.popularShows.apply {
|
||||
layoutManager = gridLayoutManager
|
||||
setHasFixedSize(true)
|
||||
adapter = showsAdapter
|
||||
@ -82,11 +82,11 @@ class HomeActivity : AppCompatActivity(), ShowsAdapter.Callback {
|
||||
}
|
||||
|
||||
private fun showProgress() {
|
||||
progress.visibility = View.VISIBLE
|
||||
binding.progress.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun hideProgress() {
|
||||
progress.visibility = View.GONE
|
||||
binding.progress.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -2,7 +2,7 @@ package com.android.tvmaze.network.home
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.squareup.moshi.JsonClass
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
@ -3,7 +3,7 @@ package com.android.tvmaze.network.home
|
||||
import android.os.Parcelable
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
@ -5,7 +5,7 @@ object Deps {
|
||||
const val target_sdk = 26
|
||||
const val app_version_code = 104
|
||||
const val app_version_name = "2.1.0"
|
||||
const val android_plugin = "4.0.1"
|
||||
const val android_plugin = "4.1.1"
|
||||
const val constraint_layout = "2.0.0-beta4"
|
||||
const val lifecycle = "2.2.0"
|
||||
const val android_test = "1.2.0"
|
||||
@ -15,14 +15,14 @@ object Deps {
|
||||
const val mockito = "3.2.4"
|
||||
const val okhttp = "4.8.0"
|
||||
const val retrofit = "2.9.0"
|
||||
const val paging = "3.0.0-alpha04"
|
||||
const val paging = "3.0.0-alpha10"
|
||||
const val room = "2.2.5"
|
||||
const val kotlin = "1.4.0"
|
||||
const val kotlin = "1.4.21"
|
||||
const val timber = "4.7.1"
|
||||
const val mockito_kotlin = "2.2.0"
|
||||
const val arch_core_testing = "2.0.0"
|
||||
const val moshi = "1.9.2"
|
||||
const val coroutines = "1.3.7"
|
||||
const val moshi = "1.11.0"
|
||||
const val coroutines = "1.3.9"
|
||||
const val truth = "1.0.1"
|
||||
const val annotation = "1.1.0"
|
||||
const val chucker = "3.2.0"
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
||||
#Sun Jun 14 15:55:13 IST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
137
gradlew
vendored
137
gradlew
vendored
@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@ -6,42 +22,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@ -60,6 +40,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@ -85,7 +105,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@ -105,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
@ -134,27 +154,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
30
gradlew.bat
vendored
30
gradlew.bat
vendored
@ -1,3 +1,19 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@ -8,14 +24,14 @@
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
@ -46,10 +62,9 @@ echo location of your Java installation.
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@ -60,11 +75,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
Reference in New Issue
Block a user