Skip to content

Commit 6746dae

Browse files
committed
imports optimized, deprecation fixes.
1 parent 518c7a8 commit 6746dae

40 files changed

+404
-388
lines changed

build.gradle

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
// root build.gradle
22
buildscript {
33
ext {
4-
agp_version = '8.1.2'
4+
android_gradle_plugin_version = '8.1.3'
55
kotlin_version = '1.9.10'
66
material_design_version = '1.10.0'
7-
appcompat_version = '1.6.1'
8-
annotation_version = '1.6.0'
9-
fragment_version = '1.6.1'
10-
nav_version = '2.7.4'
11-
room_version = '2.6.0'
7+
androidx_appcompat_version = '1.6.1'
8+
androidx_annotation_version = '1.6.0'
9+
androidx_fragment_version = '1.6.2'
10+
androidx_navigation_version = '2.7.5'
11+
androidx_room_version = '2.6.0'
1212
flexbox_version = '3.0.0'
13-
splash_version = '1.0.1'
14-
recyclerview_version = '1.3.2'
15-
preference_version = '1.2.1'
16-
cardview_version = '1.0.0'
13+
androidx_splash_version = '1.0.1'
14+
androidx_recyclerview_version = '1.3.2'
15+
androidx_preference_version = '1.2.1'
16+
androidx_cardview_version = '1.0.0'
1717
retrofit_version = '2.9.0'
1818
gson_version = '2.10.1'
1919
// DirCacheCheckout.java uses InputStream.transferTo() since 6.3; no such method on Android.
2020
jgit_version = '6.2.0.202206071550-r' // instead of 6.5.0.202303070854-r
2121
slf4j_version = '2.0.7'
2222
junit_version = '4.13.2'
23-
test_junit_version = '1.1.5'
24-
test_core_version = '1.5.0'
25-
test_monitor_version = '1.6.1'
26-
test_runner_version = '1.5.2'
27-
test_rules_version = '1.5.0'
28-
uiautomator_version = '2.2.0'
29-
espresso_version = '3.5.1'
23+
androidx_test_junit_version = '1.1.5'
24+
androidx_test_core_version = '1.5.0'
25+
androidx_test_monitor_version = '1.6.1'
26+
androidx_test_runner_version = '1.5.2'
27+
androidx_test_rules_version = '1.5.0'
28+
androidx_test_uiautomator_version = '2.2.0'
29+
androidx_test_espresso_version = '3.5.1'
3030
}
3131
}
3232

3333
plugins {
34-
id 'com.android.application' version "$agp_version" apply false
35-
id 'com.android.library' version "$agp_version" apply false
36-
id 'androidx.navigation.safeargs' version "$nav_version" apply false
34+
id 'com.android.application' version "$android_gradle_plugin_version" apply false
35+
id 'com.android.library' version "$android_gradle_plugin_version" apply false
36+
id 'androidx.navigation.safeargs' version "$androidx_navigation_version" apply false
3737
}
3838

3939
/** Version Settings, loaded from file `version.properties` */

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ org.gradle.configureondemand = true
77
org.gradle.workers.max = 6
88
org.gradle.parallel = true
99

10-
android.suppressUnsupportedCompileSdk = 34
1110
android.enableJetifier = false
1211
android.useAndroidX = true

library/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ dependencies {
6868
implementation "com.google.android.material:material:$material_design_version"
6969

7070
// Annotations
71-
implementation "androidx.annotation:annotation:$annotation_version"
71+
implementation "androidx.annotation:annotation:$androidx_annotation_version"
7272

7373
// App Compat
74-
implementation "androidx.appcompat:appcompat:$appcompat_version"
74+
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
7575

7676
// Data-Binding Runtime
77-
implementation "androidx.databinding:databinding-runtime:$agp_version"
77+
implementation "androidx.databinding:databinding-runtime:$android_gradle_plugin_version"
7878

7979
// Room Runtime
80-
annotationProcessor "androidx.room:room-compiler:$room_version"
81-
testImplementation "androidx.room:room-testing:$room_version"
82-
implementation "androidx.room:room-runtime:$room_version"
80+
annotationProcessor "androidx.room:room-compiler:$androidx_room_version"
81+
testImplementation "androidx.room:room-testing:$androidx_room_version"
82+
implementation "androidx.room:room-runtime:$androidx_room_version"
8383

8484
// Retrofit2
8585
implementation "com.google.code.gson:gson:$gson_version"
@@ -89,7 +89,7 @@ dependencies {
8989
}
9090

9191
testImplementation "junit:junit:$junit_version"
92-
androidTestImplementation "androidx.test.ext:junit:$test_junit_version"
92+
androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit_version"
9393
}
9494

9595
tasks.register('javadoc', Javadoc) {

mobile/build.gradle

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,30 +112,30 @@ dependencies {
112112
implementation "com.google.android.material:material:$material_design_version"
113113

114114
// Annotations
115-
implementation "androidx.annotation:annotation:$annotation_version"
115+
implementation "androidx.annotation:annotation:$androidx_annotation_version"
116116

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

120120
// https://developer.android.com/jetpack/androidx/
121-
implementation "androidx.appcompat:appcompat:$appcompat_version"
122-
implementation "androidx.core:core-splashscreen:$splash_version"
123-
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
124-
implementation "androidx.preference:preference:$preference_version"
125-
implementation "androidx.cardview:cardview:$cardview_version"
121+
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
122+
implementation "androidx.core:core-splashscreen:$androidx_splash_version"
123+
implementation "androidx.recyclerview:recyclerview:$androidx_recyclerview_version"
124+
implementation "androidx.preference:preference:$androidx_preference_version"
125+
implementation "androidx.cardview:cardview:$androidx_cardview_version"
126126

127127
// Navigation
128-
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
129-
implementation "androidx.navigation:navigation-fragment:$nav_version"
128+
androidTestImplementation "androidx.navigation:navigation-testing:$androidx_navigation_version"
129+
implementation "androidx.navigation:navigation-fragment:$androidx_navigation_version"
130130

131131
// Fragment
132-
androidTestImplementation "androidx.fragment:fragment-testing:$fragment_version"
133-
implementation "androidx.fragment:fragment:$fragment_version"
132+
androidTestImplementation "androidx.fragment:fragment-testing:$androidx_fragment_version"
133+
implementation "androidx.fragment:fragment:$androidx_fragment_version"
134134

135135
// Room Runtime
136-
annotationProcessor "androidx.room:room-compiler:$room_version"
137-
testImplementation "androidx.room:room-testing:$room_version"
138-
implementation "androidx.room:room-runtime:$room_version"
136+
annotationProcessor "androidx.room:room-compiler:$androidx_room_version"
137+
testImplementation "androidx.room:room-testing:$androidx_room_version"
138+
implementation "androidx.room:room-runtime:$androidx_room_version"
139139

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

157157
// Required for connected tests.
158158
// https://mvnrepository.com/artifact/androidx.test/monitor
159-
debugImplementation "androidx.test:monitor:$test_monitor_version"
159+
debugImplementation "androidx.test:monitor:$androidx_test_monitor_version"
160160

161161
// https://mvnrepository.com/artifact/androidx.test.ext
162-
androidTestImplementation "androidx.test.ext:junit:$test_junit_version"
162+
androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit_version"
163163

164164
// https://mvnrepository.com/artifact/androidx.test
165165
// https://developer.android.com/jetpack/androidx/releases/test
166-
androidTestImplementation "androidx.test:core:$test_core_version"
167-
androidTestImplementation "androidx.test:runner:$test_runner_version"
168-
androidTestImplementation "androidx.test:rules:$test_rules_version"
166+
androidTestImplementation "androidx.test:core:$androidx_test_core_version"
167+
androidTestImplementation "androidx.test:runner:$androidx_test_runner_version"
168+
androidTestImplementation "androidx.test:rules:$androidx_test_rules_version"
169169

170170
// https://mvnrepository.com/artifact/androidx.test.uiautomator/uiautomator
171-
androidTestImplementation "androidx.test.uiautomator:uiautomator:$uiautomator_version"
171+
androidTestImplementation "androidx.test.uiautomator:uiautomator:$androidx_test_uiautomator_version"
172172

173173
// Espresso
174-
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
175-
// androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
176-
// androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
177-
// androidTestImplementation "androidx.test.espresso:espresso-accessibility:$espresso_version"
178-
androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version"
174+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidx_test_espresso_version"
175+
// androidTestImplementation "androidx.test.espresso:espresso-contrib:$androidx_test_espresso_version"
176+
// androidTestImplementation "androidx.test.espresso:espresso-intents:$androidx_test_espresso_version"
177+
// androidTestImplementation "androidx.test.espresso:espresso-accessibility:$androidx_test_espresso_version"
178+
androidTestImplementation "androidx.test.espresso:espresso-web:$androidx_test_espresso_version"
179179
// androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$espresso_version"
180180

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

185185
}

mobile/src/androidTest/java/io/syslogic/github/TestProfile.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package io.syslogic.github;
22

3-
import static org.hamcrest.CoreMatchers.equalTo;
4-
import static org.hamcrest.CoreMatchers.is;
3+
import org.junit.Assert;
4+
import org.junit.Before;
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
57

68
import androidx.test.ext.junit.runners.AndroidJUnit4;
79
import androidx.test.platform.app.InstrumentationRegistry;
810
import androidx.test.uiautomator.By;
911
import androidx.test.uiautomator.UiObject2;
1012

11-
import org.junit.Assert;
12-
import org.junit.Before;
13-
import org.junit.Test;
14-
import org.junit.runner.RunWith;
13+
import static org.hamcrest.CoreMatchers.equalTo;
14+
import static org.hamcrest.CoreMatchers.is;
1515

1616
/**
1717
* Profile Test Case

mobile/src/androidTest/java/io/syslogic/github/TestRepositories.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package io.syslogic.github;
22

3-
import static org.hamcrest.CoreMatchers.equalTo;
4-
import static org.hamcrest.CoreMatchers.is;
3+
import org.junit.Assert;
4+
import org.junit.Before;
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
57

68
import androidx.test.ext.junit.runners.AndroidJUnit4;
79
import androidx.test.platform.app.InstrumentationRegistry;
810
import androidx.test.uiautomator.By;
911
import androidx.test.uiautomator.UiObject2;
1012

11-
import org.junit.Assert;
12-
import org.junit.Before;
13-
import org.junit.Test;
14-
import org.junit.runner.RunWith;
13+
import static org.hamcrest.CoreMatchers.equalTo;
14+
import static org.hamcrest.CoreMatchers.is;
1515

1616
/**
1717
* Repositories Test Case

mobile/src/androidTest/java/io/syslogic/github/TestRepository.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package io.syslogic.github;
22

3-
import static org.hamcrest.CoreMatchers.equalTo;
4-
import static org.hamcrest.CoreMatchers.is;
3+
import org.junit.Assert;
4+
import org.junit.Before;
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
57

68
import androidx.test.ext.junit.runners.AndroidJUnit4;
79
import androidx.test.platform.app.InstrumentationRegistry;
810
import androidx.test.uiautomator.By;
911
import androidx.test.uiautomator.UiObject2;
1012

11-
import org.junit.Assert;
12-
import org.junit.Before;
13-
import org.junit.Test;
14-
import org.junit.runner.RunWith;
13+
import static org.hamcrest.CoreMatchers.equalTo;
14+
import static org.hamcrest.CoreMatchers.is;
1515

1616
/**
1717
* Repository Test Case

mobile/src/androidTest/java/io/syslogic/github/TestSuite.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
package io.syslogic.github;
22

3-
import static org.hamcrest.CoreMatchers.equalTo;
4-
import static org.hamcrest.CoreMatchers.is;
5-
import static org.hamcrest.CoreMatchers.not;
6-
import static org.hamcrest.core.IsNull.notNullValue;
7-
83
import android.content.ComponentName;
94
import android.content.Context;
105
import android.content.Intent;
@@ -14,6 +9,12 @@
149
import android.os.Bundle;
1510
import android.util.Log;
1611

12+
import org.junit.Assert;
13+
import org.junit.runner.RunWith;
14+
import org.junit.runners.Suite.SuiteClasses;
15+
16+
import java.util.List;
17+
1718
import androidx.test.platform.app.InstrumentationRegistry;
1819
import androidx.test.uiautomator.By;
1920
import androidx.test.uiautomator.Direction;
@@ -25,11 +26,10 @@
2526
import androidx.test.uiautomator.UiSelector;
2627
import androidx.test.uiautomator.Until;
2728

28-
import org.junit.Assert;
29-
import org.junit.runner.RunWith;
30-
import org.junit.runners.Suite.SuiteClasses;
31-
32-
import java.util.List;
29+
import static org.hamcrest.CoreMatchers.equalTo;
30+
import static org.hamcrest.CoreMatchers.is;
31+
import static org.hamcrest.CoreMatchers.not;
32+
import static org.hamcrest.core.IsNull.notNullValue;
3333

3434
/**
3535
* Application Test Suite

mobile/src/main/java/io/syslogic/github/activity/AuthenticatorActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
import android.util.Log;
99
import android.widget.Toast;
1010

11-
import androidx.annotation.NonNull;
12-
import androidx.annotation.Nullable;
13-
import androidx.annotation.VisibleForTesting;
14-
import androidx.databinding.ViewDataBinding;
15-
1611
import com.google.gson.JsonObject;
1712
import com.google.gson.JsonParser;
1813

1914
import java.io.IOException;
2015

16+
import androidx.annotation.NonNull;
17+
import androidx.annotation.Nullable;
18+
import androidx.annotation.VisibleForTesting;
19+
import androidx.databinding.ViewDataBinding;
20+
2121
import io.syslogic.github.BuildConfig;
2222
import io.syslogic.github.R;
2323
import io.syslogic.github.api.GithubClient;

mobile/src/main/java/io/syslogic/github/activity/NavHostActivity.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.os.Bundle;
44

5+
import androidx.activity.OnBackPressedCallback;
6+
import androidx.activity.OnBackPressedDispatcher;
57
import androidx.annotation.NonNull;
68
import androidx.annotation.Nullable;
79
import androidx.annotation.VisibleForTesting;
@@ -50,6 +52,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5052

5153
this.setDataBinding(FragmentNavHostBinding
5254
.inflate(getLayoutInflater(), findViewById(android.R.id.content), true));
55+
this.addBackPressedCallback();
5356
this.setNavController();
5457
}
5558

@@ -61,6 +64,22 @@ private void setNavController() {
6164
}
6265
}
6366

67+
/**
68+
* Register an {@link OnBackPressedCallback]} with the {@link OnBackPressedDispatcher}.
69+
* The callback either pops the FragmentManager's back-stack - or it navigates upwards.
70+
*/
71+
private void addBackPressedCallback() {
72+
getOnBackPressedDispatcher().addCallback(NavHostActivity.this, new OnBackPressedCallback(true) {
73+
@Override
74+
public void handleOnBackPressed() {
75+
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
76+
getSupportFragmentManager().popBackStack();
77+
} else {
78+
getNavController().navigateUp();
79+
}
80+
}
81+
});
82+
}
6483
public NavController getNavController() {
6584
return this.navController;
6685
}

0 commit comments

Comments
 (0)