#getcheffed
Explore tagged Tumblr posts
Photo
Solar powered "cheff off" cook off in Gippsland. Our clean energy trailer is currently powering an oven, a deep fryer, several fridges as well as all PA equipment with no issues. ๐๐
๐๐
๐๐
There aren't many batteries that can do this and even fewer that are safe to carry round in a portable trailer. ๐๐
๐๐
๐๐
This is proving to be a great event on Feb 18 which we are proud to support with our clean energy trailer rather than having to rely on diesel generators for power. ๐๐
๐๐
๐๐
If you are in Morwell come and join in the fun with @reactivatelatrobevalley at Kernott Hall in Morwell ๐๐
๐๐
๐๐
#getcheffed #supportlocal #OurLV #portablepowersupply #backuppowersupply #bestportablepowerbank #bestportablebattery #portablepowergenerator #alternativeenergysources #thefutureofenergy #Batterystorage #Solarbatterystorage #solarstoragebatteries #gridedge #dieselgenerator #cleanenergytrailer (at Kernot Hall)
#backuppowersupply#alternativeenergysources#getcheffed#bestportablepowerbank#batterystorage#bestportablebattery#solarbatterystorage#solarstoragebatteries#portablepowergenerator#dieselgenerator#portablepowersupply#thefutureofenergy#gridedge#cleanenergytrailer#ourlv#supportlocal
0 notes
Photo
New Post has been published on http://programmingbiters.com/android-content-placeholder-animation-like-facebook-using-shimmer/
Android Content Placeholder Animation like Facebook using Shimmer
We normally use spinner loaders when the app wants to load the data from a network call. Instead of using the usual loaders, we can make the loading screen more interesting using Facebookโs Shimmer library. This library adds Shimmer effect on to any custom view that we define. You can notice this shimmer effect in Facebookโs mobile and desktop apps.
This article explains how to use the Shimmer library in your apps with an example of loading a list data from a JSON http call.
VIDEO DEMO
youtube
1. Facebookโs Shimmer Library
To get shimmer effect on any layout, you have to place your layout inside ShimmerFrameLayout. To start the animation, you have to call startShimmerAnimation() on ShimmerFrameLayout. Thatโs all, you can immediately notice the shimmer effect on your layout. You can find the additional documentation on the Shimmerโs page.
Below is the code snippet to get the Shimmer effect. First, place your layout inside ShimmerFrameLayout.
To start the animation, call startShimmerAnimation() from your activity.
ShimmerFrameLayout shimmerContainer = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container); shimmerContainer.startShimmerAnimation();
2. Sample JSON
To demonstrate this example, I have created a sample JSON that contains a list of recipes. This endpoint simulates the network delay by adding 2 sec delay before responding the JSON so that the Shimmer effect can be noticed.
https://api.androidhive.info/json/shimmer/menu.php
[ "id": 1, "name": "Salmon Teriyaki", "description": "Put the ginger and garlic into a bowl and mix with the soy sauce, maple syrup, mirin and a drizzle of olive oil", "price": 140, "chef": "Gordon Ramsay", "thumbnail": "https://api.androidhive.info/images/food/1.jpg", "timestamp": "2 min ago" , "id": 2, "name": "Grilled Mushroom", "description": "Combine butter, dill and garlic salt, brush over mushrooms.", "price": 150, "chef": "Ravi Tamada", "thumbnail": "https://api.androidhive.info/images/food/2.jpg", "timestamp": "5 min ago" ]
Letโs try the Shimmer library by creating a simple app.
3. Creating New Project
1. Create a new project in Android Studio from File โ New Project and select Basic Activity from templates.
2. Add Shimmer dependency to your build.gradle and rebuild the project.
dependencies implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' // Shimmer implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
3. Add the below colors and dimens to respective files.
#d91248 #d91248 #3ad23e #dddddd #0c0c0c #1a1a1a #777 #777
16dp 50dp 8dp 16dp 10dp 15dp 12dp 11dp 15dp 13dp
4. Create a new layout xml file named recipe_placeholder_item.xml. In this file we define the placeholder layout using plain View elements. All the views will be placed similar to actual list items.
5. As the placeholder view is ready, letโs add it to our main activity layout. Open the layout file of your main activity i.e activity_main.xml and include the placeholder layout. We are including the placeholder layout three times to make it appear as list.
6. Open MainActivity.java and start the Shimmer animation by calling startShimmerAnimation() method in onResume(). We are also pausing the animation in onPause() when the activity is paused.
import com.facebook.shimmer.ShimmerFrameLayout; public class MainActivity extends AppCompatActivity private ShimmerFrameLayout mShimmerViewContainer; @Override protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mShimmerViewContainer = findViewById(R.id.shimmer_view_container); @Override public void onResume() super.onResume(); mShimmerViewContainer.startShimmerAnimation(); @Override public void onPause() mShimmerViewContainer.stopShimmerAnimation(); super.onPause();
Now if you run the app, you can see the below Shimmer animation.
3.1 Loading feed from JSON and hiding the Shimmer
Now as our Shimmer loader is ready, letโs see how to load the JSON feed in RecyclerView and hide the shimmer loader once the list is rendered. By following the remaining part of the article, you will understand how to implement the Shimmer effect in a real world app.
7. Open the build.gradle and add RecyclerView, Glide and Volley dependencies.
dependencies implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' // ... // Shimmer implementation 'com.facebook.shimmer:shimmer:0.1.0@aar' // RecyclerView implementation 'com.android.support:recyclerview-v7:26.1.0' // glide image library implementation 'com.github.bumptech.glide:glide:3.7.0' // volley http library implementation 'com.android.volley:volley:1.0.0' implementation 'com.google.code.gson:gson:2.6.2'
8. Create a class named MyApplication.java and extend the class from Application. This is a singleton class in which the Volley library will be initiated.
package info.androidhive.shimmer; /** * Created by ravi on 18/01/18. */ import android.app.Application; import android.text.TextUtils; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; public class MyApplication extends Application public static final String TAG = MyApplication.class .getSimpleName(); private RequestQueue mRequestQueue; private static MyApplication mInstance; @Override public void onCreate() super.onCreate(); mInstance = this; public static synchronized MyApplication getInstance() return mInstance; public RequestQueue getRequestQueue() if (mRequestQueue == null) mRequestQueue = Volley.newRequestQueue(getApplicationContext()); return mRequestQueue; public void addToRequestQueue(Request req, String tag) // set the default tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); public void addToRequestQueue(Request req) req.setTag(TAG); getRequestQueue().add(req); public void cancelPendingRequests(Object tag) if (mRequestQueue != null) mRequestQueue.cancelAll(tag);
9. Open AndroidManifest.xml and add the MyApplication class to tag. We also need INTERNET permission as we are going to make http calls.
10. Open activity_main.xml and add RecyclerView widget below the ShimmerFrameLayout.
11. Create a new class named Recipe.java and define the following variables. This is a POJO class used to serialize the JSON.
package info.androidhive.shimmer; /** * Created by ravi on 18/01/18. */ public class Recipe int id; String name; String description; double price; String thumbnail; String chef; String timestamp; public Recipe() public int getId() return id; public String getName() return name; public String getDescription() return description; public double getPrice() return price; public String getThumbnail() return thumbnail; public String getChef() return chef; public String getTimestamp() return timestamp;
12. Create a new xml layout named recipe_list_item.xml. This layout holds the actual list row with a thumbnail image and few TextViews.
13. We need another class to write the necessary adapter required for RecyclerView. Create a class named RecipeListAdapter.java and add below code.
package info.androidhive.shimmer; /** * Created by ravi on 18/01/18. */ import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import java.util.List; public class RecipeListAdapter extends RecyclerView.Adapter private Context context; private List cartList; public class MyViewHolder extends RecyclerView.ViewHolder public TextView name, description, price, chef, timestamp; public ImageView thumbnail; public MyViewHolder(View view) super(view); name = view.findViewById(R.id.name); chef = view.findViewById(R.id.chef); description = view.findViewById(R.id.description); price = view.findViewById(R.id.price); thumbnail = view.findViewById(R.id.thumbnail); timestamp = view.findViewById(R.id.timestamp); public RecipeListAdapter(Context context, List cartList) this.context = context; this.cartList = cartList; @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.recipe_list_item, parent, false); return new MyViewHolder(itemView); @Override public void onBindViewHolder(MyViewHolder holder, final int position) final Recipe recipe = cartList.get(position); holder.name.setText(recipe.getName()); holder.chef.setText("By " + recipe.getChef()); holder.description.setText(recipe.getDescription()); holder.price.setText("Price: โน" + recipe.getPrice()); holder.timestamp.setText(recipe.getTimestamp()); Glide.with(context) .load(recipe.getThumbnail()) .into(holder.thumbnail); // recipe @Override public int getItemCount() return cartList.size();
14. Now we have everything in place. Open MainActivity.java and modify the code as shown below.
> fetchRecipes() method fetches the JSON by making Volleyโs http call. The JSON is parsed using Gson serializer.
> Once the JSON is parsed and added to RecyclerView adapter, the list is rendered and ShimmerFrameLayout is hidden making the actual list visible on the screen.
package info.androidhive.shimmer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.Toast; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonArrayRequest; import com.facebook.shimmer.ShimmerFrameLayout; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.json.JSONArray; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity private static final String TAG = MainActivity.class.getSimpleName(); private RecyclerView recyclerView; private List cartList; private RecipeListAdapter mAdapter; private ShimmerFrameLayout mShimmerViewContainer; // URL to fetch menu json // this endpoint takes 2 sec before giving the response to add // some delay to test the Shimmer effect private static final String URL = "https://api.androidhive.info/json/shimmer/menu.php"; @Override protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mShimmerViewContainer = findViewById(R.id.shimmer_view_container); recyclerView = findViewById(R.id.recycler_view); cartList = new ArrayList(); mAdapter = new RecipeListAdapter(this, cartList); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemDecoration(new MyDividerItemDecoration(this, LinearLayoutManager.VERTICAL, 16)); recyclerView.setAdapter(mAdapter); // making http call and fetching menu json fetchRecipes(); /** * method make volley network call and parses json */ private void fetchRecipes() JsonArrayRequest request = new JsonArrayRequest(URL, new Response.Listener() @Override public void onResponse(JSONArray response) if (response == null) Toast.makeText(getApplicationContext(), "Couldn't fetch the menu! Pleas try again.", Toast.LENGTH_LONG).show(); return; List recipes = new Gson().fromJson(response.toString(), new TypeToken>() .getType()); // adding recipes to cart list cartList.clear(); cartList.addAll(recipes); // refreshing recycler view mAdapter.notifyDataSetChanged(); // stop animating Shimmer and hide the layout mShimmerViewContainer.stopShimmerAnimation(); mShimmerViewContainer.setVisibility(View.GONE); , new Response.ErrorListener() @Override public void onErrorResponse(VolleyError error) // error in getting json Log.e(TAG, "Error: " + error.getMessage()); Toast.makeText(getApplicationContext(), "Error: " + error.getMessage(), Toast.LENGTH_SHORT).show(); ); MyApplication.getInstance().addToRequestQueue(request); @Override public void onResume() super.onResume(); mShimmerViewContainer.startShimmerAnimation(); @Override public void onPause() mShimmerViewContainer.stopShimmerAnimation(); super.onPause();
I hope this article is pretty simple and explained very well about Shimmer library. If you have any queries, do post them in comments section below.
Hi there! I am Founder at androidhive and programming enthusiast. My skills includes Android, iOS, PHP, Ruby on Rails and lot more. If you have any idea that you would want me to develop? Letโs talk: [email protected]
(function(d, s, id) var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "http://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9"; fjs.parentNode.insertBefore(js, fjs); (document, 'script', 'facebook-jssdk'));
ูุงูุจ ูุฑุฏูพุฑุณ
0 notes
Text
RT @bgelens: Final post on using #PSDSC with Chef #getchef Configuring Chef client settings https://t.co/dFVyDeJldH
Final post on using #PSDSC with Chef #getchef Configuring Chef client settings https://t.co/dFVyDeJldH
โ Ben Gelens (@bgelens) December 12, 2017
from Twitter https://twitter.com/sstranger December 12, 2017 at 07:13PM via IFTTT
0 notes
Photo
Packing more friend fruits & nuts for #healthyandaffordable Sales have been increasing lately thnx to the amazing work of the Padawans of @sapientsocialbusiness You can now find us on ThuisAfGehaald, BoerenEnBuren, Lunchie, ResQ, & soon also on GetChef. We are in touch with a new location for our kitchen, and with an importer of veggies & fruit from South America which has huge amounts of surplus, on a weekly basis, which we will try to prevent from being wasted, together with partners from the #foodsurplusentrepreneursnetwork in the Netherlands. #food #foodsurplus #foodie #foodwaste #fsennl #savetheworld #socialbusiness #eatfooddontwasteit #nomorefoodwaste #sensemakers #makesense #changemakers (at De Verrekijker)
#foodsurplus#nomorefoodwaste#healthyandaffordable#makesense#foodwaste#savetheworld#fsennl#sensemakers#socialbusiness#food#changemakers#foodsurplusentrepreneursnetwork#foodie#eatfooddontwasteit
0 notes
Text
RT @bgelens: New blog in the series on #PSDSC enhanced by CM tooling. Chef bootstrapping https://t.co/Bw8cJECkbg #getchef https://t.co/ENUUMtRM0a
New blog in the series on #PSDSC enhanced by CM tooling. Chef bootstrapping https://t.co/Bw8cJECkbg #getchef http://pic.twitter.com/ENUUMtRM0a
โ Ben Gelens (@bgelens) November 28, 2017
from Twitter https://twitter.com/sstranger November 28, 2017 at 05:41PM via IFTTT
0 notes
Text
Favorite tweets
New blog in the series on #PSDSC enhanced by CM tooling. Chef bootstrapping https://t.co/Bw8cJECkbg #getchef http://pic.twitter.com/ENUUMtRM0a
โ Ben Gelens (@bgelens) November 28, 2017
from http://twitter.com/bgelens via IFTTT
0 notes