Skip to content

Instantly share code, notes, and snippets.

View non_rote_split.tsx
import React , {useState,lazy} from "react";
import Button from "./button";
const DialogBox = lazy(() => import("./dialogBox"));
const MyComponent = () => {
const [showDialogBox, setShowDialogBox] = useState(false);
return(
<div>
<React.Suspense fallback={"loading"} />
View app_route_split.tsx
import React , {lazy , Suspense} from "react";
import { Route, Switch } from "react-router-dom";
const Home = lazy(() =>
import("./home" /* webpackChunkName: "HomePage" */)
);
const Login = lazy(() =>
import("./login" /* webpackChunkName: "LoginPage" */)
);
@crypticminds
crypticminds / app.tsx
Created Jul 12, 2020
Regular route without splitting
View app.tsx
import React from "react";
import { Route, Switch } from "react-router-dom";
import Home from "./home";
import Login from "./login";
import Profile from "./profile";
const MyComponent = () => {
return (
<Switch>
<Route path="/home">
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) {