Commit 03174051 authored by Yusuke Iwaki's avatar Yusuke Iwaki

make common module ViewDataCache.

parent 541d705a
......@@ -65,14 +65,9 @@ public class Avatar {
* render avatar into imageView.
*/
public void into(final ImageView imageView) {
Object tag = imageView.getTag();
if (tag != null && tag instanceof String) {
String username = (String) tag;
if (this.username.equals(username)) {
return;
}
if (ViewDataCache.isStored(username, imageView)) {
return;
}
imageView.setTag(this.username);
final Context context = imageView.getContext();
Picasso.with(context)
......
package chat.rocket.android.helper;
import android.view.View;
import hugo.weaving.DebugLog;
/**
* save String to setTag.
*/
public class ViewDataCache {
/**
* stores str if not stored. returns true if already stored.
*/
@DebugLog
public static boolean isStored(String str, View view) {
if (view.getTag() != null && view.getTag() instanceof String
&& ((String) view.getTag()).equals(str)) {
return true;
}
view.setTag(str);
return false;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment