View RecipeListAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View RecipeResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.gson.annotations.SerializedName | |
import java.io.Serializable | |
class RecipeResponse : Serializable { | |
@SerializedName("id") | |
var id: String? = "" | |
@SerializedName("description") | |
var description: String? = "" |
View MainActivity1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
View activity_main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
View recipe_placeholder_item.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" |
View build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
View ShimmerFrameLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShimmerFrameLayout shimmerContainer = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container); | |
shimmerContainer.startShimmerAnimation(); |
View shimmer_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" /> |