Skip to content

Commit

Permalink
Merge pull request #50 from Simplx-dev/master
Browse files Browse the repository at this point in the history
Update the libraries and build system and switch to using view binding #51
  • Loading branch information
Spikeysanju authored Jan 3, 2022
2 parents 9bd40f9 + 551ff15 commit 4c89f8c
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 228 deletions.
23 changes: 13 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "www.sanju.motiontoast"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding true
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -26,12 +29,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
implementation 'com.google.android.material:material:1.2.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.13.2'
implementation 'com.google.android.material:material:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation project(path: ':motiontoast')
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="www.sanju.motiontoastapp.MainActivity">
<activity android:name="www.sanju.motiontoastapp.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
34 changes: 19 additions & 15 deletions app/src/main/java/www/sanju/motiontoastapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,35 @@ import android.view.View
import android.widget.CompoundButton
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import kotlinx.android.synthetic.main.activity_main.*
import www.sanju.motiontoast.MotionToast
import www.sanju.motiontoast.MotionToastStyle
import www.sanju.motiontoastapp.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity(), View.OnClickListener, View.OnLongClickListener,
CompoundButton.OnCheckedChangeListener {

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)

switch_custom_colors?.setOnCheckedChangeListener(this)
successBtn.setOnClickListener(this)
errorBtn.setOnClickListener(this)
warningBtn.setOnClickListener(this)
infoBtn.setOnClickListener(this)
deleteBtn.setOnClickListener(this)
noInternetBtn.setOnClickListener(this)
binding.switchCustomColors.setOnCheckedChangeListener(this)
binding.successBtn.setOnClickListener(this)
binding.errorBtn.setOnClickListener(this)
binding.warningBtn.setOnClickListener(this)
binding.infoBtn.setOnClickListener(this)
binding.deleteBtn.setOnClickListener(this)
binding.noInternetBtn.setOnClickListener(this)

successBtn.setOnLongClickListener(this)
errorBtn.setOnLongClickListener(this)
warningBtn.setOnLongClickListener(this)
infoBtn.setOnLongClickListener(this)
deleteBtn.setOnLongClickListener(this)
noInternetBtn.setOnLongClickListener(this)
binding.successBtn.setOnLongClickListener(this)
binding.errorBtn.setOnLongClickListener(this)
binding.warningBtn.setOnLongClickListener(this)
binding.infoBtn.setOnLongClickListener(this)
binding.deleteBtn.setOnLongClickListener(this)
binding.noInternetBtn.setOnLongClickListener(this)
}

private fun setToastColors(newColorsEnabled: Boolean) {
Expand Down
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-alpha15'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

Expand All @@ -21,8 +21,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()

mavenCentral()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-all.zip
32 changes: 15 additions & 17 deletions motiontoast/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


apply plugin: 'com.github.dcendents.android-maven'
group 'spikeysanju'
version = '1.0'

android {
compileSdkVersion 30
buildToolsVersion "29.0.2"
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"

Expand All @@ -28,16 +22,20 @@ android {
}
}

buildFeatures {
viewBinding true
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Loading

0 comments on commit 4c89f8c

Please sign in to comment.