hamadakram / sneaker Goto Github PK
View Code? Open in Web Editor NEWA lightweight Android library for customizable alerts
A lightweight Android library for customizable alerts
Error:Could not find com.android.tools.build:gradle:3.0.0-alpha1.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
Required by:
project :
Hello I'm getting force on Kitkat Api 16 on genymotion while it is working fine on Android 7.1.2 API25, can you please look into it and can you bring down minimum api sdk level to atleast 16.
java.lang.NoSuchMethodError: android.widget.LinearLayout.setElevation at com.irozon.sneaker.Sneaker.sneakView(Sneaker.java:360) at com.irozon.sneaker.Sneaker.sneakError(Sneaker.java:326) at com.ingridtech.ommahajan.ui.fragment.LoginFragment.onClick(LoginFragment.java:169) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) 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:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)
Firstly, thank you for this beautiful library.
My doubt here is how do I change the font of text inside sneaker? I know you have provided us with a snippet of code in which there's this line:
.setTypeface(Typeface.createFromAsset(this.getAssets(), "font/" + fontName)); // Custom font for title and message
When I use this as it is in my project it gives me an error atfontName
. What do I have to do in order to change the font or use this snippet provided by you?
Could you please post an example providing more clarity on this subject?
Any help would be appreciated.
Maybe it's an error on my end but I found that setting no height on Sneaker results in long texts truncated, and while the issue can be resolved setting an height it does not provide a reliable solution, because some device I didn't tested against or some future device could have some exotic form-factor that vanifies this implementation. So a wrap-content option could be a definitive solution to this problem. However thank you for your work.
The upper part of the Sneaker gets overlapped by a status bar on Pre-Lollipop devices
if (mAutoHide) {
Handler handler = new Handler();
handler.removeCallbacks(null);
handler.postDelayed(new Runnable() {
@OverRide
public void run() {
getLayout().startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.popup_hide));
viewGroup.removeView(getLayout());
}
}, mDuration);
}
Hey there, i just started using this repo and it's very useful but in some devices alert message is not showing completely as given below:
Code:
(In Activity)
Sneaker
.with(this)
.setTitle("Alert!!")
.setMessage("Internet Connection Not Found")
.sneakWarning()
is there any solution for this problem??
Hello, I'm showing custom Sneaker with my own background color. How can i change text color of Sneaker?
Using the code:
Sneaker.with(this) // Activity, Fragment or ViewGroup
.setTitle("Warning!!")
.autoHide(false)
.setMessage("Please check your internet connection.", getResources().getColor(R.color.black, null))
.sneak(getResources().getColor(R.color.alert_yellow, null));
I always see a white background for the text. I've tried multiple OS versions, and all the same.
I have also tried using .sneakWarning()
, which showed the same thing.
Is there any way to supply a transparent background for the text?
When I try to display Sneaker, keeping open a Android Dialog or Alert Dialog, it is seen that Sneaker stays below it [transparent background]. Is there any way to bring it on top of everything?
This is a beautiful library for showing alerts. Will you port it to iOS anytime soon?
why activity onDismiss() have not executed
Sneaker.with(this) .setTitle(getString(R.string.login_success)) .setMessage(getString(R.string.success)) .setOnSneakerDismissListener(this) .setDuration(5000) .sneakSuccess()
override fun onDismiss() { val intent = Intent(this, MainActivity::class.java) launchActivity(intent) }
I am trying to add Sneaker into our dependencies but it throws an error like below
Execution failed for task ':app:dataBindingMergeDependencyArtifactsBrandtestDebug'.
Could not resolve all files for configuration ':app:brandtestDebugCompileClasspath'.
Could not find com.irozon.sneaker:sneaker:2.0.0.
Required by:
project :app
Possible solution:
project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
what I am missing here?
}
task clean(type: Delete) {
delete rootProject.buildDir
}
this view show above activity but bellow fragment,so can't show to user when activity contain fragment
Hi, as explained in my PR, the Sneaker isn't shown when I remove the statusbar from the Activity (and I'm not talking about Toolbar/Actionbar).
This is the code I use to remove the statusbar in any activity :
protected void onCreate(Bundle savedInstanceState) {
(...)
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
Hey bro,
I want to show Sneaker at the bottom of the screen same as now showing at top
And I want to give user a choice to show at top or bottom dynamically.
So how can I achieve this ?
Thanks...
Title says it all..
Would be awesome to see a updating/refreshing style for sneaker like you have done with the error and success. I'm happy to give it a go :)
Would essentially show a unhideable sneaker that allows a cancel when something has finished updating, it could then change colour to show a success (or cancel) and then hide again.
I've updated Sneaker library to v1.0.3 and noticed that the Error message (Red one) stays on the screen and does not appear automatically.
This only happens with latest version. I reverted the library version and everything works fine.
when I use the custom view,the sneaker can not get focused,so I can not to hide it manually
Hello, is it possible to change the sneaker position? I would like to show it on center and bottom as well.
Thanks.
Hi,
Sneaker appears differently from Activity and Fragment like below.
In Activity, it comes from the toolbar but in the fragment, it comes from the bottom of the toolbar.
The images are from different devices but it shows the same behavior with other devices as well.
I want both of them comes from the bottom of the toolbar as Fragment did.
Here is the AppTheme, its given in Android manifest and I didn't give any other theme to Activity.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/color_light_grey</item>
<item name="colorPrimaryDark">@color/color_black</item>
<item name="colorAccent">@color/color_red</item>
<item name="android:windowContentTransitions">true</item>
</style>
Here how I show the error message, same code for both
protected fun showErrorMessage(errorMessage: String?, isGreen: Boolean = false) {
val sneaker = Sneaker.with(this)
.setDuration(4000)
.autoHide(true)
val view = LayoutInflater.from(this)
.inflate(R.layout.view_sneaker_error, sneaker.getView(), false)
if (isGreen) {
view.setBackgroundColor(resources.getColor(R.color.color_green, null))
}
view.findViewById<TextView>(R.id.error_message).text = errorMessage
sneaker.sneakCustom(view)
}
In Activity, FrameLayout at higher hierarchy
In Activity of Fragment,
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:filterTouchesWhenObscured="true"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/navigation_rent"/>
</merge>
and in Fragment, XML has also FrameLayout at higher hierarchy
On platform previous lolipop,Sneaker will crash app because setElevation() is introduced on api 21
i have a strange problem :
i have button in a activity and a function for onClick event
fun sendComment(view: View): Unit {
Sneaker.with(this) // Activity, Fragment or ViewGroup
.setTitle("Warning!!")
.setMessage("This is the warning message")
.sneakWarning()
Toast.makeText(this,"show",Toast.LENGTH_LONG).show()
}
Toast show correct but Sneaker don't show!!
but i have a other Sneaker on onCreate
activity function It is displayed correctly
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_contact)
val typeface= Typeface.createFromAsset(assets,getString(R.string.font_path))
_tv_name.typeface = typeface
_tv_phone_number.typeface = typeface
_tv_comment.typeface = typeface
_tl_comment.typeface = typeface
_tl_phone_number.typeface = typeface
_tl_name.typeface = typeface
Sneaker.with(this) // Activity, Fragment or ViewGroup
.setTitle("Warning!!")
.setMessage("This is the warning message")
.sneakWarning()
}
i test it on genymotion samsung S7 and Samsung S5
When I create the object sneaker.with (this) throws me the error .. snearker is not applied
Some way to do it correctly.?
Thank you
if I click on a button multiple times it shows the sneaker, the application stops, it does not solve to add try {} catch {} when creating the sneaker
the error points to this line : getLayout().startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.popup_hide));
10-02 01:46:31.620 1767-1767/com.edwin E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.edwin, PID: 1767
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.startAnimation(android.view.animation.Animation)' on a null object reference
at com.irozon.sneaker.Sneaker$1.run(Sneaker.java:474)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
Hello . How can i (title and text and icons) right to left ?
I've noticed that the onDismiss callback is called after several seconds of the gesture. Is there a way to speed up the process?
**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 ?
Doesn't appear when calling on Android 4.4, flash when dismiss, but normal in Android 9.
While appearing the sneaker just appears without any sliding-in animation. Is there any method for it or is it not yet supported?
Hello . I need to add a padding and margin to sneaker, how can I do this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.