Skip to content

Instantly share code, notes, and snippets.

View Hardik8184's full-sized avatar

Hardikkumar Dungrani Hardik8184

View GitHub Profile
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView.Adapter
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.bumptech.glide.Glide
import com.hardik.shimmereffect.R.layout
import com.hardik.shimmereffect.RecipeListAdapter.RecipeViewHolder
import kotlinx.android.synthetic.main.recipe_list_item.view.chef
import com.google.gson.annotations.SerializedName
import java.io.Serializable
class RecipeResponse : Serializable {
@SerializedName("id")
var id: String? = ""
@SerializedName("description")
var description: String? = ""
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import com.hardik.shimmereffect.ApiClient.client
import kotlinx.android.synthetic.main.activity_main.mShimmerViewContainer
import android.os.Bundle
import android.util.Log
import android.view.View
import kotlinx.android.synthetic.main.activity_main.mShimmerViewContainer
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:shimmer="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".MainActivity">
<com.facebook.shimmer.ShimmerFrameLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/activity_padding">
<View
android:id="@+id/thumbnail"
android:layout_width="@dimen/placeholder_image"
android:layout_height="@dimen/placeholder_image"
dependencies {
// Shimmer
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
ShimmerFrameLayout shimmerContainer = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container);
shimmerContainer.startShimmerAnimation();
<com.facebook.shimmer.ShimmerFrameLayout
android:id=“@+id/shimmer_view_container”
android:layout_width=“wrap_content”
android:layout_height="wrap_content"
shimmer:duration="1000">
<View
android:layout_width="100dp"
android:layout_height="8dp"
android:background="#dddddd" />