diff --git a/.gitignore b/.gitignore index 09b993d..0bce669 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,77 @@ +# Built application files +*.apk +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class +app/.classpath + +# Generated files +bin/ +gen/ +out/ +release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ *.iml -.gradle -/local.properties -/.idea -.DS_Store -/build -/captures +.idea/ + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later .externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +.settings +.env.* +!.env.example diff --git a/app/build.gradle b/app/build.gradle index 2c29832..daa1880 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 - buildToolsVersion '26.0.2' + compileSdkVersion 29 defaultConfig { applicationId "vn.luongvo.widget.iosswitchview.sample" - minSdkVersion 11 - targetSdkVersion 25 + minSdkVersion 25 + targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -22,11 +21,11 @@ android { } dependencies { - compile 'com.android.support:appcompat-v7:25.2.0' - compile project(':library') + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation project(':library') - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - testCompile 'junit:junit:4.12' + implementation 'junit:junit:4.12' } diff --git a/app/src/main/java/vn/luongvo/widget/iosswitchview/sample/MainActivity.java b/app/src/main/java/vn/luongvo/widget/iosswitchview/sample/MainActivity.java index 03b09ad..24d020a 100644 --- a/app/src/main/java/vn/luongvo/widget/iosswitchview/sample/MainActivity.java +++ b/app/src/main/java/vn/luongvo/widget/iosswitchview/sample/MainActivity.java @@ -1,10 +1,10 @@ package vn.luongvo.widget.iosswitchview.sample; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.view.View; import android.widget.Toast; +import androidx.appcompat.app.AppCompatActivity; + import vn.luongvo.widget.iosswitchview.SwitchView; public class MainActivity extends AppCompatActivity { @@ -14,7 +14,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - final SwitchView switchView = (SwitchView) findViewById(R.id.switchview); + final SwitchView switchView = findViewById(R.id.switchview); switchView.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() { @Override public void onCheckedChanged(SwitchView switchView, boolean isChecked) { diff --git a/build.gradle b/build.gradle index 7bdac0a..e00c062 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.5.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -16,6 +16,7 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/library/build.gradle b/library/build.gradle index e55083d..7e5e19e 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 - buildToolsVersion '26.0.2' + compileSdkVersion 29 + buildToolsVersion '28.0.3' defaultConfig { - minSdkVersion 11 + minSdkVersion 14 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -18,8 +18,8 @@ android { } dependencies { - testCompile 'junit:junit:4.12' - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + testImplementation 'junit:junit:4.12' + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) } diff --git a/library/src/main/java/vn/luongvo/widget/iosswitchview/SwitchView.java b/library/src/main/java/vn/luongvo/widget/iosswitchview/SwitchView.java index 882693e..80aff02 100644 --- a/library/src/main/java/vn/luongvo/widget/iosswitchview/SwitchView.java +++ b/library/src/main/java/vn/luongvo/widget/iosswitchview/SwitchView.java @@ -241,7 +241,7 @@ protected void onDraw(Canvas canvas) { final float scaleOffset = (bOnLeftX + bRadius - sCenterX) * (isChecked ? 1 - dsAnim : dsAnim); canvas.save(); canvas.scale(scale, scale, sCenterX + scaleOffset, sCenterY); - paint.setColor(0xffffffff); + paint.setColor(colorOff); canvas.drawPath(sPath, paint); canvas.restore(); // draw center bar