Has anyone noticed the SwipeRefreshLayout
in gmail. It changes color for every rotation in a single load iteration. Does anyone have any idea how to achieve it?
swipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.simpleSwipeRefreshLayout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
public void onRefresh() {
// implement Handler to wait for 3 seconds and then update UI means update value of TextView
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// cancle the Visual indication of a refresh
swipeRefreshLayout.setRefreshing(false);
swipeRefreshLayout.setColorSchemeResources(R.color.Aqua,R.color.Blue,R.color.Violet);
// Generate a random integer number
Random r = new Random();
int i1 = r.nextInt(80 - 65) + 65;
// set the number value in TextView
textView.setText(String.valueOf(i1));
}
}, 3000);
}
});
}