Skip to content

Commit c6f0842

Browse files
committed
Bump AGP to 7.4.2 and Gradle to 7.6.1 and apply spotless
1 parent 56c6e03 commit c6f0842

File tree

13 files changed

+59
-48
lines changed

13 files changed

+59
-48
lines changed

.DS_Store

8 KB
Binary file not shown.

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
[*]
3+
# Most of the standard properties are supported
4+
indent_size=2
5+
max_line_length=100

app/src/main/java/com/skydoves/colorpickerviewdemo/MainActivity.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ public class MainActivity extends AppCompatActivity {
5858
public void onItemClick(int position, PowerMenuItem item) {
5959
switch (position) {
6060
case 0:
61-
{
62-
palette();
63-
break;
64-
}
61+
{
62+
palette();
63+
break;
64+
}
6565
case 1:
66-
{
67-
paletteFromGallery();
68-
break;
69-
}
66+
{
67+
paletteFromGallery();
68+
break;
69+
}
7070
case 2:
7171
selector();
7272
break;
@@ -82,7 +82,6 @@ public void onItemClick(int position, PowerMenuItem item) {
8282
protected void onCreate(Bundle savedInstanceState) {
8383
super.onCreate(savedInstanceState);
8484
setContentView(R.layout.activity_main);
85-
Timber.plant(new Timber.DebugTree());
8685

8786
powerMenu = PowerMenuUtils.getPowerMenu(this, this, powerMenuItemClickListener);
8887

colorpickerview/src/main/java/com/skydoves/colorpickerview/preference/ColorPickerPreferenceManager.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ public void restoreColorPickerData(ColorPickerView colorPickerView) {
226226
String name = colorPickerView.getPreferenceName();
227227
colorPickerView.setPureColor(getColor(name, -1));
228228
Point defaultPoint =
229-
new Point(
230-
colorPickerView.getWidth() / 2, colorPickerView.getMeasuredHeight() / 2);
229+
new Point(colorPickerView.getWidth() / 2, colorPickerView.getMeasuredHeight() / 2);
231230
colorPickerView.moveSelectorPoint(
232231
getSelectorPosition(name, defaultPoint).x,
233232
getSelectorPosition(name, defaultPoint).y,

colorpickerview/src/main/java/com/skydoves/colorpickerview/sliders/AbstractSlider.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ public boolean onTouchEvent(MotionEvent event) {
149149
selector.setPressed(true);
150150
if (event.getX() > getWidth() || event.getX() < 0) {
151151
return false;
152-
}
153-
else {
152+
} else {
154153
onTouchReceived(event);
155154
return true;
156155
}
@@ -212,8 +211,7 @@ public void setSelectorPosition(@FloatRange(from = 0.0, to = 1.0) float selector
212211
public void setSelectorByHalfSelectorPosition(
213212
@FloatRange(from = 0.0, to = 1.0) float selectorPosition) {
214213
this.selectorPosition = Math.min(selectorPosition, 1.0f);
215-
float x =
216-
(getWidth() * selectorPosition) - (getSelectorSize() * 0.5f) - getBorderHalfSize();
214+
float x = (getWidth() * selectorPosition) - (getSelectorSize() * 0.5f) - getBorderHalfSize();
217215
selectedX = (int) getBoundaryX(x);
218216
selector.setX(selectedX);
219217
}

colorpickerview/src/main/java/com/skydoves/colorpickerview/sliders/AlphaSlideBar.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,7 @@ public void updatePaint(Paint colorPaint) {
9595
int endColor = Color.HSVToColor(255, hsv);
9696
Shader shader =
9797
new LinearGradient(
98-
0,
99-
0,
100-
getWidth(),
101-
getMeasuredHeight(),
102-
startColor,
103-
endColor,
104-
Shader.TileMode.CLAMP);
98+
0, 0, getWidth(), getMeasuredHeight(), startColor, endColor, Shader.TileMode.CLAMP);
10599
colorPaint.setShader(shader);
106100
}
107101

colorpickerview/src/main/java/com/skydoves/colorpickerview/sliders/BrightnessSlideBar.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,19 @@ protected void updatePaint(Paint colorPaint) {
9292

9393
@Override
9494
public void onInflateFinished() {
95-
selector.post(()->{
96-
int defaultPosition = getWidth() - selector.getWidth();
95+
selector.post(
96+
() -> {
97+
int defaultPosition = getWidth() - selector.getWidth();
9798

98-
if (getPreferenceName() != null) {
99-
updateSelectorX(
99+
if (getPreferenceName() != null) {
100+
updateSelectorX(
100101
ColorPickerPreferenceManager.getInstance(getContext())
101102
.getBrightnessSliderPosition(getPreferenceName(), defaultPosition)
102-
+ getSelectorSize() / 2);
103-
} else {
104-
selector.setX(defaultPosition);
105-
}
106-
});
103+
+ getSelectorSize() / 2);
104+
} else {
105+
selector.setX(defaultPosition);
106+
}
107+
});
107108
}
108109

109110
@Override

dependencies.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ext.versions = [
1818
versionoCode : 28,
1919
versionName : '2.2.4',
2020

21-
gradleBuildTool : '7.1.2',
22-
spotlessGradle : '6.3.0',
21+
gradleBuildTool : '7.4.2',
22+
spotlessGradle : '6.7.0',
2323
dokkaGradle : '1.4.32',
2424
mavenPublish : '0.18.0',
2525

@@ -28,6 +28,6 @@ ext.versions = [
2828

2929
// for demo
3030
googleMaterial : '1.5.0',
31-
powermenu : '2.2.0',
31+
powermenu : '2.2.2',
3232
timber : '5.0.1'
3333
]

gradle/wrapper/gradle-wrapper.jar

1.99 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

+14-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal

spotless.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ spotless {
1818
target "**/*.java"
1919
licenseHeaderFile "$rootDir/spotless.license.java"
2020
trimTrailingWhitespace()
21-
removeUnusedImports()
22-
googleJavaFormat()
21+
googleJavaFormat('1.5')
2322
endWithNewline()
2423
}
2524
kotlin {
2625
target "**/*.kt"
27-
ktlint().userData(['indent_size': '2', 'continuation_indent_size': '2'])
26+
ktlint()
27+
.setUseExperimental(true)
28+
.editorConfigOverride(['indent_size': '2', 'continuation_indent_size': '2'])
2829
licenseHeaderFile "$rootDir/spotless.license.java"
2930
trimTrailingWhitespace()
3031
endWithNewline()

0 commit comments

Comments
 (0)