Skip to content

Commit

Permalink
Merge pull request #27 from ShivamNagpal/gradle-plugin-update
Browse files Browse the repository at this point in the history
Gradle plugin update
  • Loading branch information
ShivamNagpal authored Apr 15, 2023
2 parents 41fb88d + 480970d commit a0959ce
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 10 deletions.
15 changes: 15 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

kotlin {
jvmToolchain(11)
}

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = 11
}
}
buildFeatures {
viewBinding true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED
import androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.*
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.navigateUp
import androidx.navigation.ui.onNavDestinationSelected
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.nagpal.shivam.vtucslab.R
import com.nagpal.shivam.vtucslab.databinding.ActivityMainBinding
import kotlin.system.exitProcess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class ContentAdapter(
)
SspSfViewHolder(sspSfBinding)
}

VIEW_TYPE_MSP_SF -> {
val mspSfBinding =
LayoutCardSeMspBinding.inflate(
Expand All @@ -55,6 +56,7 @@ class ContentAdapter(
)
MspSfViewHolder(mspSfBinding)
}

VIEW_TYPE_SSP_MF -> {
val sspMfBinding =
LayoutCardSeSspMfBinding.inflate(
Expand All @@ -64,6 +66,7 @@ class ContentAdapter(
)
SspMfViewHolder(sspMfBinding)
}

VIEW_TYPE_MSP_MF -> {
val seMspBinding =
LayoutCardSeMspBinding.inflate(
Expand All @@ -73,6 +76,7 @@ class ContentAdapter(
)
MspMfViewHolder(seMspBinding)
}

else -> InvalidViewHolder(View(context))
}
}
Expand All @@ -91,6 +95,7 @@ class ContentAdapter(
formatProgramName(parts[parts.size - 2])
}
}

is MspSfViewHolder -> {
holder.binding.serialOrder.text = serialOrder
val adapter = MultipleSubPartAdapter(
Expand All @@ -101,6 +106,7 @@ class ContentAdapter(
)
holder.binding.subPartContainer.adapter = adapter
}

is SspMfViewHolder -> {
holder.binding.serialOrder.text = serialOrder
val adapter = MultipleFileAdapter(
Expand All @@ -111,6 +117,7 @@ class ContentAdapter(
holder.binding.filesContainer.adapter = adapter

}

is MspMfViewHolder -> {
holder.binding.serialOrder.text = serialOrder
val adapter = MultipleSubPartAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MultipleSubPartAdapter(
)
}
}

is SubPartWithFilesViewHolder -> {
holder.binding.serialOrder.text = subParts[i].subSerialOrder
val adapter = MultipleFileAdapter(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.nagpal.shivam.vtucslab.data.local

import androidx.room.TypeConverter
import java.util.*
import java.util.Date

class Converters {
@TypeConverter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.nagpal.shivam.vtucslab.retrofit

import com.nagpal.shivam.vtucslab.retrofit.ApiResult.*
import com.nagpal.shivam.vtucslab.retrofit.ApiResult.ApiError
import com.nagpal.shivam.vtucslab.retrofit.ApiResult.ApiException
import com.nagpal.shivam.vtucslab.retrofit.ApiResult.ApiSuccess
import com.nagpal.shivam.vtucslab.utilities.StaticMethods
import retrofit2.HttpException
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import com.nagpal.shivam.vtucslab.utilities.Stages
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch

object Utils {
Expand All @@ -35,6 +39,7 @@ object Utils {
is Resource.Loading -> {
uiStateFlow.update { ContentState(Stages.LOADING) }
}

is Resource.Success -> {
uiStateFlow.update {
ContentState(
Expand All @@ -44,6 +49,7 @@ object Utils {
)
}
}

is Resource.Error -> {
uiStateFlow.update {
val uiMessage: UIMessage = when (resource.error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.*
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -60,6 +65,7 @@ class DisplayFragment : Fragment() {
Stages.LOADING -> {
binding.progressBar.visibility = View.VISIBLE
}

Stages.SUCCEEDED -> {
binding.displayTextView.text = it.data
requireActivity().invalidateOptionsMenu()
Expand All @@ -68,6 +74,7 @@ class DisplayFragment : Fragment() {
binding.verticalScroll.scrollY = viewModel.scrollY
}, 500)
}

Stages.FAILED -> {
val message: String = it.errorMessage.asString(requireContext())
showErrorMessage(message)
Expand Down Expand Up @@ -100,6 +107,7 @@ class DisplayFragment : Fragment() {
viewModel.onEvent(UiEvent.RefreshContent(url))
return true
}

R.id.menu_item_copy_display_activity -> {

val clipboard =
Expand All @@ -118,6 +126,7 @@ class DisplayFragment : Fragment() {
).show()
return true
}

else -> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ class DisplayViewModel(
is UiEvent.LoadContent -> {
loadContent(event.url)
}

is UiEvent.RefreshContent -> {
resetState()
loadContent(event.url)
}

UiEvent.ResetToast -> {
_uiState.update { _uiState.value.copy(toast = null) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ProgramFragment : Fragment() {
Stages.LOADING -> {
binding.progressBar.visibility = View.VISIBLE
}

Stages.SUCCEEDED -> {
if (it.data!!.isValid) {
contentAdapter.clear()
Expand All @@ -67,6 +68,7 @@ class ProgramFragment : Fragment() {
showErrorMessage(it.data.invalidationMessage)
}
}

Stages.FAILED -> {
val message: String = it.errorMessage.asString(requireContext())
showErrorMessage(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ class ProgramViewModel(
is UiEvent.LoadContent -> {
loadContent(event.url)
}

is UiEvent.RefreshContent -> {
// ToDo: Handle this case
}

UiEvent.ResetToast -> {
_uiState.update { _uiState.value.copy(toast = null) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ package com.nagpal.shivam.vtucslab.screens.repository
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.*
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -58,6 +63,7 @@ class RepositoryFragment : Fragment() {
Stages.LOADING -> {
binding.progressBar.visibility = View.VISIBLE
}

Stages.SUCCEEDED -> {
if (it.data!!.isValid) {
navigationAdapter.clear()
Expand All @@ -67,6 +73,7 @@ class RepositoryFragment : Fragment() {
showErrorMessage(it.data.invalidationMessage)
}
}

Stages.FAILED -> {
val message: String = it.errorMessage.asString(requireContext())
showErrorMessage(message)
Expand Down Expand Up @@ -127,6 +134,7 @@ class RepositoryFragment : Fragment() {
startActivity(intent)
true
}

else -> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ class RepositoryViewModel(
is UiEvent.LoadContent -> {
loadContent(event.url)
}

is UiEvent.RefreshContent -> {
// ToDo: Handle this case
}

UiEvent.ResetToast -> {
_uiState.update { _uiState.value.copy(toast = null) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.json.JsonMapper
import com.nagpal.shivam.vtucslab.models.LaboratoryExperimentResponse
import com.nagpal.shivam.vtucslab.models.LaboratoryResponse
import java.util.*
import java.util.Calendar
import java.util.Date

object StaticMethods {

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1024m

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
4 changes: 2 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
def versions = [:]
versions.appcompat = "1.6.1"
versions.constraintlayout = "2.1.4"
versions.core_ktx = "1.9.0"
versions.core_ktx = "1.10.0"
versions.espresso_core = "3.5.1"
versions.firebase_bom = "31.2.3"
versions.firebase_crashlytics_gradle = "2.9.4"
versions.google_services = "4.3.15"
versions.gradle = "7.4.2"
versions.gradle = "8.0.0"
versions.jackson_module_kotlin = "2.14.2"
versions.junit = "4.13.2"
versions.kotlin_gradle_plugin = "1.8.0"
Expand Down

0 comments on commit a0959ce

Please sign in to comment.