Skip to content

Instantly share code, notes, and snippets.

View osama-raddad's full-sized avatar
💻
Working

Osama Raddad osama-raddad

💻
Working
View GitHub Profile
/*
* Copyright (c) 2022. , Osama Raddad
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
val namewarehouse = warehouse(Accessibility.LOCAL) {
this add module {
this add factory(contract = Name::class) {
this constructor { FirstName() }
this name "osa"
}
this add factory(contract = Name::class) {
this constructor { FirstName() }
this name "first"
this type Type.SINGLETON
https://github.com/rygelouv/LiteKoin
https://proandroiddev.com/lets-build-our-own-simplified-version-of-koin-19a887306258
main()
fun main() {
val test = 1
val squareFun = squareFun()
val xxx = squareFun()
@osama-raddad
osama-raddad / RecyclerView.java
Created December 17, 2015 07:30
animate RecyclerView
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder>
{
private Context context;
// The items to display in your RecyclerView
private ArrayList<String> items;
// Allows to remember the last item shown on screen
private int lastPosition = -1;
public static class ViewHolder extends RecyclerView.ViewHolder
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
@osama-raddad
osama-raddad / proguard-rules.pro
Created October 15, 2020 11:22 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
dependencies {
implementation 'com.github.osama-raddad:FireCrasher:2.0.0'
}
FireCrasher.install(this, object : CrashListener() {
override fun onCrash(throwable: Throwable) {
evaluate { activity, crashLevel ->
recover {
Toast.makeText(this@App, "recover", Toast.LENGTH_LONG).show()
}
}
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
class App : Application() {
override fun onCreate() {
super.onCreate()
FireCrasher.install(this, object : CrashListener() {
override fun onCrash(throwable: Throwable, activity: Activity) {
Toast.makeText(activity, throwable.message, Toast.LENGTH_SHORT).show()
// start the recovering process
recover(activity)