Skip to content

Instantly share code, notes, and snippets.

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"} />
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 July 12, 2020 21:25
Regular route without splitting
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">
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
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() {
<?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"
<?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"
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
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")
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) {