Skip to content

Instantly share code, notes, and snippets.

View cold_storage_tutorial_1.kt
package com.arcane.coldstorage.application
import android.app.Application
import com.arcane.coldstoragecache.cache.Cache
class Application : Application() {
/**
* The cache needs to be initialized here allowing the
* cache to pull any available data from shared preference and
View image_cache.kt
package com.arcane.coldstorage.cache
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.util.Base64
import android.util.Log
import com.arcane.coldstoragecache.cache.Cache
import java.io.ByteArrayOutputStream
import java.net.URL
View cold_storage_tutorial_2.txt
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".application.Application">
...... your activities go here
View main_activity.kt
package com.arcane.coldstorage
import android.graphics.Bitmap
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.Button
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.arcane.coldstorage.cache.ImageCache
View cold_storage_tutorial_3.kt
package com.arcane.coldstoragecache.converter.impl
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.util.Base64
import android.util.Log
import com.arcane.coldstoragecache.converter.IConverter
/**
* An example converter that will convert the stored string
View layout.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/constraintlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
View coldstorage_annotation_tutorial.kt
import com.arcane.coldstorageannotation.Refrigerate
import java.net.URL
class MakeRemoteCall {
/**
* A method that makes a call to the "https://httpbin.org/get"
* endpoint. This endpoint simply returns the arguments that were passed to it.
* For the caching logic the parameter passed to the endpoint will act as
* the key of the cache.
View coldstorage_annotation_tutorial2.kt
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.arcane.coldstoragecache.callback.OnOperationSuccessfulCallback
import com.arcane.coldstorageexamples.remotecall.MakeRemoteCall
//WHAT IS THIS ???????????
import com.arcane.generated.GeneratedCacheLayer
class MainActivity : AppCompatActivity(), OnOperationSuccessfulCallback<String?> {
View activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/remotecall1"
View list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- selected. This style will be applied when the view is selected -->
<item android:state_selected="true">
<shape>
<corners android:radius="12dp" />
<solid android:color="@android:color/black" />
</shape>
</item>