Skip to content

Commit

Permalink
feat: atualizando pacotes gradle, atualizando para a API 34 e movendo…
Browse files Browse the repository at this point in the history
… a injeção de JS para o método webView.post()
  • Loading branch information
JGMelon22 committed Oct 13, 2023
1 parent 22c05cb commit 9d5f8e2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
17 changes: 8 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ plugins {

android {
namespace 'com.example.appuva'
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "com.example.appuva"
minSdk 28
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0.85"
versionName "1.0.86"

vectorDrawables {
useSupportLibrary true
Expand Down Expand Up @@ -49,20 +49,19 @@ android {
dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.webkit:webkit:1.7.0'
implementation 'androidx.webkit:webkit:1.8.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation 'androidx.navigation:navigation-fragment:2.6.0'
implementation 'androidx.navigation:navigation-ui:2.6.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
}
Expand Down
14 changes: 9 additions & 5 deletions app/src/main/java/com/example/appuva/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ public void onPageFinished(WebView view, String url) {
// Classe com injeção do JS para estética usando Thread do Java
JavaScriptInjectionService javaScriptInjectionService = new JavaScriptInjectionService();

javaScriptInjectionService.pseudoDarkTheme(view);
javaScriptInjectionService.beautyTools(view);
javaScriptInjectionService.removeElement(view);
javaScriptInjectionService.carterinhaAluno(view);
// This method allows you to post a Runnable object to the main UI thread's message queue,
// ensuring that the code inside the Runnable is executed on the main UI thread.
webView.post(() -> {
javaScriptInjectionService.pseudoDarkTheme(view);
javaScriptInjectionService.beautyTools(view);
javaScriptInjectionService.removeElement(view);
javaScriptInjectionService.carterinhaAluno(view);
});

// Aplica um pouco de delay para que minimize o efeito gráfico da injeção de tema via JS
try {
Expand All @@ -92,7 +96,7 @@ public void onPageFinished(WebView view, String url) {
NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();

if(isConnected)
if (isConnected)
view.setVisibility(View.VISIBLE);
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.1' apply false
id 'com.android.library' version '8.1.1' apply false
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ android.useAndroidX=true
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonFinalResIds=true
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ dependencyResolutionManagement {
}
rootProject.name = "AppUVA"
include ':app'

0 comments on commit 9d5f8e2

Please sign in to comment.