Skip to content

Instantly share code, notes, and snippets.

@Evin1-
Evin1- / AndroidManifest.xml
Created August 6, 2020 13:03
Loop Cupcakes. Doing 2 network calls using RxJava Zip operator
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / AndroidManifest.xml
Created August 6, 2020 04:28
Loop Cupcakes. Advanced image loading Glide.
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / AndroidManifest.xml
Last active August 6, 2020 03:33
Loop Cupcakes. Image Loading Glide
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / MainActivity.kt
Last active August 5, 2020 01:43
Loop Cupcakes. Migrating AsyncTask to RxJava.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
/* Creates a flow of exactly one item, switches to a new thread to perform the operation
* using the subscribeOn operator, and comes back to the main thread after the chain is
* fully computed using the observeOn operator, the logging and error handling are run
* on the main thread. This will print the String "Result is 4" to the Logcat */
Single.fromCallable { doExpensiveFunction(2) }
@Evin1-
Evin1- / AndroidManifest.xml
Last active August 5, 2020 02:26
Loop Cupcakes. Network call with Retrofit
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / AndroidManifest.xml
Last active August 5, 2020 02:26
Loop Cupcakes. Retrofit with Coroutines
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / CustomRectangle.java
Last active July 26, 2017 21:31
Minimal CustomView
public class CustomRectangle extends View {
private Rect rectangle;
private Paint paint;
public CustomRectangle(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
rectangle = new Rect(100, 100, 300, 250);
paint = new Paint();
@Evin1-
Evin1- / AndroidManifest.xml
Last active March 22, 2017 03:41
Minimal Chromecast
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<uses-permission android:name="android.permission.INTERNET" />
<application>
<!--...-->
<!-- TODO Change this com.example.myapplication to your package name -->
<meta-data
@Evin1-
Evin1- / AndroidManifest.xml
Last active March 21, 2017 03:28
Minimal VideoView
<uses-permission android:name="android.permission.INTERNET" />
@Evin1-
Evin1- / AndroidManifest.xml
Last active March 21, 2017 03:02
Minimal MediaPlayer
<uses-permission android:name="android.permission.INTERNET" />