**This is SneakerHelper class : **
package com.okabbas.olympiad.helper
import android.support.v4.app.FragmentActivity
import com.irozon.sneaker.Sneaker
import com.okabbas.olympiad.R
import com.okabbas.olympiad.app.AppApp
import com.okabbas.olympiad.helper.SneakerHelper.SneakerModel.*
class SneakerHelper {
private var sneaker: Sneaker? = null
enum class SneakerModel {
SUCCESSFUL, UNSUCCESSFUL,
WARNING, ERROR, WAIT
}
fun showMessage(activity: FragmentActivity, message: String, model: SneakerModel) {
Sneaker.with(activity)
.setTypeface(AppApp.mediumFont)
.setTitle("result -> $message", R.color.colorWhite)
.setIcon(getIcon(model), false)
.setDuration(5000)
.autoHide(true)
.setHeight(150)
.sneak(getColor(model))
}
fun showLoading(activity: FragmentActivity, message: String, model: SneakerModel) {
sneaker = null
sneaker = Sneaker.with(activity)
.setTypeface(AppApp.mediumFont)
.setTitle(message, R.color.colorWhite)
.setIcon(getIcon(model), false)
.setDuration(5000)
.autoHide(false)
.setHeight(150)
sneaker?.sneak(getColor(model))
}
fun hideLoading() {
sneaker?.let {
it.setDuration(0)
it.autoHide(true)
it.setHeight(0);
it.sneak(R.color.colorBlack);
}
}
private fun getIcon(model: SneakerModel): Int {
return when (model) {
SUCCESSFUL -> R.mipmap.ico_successful
UNSUCCESSFUL -> R.mipmap.ico_unsuccessful
WARNING -> R.mipmap.ico_warnings
ERROR -> R.mipmap.ico_error
WAIT -> R.mipmap.ico_wait
}
}
private fun getColor(model: SneakerModel): Int {
return when (model) {
SUCCESSFUL -> R.color.colorPrimaryDark
UNSUCCESSFUL -> R.color.colorOrange
WARNING -> R.color.colorRed
ERROR -> R.color.colorHepatic
WAIT -> R.color.colorBlack
}
}
}
i'm call methods hideLoading and showLoading and showMessage in main activity :
In debug mode, there's no problem, but when I release the application, I get the following errors using the fabric service.
Fatal Exception: java.lang.NullPointerException
at com.irozon.sneaker.Sneaker$1.run(Sneaker.java:614)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(NativeStart.java)
What do you think the problem is ? Sneaker bug ?
**This is SneakerHelper class : **
i'm call methods
hideLoadingandshowLoadingandshowMessagein main activity :In debug mode, there's no problem, but when I release the application, I get the following errors using the fabric service.
What do you think the problem is ? Sneaker bug ?