Skip to content

Commit

Permalink
Removed some deprecated code. (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlMathuthu committed May 23, 2023
1 parent 9eb0b5e commit 5e5233c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 45 deletions.
39 changes: 19 additions & 20 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/runConfigurations.xml

This file was deleted.

4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group 'com.example.FlutterToast'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ import android.content.Context
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Handler
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowInsets
import android.view.inputmethod.InputMethodManager
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import kotlin.Exception

internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
internal class MethodCallHandlerImpl(private var context: Context) : MethodCallHandler {

private var mToast: Toast? = null

Expand Down Expand Up @@ -50,12 +46,14 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
val text = layout.findViewById<TextView>(R.id.text)
text.text = mMessage

val gradientDrawable: Drawable = if (Build.VERSION.SDK_INT >= 21) {
val gradientDrawable: Drawable? = if (Build.VERSION.SDK_INT >= 21) {
context.getDrawable(R.drawable.corner)!!
} else {
context.resources.getDrawable(R.drawable.corner)
// context.resources.getDrawable(R.drawable.corner)
ContextCompat.getDrawable(context, R.drawable.corner)
}
gradientDrawable.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_IN)
gradientDrawable!!.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_IN)

text.background = gradientDrawable
if (textSize != null) {
text.textSize = textSize.toFloat()
Expand All @@ -71,13 +69,14 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
if (Build.VERSION.SDK_INT <= 31) {
try {
val textView: TextView = mToast?.view!!.findViewById(android.R.id.message)

if (textSize != null) {
textView.textSize = textSize.toFloat()
}
if (textcolor != null) {
textView.setTextColor(textcolor.toInt())
}
} catch (e: Exception) {
} catch (_: Exception) {

}
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip

0 comments on commit 5e5233c

Please sign in to comment.