Skip to content

Commit

Permalink
Merge pull request #98 from skydoves/agp.7.4.2
Browse files Browse the repository at this point in the history
Bump AGP to 7.4.2 and Gradle to 7.6.1 and apply spotless
  • Loading branch information
skydoves authored Apr 8, 2023
2 parents 56c6e03 + d395286 commit 2a3e22f
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true
[*]
# Most of the standard properties are supported
indent_size=2
max_line_length=100
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ captures/
.idea/gradle.xml
.idea/dictionaries
.idea/libraries
app/.idea/

# Mac
*.DS_Store

# Keystore files
*.jks
Expand All @@ -53,4 +57,4 @@ google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
freeline_project_description.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public class MainActivity extends AppCompatActivity {
public void onItemClick(int position, PowerMenuItem item) {
switch (position) {
case 0:
{
palette();
break;
}
{
palette();
break;
}
case 1:
{
paletteFromGallery();
break;
}
{
paletteFromGallery();
break;
}
case 2:
selector();
break;
Expand All @@ -82,7 +82,6 @@ public void onItemClick(int position, PowerMenuItem item) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Timber.plant(new Timber.DebugTree());

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ public void restoreColorPickerData(ColorPickerView colorPickerView) {
String name = colorPickerView.getPreferenceName();
colorPickerView.setPureColor(getColor(name, -1));
Point defaultPoint =
new Point(
colorPickerView.getWidth() / 2, colorPickerView.getMeasuredHeight() / 2);
new Point(colorPickerView.getWidth() / 2, colorPickerView.getMeasuredHeight() / 2);
colorPickerView.moveSelectorPoint(
getSelectorPosition(name, defaultPoint).x,
getSelectorPosition(name, defaultPoint).y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ public boolean onTouchEvent(MotionEvent event) {
selector.setPressed(true);
if (event.getX() > getWidth() || event.getX() < 0) {
return false;
}
else {
} else {
onTouchReceived(event);
return true;
}
Expand Down Expand Up @@ -212,8 +211,7 @@ public void setSelectorPosition(@FloatRange(from = 0.0, to = 1.0) float selector
public void setSelectorByHalfSelectorPosition(
@FloatRange(from = 0.0, to = 1.0) float selectorPosition) {
this.selectorPosition = Math.min(selectorPosition, 1.0f);
float x =
(getWidth() * selectorPosition) - (getSelectorSize() * 0.5f) - getBorderHalfSize();
float x = (getWidth() * selectorPosition) - (getSelectorSize() * 0.5f) - getBorderHalfSize();
selectedX = (int) getBoundaryX(x);
selector.setX(selectedX);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,7 @@ public void updatePaint(Paint colorPaint) {
int endColor = Color.HSVToColor(255, hsv);
Shader shader =
new LinearGradient(
0,
0,
getWidth(),
getMeasuredHeight(),
startColor,
endColor,
Shader.TileMode.CLAMP);
0, 0, getWidth(), getMeasuredHeight(), startColor, endColor, Shader.TileMode.CLAMP);
colorPaint.setShader(shader);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,19 @@ protected void updatePaint(Paint colorPaint) {

@Override
public void onInflateFinished() {
selector.post(()->{
int defaultPosition = getWidth() - selector.getWidth();
selector.post(
() -> {
int defaultPosition = getWidth() - selector.getWidth();

if (getPreferenceName() != null) {
updateSelectorX(
if (getPreferenceName() != null) {
updateSelectorX(
ColorPickerPreferenceManager.getInstance(getContext())
.getBrightnessSliderPosition(getPreferenceName(), defaultPosition)
+ getSelectorSize() / 2);
} else {
selector.setX(defaultPosition);
}
});
+ getSelectorSize() / 2);
} else {
selector.setX(defaultPosition);
}
});
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ ext.versions = [
versionoCode : 28,
versionName : '2.2.4',

gradleBuildTool : '7.1.2',
spotlessGradle : '6.3.0',
gradleBuildTool : '7.4.2',
spotlessGradle : '6.7.0',
dokkaGradle : '1.4.32',
mavenPublish : '0.18.0',

Expand All @@ -28,6 +28,6 @@ ext.versions = [

// for demo
googleMaterial : '1.5.0',
powermenu : '2.2.0',
powermenu : '2.2.2',
timber : '5.0.1'
]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

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

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

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

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

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

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
7 changes: 4 additions & 3 deletions spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ spotless {
target "**/*.java"
licenseHeaderFile "$rootDir/spotless.license.java"
trimTrailingWhitespace()
removeUnusedImports()
googleJavaFormat()
googleJavaFormat('1.5')
endWithNewline()
}
kotlin {
target "**/*.kt"
ktlint().userData(['indent_size': '2', 'continuation_indent_size': '2'])
ktlint()
.setUseExperimental(true)
.editorConfigOverride(['indent_size': '2', 'continuation_indent_size': '2'])
licenseHeaderFile "$rootDir/spotless.license.java"
trimTrailingWhitespace()
endWithNewline()
Expand Down

0 comments on commit 2a3e22f

Please sign in to comment.