This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script will alert you whenever some slot opens up on the given date within the given District IDs | |
// Change the districts to your needs as per your city | |
// Change the dateArr to add your convinent set of dates | |
// For further update do checkout http://twitter.com/debarko/ | |
// How To setup Video -> https://www.youtube.com/watch?v=3_N5FFegtI4 | |
// Steps to use | |
// 1. Update Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Kotlin extension | |
fun Context.alert( | |
@StyleRes style: Int = 0, | |
dialogBuilder: MaterialAlertDialogBuilder.() -> Unit | |
) { | |
MaterialAlertDialogBuilder(this, style) | |
.apply { | |
setCancelable(false) | |
dialogBuilder() | |
create() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"program_name": "(ISC)²", | |
"policy_url": "https://bugcrowd.com/isc2", | |
"submission_url": "https://bugcrowd.com/isc2/report", | |
"launch_date": "", | |
"bug_bounty": false, | |
"swag": false, | |
"hall_of_fame": true, | |
"safe_harbor": "partial" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MyReachability { | |
private fun hasNetworkAvailable(context: Context): Boolean { | |
val service = Context.CONNECTIVITY_SERVICE | |
val manager = context.getSystemService(service) as ConnectivityManager? | |
val network = manager?.activeNetworkInfo | |
Log.d(classTag, "hasNetworkAvailable: ${(network != null)}") | |
return (network?.isConnected) ?: false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get reference to the connectivity manager | |
*/ | |
ConnectivityManager connectivityManager = | |
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
/** | |
* Find out whether device is connected to wifi or cellular at the moment | |
*/ | |
public NetworkType getNetworkType() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
You need to call the below method once. It register the callback and fire it when there is a change in network state. | |
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application. | |
*/ | |
// You need to pass the context when creating the class | |
public CheckNetwork(Context context) { | |
this.context = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity | |
import android.content.Intent | |
import android.content.IntentSender | |
import android.os.Bundle | |
import android.widget.Toast | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.core.content.ContextCompat | |
import com.google.android.material.snackbar.Snackbar | |
import com.google.android.play.core.appupdate.AppUpdateManager | |
import com.google.android.play.core.appupdate.AppUpdateManagerFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
signingConfigs { | |
getByName("debug") { | |
keyAlias = "debug" | |
keyPassword = "my debug key password" | |
storeFile = file("/home/miles/keystore.jks") | |
storePassword = "my keystore password" | |
} | |
create("release") { | |
keyAlias = "release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Authenticator that attempts to refresh the client's access token. | |
* In the event that a refresh fails and a new token can't be issued an error | |
* is delivered to the caller. This authenticator blocks all requests while a token | |
* refresh is being performed. In-flight requests that fail with a 401 are | |
* automatically retried. | |
*/ | |
class AccessTokenAuthenticator( | |
private val tokenProvider: AccessTokenProvider | |
) : Authenticator { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Utils - Declaration | |
object PromptUtils { | |
fun alertDialog(context: Context, @StyleRes style: Int, dialogBuilder: AlertDialog.Builder.() -> Unit): Dialog { | |
val builder = AlertDialog.Builder(context, style).also { | |
it.setCancelable(false) | |
it.dialogBuilder() | |
} | |
return builder.create() | |
} |
NewerOlder