Skip to content

Commit

Permalink
imports optimized, deprecation fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
syslogic committed Nov 11, 2023
1 parent 518c7a8 commit 6746dae
Show file tree
Hide file tree
Showing 40 changed files with 404 additions and 388 deletions.
40 changes: 20 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// root build.gradle
buildscript {
ext {
agp_version = '8.1.2'
android_gradle_plugin_version = '8.1.3'
kotlin_version = '1.9.10'
material_design_version = '1.10.0'
appcompat_version = '1.6.1'
annotation_version = '1.6.0'
fragment_version = '1.6.1'
nav_version = '2.7.4'
room_version = '2.6.0'
androidx_appcompat_version = '1.6.1'
androidx_annotation_version = '1.6.0'
androidx_fragment_version = '1.6.2'
androidx_navigation_version = '2.7.5'
androidx_room_version = '2.6.0'
flexbox_version = '3.0.0'
splash_version = '1.0.1'
recyclerview_version = '1.3.2'
preference_version = '1.2.1'
cardview_version = '1.0.0'
androidx_splash_version = '1.0.1'
androidx_recyclerview_version = '1.3.2'
androidx_preference_version = '1.2.1'
androidx_cardview_version = '1.0.0'
retrofit_version = '2.9.0'
gson_version = '2.10.1'
// DirCacheCheckout.java uses InputStream.transferTo() since 6.3; no such method on Android.
jgit_version = '6.2.0.202206071550-r' // instead of 6.5.0.202303070854-r
slf4j_version = '2.0.7'
junit_version = '4.13.2'
test_junit_version = '1.1.5'
test_core_version = '1.5.0'
test_monitor_version = '1.6.1'
test_runner_version = '1.5.2'
test_rules_version = '1.5.0'
uiautomator_version = '2.2.0'
espresso_version = '3.5.1'
androidx_test_junit_version = '1.1.5'
androidx_test_core_version = '1.5.0'
androidx_test_monitor_version = '1.6.1'
androidx_test_runner_version = '1.5.2'
androidx_test_rules_version = '1.5.0'
androidx_test_uiautomator_version = '2.2.0'
androidx_test_espresso_version = '3.5.1'
}
}

plugins {
id 'com.android.application' version "$agp_version" apply false
id 'com.android.library' version "$agp_version" apply false
id 'androidx.navigation.safeargs' version "$nav_version" apply false
id 'com.android.application' version "$android_gradle_plugin_version" apply false
id 'com.android.library' version "$android_gradle_plugin_version" apply false
id 'androidx.navigation.safeargs' version "$androidx_navigation_version" apply false
}

/** Version Settings, loaded from file `version.properties` */
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ org.gradle.configureondemand = true
org.gradle.workers.max = 6
org.gradle.parallel = true

android.suppressUnsupportedCompileSdk = 34
android.enableJetifier = false
android.useAndroidX = true
14 changes: 7 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ dependencies {
implementation "com.google.android.material:material:$material_design_version"

// Annotations
implementation "androidx.annotation:annotation:$annotation_version"
implementation "androidx.annotation:annotation:$androidx_annotation_version"

// App Compat
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"

// Data-Binding Runtime
implementation "androidx.databinding:databinding-runtime:$agp_version"
implementation "androidx.databinding:databinding-runtime:$android_gradle_plugin_version"

// Room Runtime
annotationProcessor "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$androidx_room_version"
testImplementation "androidx.room:room-testing:$androidx_room_version"
implementation "androidx.room:room-runtime:$androidx_room_version"

// Retrofit2
implementation "com.google.code.gson:gson:$gson_version"
Expand All @@ -89,7 +89,7 @@ dependencies {
}

testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$test_junit_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit_version"
}

tasks.register('javadoc', Javadoc) {
Expand Down
50 changes: 25 additions & 25 deletions mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,30 @@ dependencies {
implementation "com.google.android.material:material:$material_design_version"

// Annotations
implementation "androidx.annotation:annotation:$annotation_version"
implementation "androidx.annotation:annotation:$androidx_annotation_version"

// Flexbox Layout
implementation "com.google.android.flexbox:flexbox:$flexbox_version"

// https://developer.android.com/jetpack/androidx/
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.core:core-splashscreen:$splash_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "androidx.preference:preference:$preference_version"
implementation "androidx.cardview:cardview:$cardview_version"
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
implementation "androidx.core:core-splashscreen:$androidx_splash_version"
implementation "androidx.recyclerview:recyclerview:$androidx_recyclerview_version"
implementation "androidx.preference:preference:$androidx_preference_version"
implementation "androidx.cardview:cardview:$androidx_cardview_version"

// Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
implementation "androidx.navigation:navigation-fragment:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$androidx_navigation_version"
implementation "androidx.navigation:navigation-fragment:$androidx_navigation_version"

// Fragment
androidTestImplementation "androidx.fragment:fragment-testing:$fragment_version"
implementation "androidx.fragment:fragment:$fragment_version"
androidTestImplementation "androidx.fragment:fragment-testing:$androidx_fragment_version"
implementation "androidx.fragment:fragment:$androidx_fragment_version"

// Room Runtime
annotationProcessor "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$androidx_room_version"
testImplementation "androidx.room:room-testing:$androidx_room_version"
implementation "androidx.room:room-runtime:$androidx_room_version"

// Retrofit2
implementation "com.google.code.gson:gson:$gson_version"
Expand All @@ -156,30 +156,30 @@ dependencies {

// Required for connected tests.
// https://mvnrepository.com/artifact/androidx.test/monitor
debugImplementation "androidx.test:monitor:$test_monitor_version"
debugImplementation "androidx.test:monitor:$androidx_test_monitor_version"

// https://mvnrepository.com/artifact/androidx.test.ext
androidTestImplementation "androidx.test.ext:junit:$test_junit_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit_version"

// https://mvnrepository.com/artifact/androidx.test
// https://developer.android.com/jetpack/androidx/releases/test
androidTestImplementation "androidx.test:core:$test_core_version"
androidTestImplementation "androidx.test:runner:$test_runner_version"
androidTestImplementation "androidx.test:rules:$test_rules_version"
androidTestImplementation "androidx.test:core:$androidx_test_core_version"
androidTestImplementation "androidx.test:runner:$androidx_test_runner_version"
androidTestImplementation "androidx.test:rules:$androidx_test_rules_version"

// https://mvnrepository.com/artifact/androidx.test.uiautomator/uiautomator
androidTestImplementation "androidx.test.uiautomator:uiautomator:$uiautomator_version"
androidTestImplementation "androidx.test.uiautomator:uiautomator:$androidx_test_uiautomator_version"

// Espresso
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-accessibility:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidx_test_espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-contrib:$androidx_test_espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-intents:$androidx_test_espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-accessibility:$androidx_test_espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-web:$androidx_test_espresso_version"
// androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$espresso_version"

// The following dependency can be either "implementation" or "androidTestImplementation",
// depending on whether you want it to appear on your APK's compile classpath or the test APK classpath.
// androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$espresso_version"
// androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$androidx_test_espresso_version"

}
12 changes: 6 additions & 6 deletions mobile/src/androidTest/java/io/syslogic/github/TestProfile.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.syslogic.github;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;

/**
* Profile Test Case
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.syslogic.github;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;

/**
* Repositories Test Case
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.syslogic.github;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;

/**
* Repository Test Case
Expand Down
20 changes: 10 additions & 10 deletions mobile/src/androidTest/java/io/syslogic/github/TestSuite.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package io.syslogic.github;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.core.IsNull.notNullValue;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
Expand All @@ -14,6 +9,12 @@
import android.os.Bundle;
import android.util.Log;

import org.junit.Assert;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;

import java.util.List;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.Direction;
Expand All @@ -25,11 +26,10 @@
import androidx.test.uiautomator.UiSelector;
import androidx.test.uiautomator.Until;

import org.junit.Assert;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;

import java.util.List;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.core.IsNull.notNullValue;

/**
* Application Test Suite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import android.util.Log;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.databinding.ViewDataBinding;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import java.io.IOException;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.databinding.ViewDataBinding;

import io.syslogic.github.BuildConfig;
import io.syslogic.github.R;
import io.syslogic.github.api.GithubClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.os.Bundle;

import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
Expand Down Expand Up @@ -50,6 +52,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

this.setDataBinding(FragmentNavHostBinding
.inflate(getLayoutInflater(), findViewById(android.R.id.content), true));
this.addBackPressedCallback();
this.setNavController();
}

Expand All @@ -61,6 +64,22 @@ private void setNavController() {
}
}

/**
* Register an {@link OnBackPressedCallback]} with the {@link OnBackPressedDispatcher}.
* The callback either pops the FragmentManager's back-stack - or it navigates upwards.
*/
private void addBackPressedCallback() {
getOnBackPressedDispatcher().addCallback(NavHostActivity.this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
getSupportFragmentManager().popBackStack();
} else {
getNavController().navigateUp();
}
}
});
}
public NavController getNavController() {
return this.navController;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.ArrayRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import java.util.ArrayList;
import java.util.List;

import io.syslogic.github.R;
import io.syslogic.github.model.SpinnerItem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;

import java.util.List;

import androidx.annotation.NonNull;
import io.syslogic.github.api.model.QueryString;
import io.syslogic.github.model.SpinnerItem;
import io.syslogic.github.api.room.Abstraction;
import io.syslogic.github.api.room.QueryStringsDao;
import io.syslogic.github.model.SpinnerItem;

/**
* Query-String {@link BaseArrayAdapter}
Expand Down
Loading

0 comments on commit 6746dae

Please sign in to comment.