Skip to content

Instantly share code, notes, and snippets.

crypticminds

Block or report user

Report or block crypticminds

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View load_image_fragment.kt
package com.arcane.coldstorageexamples.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.fragment.app.Fragment
import com.arcane.coldstorageannotation.LoadImage
import com.arcane.coldstoragecache.cache.Cache
View load_image_activity_code.kt
package com.arcane.coldstorageexamples.activity
import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.arcane.coldstorageannotation.LoadImage
import com.arcane.coldstoragecache.cache.Cache
import com.arcane.coldstorageexamples.R
class LoadImageExampleActivity : AppCompatActivity() {
View fragment_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/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_2"
View load_image_activity_lauout.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/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_1"
View freeze_example_2.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.generated.MyBeautifulCacheLayer
class FreezeCacheActivity : AppCompatActivity(), OnOperationSuccessfulCallback<String?> {
private lateinit var button: Button
View freeze_example_1.kt
import com.arcane.coldstorageannotation.CacheKey
import com.arcane.coldstorageannotation.Freeze
import java.net.URL
/**
* Putting all the rest calls into this class and applying the annotation.
* It is optional to use the generatedClassName paramter. If no value is passed to it , the generated class
* will have the prefix Generated along with the original class name. Eg -> GeneratedMakeRemoteCallWithFreeze
**/
@Freeze(generatedClassName = "MyBeautifulCacheLayer")
View adapter.kt
class MyAdapter(private val dataset: List<String>)
: RecyclerView.Adapter<MyAdapter.ViewHolder>() {
private var currentSelection = 0
/**
* The view holder.
*/
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
View item_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"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
<!-- adding the drawable here -->
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>
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"
You can’t perform that action at this time.